Boost logo

Boost :

Subject: Re: [boost] [lockfree] review
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-07-31 10:58:23

On Jul 30, 2011, at 9:44 PM, Dave Abrahams <dave_at_[hidden]> wrote:

> No program of substantial size can be understood "dynamically." You
> can't think about code paths and timing and control flow; there are just
> too many combinations and too much to keep track of. You have to think
> of static things like preconditions, postconditions, and invariants.
> That's why purely functional languages are easier to reason about, and
> why const and value semantics are important in languages with mutation.

Right, sequential consistency in itself is too low level to help understanding --

> 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), 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at