[cpp-threads] Somewhat relevant technical report

Nick Maclaren nmm1 at cus.cam.ac.uk
Thu Dec 15 20:49:06 GMT 2005


"Boehm, Hans" <hans.boehm at hp.com> wrote:
> 
> This basically asks and answers the question of what memory fences are
> required by pthread locks, if you try as much as possible to take the
> current spec at face value.  (Pthread_mutex_lock() requires a full
> barrier, pthread_mutex_unlock() doesn't.)  I thought it was worth making
> this precise, since it allows us to reason about what, if anything,
> we're changing.  I'd be surprised if there were much consistency in what
> vendors actually do on machines with weak memory models, especially
> since the rules seem to be both subtle and at least partially
> accidental.  So don't read this as a spec for current implementations.
> (And you should probably disbelieve lock-intensive multithreaded pthread
> benchmarks unless you check what the implementation actually does.)

Quite.  And I will bet that almost every current implementation is
broken in at least one respect, unless you choose a truly perverse
and system-specific interpretation of the standard.  By that I mean
that they will be incompatible with at least one of the relatively
rare unambiguous statements in POSIX.  This remark is based on actual
experience as well as cynicism :-(

> I don't believe any of this is central to what we're trying to do.

Except as more evidence that there is no adeuate POSIX model.


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