1. The major difference between deadlock, starvation and race is that in deadlock, the problem occurs when the jobs are processed. Starvation, however is the allocation of resource that prevents one job to be executed. Race occurs before the process has been started. 2. Example of Deadlock: When two person are about to buy one product at the time. Example of Starvation: When one person borrowed a pen from his classmate and his classmate get his pen back. Example of Race: When two guys have the same girlfriend. 3. Four necessary condition needed for the deadlock from exercise #2: @ if the product is only one. @ if the two person needed that one product urgently. @ if there's other alternative products available. @ if the two person are brand concious and the product happen to be what they like. |
a. Deadlock will not happen because there are two traffic lights that control the traffic. But when some motorist don't follow the traffic lights, deadlock can occur because there's only one bridge to drive through.
b. Deadlock can be detected when there will be a huge bumper to bumper to the traffic and there will be accident that will happen.
c. The solution to prevent deadlock is that, the traffic lights should be accurate and motorist should follow it. In order to have a nice driving through the bridge.