Dining philosopher problem
Classic problem is usually discussed with 5 philosophers: But you should really consider N philosophers.
5 philosophers, 5 plates of noodles, 5 forks and circular dining table. Each one needs two forks. Examine how it satisfies the preconditions for deadlock!
- Mutual exclusion : shared fork.
- Hold and wait: One may hold the left fork and wait forever for the right fork.
- No preemption: One may not want to give up the fork he/she has.
- Circular wait: Of course, one waiting on the other around the table.