Possible language changes

Richard C Bilson rcbilson at plg.uwaterloo.ca
Tue Mar 1 21:43:05 GMT 2005


>From hans.boehm at hp.com Tue Mar  1 15:13:19 2005
> I think the generic objection is something like: I already use volatiles
> to ensure some weaker property on my hardware.  Adding acquire/release
> semantics adds memory barrier overhead on my platform, which I don't
> need.  It would be nice to understand the weaker properties that might
> be desirable, and to ensure that the atomic operations library can
> provide those.
> 
> It seems to me that at the moment, there is enough platform variation
> in the meaning of "volatile" that it's hard to use it in portable code.

It is sometimes useful to enforce the ordering of memory operations,
even in the single-threaded case.  Memory-mapped device registers are
an example that I have worked with before -- it's important that writes
go on the bus as soon as they happen, and in the order in which they
happen; similarly for reads.

Note that this isn't necessarily a "weaker property" -- it relates to
the interaction of the program with its execution environment rather
than the interaction among threads in the program.  It might be the
case that preserving this property while ensuring proper ordering among
threads might actually impose costs that users of threads are unwilling
to bear (compare the Itanium's mf and mf.a).






More information about the cpp-threads mailing list