50 likes | 422 Views
Recovery from deadlock 1) Process Terminaton. Abort all deadlock process Expensive -> Some computations done by the killed process might be required by some other running process. Abort one at a time Overhead -> Deadlock detection algorithm is required.
E N D
Recovery from deadlock1) Process Terminaton • Abort all deadlock process Expensive -> Some computations done by the killed process might be required by some other running process. • Abort one at a time Overhead -> Deadlock detection algorithm is required. In which order should we choose to abort ? -> Priority of the process -> Better to stop a process at a initial stage
Deadlock Avoidance • Requires that the system has some prior initial information. • At the time of allocation, system should check if it is safe to allocate resources. If safe, only then allocate the resources. • The check must also be performed at intermediate stages to check if the allocation leaves the system in safe state. • System is safe if there exists a sequence <P1,P2,...Pn> of All the processes in the system such that for each Pi, the resources that Pi can require be satisfied bu currently available resources + resources held by all Pj with j < i
Safe Sequence <P1,...Pi,Pj.....Pn> • In the safe sequence, if Pi resource needs are not immediately available, then Pi can wait until all Pj have finished. • When Pj finished, Pi can obtain needed resources, execute and return allocated resources and terminate. • This sequence can go on and all the processes in the line can be safely executed.
Example • Safe sequence <P1, P0, P2> Safe state