Timeline for C++ lock-free, MPMC Ring buffer in C++20
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 20, 2021 at 12:04 | comment | added | Matthieu M. | MPMC are the most difficult queues to get to work properly. Is there any chance you could rework the system to use multiple MPSC instead? | |
Jun 20, 2021 at 9:51 | comment | added | ALX23z |
I don't see how this is lock-free is any better than a mutex version. The heaviest operations that mutexes have are memory fencing - acquire and release fences. The operations themselves don't take much time bit they require cache data to be reloaded/committed which will slow down whatever code uses the class. What's the advantage over mutexes?
|
|
Jun 18, 2021 at 21:55 | comment | added | Peter Cordes | related: Lock-free Progress Guarantees analyzes the MPMC queue from liblfds, which uses sequence numbers in each bucket to avoid having both readers reader the current write-index, and vice versa. (i.e. reduces contention between "hot" parts for both sides.) | |
Jun 18, 2021 at 21:31 | answer | added | avakar | timeline score: 9 | |
Jun 18, 2021 at 18:00 | history | tweeted | twitter.com/StackCodeReview/status/1405948471513862144 | ||
Jun 18, 2021 at 3:35 | history | became hot network question | |||
Jun 17, 2021 at 22:12 | answer | added | G. Sliepen | timeline score: 18 | |
Jun 17, 2021 at 21:29 | comment | added | stepan | Is this possible: Thread 0: TryConsume => load toRead/toWrite => check empty (not empty) => context switch (right before state compare exchange). In the meantime Thread 1: TryConsume => load toRead/toWrite => advance read ptr => Release. Nothing more to read. Now we get back to Thread 0 and it tries to read already read area and advances "myNextRead" somewhere beyond written area. | |
Jun 17, 2021 at 20:03 | answer | added | Toby Speight | timeline score: 9 | |
Jun 17, 2021 at 17:10 | history | asked | Ash | CC BY-SA 4.0 |