[concurrency-interest] Propagation ofsignalstonon-interruptedthread

Dr Heinz M. Kabutz heinz at javaspecialists.eu
Tue Nov 15 16:10:19 EST 2011

I would imagine that there could be quite a few times that the CAS has 
to be retried until it is successful.  Look at the bottom right graph - 
"Throughput - Thirty-two Threads" - this is now throughput (normalized 
and on a logarithmic scale) against number of threads.  The 
AtomicPseudoRandom class is the same as in Brian's book.  If you look at 
the blue line, it dips down the more threads you have per 
AtomicPseudoRandom class, as the probability of clashes increases.  I 
could add a counter into that class to verify my assertion, but I'm 
pretty sure that the number of clashes will be substantial.


Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
IEEE Certified Software Development Professional
Tel: +30 69 72 850 460
Skype: kabutz 

On 11/15/11 11:03 PM, Ruslan Cheremin wrote:
> It seems very strange to me -- how can value updated by many threads
> guarded by ReentrantLock outperform just simple CAS? As far, as I
> know, ReentrantLock on fast path still has at least one CAS + value
> update itself, it must be slower then just one CAS in an way.

More information about the Concurrency-interest mailing list