$22
1.The dining philosopher problem consists of five philosophers that spend their entire life either thinking or eating. There are five states that a philosopher can be in. These are thinking, eating, hungry, famished, or starved. After a random time period of thinking, a philosopher will try to pick up two chopsticks (on the right and left of him). If he succeeds, he goes into the eating state. If he fails (because other philosophers have one (or both) of the chopsticks), he waits and then tries again. After a certain number of waits and unsuccessful tries (your choice of how many), he switches to the hungry state. If he waits and unsuccessfully tries a number of more times, he switches to the famished state. Finally, if he still cannot get a pair of chopsticks, he'll die and go to the starve state. After eating, a philosopher releases the two chopsticks and goes back to thinking. The philosophers are greedy; they will never release a chopstick that they pick up if they are waiting to eat.