[concurrency-interest] AtomicXXX.lazySet and happens-before reasoning

Boehm, Hans hans.boehm at hp.com
Fri Sep 30 16:25:27 EDT 2011


> c) Does it mean what next JMM release will throw out HB reasoning and
> move to memory barriers/fences notation?
> 
Adding to Doug's answer, the answer to this question is a resounding "no".  Happens-before reasoning largely remains valid with lazySet, as you can see in the C++ model (which is unfortunately also significantly complicated by memory_order_consume, which currently has no Java analog, though it's closely related to some of the final field extension discussions).  What I believe goes away is any meaningful notion of a single total synchronization order.

I do not believe you ever want to reason in terms of fences.  Such reasoning is not usually sound for Java, since the memory model is carefully designed to allow elimination of synchronization on e.g. a volatile accessible form accessed by only a single thread.  Java volatiles etc. do not have fence semantics.  I do not know of any language-level memory models that have been successfully expressed in terms of fences.  See http://dl.acm.org/citation.cfm?doid=1988915.1988919 for a discussion of why I don't consider a couple of better known attempts to be fully successful.

Hans



More information about the Concurrency-interest mailing list