Search code examples
javac++ccollectionsdisruptor-pattern

What in C/C++ is the most suitable close in functionality to collection Disruptor in Java?


Which of the existing collections of data in C/C++ is the most suitable close in functionality to collection(library) Disruptor in Java?

http://lmax-exchange.github.io/disruptor/

The small description:

It is an extremely fast alternative using messaging queues in multithreaded programs. Framework which has "mechanical sympathy" for the hardware it's running on, and that's lock-free. And lots of efforts to avoid lock, CAS, even memory barrier.

Read more about it in the discussion: How does LMAX's disruptor pattern work?


Solution

  • If you want the same functionality, use a mutex protected queue. If you want the same performance you should re-implement the disruptor algorithm in C++ or try this open source project: https://code.google.com/p/disruptor-cpp/

    And for those who don't know, the Disruptor (unfortunate name) is a message passing technique that uses lock-free algorithms and pays close attention to issues such as cache conflicts, to deliver very high performance in cases where it can be used. A company named LMAX came up with it and named it. Martin Fowler (of Refactoring fame) is an advocate for it.