Read-write-lock
A lock that permits many threads to read concurrently, but only one to write, with no readers allowed while a writer holds it.
Read-write locks generalize ordinary mutex locks. In many workloads, reads vastly outnumber writes — an RWLock lets thousands of readers run in parallel as long as no writer is waiting. A writer blocks all readers and vice versa. This dramatically increases throughput for read-heavy workloads compared to a regular mutex.
The tradeoff is complexity. RWLocks are more expensive than mutex on low contention, and can suffer from writer starvation if a constant stream of readers keeps arriving. They're popular in caching systems, databases, and in-memory indexes, but less useful for extreme high-frequency critical sections.