Expand description
Read-Copy-Update (RCU) Synchronization
RCU provides extremely fast read-side access to shared data structures without locks. Readers proceed without synchronization overhead while writers create copies, update pointers atomically, and reclaim old versions after a grace period.
This implementation uses a simplified epoch-based reclamation scheme suitable for a microkernel with a small number of CPUs:
- Readers call
rcu_read_lock()/rcu_read_unlock()to mark critical sections (these compile to atomic counter increments, no actual locks). - Writers call
synchronize_rcu()to wait for all pre-existing readers to complete, orcall_rcu()to defer cleanup to a callback. - Grace period detection uses per-CPU counters: when all CPUs have passed
through a quiescent state (context switch or explicit
rcu_quiescent()), the grace period is complete.
Functions§
- call_
rcu - Register a deferred callback to be called after the next grace period.
- rcu_
is_ reading - Check whether the current CPU is inside an RCU read-side critical section.
- rcu_
quiescent - Report that the current CPU has passed through a quiescent state.
- rcu_
read_ lock - Enter an RCU read-side critical section.
- rcu_
read_ unlock - Exit an RCU read-side critical section.
- synchronize_
rcu - Wait for all pre-existing RCU read-side critical sections to complete.