[concurrency-interest] New version of Java Concurrent Animated
nathan.reynolds at oracle.com
Wed Apr 17 02:34:30 EDT 2013
Nice animation! I noticed a couple of problems.
The ConcurrentHashMap demo fails to draw the threads if you keep hitting
putIfAbsent. The threads are drawn beyond the bottom.
If I remember right ReentrantReadWriteLock gives priority to writer
threads. If that is the case then the ReadWriteLock demo is not quite
Consider this scenario.
1. Thread #1 calls writeLock().lock() and enters the critical region.
2. Thread #2 calls readLock().lock() and blocks.
3. Thread #3 calls readLock().lock() and blocks.
4. Thread #4 calls readLock().lock() and blocks.
5. Thread #5 calls readLock().lock() and blocks.
6. Thread #6 calls writeLock().lock() and blocks.
7. Thread #1 releases the lock.
8. If writer threads are given priority, then Thread #6 should enter
the critical region.
In the demo, threads #2 to #5 are given the lock in step 8.
Architect | 602.333.9091
Oracle PSR Engineering <http://psr.us.oracle.com/> | Server Technology
On 4/16/2013 6:02 PM, Victor Grazi wrote:
> Hi, just a quick note to let everyone know there is a new version of
> Java Concurrent Animated on SourceForge.
> Some of the new features:
> * A new animation showing good old synchronized/wait/notify. Kind of
> surprising when you see it in action.
> * Thread states are now color coded, and includes a novel state
> diagram kind courtesy of Dr. Heinz Kabutz and his Concurrency
> Specialist Training
> <http://www.javaspecialists.eu/courses/concurrency.jsp> course.
> Check it out!
> Victor Grazi
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest