1. The major difference between deadlock, starvation and race?
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 trains approach each other at a crossing, both shall come to a full stop and neither shall start up again until the other has gone.
Example of Starvation:
When you barrowed a book and the owner want it back.
Example of Race:
A two car race for a price.
3. Four necessary condition needed for the deadlock from exercise #2:
if the terminal of the train is only one.if the two train needed the passengers.if there's other alternative terminal available.if the two train is not full.
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.