[zeromq-dev] LMAX/Distruptor code project

James Cipar jcipar at cmu.edu
Thu Oct 6 14:45:28 CEST 2011

I found this thread intriguing and went to read the disruptor technical paper.  Pretty cool stuff.  This may be a bit OT, but if you're interested in this stuff, the Xen paravirtualized call interface is very similar to a disruptor.  I haven't looked at the code in a few years, but if I remember right, it uses a ring buffer with a couple of atomic variables to mark the start & end of the ring.  Producers atomically update an allocation variable to grab a slot, when they are done writing they atomically update a cursor to indicate that the slot is ready.  Consumers basically do the reverse: grab a slot, copy the data, then update a different cursor to indicate that the slot is free.

Xen is doing this for basically the same reasons as the disruptor: super low latency message queue.  In Xen's case it's operations like setting page table entries or messaging other domains (e.g. to access hardware) that can't be done by the OS, but have to be sent to the Xen hypervisor.  These have to be very low latency.

The Xen implementation is GPL2, and in a very different context, so it's probably not possible to reuse that code here.  Also, it looks like Francois has already done a lot of work integrating his implementation into 0MQ which is awesome.  Just thought you might be interested in another nifty use for this technology.

On Oct 6, 2011, at 7:20 AM, Martin Sustrik wrote:

> On 10/06/2011 01:10 PM, Daniel Cegiełka wrote:
>> I think it would be better if ask someone who knows much better than I
>> zeromq structure.
> Ok. I've sent the message myself. If Francios is interested, I'll 
> redirect the discussion to the mailing list.
> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list