• Home
  • Lakehead University
  • Principles of Operating Systems
  • Process Scheduling and Deadlock in Traffic Systems

Process Scheduling and Deadlock in Traffic Systems

Lakehead UNIVERSITY Teaching Commons Assignment 3 Process Scheduling and Deadlock Group 5 Nolan Engstrom Parker Jackson COMP3473-Operating Systems Department of Computer Science Fall 2023 Question 1: Traffic Deadlock ... IDADEDO ... D ID . . a) The four necessary conditions for deadlock, and how they apply in this situation are: - Mutual exclusion: only one process at a time can use a resource - In the traffic deadlock example, there is mutual exclusion as only one vehicle is able to move along its given intersection at a time, or else there will be crashes. Considering that there is no traffic control system (stop signs, traffic lights, etc.), there is no way to control said traffic from not having to go one at a time, thus causing a case of mutual exclusion. - Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. - In the traffic deadlock, each process is holding a point along the road, and they are waiting for the path ahead of them to clear due to other vehicles holding those spots. In other words, the car processes are waiting for additional road resources held by other cars to move along in their process (movement along the road). - No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task - In the case of the traffic deadlock, the cars are only able to voluntarily release their road space (resource) only after they have completed the task of moving along the road. In other words, cars cannot be removed from their spot in the traffic flow, except by moving forward. - Circular wait: there exists a set {P0, P1, ..., Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, ... , Pn-1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0. - The traffic deadlock itself is circular in nature - the cars in the top left intersection wait for the cars in the bottom left, bottom left waits for bottom right, bottom right for top right, and top right for the top left intersection. In other words, the original vehicle in the circular intersection holds the resource for the final car in our counterclockwise circle. - Answers word count (not including deadlock condition descriptions): 67 + 58 + 49 + 63 = 237 words. b) A simple rule for avoiding deadlocks in the traffic system was briefly stated above, which involves creating a traffic flow control system. Installing traffic lights can ensure that the traffic only flows in one direction or the other at a time, and will avoid deadlock all together. In our opinion, a full traffic light system will be more efficient than just stop signs, as a traffic light system will