[cpp-threads] Brief example ITANIUM Implementation for C/C++MemoryModel
Alexander Terekhov
alexander.terekhov at gmail.com
Fri Jan 2 19:53:01 GMT 2009
On Fri, Jan 2, 2009 at 7:28 PM, Paul E. McKenney
<paulmck at linux.vnet.ibm.com> wrote:
[... reasoning ...]
> My explanation is: "If you want sequentially consistent results, use
> memory_order_seq_cst everywhere". On the other hand, if you want to use
> optimizations involving non-seq_cst atomics, make sure that you
> understand the actual guarantees that they provide. ;-)
I suggest to add this further explanation of your as a note to the
prominent place like 1.10 just like your previous note:
"[Nothing] requires that seq_cst operations be ordered with respect to
non-seq_cst operations [atomics as well, see 29.1] except as required
by acquire, consume, and release semantics."
Now, what is your reasoning regarding
P1: Y.store(1, relaxed);
P2: Z.store(1, relaxed); fence(seq_cst); a = Y.load(relaxed);
P3: b = Y.load(relaxed); fence(seq_cst); c = Z.load(relaxed);
and a=0, b=1, c=0 outcome?
TIA.
regards,
alexander.
More information about the cpp-threads
mailing list