CS FundamentalsEasyGATE CS (PYQ pattern)
A ticket lock has next_ticket = 10 and now_serving = 10 (free). Events in order: T1 acquires, T2 acquires, T3 acquires, T1 releases, T4 acquires, T2 releases, T5 acquires, T3 releases. (acquire = take ticket next_ticket++, then spin until now_serving equals it; release = now_serving++.) Afterwards, what are next_ticket and now_serving, and who holds the lock?
- A. next_ticket 15, now_serving 13, held by T5
- B. next_ticket 14, now_serving 13, held by T4
- C. next_ticket 15, now_serving 13, held by T4
- D. next_ticket 15, now_serving 12, held by T3
Correct answer: C. next_ticket 15, now_serving 13, held by T4
Tickets: T1 10, T2 11, T3 12, T4 13, T5 14, so next_ticket = 15. Three releases move now_serving from 10 to 13, which is T4's ticket. T5 (14) keeps spinning; FIFO order follows ticket order, not arrival at the spin loop.
More Operating Systems questions
- Which of the following statements about read-copy-update (RCU) are correct? I. Readers traverse the data structure without taking locks…
- Which of the following statements about fork() with copy-on-write are correct? I. Right after fork, parent and child map the same physical…
- Under first-fit, the fifty-percent rule says that with N allocated blocks there are about N/2 holes. In a measured system the average hole…
- A machine has 48-bit virtual addresses, 16 KB pages and 8-byte page-table entries. Every page-table node must fit in one page, lower…
- Two processes bounce a 1-byte message through a pair of pipes: 100,000 round trips take 1.2 s, and each round trip contains two context…
- MFU replacement with 3 frames (initially empty): the victim is the resident page with the LARGEST reference count since it was loaded…