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?

  1. A. Never; readers are always consistent
  2. B. If the sequence was odd at the start (a write in progress) or changed between the two reads
  3. C. Only if the data equals zero
  4. 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

Exams that ask this topic