CS FundamentalsHardGATE CS
Five dining philosophers each pick up the left fork and then the right fork. Which change removes the possibility of deadlock without a central arbiter?
- A. Make every philosopher wait a random time before picking up the left fork
- B. Make every philosopher pick up the right fork first instead
- C. Make one philosopher pick up the right fork first while the others pick up the left first
- D. Let a philosopher put down the left fork after eating
Correct answer: C. Make one philosopher pick up the right fork first while the others pick up the left first
Making one philosopher asymmetric breaks the circular wait: the cycle of everyone holding one fork and waiting for the next can no longer form. Reversing everyone's order just mirrors the same cycle, and random delays only make deadlock less likely.
More Operating Systems questions
- A user creates file f, makes a hard link h to it and a symbolic link s to f. Then f is deleted and a NEW file named f is created with…
- In the standard five-state process model (new, ready, running, blocked, exit), which transition can NOT happen directly?
- A program uses user-level threads mapped many-to-one onto a single kernel thread. One thread calls a blocking read() on a slow device…
- A bounded-buffer producer is written as wait(mutex); wait(empty); add item; signal(mutex); signal(full); while the consumer is the usual…
- Which statement about Belady's anomaly is correct?
- A machine has 32 GB of physical memory, 4 KB frames and an inverted page table with 8-byte entries. How big is the table, and why is a…