RCU
also: Read-Copy-Update
Read-Copy-Update (RCU) is a Linux kernel synchronization mechanism that allows multiple readers to access shared data concurrently without locks, by deferring updates until all current readers finish.
RCU is an optimized locking technique in the Linux kernel designed to maximize read performance in multi-core systems. Readers require no locks or atomic operations—they simply mark their read-side critical section and proceed, making reads extremely fast.
When a writer needs to modify data, it creates a new copy of the data structure, updates it, and atomically switches pointers to the new version. The old version is only freed after the kernel determines that no readers are still referencing it—this waiting period is called a grace period.
RCU excels in scenarios with many readers and few writers, such as routing tables or network filters. For example, a packet lookup might read from the routing table thousands of times per second while updates happen rarely; RCU eliminates contention that would occur with traditional reader-writer locks.