首页 > 试题广场 >

Consider the deadlock situatio

[问答题]
Consider the deadlock situation that could occur in the dining-philosophers problem when the philosophers obtain the chopsticks one at a time. Didcuss how the four necessary conditions for deadlock indeed hold in this setting. Discuss how deadlocks could be avoided by eliminating any one of the four conditions.
推荐
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, and 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.
发表于 2018-03-18 22:21:05 回复(0)