[concurrency-interest] Happens Before guarantee in case of unsafe.putOrderedObject and corresponding nomal read of a variable

Justin Sampson jsampson at guidewire.com
Fri Sep 5 13:14:34 EDT 2014


Andrew Haley wrote:

> And again: I thought the idea of lazySet was to *weaken* the
> guarantee.  Otherwise I don't know what it is for.

My own _guess_ based on the docs is that a full-volatile write ensures a
happens-before relation with _all_ subsequent volatile reads of the same
field, whereas a lazy/ordered write ensures a happens-before relation
with any subsequent volatile read _that sees the value written_ by that
write.  Therefore lazy writes guarantee, for example, safe publication
of objects, without actually forcing everything immediately out to main
memory.  But all bets are off, of course, if the read itself is not a
volatile read.

Doug et al., how close am I?

Cheers,
Justin



More information about the Concurrency-interest mailing list