-
Notifications
You must be signed in to change notification settings - Fork 107
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
A mutual exclusion test on peterson's algorithm #289
Comments
Correctness of Peterson's algorithm assumes that there is a total order among the instructions. This is not true in weak memory models such as C/C++/Rust's, because for example a But unfortunately, due to technical limitations, Loom does not understand For Peterson's algorithm, you can simply insert |
I've used the loom to test peterson's algorithm.
Peterson's algorithm does not seem to provide mutual exclusion with the below memory ordering.
The below is the result.
How could I know in which order the code have been executed?
Does the ones printed with the above
println!
macro represent the exact order which have been executed?How could the value of P1's
flag0_curr
containfalse
even after flag0 has been written astrue
by P0?Does the result mean that only P0's
turn
has been correctly stored while other stores have not been reflected?The text was updated successfully, but these errors were encountered: