🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Semaphores and Classic Problems: all 9 questions

Quiz: Semaphores and Classic Problems · Question 7 of 9

Which change makes the dining philosophers deadlock-free?

Which change makes the dining philosophers deadlock-free?

  1. A.Giving each philosopher a longer thinking time
  2. B.Letting even-numbered philosophers pick up the right fork first
  3. C.Adding a mutex around eating only
  4. D.Making every philosopher pick up the left fork first
Answer & explanation

Correct answer: Letting even-numbered philosophers pick up the right fork first

The asymmetric order breaks the circular wait.

Can you get the rest right without peeking?

Take the timed Quiz: Semaphores and Classic Problems quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →