Deadlock

Preview:

DESCRIPTION

computer networks

Citation preview

Deadlock Detection

With one resource of each type• Construct a resource graph– If this graph contains one or more cycles, deadlock

exists– If no cycles exist, system is not deadlocked.

Operating Systems: Deadlock 7

Resource Allocation Modelling using Graphs

Nodes : resource process

Arcs : resource requested :

resource allocated :

Operating Systems: Deadlock 8

• Methods of Detection - single resources– search for loops in resource allocation graph

Operating Systems: Deadlock 9

• Depth-first Graph search– use a list of nodes L and progressively mark arcs

1. For each node N in the graph, perform steps 2-6 with N as starting node

2. Initialise L to empty and designate all arcs as unmarked3. Add current node to L

• check if node appears twice in L• if so, graph contains a cycle - algorithm terminates

4. From given node, if there are any unmarked outgoing arcs, goto 5else goto 6

5. Pick an unmarked outgoing arc and mark it• follow it to new current node and goto 3

6. Have reached a dead end• go back to previous node and goto 4• if this node is the initial node, graph does not contain cycles and

algorithm terminates

Recovery

Recommended