Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory model bug #2277

Closed
rsc opened this issue Sep 20, 2011 · 2 comments
Closed

memory model bug #2277

rsc opened this issue Sep 20, 2011 · 2 comments

Comments

@rsc
Copy link
Contributor

rsc commented Sep 20, 2011

from private mail:

'''A read r of a variable v is allowed to observe a write w to v if
both of the following hold:
  1. w happens before r.
   2. There is no other write w' to v that happens after w but before r.

 A read r of a variable v is also allowed to observe a write w to v
if  w happens    concurrently with r.

 If a w does not fit into either of these two cases,  a read r of
variable v is guaranteed to not observe the write w to v.
'''

from golang-nuts (same issue):


---------- Forwarded message ----------
From: Andrew Hart <hartandrewr@gmail.com>
Date: Tue, Sep 20, 2011 at 01:29
Subject: [go-nuts] Go Memory Model: allowed
To: golang-nuts <golang-nuts@googlegroups.com>


go_mem.html states
> A read r of a variable v is allowed to observe a write w to v if both of the
following hold:
> 1. w happens before r.
> 2. There is no other write w' to v that happens after w but before r.

This definition doesn't seem necessary for the rest of the document.
One line seems to contradict it:
> Note that a read r may observe the value written by a write w that happens
concurrently with r. Even if this occurs, it does not imply that reads happening after r
will observe writes that happened before w.

If "w happens concurrently with r" is true, then "w happens before r"
is false by definition.

A more consistent definition of allowed might replace the first
condition with:
1. r does not happen before w

Should such a replacement be considered?

What motivates defining allowed (rather than only defining
guaranteed)?

Leaving "allowed" out of the model entirely might not be bad in light
of some previous posts: http://groups.google.com/group/golang-nuts/msg/ba17c1ab71357629
http://groups.google.com/group/golang-nuts/msg/75caf6fbe3b24cca
http://groups.google.com/group/golang-nuts/msg/8b1adf2a50f0dcb7

Thanks,
Andrew Hart
@rsc
Copy link
Contributor Author

rsc commented Sep 26, 2011

Comment 1:

This issue was closed by revision 44d13e3.

Status changed to Fixed.

@rsc
Copy link
Contributor Author

rsc commented Feb 29, 2012

Comment 2:

Issue #3144 has been merged into this issue.

@rsc rsc added fixed labels Feb 29, 2012
@rsc rsc self-assigned this Feb 29, 2012
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants