Subj : Re: Memory Barriers, Compiler Optimizations, etc. To : comp.programming.threads From : Joseph Seigh Date : Thu Feb 03 2005 09:03 pm On Thu, 3 Feb 2005 17:10:02 -0800, SenderX wrote: > > >> If >> the former, how are programmers in languages like C/C++ expected to make >> the association between reads/writes and memory barriers? > > > Just to clarify and answer your question directly: > > > loads are usually associated with "consumer side" memory barriers. > hoist-load-xxx, acquire, ect... > > stores are usually associated with "producer side" memory barriers. > sink-store-xxx, release, ect... > > > > I'm leaning toward the way http://www.hpl.hp.com/research/linux/qprof/README_atomic_ops.txt does it where the "memory barrier" is a qualifier to the operation it's tacked on to. Which means a load_acquire would have a different membar than a store_acquire. For sparc, load_acquire would have "#LoadLoad | #LoadStore" and store_acquire would have "#StoreLoad | #StoreStore". For ia32 it would be MFENCE for both. -- Joe Seigh .