ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018529627050_David Bukedi Diela >
Homework7_2018529627050 Version 0
👤 Author: by wx287_oz26ft1wt2_isbggtha4lgepaasa 2020-11-17 05:53:42
Consider a traffic deadlock as in the following picture:


a) Show that the four necessary conditions for deadlock indeed hold in this example.

The four conditions necessary for deadlock to be possible are:
mutual exclusion - only one car can occupy each intersection at a time
hold and wait - cars can hold an intersection while waiting in a line for access to the next intersection
no preemption - cars cannot be removed from their spot in the traffic flow, except by moving forward
circular wait - the set of cars in the deadlock situation includes the cars in the middle of the intersection

b) State a simple rule that will avoid deadlocks in this system.

Install traffic lights that only allow flow in one direction or the other at a time.
You can still envision a possible deadlock if a city block is completely full of cars turning left or right. I think you'd need to add a criteria to the problem requiring that cars will eventually leave the city block as well to prevent this.

Please login to reply. Login

Reversion History

Loading...
No reversions found.