Skip to content

[intro.races] CWG 2297, LWG 2506: Unclear specification of atomic operations #1611

Description

@jensmaurer

It is not sufficiently clear that the only atomic operations are the ones defined in clause 32 [atomics] by the library. The intent is that no accesses are atomic unless the Standard describes them as such.

An additional problem is that, e.g., new and delete are defined to be synchronization operations, but they are not defined in Clauses 32 [atomics] and 33 [thread].

CWG telecon 2017-04-10 determined this issue was editorial.

Activity

  1. self-assigned this
    on Apr 12, 2017
  2. jensmaurer commented on Apr 12, 2017

    @jensmaurer
    MemberAuthor

    I'm not seeing where we normatively say "new and delete are defined to be synchronization operations".

  3. jensmaurer commented on Apr 12, 2017

    @jensmaurer
    MemberAuthor

    It is not sufficiently clear that the only atomic operations are the ones defined in clause 32 [atomics] by the library. The intent is that no accesses are atomic unless the Standard describes them as such.

    This is slightly confused. Since the standard does not define operations other than those in [atomics] to be "atomic operations", and furthermore we usually use "operation on atomic object M" when talking about ordering in [intro.races], there seems to be no leeway for a hostile interpretation.

    The intent is that no accesses are atomic unless the Standard describes them as such.

    A conforming implementation could make all accesses atomic, but a portable user program may only rely on atomic operations specified as such in the standard.

    If there is any doubt what "atomic operations on atomic objects" are, it seems [intro.races] is not the place to fix it, but instead this should be addressed in [atomics].

  4. added a commit that references this issue on Apr 12, 2017
    2a8d97d
  5. timsong-cpp commented on Apr 19, 2017

    @timsong-cpp
    Contributor

    I'm not seeing where we normatively say "new and delete are defined to be synchronization operations".

    Maybe it's referring to the last sentence of [new.delete.dataraces]?

  6. jensmaurer commented on Apr 19, 2017

    @jensmaurer
    MemberAuthor

    @timsong-cpp: That still doesn't say that new/delete are synchronization operations; those make unrelated memory updates visible to other threads. In contrast, for new/delete we just specify that they are serializable as individual function calls, but we don't say anything about visibility of unrelated memory updates. (I'm not positive [new.delete.dataraces] actually says what it should say; we certainly want to allow thread-optimized allocators that respond to some allocations entirely locally without coordinating with other threads. See LWG 2508 for the opposite viewpoint; to be discussed.)

  7. timsong-cpp commented on Apr 19, 2017

    @timsong-cpp
    Contributor

    we don't say anything about visibility of unrelated memory updates

    The "happens before" part almost does that (but for consume operations).

  8. jensmaurer commented on Apr 19, 2017

    @jensmaurer
    MemberAuthor

    @timsong-cpp: Fine, but I think that direction is misguided to start with. See http://lists.isocpp.org/parallel/2017/04/0856.php for discussion.

  9. timsong-cpp commented on Apr 19, 2017

    @timsong-cpp
    Contributor

    @jensmaurer I can't see what I can't access :) Was just trying to point out what IMO that portion of the comment probably meant, but I think this is getting a bit off-topic...

  10. added a commit that references this issue on Jul 21, 2017
    f279a32
  11. added a commit that references this issue on Jul 30, 2017
    23578f8
  12. added a commit that references this issue on Oct 15, 2017
    ec8aa60
  13. jensmaurer commented on Apr 13, 2018

    @jensmaurer
    MemberAuthor

    This is covered by LWG 2506.

  14. changed the title [-][intro.races] CWG 2297: Unclear specification of atomic operations[/-] [+][intro.races] CWG 2297, LWG 2506: Unclear specification of atomic operations[/+] on Apr 13, 2018
  15. added
    lwgIssue must be reviewed by LWG.
    cwgIssue must be reviewed by CWG.
    not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.
    on Apr 13, 2018
  16. removed their assignment
    on Apr 13, 2018
  17. jensmaurer commented on Apr 13, 2018

    @jensmaurer
    MemberAuthor

    SG1 discussion on LWG 2506 asked for a paper to address "atomic object", "atomic operation", "synchronization operation" etc.

  18. added
    sg1Issue must be reviewed by SG1.
    and removed
    cwgIssue must be reviewed by CWG.
    lwgIssue must be reviewed by LWG.
    on Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.sg1Issue must be reviewed by SG1.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions