并发可变优先级队列优先级、队列

2023-09-11 04:36:09 作者:內些過往的曾經

是否有并发的可变优先级队列?理想情况下,我正在寻找一个C ++实现,但是,对于初学者来说,一个指针算法将是非常有益的。

Is there a concurrent mutable priority queue? Ideally, I'm looking for a C++ implementation, but, for starters, a pointer to an algorithm would be very helpful.

要清楚,我正在寻找一个优先级队列,我可以调整要素的优先级。具体而言,TBB的 concurrent_priority_queue 不提供必要的功能。 (对于这个问题,同样没有STL的 priority_queue ,即使我们忽略了并发性。)的 Boost.Heap 库提供了我想要系列的功能,但没有并发。当然,我在寻找的东西不仅仅是锁定整个队列的每一个操作更细粒度。

To be clear, I'm looking for a priority queue where I can adjust the priorities of the elements. In particular, TBB's concurrent_priority_queue doesn't provide the necessary functionality. (For that matter, neither does STL's priority_queue, even if we ignore the concurrency.) Boost.Heap library provides serial functionality that I want, but without concurrency. Naturally, I'm looking for something finer grained than just locking the entire queue on every operation.

推荐答案

一个并发的优先级队列使用skiplist通常实现的,所以Facebook的ConcurrentSkipList可能适合您的要求。

A concurrent priority queue is often implemented using a skiplist, so Facebook's ConcurrentSkipList may fit your requirements.

 
精彩推荐
图片推荐