Lecture Notes for Operating Systems
Deadlock, 11 October 1999
These are provisional lecture notes, expect changes.
- deadlocks
- resources
- pre-emptable, nonpre-emptable resource - storage, cpu; printer,
keyboard
- resource allocation and failure
- deadlock
- every process waiting on some other waiting process
- conditions - necessary and sufficient
- resource mutual exclusion - why they're waiting
- resources held while waiting - tie up resources for others
- no resource pre-emption - can't recover allocated resources
- a cycle of resource grants and requests
- resource grant-request graphs
- resource and process nodes
- request and grant arcs
- deadlocks are cycles in the resource graph
- deadlock avoidance techniques
- ignore the problem - recover on system restarts;
- sometimes necessary - rare occurrences, expensive solutions
- good special purpose solution, bad general purpose solution
- detection and recovery
- break cycles by pre-emption (killing the holder)
- good - effective and general purpose
- bad - may be difficult to detect, roll-back may be difficult
- prevention - remove any of the for deadlock conditions
- mutual exclusion - virtual devices, multiplexing, spooling
- pre-allocation before execution - eliminate the wait during hold
- good - effective
- bad - inefficient, difficult to comply with
- allow resource pre-emption - difficult to implement without extra
help
- eliminate request-grant cycles - order resources; difficult to find
orderings that satisfy everyone
- deadlock avoidance - examine requests
- the banker's algorithm - dikjstra
- always have enough in reserve to satisfy someone completely
- delay request until safe.
- resource trajectories - graphical, multi-resource analysis
- multi-resource banker's algorithm
- general problems - pre-allocation difficult, requesters pop in and
out of existence, resources pop in and out of existence
- special-purpose algorithms - databases
This page last modified on 11 October 1999.