Deadlock
A set of process is said to be in a deadlock when every process in the set waits for an event that can only be caused by another process in the set.
OR
Two or more process are said to be in a deadlock if they wait for the happening of an event , which would never happen.
P1 required R1 and R2 to execute
P2 required R1 and R2 to execute
Necessary condition for Deadlock:-
1) Mutual Exclusion :- Only one process at a time can use a resource.
2) Hold and Wait :- A process is holding at least one resource and waiting for another resource.
3) No-Prremption :- A resource can be released voluntarily by process itself.
4) Circular wait :- The deadlock is a circular condition.
Deadlock Handling Strategies:-
*)Deadlock Prevention:- It ensures that the four condition for resource deadlock do not occur simultaneously.[Deadlock Impossible]
*)Deadlock Avoidance:- It analyzes the allocation state to determine whether granting a request (resource) might lead to deadlock later.[BANKER'S RaG]
*)Deadlock Detection and Resource:- It analyzes the resource state to check whether a deadlock exists.If so , abort some processes and allocates the resources to other processes.
*)Deadlock Prevention:- Try to dissatisfy one/more of the following necessary condition.
1) Mutual Exclusion:- Make some of the resource sharable[file f-P1and P2]
2) Hold and Wait:- When a process require a resource, it does not hold any other resource.
3) Non-Preemption:- One running process is abort give another process.
4)Circular Wait:- Once a process has some resource allocated to it , it can allocate a new resource only if no of all its allocated resource is less than no. assigned to the requested resource.
Deadlock Avoidance:Resource allocation graph
-Algorithm examines the resource allocation stste to ensure that there can never be a circular-wait condition.
Safe State:-System is in safe state if there exists a safe sequence of all process.
P0
P1
.
.
.
.
Pn
Resource Allocation Graph Algorithm:-
i)Draw a claim edge Pi-->Pj means process Pi may request resource Rj denoted/represented by dashed (--------)line.
ii)Converts claim edge to request edge if the process request a resource.
iii)Converts assign edge to claim edge when process released the resource
--->Suppose process "Pi" request resource"Rj" this request can be granted if converting the request edge Pi---->Rj to an allocation edge Rj--->Pi does't result in information of cycle in RAG.
OR
Two or more process are said to be in a deadlock if they wait for the happening of an event , which would never happen.
P1 required R1 and R2 to execute
P2 required R1 and R2 to execute
Necessary condition for Deadlock:-
1) Mutual Exclusion :- Only one process at a time can use a resource.
2) Hold and Wait :- A process is holding at least one resource and waiting for another resource.
3) No-Prremption :- A resource can be released voluntarily by process itself.
4) Circular wait :- The deadlock is a circular condition.
Deadlock Handling Strategies:-
*)Deadlock Prevention:- It ensures that the four condition for resource deadlock do not occur simultaneously.[Deadlock Impossible]
*)Deadlock Avoidance:- It analyzes the allocation state to determine whether granting a request (resource) might lead to deadlock later.[BANKER'S RaG]
*)Deadlock Detection and Resource:- It analyzes the resource state to check whether a deadlock exists.If so , abort some processes and allocates the resources to other processes.
*)Deadlock Prevention:- Try to dissatisfy one/more of the following necessary condition.
1) Mutual Exclusion:- Make some of the resource sharable[file f-P1and P2]
2) Hold and Wait:- When a process require a resource, it does not hold any other resource.
3) Non-Preemption:- One running process is abort give another process.
4)Circular Wait:- Once a process has some resource allocated to it , it can allocate a new resource only if no of all its allocated resource is less than no. assigned to the requested resource.
Deadlock Avoidance:Resource allocation graph
-Algorithm examines the resource allocation stste to ensure that there can never be a circular-wait condition.
Safe State:-System is in safe state if there exists a safe sequence of all process.
P0
P1
.
.
.
.
Pn
Resource Allocation Graph Algorithm:-
i)Draw a claim edge Pi-->Pj means process Pi may request resource Rj denoted/represented by dashed (--------)line.
ii)Converts claim edge to request edge if the process request a resource.
iii)Converts assign edge to claim edge when process released the resource
--->Suppose process "Pi" request resource"Rj" this request can be granted if converting the request edge Pi---->Rj to an allocation edge Rj--->Pi does't result in information of cycle in RAG.
No comments