What do you mean by a deadlock?

Asked 18-Nov-2017
Viewed 733 times

1 Answer


1

Deadlock! 

What do you mean by a deadlock?

a situation where a process gets blocked in a set of processes that is because each process holds a resource and keeps on waiting for a resource held by the other process.

Let us understand deadlock with a small example, so imagine a pathway which can accommodate only one person at a time… When someone was already crossing that path the other person enters the pathway from the opposite direction… Now think what would have happened?
There’s occurred a situation of deadlock, where there are two processes and only one resource and each one of them waiting for each other to complete their process so that the other could complete it.

Key Conditions that ensures deadlock if become true simultaneously:
• Mutual Exclusion
• Hold and Wait
• No Preemption
• Circular Wait
What do you mean by a deadlock?
Mutual Exclusion:
What do you mean by a deadlock?
It is also referred as ‘Mutex’, when two threads process the same data in the same needle of a clock then this term come into the picture. It is the synchronization tool or a lock. A process takes over the Mutex if available, else it goes in the dormant state. By the use of context switch and queuing mutual exclusion can reduce busy-waits and latency. It can be implemented on both the levels software and hardware.
 To prevent the corruption of the shared data structure implement mutex at the kernel level, by disabling of interrupts for the smallest number of instruction. A flag is raised for the availability of the resources if multiple processors share the same memory. The busy-wait mechanisms implement mutex in the software area. This was backed by the following algorithm like The Black-White Bakery Algorithm, Dekkar’s Algorithm, Peterson’s Algorithm, Lamport’s Bakery Algorithm and Szymanski’s Algorithm.

Hold and Wait:
What do you mean by a deadlock?
A process is been assigned to the resources before the execution starts. This avoids deadlock but on the sake of throughput reduction as resources are been held with the processes even they are not required, thus they would have been used by other processes who are in need during that time span.
And the other approach is that processes are restricted for the request of a resource until they own a null resource, which might lead them to starvation.

No Preemption:
What do you mean by a deadlock?
Explaining in the consideration of two approaches…If a process request for a resource which is been held by another process in wait then the resource has the power to preempt the other waiting process.
Well, the other approach explains that the resources are been preempted of the process which is requesting for an unavailable resource.

Circular Wait:
What do you mean by a deadlock?
The resources are been assigned to the process in the increasing order of their number, this lead to the increase in complexity leading to poor utilization of the resource.

Thinking of avoiding deadlock?
What do you mean by a deadlock?

Well, here we go… to avoid deadlock using several algorithms and methods!
Well, It ensures that processes may not enter the unsafe or deadlock state. Apriori information states that the process gives out their need for resources beforehand to ensure that the process is not entering into an unsafe zone. Well, if one gets to know about the requirement of the processes for the resources and each process have sufficient amount of resources to complete its task, hence they would never enter into the unsafe zone called a safe state.
What do you mean by a deadlock?

This leads to the fulfillment of your query for Deadlock!


Comment
its very informative - Manish Kumar20-Nov-2017

Thanks for the detailed explanation. - Anonymous User29-Apr-2019