[cpp-threads] Brief example ITANIUM Implementation forC/C++MemoryModel
Peter Dimov
pdimov at mmltd.net
Fri Jan 2 18:26:54 GMT 2009
Alexander Terekhov:
> IOW,
>
> P1: Y.store(1, seq_cst);
> P2: Z.store(1, seq_cst); a = Y.load(relaxed);
> P3: b = Y.load(relaxed); fence(seq_cst); c = Z.load(relaxed);
>
> may legitimately yield a=0, b=1, c=0
Do you insist on P2's load being relaxed? As it stands, your example may
well allow this outcome. With:
P2: Z.store(1, seq_cst); a = Y.load(seq_cst);
I suspect that it doesn't, but I'm too lazy right now to write down all
possible total orders and prove (or disprove) it. :-)
> P1: Y.store(1, seq_cst);
> P2: Z.store(1, seq_cst); a = Y.load(relaxed);
> P3: b = Y.load(relaxed); c = Z.load(seq_cst);
It does, AFAIK, even with the modified P2.
More information about the cpp-threads
mailing list