简体   繁体   English

C ++中的无等待队列实现

[英]Wait-free queue implementation in C++

是否有可能实现一个完全无等待并且可以同时支持多个编写器和读取器的并发队列?我知道我可以使用互斥锁或现有的库,但我真的想自己实现它。任何想法?

You can find a wait-free queue for multiple enqueuers and dequeuers here , but as @David Schwartz said this will not be necessarily faster just for being wait-free. 你可以在这里为多个入队者和出队者找到一个无等待的队列,但正如@David Schwartz所说,这不仅仅是为了等待免费更快。 This is another paper about wait-free queue. 是关于无等待队列的另一篇论文。 On the references of these papers you also can find other proposed queues based on arrays, that means they have a limited capacity, but they are faster than those based on lists. 在这些论文的参考文献中,您还可以找到基于数组的其他提议队列,这意味着它们的容量有限,但它们比基于列表的队列更快。

If you are looking for a practical solution Michael and Scott's Lock-Free queue is probably a good alternative. 如果你正在寻找一个实用的解决方案迈克尔和斯科特的无锁队列可能是一个很好的选择。

If you want to learn more and give it a try yourself, Here you can find a good resume of the possible alternatives and there are a few code examples. 如果你想了解更多并亲自尝试一下, 在这里你可以找到一个可能的替代品的好简历,并且有一些代码示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM