Professional Documents
Culture Documents
Deadlock in OS
Deadlock in OS
Presentation
What is Deadlock
Deadlock is a state in a computer system where two or
more processes are unable to proceed because each is
waiting for the other to release a resource, such as
memory or a file, or to perform an action.
Examples
Real-life Technical
One real-life example of deadlock is a traffic A classic technical example of
gridlock. Imagine an intersection where four deadlock involves two processes
roads meet, and there are traffic lights competing for two resources, each
controlling the flow of vehicles. If each road holding one resource and waiting
has equal traffic volume and the traffic for the other
lights are not coordinated properly, a
deadlock can occur.
Condition
Hold and Wait: Require processes to request and acquire all the resources they need at the
start, rather than acquiring them incrementally. This ensures that a process only holds
resources while it is actively executing, reducing the likelihood of deadlock.
Circular Wait: Impose a total ordering of resource types and require that each process
requests resources in an increasing order of enumeration. This way, circular waits are
prevented because processes can only request resources that are of a lower priority than the
ones they currently hold.
Strategies for
handling deadlock
prevention Avoidance Resource
Preemption
Modify the system to Use algorithms that Temporarily take resources away
dynamically analyze the from some processes and give them
prevent at least one of the
to others to break the circular wait
necessary conditions for state of the system to condition.
deadlock (mutual ensure that deadlock will Requires careful implementation to
exclusion, hold and wait, not occur. avoid race conditions and ensure
fairness.
no preemption, circular
wait) from occurring.
Thank You !