Presentation is loading. Please wait.

Presentation is loading. Please wait.

A. Berrached::cms::uhd

Similar presentations


Presentation on theme: "A. Berrached::cms::uhd"— Presentation transcript:

1 A. Berrached::cms::uhd
Deadlock Chapter 10 10/2/2019 A. Berrached::cms::uhd

2 A. Berrached::cms::uhd
Deadlock System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection & Recovery 10/2/2019 A. Berrached::cms::uhd

3 A. Berrached::cms::uhd
The Deadlock Problem A state where a set of processes are blocked each holding a resource and waiting to acquire a resource held by another process in the set. Example: Semaphores A and B initialized to 1 P0: P1: wait(A); wait(B); wait(B); wait(A); …. ….. 10/2/2019 A. Berrached::cms::uhd

4 A. Berrached::cms::uhd
Process 1 Process 2 Process 3 …. …. …... Request (resource1); Request (resource2); Request (resource3); /*holding res 1 */ /*holding res 2 */ /*holding res 3 */ ….. ….. ….. Request(resource2) Request(resource3); Request(resource1); …. ….. ….. 10/2/2019 A. Berrached::cms::uhd

5 A. Berrached::cms::uhd
System Model 10/2/2019 A. Berrached::cms::uhd

6 Deadlock Characterization
10/2/2019 A. Berrached::cms::uhd

7 Resource Allocation Graph
10/2/2019 A. Berrached::cms::uhd

8 Resource Allocation Graph (cont.)
10/2/2019 A. Berrached::cms::uhd

9 Example of a graph with no cycles
10/2/2019 A. Berrached::cms::uhd

10 Example of a graph with a cycle
10/2/2019 A. Berrached::cms::uhd

11 A. Berrached::cms::uhd
Basic Facts 10/2/2019 A. Berrached::cms::uhd

12 Methods for handling deadlocks
10/2/2019 A. Berrached::cms::uhd

13 A. Berrached::cms::uhd
Deadlock Prevention 10/2/2019 A. Berrached::cms::uhd

14 Deadlock Prevention (cont.)
10/2/2019 A. Berrached::cms::uhd

15 A. Berrached::cms::uhd
Deadlock Avoidance 10/2/2019 A. Berrached::cms::uhd

16 A. Berrached::cms::uhd
Safe State 10/2/2019 A. Berrached::cms::uhd

17 A. Berrached::cms::uhd
Basic Facts 10/2/2019 A. Berrached::cms::uhd

18 A. Berrached::cms::uhd
Banker's Algorithm 10/2/2019 A. Berrached::cms::uhd

19 Data Structures for the Banker's Algorithm
10/2/2019 A. Berrached::cms::uhd

20 A. Berrached::cms::uhd
Safety Algorithm Else if no i can be found where Finish[i]=flase and Needi <= Work , then the system is in an unsafe state 10/2/2019 A. Berrached::cms::uhd

21 Resource Request Algorithm for Process Pi
10/2/2019 A. Berrached::cms::uhd

22 Example of Banker's Algorithm
10/2/2019 A. Berrached::cms::uhd

23 A. Berrached::cms::uhd
Example (cont.) 10/2/2019 A. Berrached::cms::uhd

24 Example (cont.): P1 requests (1,0,2)
10/2/2019 A. Berrached::cms::uhd

25 A. Berrached::cms::uhd
Deadlock Detection Allow system to enter deadlock state Detection Algorithm Recovery scheme 10/2/2019 A. Berrached::cms::uhd

26 Single Instance of Each Resource Type
Maintain a resource allocation graph Periodically invoke algorithm that searches for cycles in the graph If there is a cycle ==> set of processes in cycle are in deadlock 10/2/2019 A. Berrached::cms::uhd

27 A. Berrached::cms::uhd
Deadlock Detection 10/2/2019 A. Berrached::cms::uhd

28 RAG Reduction Algorithm
Given the resource allocation graph of the system at the current state. Determine if the system is in deadlock. 1. if a process is not blocked (i.e. if all resources the process is requesting to finish its task are available), then reduce graph by that process: remove the process node from the graph, return all its allocated resources, and remove all arrows from and to that process. 10/2/2019 A. Berrached::cms::uhd

29 Deadlock Detection--RAG Reduction
10/2/2019 A. Berrached::cms::uhd

30 Deadlock Detection--RAG Reduction
2. Repeat step 1 until all process node are removed or the graph can not be reduced any further. If a graph can be reduce by all its processes, then there is no deadlock If a graph can NOT be completely reduced by all its processes then the "irreducible" processes constitute the set of deadlocked processes. 10/2/2019 A. Berrached::cms::uhd

31 A. Berrached::cms::uhd
10/2/2019 A. Berrached::cms::uhd

32 Deadlock Detection-- Usage
10/2/2019 A. Berrached::cms::uhd

33 Recovery From Deadlock
10/2/2019 A. Berrached::cms::uhd

34 Recovery From Deadlock
10/2/2019 A. Berrached::cms::uhd


Download ppt "A. Berrached::cms::uhd"

Similar presentations


Ads by Google