I wrote: > For a good introduction to what is needed to write robust multithreaded > code on modern weakly-ordered memory architectures, I recommend the > following article: > > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2480.html
and if you want a deeper understanding of what's going on in the hardware to cause these problems, see Paul McKenney's paper "Memory Barriers: a Hardware View for Software Hackers": http://www.rdrop.com/users/paulmck/scalability/paper/whymb.2010.06.07c.pdf Mark