Introduction to Operating Systems: Unit II(b): Deadlock

Comparison Between Detection, Prevention and Methods of Handling Deadlock

Deadlock - Introduction to Operating Systems

This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources.

Comparison between Detection, Prevention and Avoidance Methods of Handling Deadlock

Example 3.8.1 Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show the system is deadlock-free.

Solution: Yes, this system is deadlock-free.

Maximum resources R1 = 4

Three processes: P1, P2, P3

• This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and, therefore it will return its resources when done.

• Need of P1 process is one resource, so it get from available. After getting one resources, process P1 releases both the resources which it hold.

• So available resource will become 2 and it allocate one by one to all remaining process. In this way, system fulfill all the needs of process. System will not enter into deadlock state.

Introduction to Operating Systems: Unit II(b): Deadlock : Tag: : Deadlock - Introduction to Operating Systems - Comparison Between Detection, Prevention and Methods of Handling Deadlock