Hi Sharath,I have answered your questions on GitHub, and referenced from the 
comment on my blog:https://github.com/JCTools/JCTools/issues/179
I'll copy here for your convenience:1. It was a bug, fixed now by commit: 
https://github.com/JCTools/JCTools/commit/56b5e58b07266bea077ab5aa2c6e6268696b4784#diff-b871020fbeb6c92660e34a22b41c2b7dL138This
 check is not part of original algo, but required to support java.util.Queue 
interface correctly where returning false indicated queue is full.
2. The queue can be non-full and still hit this case if a single consumer is 
'stuck' between claiming the slot and moving the sequence. In this state other 
consumers can make progress, clearing more slots, thus the queue is not full.I 
hope this is clear enough.Regards,Nitsan 

    On Friday, May 26, 2017 10:51 AM, Sharath Gururaj <[email protected]> 
wrote:
 

 This question is regarding JCTools MPMC queue which is a java port of Dmitry 
Vyukov's Mpmc C++ implementation
https://github.com/JCTools/JCTools/blob/011e1c3a6919a0fb641815c7429e0742911b9a79/jctools-core/src/main/java/org/jctools/queues/MpmcArrayQueue.java#L141

Everything inside the if condition of line 140 seems to be redundant. Here are 
my questions: seems 
1. the check pIndex - capacity >= (cIndex = lvConsumerIndex()) seems wrong to 
me. The >= actually be <= 

2. The inner else seems to be redundant. Under what conditions can it be that 
seq < pIndex but array has free capacity?? If so then we can remove the inner 
if..else and simply return false
ThanksSharath-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Scalable Synchronization Algorithms" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/lock-free/fd6f1b95-9bc0-4f7c-bfc7-5e1de488a890%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


   

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Scalable Synchronization Algorithms" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/lock-free/1301079.396320.1495789138111%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to