Created on2012-02-21.00:00:00 last changed136 months ago
[Moved to DR at the February, 2014 meeting as part of document N3914.]
Proposed resolution (January, 2014) [SSUPERSEDED]:
Change 6.10.2 [intro.multithread] paragraph 14 as follows:
Thevisible sequence of side effects on an atomicobjectM, with respect to a value computationB ofM,is a maximal contiguous sub-sequence of side effects in the modificationorder of M, where the first side effect is visible with respecttoB, and for every side effect, it is not the case thatBhappens before it.The value of an atomic objectM, asdetermined by evaluationB, shall be the value stored bysomeoperation in the visible sequence ofM with respecttoBside effectA that modifiesM,whereB does not happen beforeA. [Note:Itcan be shown that the visible sequence of side effects of a valuecomputation is unique givenThe set of side effects that a givenevaluation might take its value from is also restricted by the rest of therules described here, and in particular, by the coherencerequirements below. —end note]
Change 6.10.2 [intro.multithread] paragraph 20 as follows:
[Note: Thevisible sequence of side effectsvalueobserved by a load of an atomic depends on the “happensbefore” relation, which depends on the values observed by loads ofatomics, which we are restricting here. The intended reading isthat there must exist an association of atomic loads with modificationsthey observe that, together with suitably chosen modification orders andthe “happens before” relation derived as described above,satisfy the resulting constraints as imposed here. —end note]
Change 6.10.2 [intro.multithread] paragraph 22 as follows:
[Note: Compiler transformations that introduce assignments to apotentially shared memory location that would not be modified by theabstract machine are generally precluded by this standard, since such anassignment might overwrite another assignment by a different thread incases in which an abstract machine execution would not have encountered adata race. This includes implementations of data member assignment thatoverwrite adjacent members in separate memory locations. Reordering ofatomic loads in cases in which the atomics in question may alias is alsogenerally precluded, since this may violate the“visiblesequence”coherence rules. —end note]
Change 32.5.4 [atomics.order] paragraph 3 as follows:
There shall be a single total orderS on allmemory_order_seq_cst operations, consistent with the“happens before” order and modification orders for all affectedlocations, such that eachmemory_order_seq_cstoperationB that loads a value from an atomic objectMobserves one of the following values:
the result of the last modificationA ofM thatprecedesB inS, if it exists, or
ifA exists, the result of some modificationofM
in the visible sequence of side effects with respecttoBthat is notmemory_order_seq_cst and that does nothappen beforeA, orifA does not exist, the result of some modificationofM
in the visible sequence of side effects with respecttoBthat is notmemory_order_seq_cst.[Note:...
[The following is reproduced verbatim from WG14 DR406 as a C-liaisonissue.]
It has been mathematically proved that a simplification can be madeto the memory model as it is specified in the final draft of the C++11standard. Essentially, the restriction definingvisible sequence ofside effects (vsse) is redundant and can be removed with no illeffects. The main motivation for doing this is that the currentrestriction is misleading. 5.1.2.4p22 defines vsse's:
The visible sequence of side effects on an atomic object M, withrespect to a value computation B of M, is a maximal contiguoussub-sequence of side effects in the modification order of M, where thefirst side effect is visible with respect to B, and for everysubsequent side effect, it is not the case that B happens beforeit. The value of an atomic object M, as determined by evaluation B,shall be the value stored by some operation in the visible sequence ofM with respect to B.
The wording of this paragraph makes it seem as if the vsseidentifies the writes that an atomic read is allowed to read from, butthis is not the case. There can be writes in the vsse that cannot beread due to the coherence requirements (to be included in C, 1.10p15through 1.10p18 in C++ N3291). Consequently this is even moreconfusing than it at first appears.
Also propose changing 5.1.2.4p22 to the following:
The value of an atomic object M, as determined by evaluation B, shallbe the value stored by some side effect A that modifies M, where Bdoes not happen before A.
With a note to remind the reader of the coherence requirements:
NOTE: The set of side effects that a given evaluation might take itsvalue from is also restricted by the rest of the rules described here,and in particular, by the coherence requirements below
If the committee is concerned about allowing a differing text from C++11, then a note could be added to assure the reader:
NOTE: Although the rules for multi-threaded executions differ herefrom those of C++11, the executions they allow are precisely thesame. Visible sequences of side effects are a redundant restriction.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-11-24 00:00:00 | admin | set | status: dr -> c++14 |
| 2014-03-03 00:00:00 | admin | set | messages: +msg4924 |
| 2014-03-03 00:00:00 | admin | set | status: concurrency -> dr |
| 2013-10-14 00:00:00 | admin | set | messages: +msg4676 |
| 2012-02-21 00:00:00 | admin | create | |