GithubHelp home page GithubHelp logo

alexxnica / deque Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kinghajj/deque

0.0 1.0 0.0 51 KB

A (mostly) lock-free concurrent work-stealing deque in Rust.

License: Other

Rust 100.00%

deque's Introduction

deque - A (mostly) lock-free concurrent work-stealing deque

Build Status

This module contains an implementation of the Chase-Lev work stealing deque described in "Dynamic Circular Work-Stealing Deque". The implementation is heavily based on the implementation using C11 atomics in "Correct and Efficient Work Stealing for Weak Memory Models".

The only potentially lock-synchronized portion of this deque is the occasional call to the memory allocator when growing the deque. Otherwise all operations are lock-free.

Example

use deque;

let (worker, stealer) = deque::new();

// Only the worker may push/pop
worker.push(1);
worker.pop();

// Stealers take data from the other end of the deque
worker.push(1);
stealer.steal();

// Stealers can be cloned to have many stealers stealing in parallel
worker.push(1);
let stealer2 = stealer.clone();
stealer2.steal();

History

The deque module was originally authored by Alex Crichton on 2013-11-26, commit a70f9d7324a91058d31c1301c4351932880d57e8 in the Rust git repo.

It was later removed by him as part of the sync module rewrite on 2014-11-24 in commit 71d4e77db8ad4b6d821da7e5d5300134ac95974e.

With the introduction of the crates.io package repository, I decided to bring back the module as its own crate. The code is based on the version in the Rust repo just prior to the aforementioned commit for the sync module rewrite. All changes so far are only ones required to get the code and tests to compile.

deque's People

Contributors

amanieu avatar csherratt avatar faern avatar kinghajj avatar mre avatar mtsr avatar remram44 avatar utkarshkukreti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.