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?
- A. Every reader must atomically update the shared reader count, causing cache-line contention that can cost more than the short critical section
- B. Readers cannot run concurrently under a reader-writer lock
- C. Writers always starve readers
- 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
- A seqlock lets readers proceed without blocking writers. A reader reads the sequence number, reads the data, then rereads the sequence…
- A condition-variable based bounded buffer uses a single condition variable cv for both 'not full' and 'not empty', and signals with…
- Which statement about deadlock in a system with only ONE resource type that has 10 instances is correct?
- What is the main drawback of deadlock prevention by requiring a process to request ALL its resources before starting (breaking…
- Deadlock recovery by process termination: which criteria are sensible for choosing a victim? 1. Lowest priority 2. Least CPU time consumed…
- An OS uses the Banker's algorithm. Which assumption must hold for it to be applicable?