Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lock-free bounded queue #83

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

polytypic
Copy link
Contributor

@polytypic polytypic commented Jul 14, 2023

This implements a lock-free bounded queue — blocking using domain-local-await.

The data structure / algorithm is based on the Michael-Scott queue extended with length maintenance and caching of remaining capacity in such a way that additional contention is avoided in the happy paths.

TODO:

  • fix opam files to build on CI
  • use backoff from separate package
    • fix dune-project
  • try_push, length (can be done in O(1)), is_empty
  • tests
  • ability to change capacity
  • benchmarking
  • consider whether making wakeups fair is worth it (currently all awaiters are woken up so there is no fairness)
  • documentation

src/cue.ml Outdated Show resolved Hide resolved
@polytypic polytypic force-pushed the lock-free-bounded-queue branch 4 times, most recently from d4b7e51 to e548e50 Compare November 3, 2023 13:31
@polytypic polytypic force-pushed the lock-free-bounded-queue branch 2 times, most recently from 0084799 to 2aae21c Compare November 20, 2023 17:59
@polytypic polytypic force-pushed the lock-free-bounded-queue branch 4 times, most recently from 261eabb to 928660b Compare January 11, 2024 14:40
@polytypic polytypic force-pushed the lock-free-bounded-queue branch 2 times, most recently from 12a77c7 to 46c2cae Compare January 14, 2024 12:28
@lyrm lyrm mentioned this pull request Jan 24, 2024
12 tasks
@Sudha247 Sudha247 added this to the 1.0 milestone Jan 29, 2024
@polytypic polytypic force-pushed the lock-free-bounded-queue branch 3 times, most recently from b47847c to 3749cbf Compare February 17, 2024 17:22
@polytypic
Copy link
Contributor Author

FYI, I will squash this PR to a single commit to make this PR a little bit easier to work with.

@polytypic polytypic force-pushed the lock-free-bounded-queue branch 2 times, most recently from 01f316b to 55485fd Compare September 29, 2024 08:57
@polytypic
Copy link
Contributor Author

FYI, I changed this to use Picos instead of DLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants