[jmm-dev] weakCompareAndSet memory semantics
Andrew Haley
aph at redhat.com
Fri Apr 22 12:03:37 UTC 2016
On 04/22/2016 12:32 PM, David Holmes wrote:
> I consider it a different scenario because it requires high contention.
> If you have low contention (CAS ideal case) the spurious failures are
> unlikely to make your data stale so jumping back out to the outer loop
> to re-fetch doesn't gain anything - potentially the opposite!
Potentially? Maybe that would be true if spurious store exclusive
failures were common, but they aren't.
> Obviously this all depends on the exact circumstances - but that is why
> I question these blanket statements about weakCAS performing better on
> ll/sc systems. Given we're dealing with WORA Java code this may push
> people towards always using weakCAS just in case they run on a ll/sc system.
I just did 10^9 uncontended ldx/stx on my system here. Guess how many
spurious failures there were? Zero. This is a tool for people who
know what they're doing.
Andrew.
More information about the jmm-dev
mailing list