[concurrency-interest] Semantics of compareAndSwapX
stephan.diestelhorst at gmail.com
Thu Feb 27 09:29:32 EST 2014
On Wednesday 26 February 2014 18:11:04 Hans Boehm wrote:
> On ARMv8, I would expect a volatile store to be compiled to a store release,
> and a volatile load to be compiled to a load acquire. Period. Unlike on
> Itanium, a release store is ordered with respect to a later acquire load,
> so the fence between them should not be needed. Thus there is no a priori
> reason to expect that a CAS would require a fence either.
> I would argue strongly that a CAS to a thread-private object should not be
> usable as a fence. One of the principles of the Java memory model was that
> synchronization on thread-private objects should be ignorable.
> I'm hedging a bit here, because the original Java memory model doesn't say
> anything about CAS, and I don't fully understand the details of the ARMv8
> model, particularly the interaction between acquire/release loads and
> stores and traditional ARM fences.
The ARMv8 spec corroborates your points in that store release followed
by load acquire is ordered in program order, and the architecture does
not specify any additional ordering constraints, except the ones caused
through the acquire and release aspects.
More information about the Concurrency-interest