Lack of process synchronization can result in two extreme conditions:
deadlock or starvation
In early OS, deadlock was known as __________
deadly embrace
an extreme case of indefinite postponement
starvation
Seven cases of deadlock
Case 1: Deadlocks on File Requests
Case 2: Deadlocks in Databases
Case 3: Deadlocks in Dedicated Device Allocation
Case 4: Deadlocks in Multiple Device Allocation
Case 5: Deadlocks in Spooling
Case 6: Deadlocks in a Network
Case 7: Deadlocks in Disk Sharing
What is locking?
a technique used to guarantee the integrity of the data through which the user locks out all other users while working with the database
Locking can be done at three different levels:
conditions for deadlock
Mutual exclusion
Resource holding
No preemption
Circular wait
In general, operating systems use one of three strategies to deal with deadlocks:
The Banker’s Algorithm is based on a bank with a fixed amount of capital that operates on the following principles:
One algorithm was proposed by Dijkstra in 1965 to regulate resource allocation to avoid deadlocks.
The Banker’s Algorithm
deadlock became more prevalent after the introduction of these systems
interactive systems
There are several recovery algorithms, but they all have one feature in common:
They all require at least one victim, an expendable job, which, when removed from the deadlock, will free the system.
Several factors must be considered to select the victim that will have the least-negative effect on the system. The most common are:
recovery methods:
How can we eliminate mutual exclusion
May be bypassed by spooling, which allows the output from many jobs to be stored in separate temporary spool files at the same time
Directed graphs use these symbols:
Processes represented by circles and resources represented by squares
How can we eliminate resource holding
By forcing each job to request, at creation time, every resource it will need to run to completion
How to eliminate no preemption
By allowing the OS to deallocate resources from jobs
How to eliminate circular wait
One solution was proposed by Havender, based on a numbering system.
Forces each job to request its resources in ascending order
This scheme removes the possible of a circular wait and therefore guarantees the removal of deadlocks
Hierarchical ordering
Difficulties of hierarchical ordering
What algorithm was used in avoidance
Banker’s Algorithm
Steps to reduce a graph: