[concurrency-interest] AtomicReferenceweakCompareAndSet "Mayfailspuriously"?

Doug Lea dl at cs.oswego.edu
Mon May 29 11:44:23 EDT 2006

Jeremy Manson wrote:
> I'm probably being dim, but why don't you need the happens-before 
> relationship here between the setter and a subsequent getter?  It seems 
> to me that you need the release on fixedNext...  No?

Remember that all threads are running the same code. As long as any
of them see inconsistencies, they will try to fix and then restart.
So, that CAS is OK being asynchronous wrt any of them. Just using
weakCAS might further delay progress of any for which the CAS fails, but
this might empirically be faster than using a hard LL/SC spin underlying
strong CAS on some machines.


More information about the Concurrency-interest mailing list