[cpp-threads] Whence Sequential Consistency?
Peter Dimov
pdimov at mmltd.net
Sat Jan 20 01:02:03 GMT 2007
Lawrence Crowl wrote:
> But Raul Silvera (above) seems to imply that not all uses of locks
> result in a sequentially consistent program.
I assume that you are talking about programs that have no data races (apart
from the lock locations). Even then, consider this equivalent of one of the
classic non-SC examples:
// a, b initially locked
// T1
unlock( a );
r1 = try_lock( b );
// T2
unlock( b );
r2 = try_lock( a );
I think that it's perfectly possible for both try_locks to fail, something
that can't happen in a sequentially consistent execution.
> How can non-sequentially consistent atomics build
> a lock that enforces sequentially consistent behavior on programs?
Why not? For one thing, a lock is allowed to wait until SC is achieved,
while the atomics are non-blocking.
More information about the cpp-threads
mailing list