|
Boost : |
Subject: Re: [boost] [lockfree] review
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-07-31 13:05:04
on Sun Jul 31 2011, Gordon Woodhull <gordon-AT-woodhull.com> wrote:
> On Jul 30, 2011, at 9:44 PM, Dave Abrahams <dave_at_[hidden]> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk