
on Sun Jul 31 2011, Gordon Woodhull <gordon-AT-woodhull.com> wrote:
On Jul 30, 2011, at 9:44 PM, Dave Abrahams <dave@boostpro.com> wrote:
That's also why it's always seemed to me that thinking in terms of interleavings of instructions doesn't lead to any fundamentally improved ability to understand parallelism: it doesn't change anything from a static point of view. The basic issue is still one of protecting one thread from observing the broken invariants of another.
-- but without sequential consistency, the compiler may be rearranging instructions in ways that wouldn't affect a single thread (as allowed by c++03),
Yes.
and threads may see each others' actions in the wrong order, so a weak memory model can actually break invariants even if the code is good.
I don't get it. Please, show me an example. Anyway, what's the "wrong order?" If one thread is depending on the order of things that happen in another thread without both threads using the synchronization necessary to ensure that order, it's a race condition (a.k.a. a bug), right? -- Dave Abrahams BoostPro Computing http://www.boostpro.com