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

AtomicArc via coalesced deferred RC, resolves #160 #564

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

Conversation

acsearle
Copy link

@acsearle acsearle commented Sep 9, 2020

Another draft of a (potentially) fast, (arguably) ergonomic AtomicReference-like type that leverages crossbeam's collector (and requires some minimal additional hooks into it.)

  • Atomic operations are protected by a crossbeam epoch guard
  • Pending increments and decrements are written to a thread-local ledger
  • Pending increments and decrements will often cancel within the ledger and never touch the atomic reference count
  • At the end of the guarded region, the increments are applied immediately and the decrements are deferred to the garbage collector
  • Loads and failed compare_exchanges produce non-owning 'borrowed' objects with lifetimes limited to the guard, that don't need to touch even the thread local ledger
  • Therefore, loads are pure atomic reads, and 'as fast as possible'?
  • Compare exchange loops only generate a hit to the atomic reference count when successful, and even that is deferred

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

Successfully merging this pull request may close these issues.

2 participants