CS FundamentalsVery hardGATE CS
A seqlock lets readers proceed without blocking writers. A reader reads the sequence number, reads the data, then rereads the sequence number. When must the reader retry?
- A. Never; readers are always consistent
- B. If the sequence was odd at the start (a write in progress) or changed between the two reads
- C. Only if the data equals zero
- D. If the sequence number is even
Correct answer: B. If the sequence was odd at the start (a write in progress) or changed between the two reads
Writers increment the counter before and after updating, making it odd during a write. An odd or changed value means the reader may have seen a torn update and must retry.
More Operating Systems questions
- 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?
- Processes (arrival, burst): P1 (0, 6), P2 (1, 8), P3 (2, 7), P4 (3, 3). Under SRTF, what is the turnaround time of P2?