Answer and Explanation:
Deadlock is possible because the four necessary conditions
hold in the following manner:
1) mutual exclusion is required for chopsticks,
2) the philosophers tend to hold onto the chopstick in hand while they wait for the other chopstick
3) there is no preemption of chopsticks in the sense that a chopstick allocated to a philosopher cannot be forcibly
taken away,
4) there is a possibility of circular wait.
Deadlocks could
be avoided by overcoming the conditions in the following manner:
1) allow simultaneous sharing of chopsticks
2) have the philosophers relinquish the first chopstick if they are unable to obtain the other chopstick
3) allow for chopsticks to be forcibly taken away if a philosopher has had a chopstick for a long period of time,
4) enforce a numbering of the chopsticks and always obtain the lower numbered chopstick before obtaining the higher numbered one.