Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mutexes, Reader-Writer Locks, and Condition Variables

Status Draft outlineSection Concurrency

Locks protect invariants, not merely variables. Their behavior depends on contention, critical-section length, wake-up policy, and the code executed while held.

Planned model

Schedule readers and writers around mutexes, reader-writer locks, and condition variables. Show queues, ownership, spurious wake-ups, convoying, and wait time.

Questions

  • What exact invariant does the lock protect?
  • When can a reader-writer lock perform worse than a mutex?
  • Why must a condition predicate be checked in a loop?

Exercise

Design a bounded blocking queue and specify the predicates, lock boundaries, and notifications for every state transition.