[concurrency-interest] The very best CAS loop
aph at redhat.com
Tue Sep 27 08:56:43 EDT 2016
On 27/09/16 11:44, Peter Levart wrote:
> What I was hoping to measure with the benchmark is some difference
> between using weak CAS and strong CAS in a getAndUpdate retry loop
> that always invokes the update function (even on spurious failures
> of weak CAS).
That's going to be very difficult. In practice truly spurious
failures are rare enough that you won't see them unless you have false
sharing. (In which case, of course, strong CAS slows down too.) You
benefit from using weak CAS at times of high contention by not
spinning to retry a SC which is going to fail anyway.
> I can understand that this is not possible on x86_64 as both are
> mapped to the same strong CAS intrinsic. But I also haven't observed
> any meaningful difference on arm32. So is it possible that Oracle's
> JDK 9 b137 for arm32 also maps both weak and strong CAS to the same
> implementation which is a strong CAS simulation?
Certainly. The only way to be enlightened is to look at the generated
> Is there any platform where weak CAS is actually a weak CAS
More information about the Concurrency-interest