0% found this document useful (0 votes)
19 views1 page

Deadlock

Deadlock occurs when two or more processes are waiting for each other to release resources, resulting in an infinite wait. For deadlock to occur, there must be mutual exclusion of resources (only one process can use a resource at a time), hold and wait (a process requests resources already held by another), no preemption (a process cannot forcibly have its resources removed), and a circular wait condition where processes are waiting for each other in a cycle.

Uploaded by

Akshay Gorade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Deadlock

Deadlock occurs when two or more processes are waiting for each other to release resources, resulting in an infinite wait. For deadlock to occur, there must be mutual exclusion of resources (only one process can use a resource at a time), hold and wait (a process requests resources already held by another), no preemption (a process cannot forcibly have its resources removed), and a circular wait condition where processes are waiting for each other in a cycle.

Uploaded by

Akshay Gorade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Deadlock

Hold and Wait


Deadlock is a situation where two or more processes
are waiting for each other. A process can hold a number of resources at a time
 For example, let us assume, we have two processes P1 and at the same time, it can request for other
and P2. resources that are being held by some other process.
 Now, process P1 is holding the resource R1 and is For example, a process P1 can hold two resources R1
waiting for the resource R2. and R2 and at the same time, it can request some
 At the same time, the process P2 is having the resource resource R3 that is currently held by process P2.
R2 and is waiting for the resource R1.
 So, the process P1 is waiting for process P2 to release
its resource and at the same time, the process P2 is
waiting for process P1 to release its resource.
 And no one is releasing any resource. So, both are
waiting for each other to release the resource.
 This leads to infinite waiting and no work is done here.
 This is called Deadlock.

No pre-emption

A resource can't be preempted from the process by


another process, forcefully. For example, if a process
P1 is using some resource R, then some other process
P2 can't forcefully take that resource. If it is so, then
what's the need for various scheduling algorithm. The
process P2 can request for the resource R and can
wait for that resource to be freed by the process P1.

If a process is in the waiting state and is unable to


change its state because the resources required by the Circular Wait
process is held by some other waiting process, then
the system is said to be in Deadlock Circular wait is a condition when the first process is
waiting for the resource held by the second process,
the second process is waiting for the resource held by
the third process, and so on. At last, the last process
is waiting for the resource held by the first process.
So, every process is waiting for each other to release
Necessary Conditions of Deadlock the resource and no one is releasing their own
resource. Everyone is waiting here for getting the
resource. This is called a circular wait.
Mutual Exclusion

A resource can be held by only one process at a time.


In other words, if a process P1 is using some resource
R at a particular instant of time, then some other
process P2 can't hold or use the same resource R at
that particular instant of time. The process P2 can
make a request for that resource R but it can't use that
resource simultaneously with process P1.

You might also like