Subj : Re: Memory visibility and MS Interlocked instructions To : comp.programming.threads From : Scott Meyers Date : Thu Aug 25 2005 02:04 pm Alexander Terekhov wrote: > No on the first part to the extent that "... thread W (the writer) > writes a value to variable x and thread R (the reader) later reads > the value of x ... to guarantee that R sees the value written by > W, W must follow the write with a release membar and R must > precede the read with an acquire membar" is not true on shared > memory MP hardware level where acquire and release merely ensure > ordering with respect to other accesses. I was actually asking about the truth of this statement: Both writer and reader must participate in a handshake to ensure that writer changes to memory are visible to readers in a relaxed memory architecture. What struck me most about the documentation of the interlocked instructions was that it suggested there was no need for a handshake, i.e., if the writer called an interlocked routine, there was no need for a reader to do anything special when reading. From the responses I've seen in this thread, I get the impression that a handshake *is* required, that both writer and reader must do something to ensure that the reader sees what the writer last wrote, at least in the general case. As for your specific statement above, I gather you mean that on some architectures, more specific membars may be necessary rather than just release by the writer and acquire by the reader. Is that correct? Scott .