Questions: Readers-Writers Problem and Lock Patterns

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A database uses reader-preference locks. Traffic is 95% reads and 5% writes. Which problem is most likely to occur?

ADeadlock between multiple readers waiting for each other
BWriter starvation — writers may wait indefinitely while readers continuously arrive
CReader starvation — writers will lock out readers for long periods
DRace conditions — concurrent readers can corrupt the shared data
Question 2 Multiple Choice

What is the minimum information a fair readers-writers solution must track that a simple reader-preference solution does not?

AThe number of active readers
BWhether any writer is currently active
CThe arrival order or waiting queues for both readers and writers
DThe total number of reads and writes that have occurred
Question 3 True / False

In a reader-preference solution, allowing multiple readers to access data simultaneously is safe because reads do not modify shared state.

TTrue
FFalse
Question 4 True / False

Writer-preference solutions prevent writer starvation and should therefore be preferred over reader-preference solutions in most real-world systems.

TTrue
FFalse
Question 5 Short Answer

Why does a fair readers-writers solution batch waiting readers together rather than serving them one at a time in strict FIFO order?

Think about your answer, then reveal below.