首页 > 试题广场 >

Consider the traffic deadlock

[问答题]
Consider the traffic deadlock depicted in Figure7.1
a.Show that the four necessary conditions for deadlock indeed hold in this example
b.State a simple rule for avoiding deadlocks in this system


推荐


a.the four necessary conditions for a deadlock are
(1)mutual exclusion;
(2)hold-and-wait;
(3)no preemption;
(4)circular wait.
The mutual exclusion condition holds as only car can occupy a space in the roadway.Hold-and-wait occurs where a car holds onto their place in the roadway. A car cannot be removed (i.e. preempted) from its position in the roadway. Lastly, there is indeed a circular wait as each car is waiting for a subsequent car to advance. The circular wait condition is also easily observed from the graphic.
b. A simple rule that would avoid this traffic deadlock is that a car may not advance into an intersection if it is clear they will not be able to immediately clear the intersection.

发表于 2018-03-18 22:20:22 回复(0)