Note that there are some explanatory texts on larger screens.

plurals
  1. POHow LMAX's Disruptor work with Multiple producer with a shared variable?
    primarykey
    data
    text
    <p>I am new to Disruptor. I have the following two queries:</p> <p>Q1. I got a sample code of <a href="http://www.kotancode.com/2012/01/06/hello-disruptor/" rel="nofollow">one producer to one consumer</a> and <a href="http://mechanitis.blogspot.in/2011/07/dissecting-disruptor-wiring-up.html" rel="nofollow">one producer to multiple dependent consumers</a>,</p> <p>I like to get a sample code for multiple producers to multiple consumers or a Sequencer: 3P – 1C. Can you please refer any blogs or code sample to me?</p> <p>Q2. This is a generic question regarding in a multiple producer environment, how one producer result will inter related on previous producer's result in a ring buffer.</p> <p>for example: Is Disruptor can use in a environment where a single file/variable is getting updated by multiple producers. i.e there are two producers (P1,P2), Which are updating a single shared variable (named as "count").(Here count is a instance variable in ValueEvent class)</p> <p>Initially the “count” value is 0.</p> <p>Producer P1 will add 1 with the "count" current value. So after producer P1 processed, the value of count will be (0+1) = 1.</p> <p>Producer P2 will add 2 with the "count" current value, So after producer P2 processed, the value of count will be (1+2) = 3.</p> <p>Basically, P2 needs to read the updated "count" value (done by P1) from the ring buffer and add the incremented value(2).</p> <p>How we can maintain the order of execution of producers?(P2 will execute always after P1 execution.)</p> <p>At the consumer side, consumers (C1,C2) will read the "count" value as sequentially(1,3,.,.,.). This is ok, as in ring buffer, each consumer will read the ring buffer value in sequential order only.</p> <p>Thanks, Prasenjit.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload