CS FundamentalsModerateGATE CS · Amazon/Microsoft SDE MCQ
Five philosophers each pick up their left fork and then their right fork. Which change removes the possibility of deadlock without adding a central arbiter?
- A. Make each philosopher release the left fork after eating
- B. Use a mutex around each fork
- C. Make one philosopher pick up the right fork first
- D. Make the forks counting semaphores initialised to 2
Correct answer: C. Make one philosopher pick up the right fork first
An asymmetric order breaks circular wait: the 'odd' philosopher competes for its right fork first, so all five cannot each hold one fork while waiting for the next. Mutexes per fork are what the deadlocking version already uses.
More Operating Systems questions
- Two processes use while (lock) ; lock = 1; / CS / lock = 0; with a plain shared variable (no atomic instruction). Which requirement of the…
- In Peterson's algorithm for P0 and P1, the entry code for Pi is flag[i] = true; turn = j; while (flag[j] && turn == j);. What goes wrong…
- A counting semaphore is implemented WITHOUT busy waiting, and its value is −3 at some moment. What does this tell you?
- Which statement about user-level threads in a many-to-one model is correct?
- A system has 4 instances of R1 and 2 of R2. Allocated: P1 holds 1 R1; P2 holds 2 R1 and 1 R2; P3 holds 1 R1 and 1 R2. Requests: P1 wants 1…
- Which statement about a process that calls exec() successfully is correct?