[cpp-threads] A draft memory model paper
Peter Dimov
pdimov at mmltd.net
Mon Aug 7 13:36:27 BST 2006
Herb Sutter wrote:
> http://www.gotw.ca/memmodel/Prism%20-%20draft%200.8.pdf
There are some interesting parts that might need clarification.
R3 states that "Interlocked reads and writes by the same observer cannot be
reordered relative to one another and shall be performed in program order."
However, example 3.2.2 appears to contradict that by stating that an
interlocked write followed by an interlocked read can be reordered.
Examples claim that a preceding non-interlocked operation can be moved
inside a critical section (which corresponds to acquire semantics for lock).
This appears to contradict the definition of lock as an interlocked
read-modify-write and example 3.2.5. In 3.2.5, if v1 = 1 can be moved after
lock(l1), then the example does contain a race.
The absence of atomic non-interlocked operations is somewhat disturbing...
efficient reference counting needs an atomic increment (fetchadd<raw>(1)).
More information about the cpp-threads
mailing list