-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement MessageQueue without locks #6837
Comments
@Thiez is working on this |
How's this going? |
I've had https://github.com/Thiez/rust/blob/ll-message-queue/src/libstd/rt/message_queue.rs lying around for a while now. It is a Michael-Scott lockless queue as described here http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf . However, since Rust does not (at this time) have an intrinsic for double-word compare-and-swap, my version is considerably more vulnerable to the ABA-problem and thus I am hesitant to declare this queue complete. To summarize, the basic algorithm is implemented and appears to work (without leaking memory, or so valgrind tells me) but it's going to fail randomly (but rarely) when at least two threads are writing and one thread is reading. Suggestions are welcome. |
I used lock-free MPSC queue that was described by Dmitriy Vyukov (http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue) to implement one of fastest and lightweight actor for JVM: https://github.com/plokhotnyuk/actors/blob/master/src/test/scala/com/github/plokhotnyuk/actors/Actor2.scala |
The biggest place where we need to reduce lock contention is the global sleeper list #6838. Its lock is just getting hammered constantly. There are lots of ways we might fix this but an obvious one to replace it with a lock-free queue. |
@plokhotnyuk thanks for that link, implementing it in rust was incredibly easy https://github.com/Thiez/rust/blob/better-message-queue/src/libstd/rt/message_queue.rs |
Closed by #9710 |
`explicit_deref_methods` improvements Breaking up rust-lang#6837 changelog: `explicit_deref_methods` will lint chained `deref` calls and ufcs style calls
new lint: `borrow_deref_ref` changelog: ``[`borrow_deref_ref`]`` Related pr: rust-lang#6837 rust-lang#7577 `@Jarcho` Could you please give a review? `cargo lintcheck` gives no false negative (but tested crates are out-of-date). TODO: 1. Not sure the name. `deref_on_immutable_ref` or some others?
MessageQueue is the way schedulers communicate with each other. It is a multiple-producer, single-consumer unbounded queue.
The text was updated successfully, but these errors were encountered: