CS FundamentalsVery hardGATE CS

A reader-writer lock is used where reads are 99% of operations and each read is very short. Why might it perform WORSE than a plain mutex on a many-core machine?

  1. A. Every reader must atomically update the shared reader count, causing cache-line contention that can cost more than the short critical section
  2. B. Readers cannot run concurrently under a reader-writer lock
  3. C. Writers always starve readers
  4. D. Reader-writer locks are slower only on one core

Correct answer: A. Every reader must atomically update the shared reader count, causing cache-line contention that can cost more than the short critical section

Concurrency among readers is offset by the cache-line bouncing of the lock word itself. Per-CPU counters, sequence locks or RCU avoid this for very short reads.

More Operating Systems questions

Exams that ask this topic