Every popular program is eventually asked to do several things at once. The standard answer is a lock: a reader grabs it, does its work, releases it â then a writer gets its turn. Locks are correct, but they force readers to queue even when no write is happening. On a modern server with hundreds of threads, that queue can be the bottleneck.
Read-Copy-Update (RCU) is a different bargain. Readers proceed with zero synchronization overhead â no lock, no atomic increment, nothing. A writer, instead of modifying the shared data in place, makes a copy, edits it privately, then atomically swaps the pointer so future readers see the new version. Old readers finish on the old version; when the last one is done, the old copy is reclaimed.
The result is astonishing: read paths that are as fast as unsynchronized code, with full correctness. RCU was patented by Paul McKenney in 1998 and merged into the Linux kernel in 2002. Today it protects thousands of data structures â routing tables, file-system dentries, network protocol lists â inside every Linux server on the planet.
Comments
Loading comments...