简体   繁体   English

排序原子链表算法(优先级队列)

[英]sorted atomic linked list algorithm (priority queue)

Can somebody point me towards an algorithm for a sorted thread-safe atomic (lock-free) linked list/priority queue? 有人可以指向一个排序的线程安全原子(无锁)链表/优先级队列的算法吗? I'm aware of how to do just a linked list itself, but now I need one that is sorted. 我知道如何只做链接列表本身,但现在我需要一个已排序的。 I'm unsure if this is minor change or significant redesign compared to an unsorted list, thus would like to see an existing algorithm before I make my own. 与未排序的列表相比,我不确定这是微小的变化还是重大的重新设计,因此我希望在创建自己的算法之前看到现有的算法。

It needn't actually be a list (or technically sorted), but behaves like a priority queue with these properties: 它实际上不必是列表(或技术上已排序),但行为类似于具有以下属性的优先级队列:

  • lowest element is the one with the minimum integer field value 最低元素是具有最小整数字段值的元素
  • access to lowest element in constant time 在恒定时间内访问最低元素
  • modification via atomic operations only (no locks) 仅通过原子操作进行修改(无锁)
  • insertion/removal in linear time 以线性时间插入/移除

The contents will likely be pointers to structures. 内容可能是指向结构的指针。 The integer field to sort is one of the members of that structure. 要排序的整数字段是该结构的成员之一。

This is for a C++ program, but I don't need code examples, an algorithm description is fine. 这是一个C ++程序,但我不需要代码示例,算法描述很好。 Algorithms which come close, but not perfect, are also appreciated. 接近但不完美的算法也值得赞赏。

Look at this: " Fast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems ". 看看这个:“ 多线程系统的快速和无锁并发优先级队列 ”。 Googling will give you more links for sure. 谷歌搜索将为您提供更多链接。

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

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