Computer Science 440 Spring 2014
Gregory M. Kapfhammer
Keep in touch!

Office Hours, Email, Web, Twitter

Operating Systems
Deadlocks
Serious Problem
Intuitive Example
Scanner
CD Recorder
Deadlock!
Resources
Devices, data records, files, hardware, ...
Acquire
Use
Release
Differences!
Preemptible
Non-preemptible
When denied?
Wait and try again ...
Formal Definition
Page 437
Conditions for Deadlock
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
All must be present!
RAG
Page 439
Four Strategies
Ignore the problem
Detection and Recovery
Dynamic Avoidance
Prevention
Strategy Details
Detection and Recovery
Cycle detection
Dynamic Avoidance
Safe and Unsafe
Prevention
Structural Negation
OS Responsibility
Language Responsibility
Programmer Responsibility
Applications in Other Domains
Databases
Distributed Systems
Two-phase locking
2PL
Phase One
Lock all needed records
Phase Two
Perform Updates
Release Locks
Cannot get your locks?
Release and Start Over
Starvation
You never get your resource!
How?
Busy System and SJF
Solution?
Try FCFS!