lec12-deadlocks

lec12-deadlocks - Lecture 12: Deadlocks (Chapter 7)...

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

View Full Document Right Arrow Icon
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 12: Deadlocks (Chapter 7)
Background image of page 1

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

View Full DocumentRight Arrow Icon
6.2 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition 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 1 z System has 2 disk drives z P 1 and P 2 each hold one disk drive and each needs another one ± Example 2 z semaphores A and B , initialized to 1 P 0 P 1 wait (A); wait(B) wait (B); wait(A)
Background image of page 2
6.3 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Bridge Crossing (Example 3) ± Traffic on the bridge 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 (or more) (preempt resources and rollback) ± Is starvation possible?
Background image of page 3

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

View Full DocumentRight Arrow Icon
6.4 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition 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. ± Any instance of a resource of type R i will satisfy a request for that resource type ± Each process utilizes a resource as follows: z request z use System calls (e.g., open/close file, allocate/free memory, etc) z release
Background image of page 4
6.5 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition 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 0 } 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 0 is waiting for a resource that is held by P 0 . Deadlock can arise if four conditions hold simultaneously.
Background image of page 5

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

View Full DocumentRight Arrow Icon
6.6 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Resource-Allocation Graph ± V is partitioned into two types: z P = { P 1 , P 2 , …, P n }, the set of all the processes in the system z R = { R 1 , R 2 , …, R m }, the set 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 6
6.7 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition 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 7

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

View Full DocumentRight Arrow Icon
6.8 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Example of a Resource Allocation Graph Is this deadlock?
Background image of page 8
6.9 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Another Resource Allocation Graph Is this deadlock?
Background image of page 9

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

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

Page1 / 36

lec12-deadlocks - Lecture 12: Deadlocks (Chapter 7)...

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

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