Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of these conditions- deadlock, race, and starvation give at least two \

ID: 3826914 • Letter: F

Question

For each of these conditions- deadlock, race, and starvation give at least two "real life" examples (not related to a computer system environment of each of these concept. Then give your own opinion on how each of the six conditions can be resolved. Regarding the role played by the "victim "in deadlock resolution, explain your answers to these questions. a. How is the victim chosen? b. What is the fate of the victim? c. Describe the actions required, if any, to complete the victim's tasks. The figure below shows a tunnel going through a mountain and two streets parallel to each other one at each end of the tunnel. Traffic lights are located at each end of the tunnel to control the cross flow of traffic through each intersection. Based on this figure, answer the for questions: a. How can deadlock occur and under what circumstances? b. How can deadlock be detected? c. Give a solution to prevent deadlock and starvation.

Explanation / Answer

1. Lets consider we have a small door entrance. four people are coming side by side. But the door can accomade to 3 people only. In this case deadlock condition will occur. Because no one can cross the entrance.

2. Lets consider a bridge with only one way traffic but the cars from the both sides(resources) entered into the bridge. Then now deadlock condition occured.

In this both cases we can prevent the deadlock condition by the

Hold and wait condtion :- In the first case we can make one person to hold before the entrance so that the other three will enter into the room and then the fourth one can enter.

Resource Preamption:- By backing up any one car can release the deadlock situation.

1) Lets consider we have 2 switch's for the same fan in the room. If two people are suddenly switched on from both ends. this causes race condition. Because if the switch is on from one side automatically if we on the switch in other side the fan will stop wither circuit problems will rise.

2) Suppose if two users tried to connect the same network from mobiles at the same time. Then the race condition will occur.

we can prevent the race condition by

1. Serialisation :- In particular serial order if we switched on from one side then the fan will rotate. If we switched on in another side now then the fan be stop rotating.

2. In this case priority scheme can eliminate race condition. The one with higher priority first executes and then the second one will execute.

1. When deadlock occurs when the process waits for long time . it will go into the indefinite state. This is called starvation.

2. Dining philosophers problems is also one example for starvation as well as deadlock also.

By using scheduling policies we can avoid the starvation. Scheduling policies like FCFS, Priority based, and victim selection.