Consider v the dining -philosophers problem where the chopsticks are placed at the center of the table and any two of them could be used by a philosopher. Assume that requests for chopsticks are made one at a time. Describe a simple rule for determining whether a particular request could be satisfied without causing deadlock given the current allocation of chopsticks to philosophers.
If we ensure that at least one of these conditions cannot hold,we can prevent the occurrence of a deadlock.
For this problem,we can pay attention to some conditions.When a philosopher asks for a chopstick,we should
check whether the number of remaining chopsticks is more than two.Besides,we should also check how many
philosophers are in the state that holding one chopsticks.If the number of these philosophers are more than
the number of remaining chopsticks ,we should not satisfy the requset of the latest philosopher.