the Disruptor framework vs The Complexities of Concurrency

David Piepgrass qwertie256 at gmail.com
Wed Dec 12 16:59:31 PST 2012


> Maybe, but I'm still not clear what are the differences between 
> a normal ring buffer (not a new concept) and this "disruptor" 
> pattern..

Key differences with a typical lock-free queue:
- Lightning fast when used correctly. It observes that not only 
is locking expensive, even CAS (compare and swap) is not cheap, 
so it avoids CAS in favor of memory barriers (unless multiple 
writers are required.) Memory allocation is avoided too, by 
preallocating everything.
- Multicast and multisource: multiple readers can view the same 
entries.
- Separation of concerns: disruptors are a whole library instead 
of a single class, so disruptors support several configurations 
of producers and consumers, as opposed to a normal queue that is 
limited to one or two arrangements. To me, one particularly 
interesting feature is that a reader can modify an entry and then 
another reader can flag itself as "dependent" on the output of 
the first reader. So really it supports not just readers and 
writers but "annotators" that both read an write. And the set of 
readers and writers can be arranged as a graph.

See also
http://stackoverflow.com/questions/6559308/how-does-lmaxs-disruptor-pattern-work


More information about the Digitalmars-d mailing list