30 Oct 2026
The Disruptor Pattern C++
For the millionth time in my life, the answer is it's some kind of ring buffer.
It's a more performant queue that will prevent CAS (Compare And Swap) latency.
A little more on the queue problem
Usually, one end of the queue is for packets you receive. The other end of the queue is for orders you'll want to send back.
A regular queue has some latency problems but a disruptor queue uses a ring buffer internally.
If the queue is empty and you need to read and write on the same part of the queue, then you'll face some read/write issues.
Compare and swap is a way to deal with concurrent writers. (Update val if val was 6. If it's not 6 i.e. someone changed it then don't update it)
(WIP! will come back later!)