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) deadlock, starvation and race.

-Example of Deadlock: When the two person are both to buy a one product at the same time.
-Example of Starvation: When you borrowed a money and the owner want to get back her/his money.
-Example of Race: When the two mobile phone race for a price.

3. Select one example of deadlock from exercise 2 and list the four necessary conditions needed for the deadlock.

- if the product is only one,
- if the two person needed that one product urgently,
- if there's other alternative products available, and
- if the two person are brand concious and the product happen to be what they like.

4. Suppose the narrow staircase (used as an example in the beggining 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 figure, answer the following question.

A. Can deadlock occur? How can it happen and under what circumtances?
- 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 deslock 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.

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.

1 comment:

Kyn Le said...

Công Ty CP DV Đồ Cúng Tâm Linh, Chuyên cung cấp Do Cung Tron Goi cúng đầy tháng, cúng thôi nôi, Mam Cung Dong Tho, cúng khai trương, cúng thần tài trọn gói | ĐT: 0914 69 59 19
Công ty Thu Mua Phe Lieu Gia Cao Phú Quý - Chuyên thu mua phế liệu giá cao, phế liệu đồng, phế liệu sắt, phế liệu inox, phế liệu công trình, LH: 0946396616
Tổng hợp các tin tức về SEO - Dich Vu SEO Tai Tphcm | Khuong Bui SEO, Google luôn nhìn thấy bạn đang làm gì , đừng bao giờ tự tin rằng dùng các kỹ thuật để qua mặt Google