Deadlock prevention is an approach used by designers in dealing with the problem of deadlock. The basic philosophy of deadlock prevention is to delay at least one of the four necessary conditions for deadlocks.
1. Mutual exclusion:
The mutual condition must hold for nonsharable resources, such as a printer that can not be simultaneously shared by several processes. On the other hand, sharable resources do not require mutually exclusive access and thus can not be involved in a deadlock. for example, read-only files can not be accessed simultaneously by several processes.
To prevent mutual exclusion, avoid assigning a resource when that is not absolutely necessary, and try to make sure that a few processes may claim the resource as possible as.
2. Hold and wait:
The hold and wait condition can be eliminated by forcing a process to release all resources held by it whenever it requests a resource that is not available. There are two protocols to implement this strategy
- The process requests all needed resources before it begins execution. We can implement this provision by requiring that system calls requesting resources for a process procede all other system calls.
- Second protocols allow a process to request resources only when the process has none. A process requests resources and use them. Before it can request any additional resources, however, it must release all the resources that are currently allocated.
These protocols have two main advantage:
- Resource utilization may be slow, since many of the resources may be allocated but unused for a long period.
- starvation is poosible.
3. No preemption:
This condition can be prevented using following protocols. If a process holding certain resources is denied a further request, that process must release its original resources, if necessary, request them again together with the additional resource.
Alternatively, if a process requests a resource that is currently held by another process, the operating system may preempt the second process and require it to release its resources and allocate them to the requesting process.
This latter scheme prevents deadlock only if no two processes processed the same priority.
This protocol is practical only when applied to resources whose start can be saved and restored later, such as CPU registers and memory space.
3. Circular wait:
The circular wait condition can be prevented by defining a linear ordering of resource types. If a process has been allocated resources of type R, then it may be subsequently request only those resources of types following R in the ordering.
A disadvantage of this approach is that resources must be acquired in the prescribed order as apposed to being requested when actually needed. This may cause some resources to be acquired in advance of their use, Thus lowering the degree of concurrency by making unused resources unavaliable for allocation to other processes.
In the case of any queries, you can write to us at email@example.com we will get back to you ASAP.
Hope! you would have enjoyed this post about deadlock prevention methods.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!
- ICMP – Internet Control Message Protocol
- खजुराहो से छतरपुर, टीकमगढ़ होकर दिल्ली के लिए चलेगी ट्रेन, Train from Khajuraho to Delhi via Chhatarpur and Tikamgarh.
- What Is The Internet And Its Applications?
- Internet vs Extranet
- What is Intranet and extranet in a computer network 2020?
- ATM vs Frame Relay
- Telecommunication Network & Corporate Network
- What are the various Network Topologies?
- Online Fraud: Data Entry and Part-Time Job.
- Pepper and Jones Is a Scam or legit?