-
Notifications
You must be signed in to change notification settings - Fork 441
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
Is MsQueue missing memory barriers? #12
Comments
You're correct. I've fixed the orderings -- thanks! |
schets
pushed a commit
to schets/crossbeam
that referenced
this issue
Jan 20, 2016
The `MsQueue` implementation incorrectly used `Relaxed` operations in a few places, which resulted in a lack of pairing between `Acquire` and `Release` operations. Closes crossbeam-rs#12
exrook
pushed a commit
to exrook/crossbeam
that referenced
this issue
Oct 7, 2020
…ere using. Also fixes crossbeam-rs#12. This change removes all the `CacheStats` / `CacheStatistics` types and adds a `ServerInfo` struct which contains the existing `ServerStats` struct as a field as well as the cache location and size info we're currently sending in the stats response. We now just send a `ServerInfo` directly in the server response using serde for serialization. The existing `print_stats` code is moved into `ServerStats::print` and `ServerInfo::print` methods. This lays the foundation to make it easy to implement JSON stats output.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm looking over the MsQueue code to practice reasoning about memory barriers, and I see a couple things that appear odd:
Acquire
only does something when paired withRelease
and conversely, but MsQueue only usesRelease
andRelaxed
on thenext
pointers andAcquire
andRelaxed
on thehead
andtail
pointers. So I think the implementation is allowed to replace all of the orderings withRelaxed
. ?Acquire
can synchronize withRelaxed
,pop()
is still doing aRelaxed
fetch ofhead.next
and then reading from the next record'sdata
without additional memory barriers, which could get uninitialized memory on Alpha ? (It looks like this is the kind of thingmemory_order_consume
is for, as this is technically stronger thanRelaxed
but still requires no barriers on common hardware. Wonder when LLVM/Rust will get it.)The text was updated successfully, but these errors were encountered: