[cpp-threads] Slightly revised memory model proposal (D2300)

Paul E. McKenney paulmck at linux.vnet.ibm.com
Fri Jun 22 18:37:04 BST 2007


On Fri, Jun 22, 2007 at 10:08:50AM -0700, Paul E. McKenney wrote:
> On Fri, Jun 22, 2007 at 02:22:30AM -0000, Boehm, Hans wrote:

[ . . . ]

> > 1.10p10:
> 
> [ . . . ]
> 
> >     A multi-threaded execution is consistent if each thread observes
> >     values of objects that obey the following constraints:
> > 
> >         * No evaluation happens before itself.

One more thing...  This was added in the revision, but the node has
not been updated to give the rationale.  Seems intuitive enough at
first glance, but more thought quickly leads to questions like "which
part of the evaluation?" and "from the viewpoint of which component of
the system?".

So, what is this really trying to say, and what mishaps is it trying
to prevent?

						Thanx, Paul

> >         * No read access B to a scalar object observes a side effect A,
> > 	  such that B happens before A.
> >         * Each read access B to a scalar object M observes the value
> > 	  assigned to M by a side effect A only if there is no other
> > 	  side effect X to M such that
> >               o A happens before X, and
> >               o X happens before B. 
> >         * If a side effect A to scalar object M happens before another
> > 	    side effect B to the same scalar object M, then A must precede
> > 	    B in Ms modification order.
> >         * If read access A to scalar B object M observes a value a, and
> > 	    A happens before read access B to the same scalar object M which
> > 	    observes b, then the corresponding assignment of b to M may
> > 	    not precede the assignment of a to M in M's modification order.
> 
> My guess is that "scalar B object M" needs to instead be "scalar object M".
> This assumes b!=a, so shouldn't this be made explicit?
> 
> On the "scalar" modifier used here, this means that we are not proposing
> atomic access to arbitrary structures, for example, atomic<struct foo>? 
> (Fine by me, but need to know.)  However, we -are- requiring that
> implementations provide atomic access to large scalars, correct?  So that
> a conforming 8-bit system would need to provide proper semantics for
> "atomic<long long>"?  Not that there are likely to be many parallel 8-bit
> systems, to be sure, but same question for 32-bit systems and both long
> long and double.  (Again, fine by me either way, but need to know.)
> 
> Although the general thrust of 1.10p8 and 1.10p10 look OK to me, more
> careful analysis will be required -- which won't happen by your deadline,
> sorry to say!
> 
> 						Thanx, Paul



More information about the cpp-threads mailing list