#rcu #critical-section #counter #arc #thread-local #cleanup #once

no-std arcu

An Rcu implementation using an Arc to keep the read critical section short and handle cleanup

1 unstable release

0.1.2 Dec 31, 2024
0.1.1 Feb 19, 2024
0.1.0 Feb 18, 2024

#482 in Concurrency

Download history 36/week @ 2024-11-27 74/week @ 2024-12-04 107/week @ 2024-12-11 52/week @ 2024-12-18 102/week @ 2024-12-25 174/week @ 2025-01-01 78/week @ 2025-01-08 83/week @ 2025-01-15 69/week @ 2025-01-22 78/week @ 2025-01-29 55/week @ 2025-02-05 155/week @ 2025-02-12 217/week @ 2025-02-19 106/week @ 2025-02-26 44/week @ 2025-03-05 35/week @ 2025-03-12

413 downloads per month

MIT/Apache

29KB
361 lines

Arcu

An Arc based Rcu implementation originally implementated in mthom/scryer-prolog#1980

A r c u
A r c
R c u

The atomics based version performs lock-free[^1] reads. By using Arc we keep the read-critical-section short; free of user defined code; and automatically perform cleanup when no reference remains.

To coordinate reads and writes [EpochCounter]s from an [EpochCounterPool] are used. Each read uses an EpochCounter from the EpochCounterPool of the Arcu, incrementing it once before entering the RCS and once more on leaving the RCS. Each write checks against all EpochCounters in the pool, blocking until it is safe to decrement the strong count of the Arc that was replaced by the write.

[^1]: when using thread local epoch counter with the global epoch counter pool, the initial read may block while adding the threads epoch counter to the pool


lib.rs:

Arc based Rcu implementation originally implementated in mthom/scryer-prolog#1980

A r c
  R c u
A r c u

The atomics based version performs lock-free[^1] reads. By using Arc we keep the read-critical-section short and free of user defined code and automatically perform cleanup when no reference remains.

To coordinate reads and writes [EpochCounter]s from an [EpochCounterPool] are used. Each read used an EpochCounter from the EpochCounterPool of the Arcu incrementing it once before entering the RCS and once more on leaving the RCS. Each write checks against all EpochCounters in the pool, blocking until it is safe to decrement the strong count of the Arc that was replaced by the write.

[^1]: when using thread local epoch counter with the global epoch counter pool, the initial read may block while adding the threads epoch counter to the pool

No runtime deps

Features