






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Chapter 3
Chapter 3 2 Overview Resources Why do deadlocks occur? Dealing with deadlocks Ignoring them: ostrich algorithm Detecting & recovering from deadlock Avoiding deadlock Preventing deadlock
Chapter 3 4 When do deadlocks happen? (^) Suppose (^) Process 1 holds resource A and requests resource B (^) Process 2 holds B and requests A (^) Both can be blocked, with neither able to proceed (^) Deadlocks occur when … (^) Processes are granted exclusive access to devices or software constructs (resources) (^) Each deadlocked process needs a resource held by
Process 1 (^) Process 2 DEADLOCK!
CS 1550, cs.pitt.edu Chapter 3 5 (originaly modified by Ethan Using resources Sequence of events required to use a resource
Can’t use the resource if request is denied
(^) Block and wait for resource (^) Continue (if possible) without it: may be able to use an alternate resource (^) Process fails with error code
CS 1550, cs.pitt.edu Chapter 3 7 (originaly modified by Ethan Four conditions for deadlock
(^) Each resource is assigned to at most one process
(^) A process holding resources can request more resources
(^) Previously granted resources cannot be forcibly taken away
(^) There must be a circular chain of 2 or more processes where each is waiting for a resource held by the next member of the chain
CS 1550, cs.pitt.edu Chapter 3 8 (originaly modified by Ethan Resource allocation graphs R (^) Resource allocation modeled by directed graphs (^) Example 1: (^) Resource R assigned to process A (^) Example 2: (^) Process B is requesting / waiting for resource S (^) Example 3: (^) Process C holds T, waiting for U (^) Process D holds U, waiting for T (^) C and D are in deadlock! A S B U T C D
Graph With A Cycle But No Deadlock
Basic Facts If graph contains no cycles no deadlock If graph contains a cycle if only one instance per resource type, then deadlock (^) necessary and sufficient condition if several instances per resource type, possibility of deadlock (^) necessary condition