-
Notifications
You must be signed in to change notification settings - Fork 141
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
Causality test case 12: behavior allowed? #386
Comments
Similar question concerning casuality test kaist-cp/helpdesk#14 Causality test case 14 Initially, a = b = y = 0, y is volatile Thread 1: Thread 2: Behavior in question: r1 == r3 = 1; r2 = 0 Decision: Disallowed In all sequentially consistent executions, r1 = 0 and Why can't we reorder Thread 2 in the following way? Thread 1: Thread 2: Scheduling goes as following: In this way r1 == r3 = 1; r2 = 0 |
You're reordering instructions beyond what is allowed. For example, in test case 12, you cannot reorder a[r1] = 0 with r2 = a[0]. The promising semantics define which reorderings are allowed and which are not, so I recommend you to execute those test cases in the promising semantics to see what can happen. |
Closing, but feel free to reopen it if you have followup questions. |
Causality test case 12
Initially, x = y = 0; a[0] = 1, a[1] = 2
Thread 1
r1 = x
a[r1] = 0
r2 = a[0]
y = r2
Thread 2
r3 = y
x = r3
Behavior in question: r1 = r2 = r3 = 1
Decision: Disallowed. Since no other thread accesses the array a,
the code for thread 1 should be equivalent to
In the answer, it's written that behavior is disallowed. However, it seems that there is the case when r1 = r2 = r3 = 1 can happen(described bellow). Am I missing something?
`Thread 1
r2 = a[0]
y = r2
r1 = x
a[r1] = 0
Thread 2
r3 = y
x = r3
Scheduling goes as following:
Thread 1
r2 = a[0]
y = r2
Thread 2
r3 = y
x = r3
Thread 1
r1 = x
a[r1] = 0
In this way r1 = r2 = r3 = 1
`
Thank you!
The text was updated successfully, but these errors were encountered: