21-06-2012, 01:40 PM
OPERATING SYSTEMS DEADLOCKS
OPERATING SYSTEMS DEADLOCKS.pdf (Size: 860.55 KB / Downloads: 360)
DEADLOCKS
BACKGROUND:
The cause of deadlocks: Each process needing what another process has. This
results from sharing resources such as memory, devices, links.
Under normal operation, a resource allocations proceed like this::
1. Request a resource (suspend until available if necessary ).
2. Use the resource.
3. Release the resource.
• Traffic only in one direction.
• Each section of a bridge can be viewed as a resource.
• If a deadlock occurs, it can be resolved if one car backs up (preempt
resources and rollback).
• Several cars may have to be backed up if a deadlock occurs.
• Starvation is possible.
DEADLOCKS - Deadlock Recovery
So, the deadlock has occurred. Now, how do we get the resources back and gain forward
progress?
PROCESS TERMINATION:
· Could delete all the processes in the deadlock -- this is expensive.
· Delete one at a time until deadlock is broken ( time consuming ).
· Select who to terminate based on priority, time executed, time to completion, needs
for completion, or depth of rollback
· In general, it's easier to preempt the resource, than to terminate the process.
RESOURCE PREEMPTION:
· Select a victim - which process and which resource to preempt.
· Rollback to previously defined "safe" state.
· Prevent one process from always being the one preempted ( starvation ).