Reader/Reader blocking in reader/writer locks

Reader/Reader blocking in reader/writer locks

This post describes a phenomenon that can occur in systems built on reader/writer locks, where slow readers and a small number of writers (e.g. even a single writer) can lead to substantial latency spikes for the entire system. This writer priority behavior, however, essentially creates the possibility for readers to block on other readers, something that a reader/writer lock is supposed to avoid. If readers ever hold locks for extended periods of time, such that T₄ is much later than T₁, this can lead to disastrous system pauses: a very small amount of write load may be sufficient to allow long-running readers to halt all other threads until they complete.

Source: blog.nelhage.com