What is deadlock and it’s Conditions in Operating System
DEADLOCK:
The term Deadlock is simply defined as a condition where one process or many processes are blocked forever; as they do not satisfy the requirements. These processes remain in the deadlock until and unless some kind of external force; such as an operator of an operating system; takes some action to get them out of the deadlock state.
Moreover, deadlock can be explained considering an example by taking two processes such as A and B; deadlock can occur when there are two processes and two resources. Consider the two resources as p1 and p2. A resource cannot be released by a process which is waiting for a request. Consider that p1 is designated to A and p2 is designated to B; now if suppose A request for p2 and B request for p1. Due to this it will result in a deadlock situation for A and B.
Deadlock is also defined as the study of the logic; of the process interactions in the computer system.
Conditions Of Deadlock:
Deadlocks are caused or achieved by the following conditions mentioned below:
Hold And Wait:
By Hold and Wait it is defined as the condition that when a process is holding one resource; waiting for at least one resource which is at that time held by some other process.
No Preemption:
By No preemption it is defined that when a process takes a resource or is holding; on a resource and the process request has been granted then no other process can take that resource; from that process until that process after availing the resource releases it.
Circular Wait:
Circular wait is simple defined as when a set of processes such as {W0, W1, W2, W3, …, WN}; must exist in such a way that if every P[i] I waiting for the W[ ( i+1) % (N+1)] . These conditions mainly implies for the hold and wait condition; but if the processes are deal separately it is easier to deal with them.