#data-structures #atomic #hazard-pointers #shared-ptr #thread-local-storage

lockfree

This crate provides concurrent data structures and a solution to the ABA problem as an alternative of hazard pointers

11 releases (4 breaking)

Uses old Rust 2015

0.5.1 Nov 18, 2018
0.5.0 Nov 17, 2018
0.4.1 Nov 11, 2018
0.3.2 Nov 4, 2018
0.1.1 Jun 15, 2018

#460 in Concurrency

Download history 3126/week @ 2024-03-14 4153/week @ 2024-03-21 4159/week @ 2024-03-28 3968/week @ 2024-04-04 4394/week @ 2024-04-11 4441/week @ 2024-04-18 3637/week @ 2024-04-25 3726/week @ 2024-05-02 3232/week @ 2024-05-09 3667/week @ 2024-05-16 3592/week @ 2024-05-23 4216/week @ 2024-05-30 4051/week @ 2024-06-06 4001/week @ 2024-06-13 4196/week @ 2024-06-20 3167/week @ 2024-06-27

16,252 downloads per month
Used in 116 crates (16 directly)

MIT license

260KB
5.5K SLoC

lockfree

Lockfree data structures for Rust.

We currently have:

  • Per-Object Thread-Local Storage
  • Map
  • Set
  • Queue
  • Stack
  • SPSC, MPSC, SPMC and MPMC channels

Documentation for the Lastest Commit

https://bzim.gitlab.io/lockfree/lockfree/

Changelog

See CHANGELOG.md

Contributing

See CONTRIBUTING.md

Benchmarks

See BENCHMARKS.md

C11 Incinerator Implementation

https://gitlab.com/bzim/c11-incinerator/


lib.rs:

A crate providing lock-free data structures and a solution for the "ABA problem" related to pointers.

The incinerator is the API which tries to solve the "ABA problem" when related to pointer dropping. With incinerator, every thread has a local garbage list. Dropping a shared object consist of first removing the pointer from the shared context, then adding the pointer to the garbage list. A "pause counter" is checked. If the counter is zero, then the whole list is deleted, otherwise, the list will only be deleted later.

This counter is counting how many times the incinerator was asked to "pause". A thread may pause the incinerator to load and use the shared pointer, and this is why it is important to remove the pointer from the shared context before deleting. Previous version of lockfree used a global incinerator. Currently, a per-object incinerator is used.

This crate is under development, and there are plans for some structures. We have:

Performance Guide

In order to achieve a better time performance with lockfree, it is recommended to avoid global locking stuff like heap allocation.

Dependencies