os8 - Modified from Lecture Slides for Operating System...

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

View Full Document Right Arrow Icon
Operating Systems : Deadlocks (Chapter 8) Sung-Yong Park, Ph.D. Distributed Computing & Communication Laboratory Department of Computer Science Sogang University Modified from Lecture Slides for Operating System Concepts (6 th Edition) by Silberschatz et. al. Sogang University Distributed Computing & Communication Lab. Page 2 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 ± System has 2 tape drives. ± P 1 and 2 each hold one tape drive and each needs another one. ± Example 2 ± semaphores A and B , initialized to 1 0 1 wait (A); wait(B) wait (B); wait(A)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sogang University Distributed Computing & Communication Lab. Page 3 System Model ± Resource types R 1 , 2 , . . ., m CPU cycles, memory space, I/O devices (printer, etc.) ± Each resource type i has W i instances . ± Under the normal mode of operation, a process may utilize a resource in only the following sequence: ± request ± use ± release Sogang University Distributed Computing & Communication Lab. Page 4 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 , 1 , …, n } of waiting processes such that 0 is waiting for a resource that is held by 1 , 1 is waiting for a resource that is held by 2 , …, n –1 is waiting for a resource that is held by n , and n is waiting for a resource that is held by 0 . Deadlock can arise if four conditions hold simultaneously .
Background image of page 2
Sogang University Distributed Computing & Communication Lab. Page 5 Resource Allocation Graph ± V is partitioned into two types: ± P = { 1 , 2 , …, n }, the set consisting of all the processes in the system. ± R = { 1 , 2 , …, m }, the set consisting of all resource types in the system. ± request edge – directed edge i j , which signifies that process requested an instance of resource type and is currently waiting for that resource. ± assignment edge – directed edge i , which signifies that an instance of resource type has been allocated to process . A set of vertices V and a set of edges E . Sogang University Distributed Computing & Communication Lab. Page 6 Example of Resource Allocation Graph ± Process ± Resource Type with 4 instances ± requests instance of ± is holding an instance of P i R j P i R j
Background image of page 3

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

View Full DocumentRight Arrow Icon
Sogang University Distributed Computing & Communication Lab. Page 7 Checking a Deadlock ± Given the resource allocation graph, if the graph contains no cycle, then no process in the system is deadlocked .
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

os8 - Modified from Lecture Slides for Operating System...

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

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