Tuesday, January 15, 2008

assignment 4.

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.4.5. 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.
6. Based on figure 5.17 answer the following question.a. is this system deadlock?-this is an deadlock because P2 still requesting or waitng for R1 that has already been allocated.

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.