[cpp-threads] modes
Peter Dimov
pdimov at mmltd.net
Sat May 7 19:33:38 BST 2005
Doug Lea wrote:
>>> Sorry for not being clear. I meant that ordinary_read and
>>> ordinary_write (or some better names) would be in the atomic
>>> classes. Although even here we'd need to decide whether these
>>> reads/writes must be bitwise-atomic. I think we once agrred they
>>> should be.
>>
>> But once we have these, we can no longer claim sequential
>> consistency.
>
> I think all is well. The basic model can talk only of modes.
> Ordinary variables always only have one mode. Similarly
> for locks and volatiles. But atomics can be used in any mode.
> Which in effect means: A compliant program without atomics will be
> "obviously" SC. Programs using atomics might or might not be
> considered SC, depending on how they are used vs how they were
> intended to be used.
I'm not sure I understand.
I thought that the memory model was the lowest level specification, and that
no well-defined program could violate it, atomics or not. So I tried to fit
the unconstrained atomics into it, and failed.
You seem to be saying that:
- programs that have no data races are sequentially consistent;
- programs that have data races involving ordinary accesses are undefined;
- and there is a third class of programs that have data races involving only
atomic accesses that are outside the memory model and will be addressed in
another specification.
Even if I accept this premise, I'm still unable to draw a mental picture of
the "another specification" and I don't see how this separation simplifies
matters.
What am I missing again?
More information about the cpp-threads
mailing list