[cpp-threads] Re: A hopefully clearer document on POSIX threads

Nick Maclaren nmm1 at cus.cam.ac.uk
Sat Mar 11 10:18:54 GMT 2006


"Boehm, Hans" <hans.boehm at hp.com> wrote:
> 
> I believe that the current strawman proposal states that the assertion
> can fail if
> 
> - Ordinary loads and stores are involved (obviously, there are many
> races).
> 
> - If all the loads and stores are atomic, but unordered.  The load of x
> in P1 still happens-before the store of y, since the latter depends-on
> the former.  But the same is not true for the loads in P2, since
> currently only stores depend-on loads.
> 
> If additionally the load of y in P2 is an acquire load, then the
> assertion is guaranteed to succeed.
> 
> This means that for now, X86 load_acquires can be ordinary loads.  If
> any future X86 processors fail to enforce this sort of transitivity,
> then that will no longer be the case, and load_acquire will need a more
> expensive implementation, as will Java volatile loads.
> 
> I'm personally OK with all of this.  Is everyone else?

No.  You have completely lost me.  Let's say that a future x86 fails
to enforce the transitivity, so the program fails.  A user then comes
to me and moans, I spend a week tracking things down and get proof
of the effect.  Do I then:

    1) Tell the user that he has misunderstood the standard, that he
can't trust the ordinary rules of logic when reading the standard,
and should write his code accordingly?

    2) Report it to the compiler vendor as a bug in their code, caused
by a change in x86 behaviour, and dedicate a month's work to bulling
that through with no very great hope of success?

    3) Classify it as yet another ambiguity in the standard, tell
both the user and the vendor of the issue, and wash my hands of the
horrible mess?

Look, I don't really CARE what the rules are, provided that they are
consistent, implementable, usable and above all CLEAR!


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679



More information about the cpp-threads mailing list