4. If a deadlock occurs at a combination of downtown intersections, as shown in
ID: 644822 • Letter: 4
Question
4. If a deadlock occurs at a combination of downtown intersections, as shown in the figure below, explain in detail how you would identify that a deadlock has occurred, how you would resolve it after it happens, and how you would act to prevent it from happening again. A classic case of traffic deadlock on four one-way streets. This is gridlock, where no vehicles can move forward to clear the traffic jam. 5. Regarding the role played by the victim in deadlock resolution, explain your answers to these questions. a. How is the victim chosen? h. What is the fate of the victim? c. Describe the actions required, if any, to complete the victim?s tasks.Explanation / Answer
Classic case of four one-way traffic deadlock
Detection
To detect the deadlock situation let us consider each road as resources R1, R2, R3 and R4. Here we can see that each car waiting to enter the four way junction is actually waiting for each of these resources. Let us consider each of the cars as P1, P2, P3 and P4. Here, P1 is waiting for R2 which is currently occupied by P2 which in turn is waiting for R3. R3 is occupied by P3 which is waiting for R4 which is again occupied by P4 awaiting R1 to get free.
Recovery
To recover from this deadlock a victim has to be identified i.e.at least one process or car has to removed from the deadlock. This car has to restart from the beginning or from a midpoint.
There are several methods in this recovery process.
One is to terminate or remove all the cars involved in the deadlock and ask them to restart from the beginning.
Another process can be to terminate or remove one car at a time and check if the deadlock is resolved.
Prevention
Prevention of deadlock can be done by following several methods. First and foremost is to limiting the number of processes or cars in this case in the system. Also the number of processes and resources should be optimised so that the resources are well utilised. All this can prevent the deadlock from happening again.
5. a) The victim in this four way deadlock system can be randomly chosen one at a time from all the cars in the system and check each time to see if the deadlock has been resolved.
b) The fate of the victim is pretty harsh. The victim has to either restart from the beginning or from a convenient midpoint.
c) The victim has to either restart the whole process from the beginning or from a convenient midpoint and go through the entire process again.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.