[concurrency-interest] Atomic.*lazyGet

Aleksey Shipilev aleksey.shipilev at oracle.com
Thu Aug 9 03:05:58 EDT 2012

On 08/09/2012 07:45 AM, Boehm, Hans wrote:
> I'm confused.  LazySet() does have happens-before semantics.  And I
> don't think that's changeable without serious code breakage.  It
> doesn't participate in the total synchronization order.  That doesn't
> really make sense in the current memory model, since the
> synchronization order is what determines happens-before semantics.
> But we kind of know what it's supposed to do.

Sorry, I was confusing myself. I think the real semantics I wanted from
weakGet() is "just" the naked memory read. After sleeping on it,
realized that trying to piggyback on memory effects to make the
compiler-only barrier is probably a messy idea. Also, it makes some
assumptions about HMM, which is not something we should probably embrace
in public API.

> On the other, there is currently a large additional overhead for
> volatile loads on POWER, which could be avoided by weakGet, even as
> defined above.

Yes, I was leaning towards the platforms which have non-marginal
volatile read cost. Naked memory op, as confusing as it might be for
JMM, would help in some corner cases.


More information about the Concurrency-interest mailing list