Tuesday, January 15, 2008

Assignment # 4

1. The major difference between deadlock, starvation and race is huge. In deadlock, problem occurs when the process has started, or simply means it occurs inside the processing of one job and one job is prevented from execution because of unavailable resource. Starvation is the allocation of resources and prevents one job to executed. Race occurs when the job is executed yet or before the process has begun.

2. Example of Deadlock: when two students recitates in the class.

Example of Starvation: when the two student are paying tuition at the same time and in a first come first serve basis.

Example of Race: when two girls have the same boyfriend.

3. Four necessary condition needed for the deadlock from exercise #2:
  • if the two student have the same answer.
  • if there were only one should recitates.
  • if the two are the only one who wants to recitate.
  • if the two student are sharing answers to others.

4.

5.

a. Deadlock can't occur to this scenario because, there were traffic lights to control the traffic build up. But in case there are motorist that will not follow the rules, deadlock can occur.

b. Deadlock can be detected when there are traffic build up and there will be accident that will happen.

c. The solution to prevent deadlock is that, motorist should follow the rules in traffic and they should have the presence of mind and patience in driving through the bridge.

6.

No comments: