ch7 - Chapter 7 Deadlocks Chapter Adapted to COP4610 by...

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

View Full Document Right Arrow Icon
Chapter 7: Deadlocks Chapter 7: Deadlocks Adapted to COP4610 by Robert van Engelen
Background image of page 1

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

View Full Document Right Arrow Icon
7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 The Deadlock Problem The Deadlock Problem Deadlock - set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set Example 1: Dining Philosophers problem Example 2: System has 2 disk drives P 0 and P 1 each hold one disk drive and each needs another drive to continue Example 3: Two processes P 0 and P 1 and two semaphores A and B initialized to 1 P 0 P 1 wait ( A ) wait ( B ) wait ( B ) wait ( A )
Background image of page 2
7.3 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Bridge Crossing Example Bridge Crossing Example Bridge is a shared resource Traffic on bridge only in one direction at a time Deadlock prevention by preemption If a deadlock occurs, one car backs up Several cars may have to be backed up if a deadlock occurs Deadlock avoidance Cars from West take precedence over cars from East Starvation is possible
Background image of page 3

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

View Full Document Right Arrow Icon
7.4 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 System Model 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 R 1 = “CD RW” with W 1 = 2 (drive D: and drive E:) Each process utilizes a resource as follows: Request - if the request cannot be granted immediately, then the requesting process has to wait Use - the process can use the resource instance Release - the process releases the resource Examples: open () … read/write close () allocate () … object manipulation free () wait () … critical section signal ()
Background image of page 4
7.5 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Deadlock Characterization Deadlock Characterization Deadlock can arise if four conditions hold simultaneously: 1. Mutual exclusion - only one process at a time can use a resource 2. Hold and wait - a process holding at least one resource is waiting to acquire additional resources held by other processes. 3. No preemption - a resource can be released only voluntarily by the process holding it, after that process has completed its task 4. 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
Background image of page 5

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

View Full Document Right Arrow Icon
7.6 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Resource-Allocation Graph Resource-Allocation Graph Graph G =( V , E ) consists of a set of vertices V and edges E V is partitioned into two types of vertices: P = { P 1 , P 2 , …, P n }, the set consisting of all the processes
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 38

ch7 - Chapter 7 Deadlocks Chapter Adapted to COP4610 by...

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

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