Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ssbl/concurrent-deque
Lock-free concurrent work stealing deque in C++
https://github.com/ssbl/concurrent-deque
chase-lev concurrent-data-structure lock-free-queue work-stealing
Last synced: about 2 months ago
JSON representation
Lock-free concurrent work stealing deque in C++
- Host: GitHub
- URL: https://github.com/ssbl/concurrent-deque
- Owner: ssbl
- License: mit
- Created: 2017-11-27T00:57:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-19T22:45:14.000Z (almost 7 years ago)
- Last Synced: 2024-08-04T02:09:22.663Z (5 months ago)
- Topics: chase-lev, concurrent-data-structure, lock-free-queue, work-stealing
- Language: C++
- Homepage:
- Size: 84 KB
- Stars: 36
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeCppGameDev - concurrent-deque - free concurrent work stealing deque in C++ (C++)
README
A lock-free work-stealing deque
---This is a C++ implementation of the Chase-Lev deque, a concurrent
single-producer, multi-consumer queue presented in the paper "Dynamic
Circular Work-Stealing Deque". Additionally, this deque handles
reclamation of unused storage at the cost of some coordination between
the stealers and the worker.This implementation is heavily based on the improved version presented
in the paper "Correct and Efficient Work-Stealing for Weak Memory
Models". The Rust `crossbeam` crate also provided a ton of
inspiration.### Usage
With `deque.hpp` in your include path:
```c++
#include "deque.hpp"auto ws = deque::deque();
auto worker = std::move(ws.first);
auto stealer = std::move(ws.second);// The worker can push and pop from one end of the queue.
worker.push(1);
worker.pop();// Stealers can pop from the other end of the queue.
worker.push(1);
std::thread stealer_thread([&stealer]() {
// Each stealer thread creates a copy.
auto stealer_copy = stealer;
stealer_copy.steal();
});stealer.steal();
stealer_thread.join();
```