Deadlock

Dec 10 • General • 4780 Views • No Comments on Deadlock

First of all let us know in details about what actually deadlock is. Well, Deadlocks is related to the subject called DBMS (Data Base Management System). It is actually a condition in which the processes get in a loop and each process waits for the other one to finish but unfortunately neither does. Now, how this was happens! Let us suppose in a database process A updates row 1 and then row 2 and process B updates row 2 first and then row 1 in the same time frame. Now process A cant update row 1 till process B as finished updating it and process B cannot update row 2 unless process A finishes updating it. So both the processes are in waiting state. So this condition called the deadlock condition.

Deadlock–>The necessary conditions for a Deadlock to arise :-

* Mutual exclusion: Mutual exclusion is the condition in which one process can only request for one resource only. it can not request the other resource. In the same way only one resource can be share by one process at a time only.

* No preemption: When one process in being processed by one resource the no other process can inturrept in between of it.It means that if one resource is being processed by any process then no other process can request for that resource.

* Hold & wait: This condition means if one process is holding one resource and then also that process is requesting or waiting for another resource. this state will acts as hold & wait condition.

* Circular wait: If one process is requesting for the resource and another process requesting for the resource that came from the first process, in this way the 3rd process wait for the resource which come from the 2nd process.after the condition comes when nth process comes and the resource that nth holding is requested by the first process.

These are the four necessary conditions which comes under the deadlocks as the reason for its arisal, so we should aware of these problems.

–>The approaches for handling the Deadlock:-

*Ignore Deadlock:- In this approach it is assumed that the deadlock will never occur. This is generally applied when the time interval between the occurrence of the deadlock is large and data loss incurred each of the time is tolerable.

*Deadlock Detection:- In this approach the deadlocks are allowed to occur. And when this deadlock has occurred then the deadlock is identified and it is corrected by the system.

*Deadlock Prevention:- In this approach the conditions which are mentioned above for the arisal of the deadlock are tried to prevent from occurring. In this way the occurrence of the deadlock is prevented.

*Deadlock Avoidance:- In this approach the deadlocks can be avoided if certain amount of information about the processes are available to the operating system before the allocation of the resources.

So these were some approaches to handle the deadlocks and prevent it from occurring.

Deadlock is a common problem in multiprocessing systems, parallel computing and distributed systems, where generally software and hardware locks are used to handle shared resources and implement process synchronization.

I hope I was able to clear out this topic. If you still have any doubt or query regarding this, please feel free to share it with us in the comment box below. You suggestions will also be open heartedly welcomed.

Tell us Your Queries, Suggestions and Feedback

Your email address will not be published.

« »