Introduction - If you have any usage issues, please Google them yourself
The philosopher's eating problem - the Java language implementation
The philosopher's eating problem is a classic example of multi-threading, involving thread synchronization/mutual exclusion, critical area access problems, and a solution to avoid deadlocks.
There were five philosophers who sat around the round table, and each philosopher had a dish in front of him, and there was a chopstick between them, so that each philosopher had a pair of chopsticks.
Philosophers have two states, think or pick up chopsticks to eat. If philosophers get a chopstick, they can't eat, until they get two to eat, and can only pick up one of their chopsticks at a time. Once you have picked up, you will not put down your chopsticks until you have finished eating.
If, unfortunately, every philosopher picks up his or her left chopsticks, no one can eat. This will cause a deadlock. This is something that needs to be firmly eliminated, just as the operating system's deadlock problem.
Packet : 11912890philosopher(1.6).rar filelist
philosopher\.project
philosopher\.classpath
philosopher\DiningPhils.java
philosopher\Philosopher.class
philosopher\DiningPhils.class
philosopher