问题描述
我正在寻找在 C/CPP 中正确实现工作窃取队列的方法.我环顾了谷歌,但没有发现任何有用的东西.
I'm looking for a proper implementation of a work stealing queue in C/CPP. I've looked around Google but haven't found anything useful.
也许有人熟悉一个好的开源实现?(我不喜欢实现取自原始学术论文的伪代码).
Perhaps someone is familiar with a good open-source implementation? (I prefer not to implement the pseudo-code taken from the original academic papers).
推荐答案
没有免费的午餐.
请看盗纸原作.这篇论文很难理解.我知道那篇论文包含理论证明而不是伪代码.但是,根本没有比 TBB 更简单的版本更多.如果有的话,它不会提供最佳性能.工作窃取本身会产生一些开销,因此优化和技巧非常重要.特别是,出队必须是线程安全的.实现高度可扩展和低开销的同步具有挑战性.
Please take a look the original work stealing paper. This paper is hard to understand. I know that paper contains theoretical proof rather than pseudo code. However, there is simply no such much more simple version than TBB. If any, it won't give optimal performance. Work stealing itself incurs some amount of overhead, so optimizations and tricks are quite important. Especially, dequeues are must be thread-safe. Implementing highly scalable and low-overhead synchronizations are challenging.
我真的很想知道你为什么需要它.我认为正确的实现意味着类似于 TBB 和 Cilk.同样,工作窃取很难实施.
I'm really wondering why you need it. I think that proper implementation means something like TBB and Cilk. Again, work stealing is hard to implement.
这篇关于在 C/C++ 中实现工作窃取队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!