Tuesday, January 15, 2008

Assignment 4

1.What are 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.Give some "real life" examples(not related to a computer system environment) of deadlock,starvation,and race.
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 hisclassmate get his pen back.
Example of Race: When two guys have the same girlfriend.

3.Select one example of deadlock from exercise 2 and list the four necessary conditions 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. needed for the deadlock.

4.Suppose the narrow staircase (used as an example in the beginning of this chapter)has become a major source of aggravation.Design an algorithm for using it so that both deadlock and starvation are not possible.

5.Figure 5.16 shows a tunnel going through a mountain and two streets parallel to each other-one at each entrance/exit of the tunnel. Traffic lights are located at each end of the tunnel to control the crossflow of traffic through each intersection.Based on the the figure, answer the following question.

a.Can deadlock occur?How can it happen and under what circumstances?
-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.How can desdlock be detected?
-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.Give a solution to prevent deadlock but watch out for starvation.
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.

1 comment:

shin_gal16 said...

may i know what's the answer of question no.4??