ch7 - Chapter 7: Deadlocks Silberschatz, Galvin and Gagne...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Silberschatz, Galvin and Gagne ©2009 Chapter 7: Deadlocks
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.2 Silberschatz, Galvin and Gagne ©2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock
Background image of page 2
1.3 Silberschatz, Galvin and Gagne ©2009 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number of different methods for preventing or avoiding deadlocks in a computer system
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.4 Silberschatz, Galvin and Gagne ©2009 The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set Example System has 2 disk drives P 1 and P 2 each hold one disk drive and each needs another one Example semaphores A and B , initialized to 1 P 0 P 1 wait (A); wait(B) wait (B); wait(A)
Background image of page 4
1.5 Silberschatz, Galvin and Gagne ©2009 Bridge Crossing Example Traffic only in one direction Each section of a bridge can be viewed as a resource If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback) Several cars may have to be backed up if a deadlock occurs Starvation is possible Note – Most OSes do not prevent or deal with deadlocks
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.6 Silberschatz, Galvin and Gagne ©2009 System Model Resource types R 1 , R 2 , . . ., R m CPU cycles, memory space, I/O devices Each resource type R i has W i instances. Each process utilizes a resource as follows: request use release
Background image of page 6
1.7 Silberschatz, Galvin and Gagne ©2009 Deadlock Characterization Mutual exclusion: only one process at a time can use a resource Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task Circular wait: there exists a set { P 0 , P 1 , …, P n } of waiting processes such that P 0 is waiting for a resource that is held by P 1 , P 1 is waiting for a resource that is held by P 2 , …, P n –1 is waiting for a resource that is held by P n , and P n is waiting for a resource that is held by P 0 . Deadlock can arise if four conditions hold simultaneously.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.8 Silberschatz, Galvin and Gagne ©2009 Resource-Allocation Graph V is partitioned into two types: P = { P 1 , P 2 , …, P n }, the set consisting of all the processes in the system R = { R 1 , R 2 , …, R m }, the set consisting of all resource types in the system request edge – directed edge P i R j assignment edge – directed edge R j P i A set of vertices V and a set of edges E .
Background image of page 8
1.9 Silberschatz, Galvin and Gagne ©2009 Resource-Allocation Graph (Cont.) Process Resource Type with 4 instances P i requests instance of R j P i is holding an instance of R j P i P i R j R j
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.10 Silberschatz, Galvin and Gagne ©2009 Example of a Resource Allocation Graph
Background image of page 10
1.11 Silberschatz, Galvin and Gagne ©2009 Resource Allocation Graph With A Deadlock
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.12 Silberschatz, Galvin and Gagne ©2009 Graph With A Cycle But No Deadlock
Background image of page 12
1.13
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/27/2010 for the course CS 4003-440 taught by Professor Brown during the Spring '10 term at RIT.

Page1 / 44

ch7 - Chapter 7: Deadlocks Silberschatz, Galvin and Gagne...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online