[concurrency-interest] Semantics of compareAndSwapX

Andrew Haley aph at redhat.com
Wed Apr 2 10:16:42 EDT 2014

On 04/02/2014 01:50 PM, Doug Lea wrote:
> Backing up first. The current specs for CAS say only
> (in java.util.concurrent.atomic package docs):
>    compareAndSet ... have the memory effects of both reading and writing
>    volatile variables.
> Conservative mappings for volatiles on AArch64 are
> volatile-read : load-acquire.
> volatile-write : store-release followed by dmb.

Well, yes... but I thought you wrote the specs, so I was rather hoping
that you'd know what you meant by this.  I know that the specs for CAS
don't really say what it means.

> So if you want to do something uncontroversial pending further
> analysis, you could stick with this and avoid voting for now.

That seems reasonable, I agree.

> Your two options weaken this in different ways, and the questions
> become whether either could detectably impact any guarantees and
> whether either could conflict with any internal openJDK/hotspot
> assumptions.  And also whether an improved spec for CAS in the style
> of C11/C++-11 for revised JMM would matter.


More information about the Concurrency-interest mailing list