A: The parameter of the assignment may make deadlocks quite unlikely, resource changes are maybe too seldom. One of the
following may help:
- Try to reduce the eat/think time to a low value or zero (no Thread.sleep at all).
- Try to introduce an explicit sleep after a philosopher acquires one resource, but before he acquires the second.
- Set the number of philosophers to 2.