Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

What is a deadlock? What are the causes for a deadlock?

– A deadlock is quite a frequent situation in the systems that have multiprocessors or do multitasking.
– When the two competing actions struggle for the same resource, they actually wait for each other to complete using the resource.
– But no one actually finishes and both the processes get trapped with each other.
– A deadlock occurring out of exactly two actions competing for a resource is known as the deadly embrace.
– It occurs whenever any thread or process try to access a resource that is being used by some other process which is also waiting for some other process to release some resource and so on.
– Then these processes and threads enter a waiting state.
– If it becomes almost impossible for the process to change its state because of the resources that it is requesting are being held by other process that are also in waiting state, then a deadlock is said to have occurred in the system.
– Deadlocks are counted among the most common problems of the distributed systems, parallel computing and the multiprocessing systems.
– In these systems the shared resources are handled by the means of the hardware and the software locks.
– Process synchronization is also implemented with the help of same means.
– Deadlocks are also common in telecommunication systems because of the signals getting lost or corrupt rather than due to resource contention.

Causes for a Deadlock

There are 4 conditions or causes also known as the Coffman conditions that if occur simultaneously lead to a deadlock situation. These causes are:
1. Mutual exclusion: Among all the resources there is one that cannot be shared. At any point of time that resource can be used by only one of the processes requesting for it.
2. Resource holding (hold and wait): One resource is held by at least one of the processes and these processes are further requesting for other resources that are being used by other threads or processes.
3. No preemption: Resources should not be de-allocated after allocation by the operating system. The processes holding them must release them by their own. We mean to say that there should be a voluntary surrender of the resources.
4. Circular wait: There is a set of processes all in waiting state. The first among these is waiting for the second one to release the resource and the second one is waiting for the resource from third one and so on. And the last one is waiting for the first one to release the resource.

– A deadlock would occur only if all these four causes or conditions are present.
– The occurrence of the deadlocks can be prevented if any one of these four causes is removed.
– There are a number of non – standard manners in which the operating systems respond to the occurring deadlocks.
– Today, a number of strategies have been developed for handling the deadlock situations.
– In one approach it is simply assumed that there are no chances of occurrence of a deadlock.
– One such example is of the ostrich algorithm.
– Systems such as the UNIX and the MINIX were the first one to implement this approach.
– This approach was used when the duration between the occurrences of deadlocks was wide enough and the data loss could be easily tolerated.
– Deadlock detection is another strategy for handling the deadlocks.
– Here, the deadlocks are allowed to occur but they are corrected also.
– This approach employs an algorithm for tracking the allocation of the resources and the states of the processes.
– Deadlocks can be avoided if it is known whether the following stages of the process will be safe or unsafe by using the details of the resources currently in use.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>