24-08-2012, 03:41 PM
Deadlocks
Deadlocks.pdf (Size: 198.65 KB / Downloads: 154)
Definitions
Use processes and threads interchangeably
Resources
Preemptable: CPU (can be taken away)
Non-preemptable: Disk, files, mutex, ... (can’t be taken away)
Use a resource
Request, Use, Release
Starvation
Processes wait indefinitely
Deadlocks
A set of processes have a deadlock if each process is waiting
for an event that only another process in the set can cause
Conditions for Deadlock
Mutual exclusion condition
Each resource is assigned to exactly one process
Hold and Wait
Processes holding resources can request new resources
No preemption
Resources cannot be taken away
Circular chain of requests
One process waits for another in a circular fashion
Question
Are all conditions necessary?
Ignore the Problem
The OS kernel locks up
Reboot
Device driver locks up
Remove the device
Restart
An application hangs (“not responding”)
Kill the application and restart
Familiar with this?
An application ran for a while and then hang
Checkpoint the application
Change the environment (reboot OS)
Restart from the previous checkpoint
Deadlocks.pdf (Size: 198.65 KB / Downloads: 154)
Definitions
Use processes and threads interchangeably
Resources
Preemptable: CPU (can be taken away)
Non-preemptable: Disk, files, mutex, ... (can’t be taken away)
Use a resource
Request, Use, Release
Starvation
Processes wait indefinitely
Deadlocks
A set of processes have a deadlock if each process is waiting
for an event that only another process in the set can cause
Conditions for Deadlock
Mutual exclusion condition
Each resource is assigned to exactly one process
Hold and Wait
Processes holding resources can request new resources
No preemption
Resources cannot be taken away
Circular chain of requests
One process waits for another in a circular fashion
Question
Are all conditions necessary?
Ignore the Problem
The OS kernel locks up
Reboot
Device driver locks up
Remove the device
Restart
An application hangs (“not responding”)
Kill the application and restart
Familiar with this?
An application ran for a while and then hang
Checkpoint the application
Change the environment (reboot OS)
Restart from the previous checkpoint