Deadlock Ceases Computer Operation
Definition of Deadlock Ceases Computer Operation – A deadlock is a condition in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in ceasing the computer operation. In earlier times the computer processes only one program at a time. But in modern times, the technology upgrade the processor to yield a multiprogramming features. It results in both the processes hanging. It commonly occurs in computers having multitasking and client-server environments. It is also called as Deadly embrace.
What are the conditions which results in deadlock?
- Mutual exclusion – When only one process can use the computer resources at a given instant of time. The resources here is unsharable. This is the one case/ situation which gave birth to problem called deadlock.
- Hold and wait or resource holding – In this situation a process is currently holding at least one resource and requesting additional resources which are being held by other processes.
- No Preemption – the resources can be released by voluntarily method.
- Circular Wait – in this case each process must be waiting for a resources which is being hold by another process, which in turn wait for the first process to withhold the resource.
How can we Handle Deadlock?
The deadlock condition is handled by few steps which are used according to Ostrich algorithms. These are –
- Ignoring deadlock – this require Ostrich algorithms to prevent deadlock. It is assumed that a deadlock will never occur.
- Detection – an algorithm is employed to track resources allocated and process states to handle the conditions of deadlock. Detecting a deadlock that has already occurred is easily possible since the resources that each process has locked the request are known to the resource scheduler of the operating system.
- No hold and wait – Adopt a policy of not letting a process wait for one resource while holding another, either by requiring each process to hold only one resource at a time, or request all of the resources it needed simultaneously.
- Allow Preemption – This is almost as good as eliminating mutual exclusion. If you can bump from some process off a resource it is hogging, then I can break a deadlock cycle.
- Eliminating Cycles – This is similar to no-hold-and-wait. We all require processes to grab resources in increasing order according to some total order (one common heuristic is increasing order by the memory address of the mutexes guarding the resources).