Deadlock avoidance allows the three necessary conditions mutual exclusion , hold and wait , no preemption , but makes the judicious choice to assure that deadlock point is never reached. it means that avoidance allows more concurrency than prevention.
The basic idea for deadlock avoidance is to grant only those requests for available resources that can not possibly result in a state of deadlock. This strategy is implemented by having the resource allocator examine the effects of granting a particular request.
If granting of resources can not lead to deadlock, the resource is granted to the requestor. otherwise, the requesting process is suspended until such time when its pending request can be safely granted.
In order to evaluate the safelty of the individual states , deadlock avoidance requires all process to state their maximum number of resources of each type requirements prior to execution.
A deadlock avoidance algorithm dynamically examines the resource-allocation state to ensure that a circular wait condition can never exist. The resource allocation state is defined by the number of available and allocated resources, and the maximum demands of the process.
Safe and unsafe state: A state is safe if the system can allocate resources to each process in some order and avoid a deadlock. In other words, a system is in a safe state only if there exists a safe sequence.
A sequence of processes < p1, p2,….pn > is a safe sequence for the current allocation state if , for each pi , the resources that pi can request can be satisfied by the currently available resources plus the resources held by all the pj, where j<i. If no such sequence exist , then the system state is said to be unsafe.
A safe state is not a deadlock state. Conversely a deadlock state is an unsafe state. However, all unsafe states are no deadlocks.
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 avoidance.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!