Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
natsys-lab.blogspot.ru
Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
1–10 of 20 posts
Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#2Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#3The subject might be interesting but the formatting of the article is horrible. Is it that difficult to remove the line terminators at the end of each line so that you get actual paragraphs?
Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#4(Here is a plug for our C version: https://github.com/redjack/varon-t).
Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#5Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#6How is this different from disruptor queues ( http://lmax-exchange.github.io/disruptor/ )? (Here is a plug for our C version: https://github.com/redjack/varon-t ).
Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#7Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#8I'm a bit skeptical about the code: it seems that it's using only the atomic fetch-and-add synchronization instruction, and not compare-and-swap. However, I think that whether queues are implementable with only fetch-and-add is an open problem in distributed computing (in technical terms, whether queues are in the Common2 family. See for example Afek et al., "Common2 Extended to Stacks and Unbounded Concurrency".)
Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#9I'm a bit skeptical about the code: it seems that it's using only the atomic fetch-and-add synchronization instruction, and not compare-and-swap. However, I think that whether queues are implementable with only fetch-and-add is an open problem in distributed computing (in technical terms, whether queues are in the Common2 family. See for example Afek et al., "Common2 Extended to Stacks and Unbounded Concurrency".)
I've seen many queues implemented similarly to this, and it works fine. Every thread that calls fetch and add receives a different result, therefore, wrapping asside, there can only be one thread with access to each slot. If there is only one consumer and one producer you don't need fetch and add at all (that is how fastflow is implemented.) You must check that your slot is populated by either comparing with the othe…
Re: Lock-free Multi-producer Multi-consumer Queue on Ring Buffer
#10Earlier quoted context omitted.
I've seen many queues implemented similarly to this, and it works fine. Every thread that calls fetch and add receives a different result, therefore, wrapping asside, there can only be one thread with access to each slot. If there is only one consumer and one producer you don't need fetch and add at all (that is how fastflow is implemented.) You must check that your slot is populated by either comparing with the othe…
Ok, so it is relatively easy to obtain a safe implementation and from there you can use a heuristic to prevent a thread from looping forever trying to find an available slot. Would that sum up the issue in practice?