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

Vitaly Davidovich vitalyd at gmail.com
Mon Sep 8 16:23:03 EDT 2014


lazySet/ordered writes are outside JMM as of today (next revision is
addressing this I believe) so it's perhaps a bit disingenuous to use JMM
terms to translate.  However, with that caveat, your description seems fair
to me.

Sent from my phone
On Sep 8, 2014 3:55 PM, "Justin Sampson" <jsampson at guidewire.com> wrote:

> Vitaly Davidovich wrote:
>
> > lazySet orders preceding writes with the write being done as part of
> > lazySet, but does not guarantee that this write is globally visible
> > before next instruction is executed by the writing CPU.  In practical
> > terms, on x86/64, this compiles into a plain mov instruction with a
> > compiler barrier prevent prior stores from moving past the lazy one.
> > If this store were done via volatile write or AtomicXXX.set(), then a
> > cpu serializing instruction would be added after the store (e.g. lock
> > add $0, %rsp).
> >
> > I'm guessing on non-TSO platforms lazySet implies a weaker release
> > fence instruction is emitted, but I don't know the details.
>
> Is there a simple translation of those implementation details into
> happens-before semantics (perhaps like I tried to describe), or is it
> best to always think in terms of reordering?
>
> Thanks,
> Justin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140908/eefe3fc4/attachment.html>


More information about the Concurrency-interest mailing list