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
Queues based on Unsafe#getAndAdd instead of CAS spins? #226
Comments
Cool, thanks for the link! Is there a paper or a presentation somewhere which explains the algorithm? Are there plans for an Mpmc variant? |
@felixbarny Not at short term, considering that this version is just experimental (even if quite stable now). @nitsanw maybe has something in mind, I can't say :) Re the algorithm is commented and explained on the code and is a (now huge) variation of the Aeron publication log buffer: https://github.com/real-logic/aeron/wiki/Data-Structures. |
@felixbarny I suppose you should be interested into #230 |
Fixes #226: XADD mpmc queue: highly scalable queue
Hi,
I'm learning about lock-free and wait-free algorithms and I was asking myself whether queues could be implemented based on the wait-free
Unsafe#getAndAdd
method as opposed to the lock-free CAS spin. The latter can still lead to queuing effects, especially under high contention and when there are more threads than processors concurrently doing the CAS spin.Example of a CAS spin in
MpmcArrayQueue
:JCTools/jctools-core/src/main/java/org/jctools/queues/MpmcArrayQueue.java
Lines 175 to 176 in 6b8feea
Would it be possible to restructure the algorithm to be wait-free or is that inherently impossible?
Thanks,
Felix
The text was updated successfully, but these errors were encountered: