Also, try to preempt the resources of those process which are in the waiting state. If the process is having a very high priority or the process is a system process, then only the process can forcefully preempt the resources of other processes. By doing so, we can remove the deadlock but there are certain things that should be kept in mind before using this forcefull approach. But if we found some resource due to which, deadlock is happening in the system, then we can forcefully preempt that resource from the process that is holding that resource. No Preemption: This is a technique in which a process can't forcefully take the resource of other processes.In this way, we can avoid the hold and wait condition. After performing the jobs on these resources, the process needs to release these resources and then the other resources will be provided to the process. At a particular time, we can provide R1, R2, R3, and R4. For example, if the process needs 10 resources R1, R2, R3., R10. So, another way of avoiding hold and wait can be the "Do not hold" technique. But this method is not practical because we can't know the resources required by a process in advance, before its execution. In this way, the process need not wait for some resources during its execution. To avoid this, the process can acquire all the resources that it needs, before starting its execution and after that, it starts its execution. Hold and Wait: Hold and wait arises when a process holds some resources and is waiting for some other resources that are being held by some other waiting process.For example, a printer can't print documents of two users at the same time. So, practically, we can't violate the mutual exclusion for a process because in general, one resource can perform the work of one process at a time. If another process is also demanding the same resource then it has to wait for the allocation of that resource. Mutual Exclusion: Mutual exclusion says that a resource can only be held by one process at a time.Let's see how we can avoid the four conditions of deadlock by using the deadlock prevention technique. So, before using the deadlock prevention mechanism, make sure that if deadlock happens in your system then it will have an adverse effect on your system or not. So, prevention technique should be applied only when there will be a drastic change if deadlock happens. Now, think of other situation, if there is a temple in the same area, then you need not install generators because here we are not dealing with some life-death situation and the power cut in the area is also very rare. No doubt, you have to bear the cost of generators. But since it is a case of life-death, then you must Prevent this by installing generators or inverters. ![]() ![]() There can be chances that in the area of the hospital, the power cut happens rarely. So that in case of a power cut, no life-saving machines should stop otherwise it can lead to the death of a patient. So, you should apply deadlock prevention in only those situation which has a drastic change in the system if deadlock happens.įor example, in hospitals, we have generators or inverters installed. ![]() Since we are preventing any one of four conditions to happen by applying some techniques. the system will make sure that at least one of the four conditions of the deadlock will be violated. In this method, the system will prevent any deadlock condition to happen i.e. So, there are various ways of deadlock handling. To remove deadlock from our system, we need to avoid any one of the above four conditions of deadlock. So, you know what Deadlock is and what are those four necessary conditions. If you haven't read that blog then please read the blog from here and then come back to this blog. In our last blog, we saw what is Deadlock and what are the four necessary conditions of Deadlock.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |