CS FundamentalsVery hardGATE CS (PYQ pattern)
Three philosophers sit at a table with three forks; philosopher i always picks up fork i (left) first and then fork (i+1) mod 3 (right), eats, and puts both down. Model each philosopher as thinking, holding only the left fork, or eating (holding both). How many global states are reachable from the all-thinking state, and how many of them are deadlocks (no philosopher can move)?
- A. 14 states, 2 deadlocks
- B. 17 states, 1 deadlock
- C. 14 states, 1 deadlock
- D. 11 states, 0 deadlocks
Correct answer: C. 14 states, 1 deadlock
Breadth-first exploration of the transition system gives 14 reachable states; the only stuck state is the one where every philosopher holds exactly the left fork.
More Operating Systems questions
- A data TLB has 64 entries organised as 16 sets of 4 ways (set index = virtual page number mod 16, LRU within a set). A loop touches…
- The enhanced clock algorithm uses (R, M) bits with 3 frames (initially empty, newly loaded pages get R = 1 and M = 1 if loaded by a…
- Page-fault-frequency control with threshold T = 3: on a fault at time t, if more than 3 time units passed since the previous fault, all…
- A disk head is at cylinder 50 at t = 0, moving towards higher cylinders, and needs 1 time unit per cylinder (service itself is…
- Round Robin with quantum 3 ms, three processes arriving at t = 0 with bursts (CPU, I/O, CPU) in ms: P0 (5, 4, 4), P1 (3, 6, 3), P2 (6, 2…
- Process P0 has 4 pages, each in its own frame. Copy-on-write fork is used (a frame is copied only when written while shared; a written…