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.

Differences between Deadlock and Starvation

Deadlocks and Starvation appear to be similar problems but they are not same. There is a whole lot of considerable difference between the two.

What is the typical scenario for a process?

– It will request for some resource, use it and then ultimately release it.
– But if the same resource is requested by the two processes, one of the two has to be blocked or put in to waiting state for ensuring that the resource is accessed in a sequential way.

When a deadlock is said to occur?
– It happens when all the processes in a set are waiting for some resource that is being held by the other processes. – Till now no efficient solution has been discovered for the problem of deadlocks.
– Resources are of two types:

  • Consumable: These are the resources that the process creates and itself destroys them such as the signals, interrupts and so on.
  • Non consumable or the reusable resources: These are the resources that can be used by other processes once they have already been used. After use they are released.

Example of Bridge Crossing

– Suppose it’s a one way bridge, therefore traffic can move only in one direction.
– Let us consider every section of the bridge as a resource.
– Now if any two cars try to cross the bridge from opposite sides, a deadlock occurs.
– If suppose one of the drivers is timid he would hesitate to cross the bridge first.
– Such a situation is called starvation.
– The first situation can be avoided if one of those cars back up (in context of computer science, by using rollback and preempt resources.)
– Sometimes it might also be required to back up a number of cars up on occurrence of a deadlock.
– If there are no cycles in the way the resources are accessed by the processes, then there is no possibility of occurrence of the deadlocks.
– But if there exists a cycle, there are chances that a deadlock might occur.

When does Starvation occur?

– Starvation is also a common problem in multitasking systems.
– It occurs when a process is kept away from using a resource that it requires.
– Since the required resources are not offered, it becomes impossible for the processes to accomplish their tasks.
– A scheduling algorithm that is somewhat overly simplistic is one of the possible causes of the starvation.
– Kernel is a part of this algorithm and holds the responsibility for equal allocation of the resources.
– Whenever a certain process or thread is denied of the resource it wants by the scheduler, then starvation occurs.
– A thread with low priority might starve if there are a number of high priority jobs already in line.
– This can lead to a number of other negative impacts especially when the low priority thread has locked on to some resource required by the high priority threads.
– When there is a negative interaction between the two processes, race conditions may occur.
– Starvation can be seen as a consequence of the deadlock itself.
– If for preventing the deadlock, suppose the same process is chosen for rollback, then this process will suffer from starvation.
– Starvation follows naturally when we try to remove or avoid the deadlock.
– Priority inversion is a case of the starvation.
– This occurs when the low priority thread is holding the resource required by the threads of higher priority.
– Because of this, the high priority job won’t be able to progress further.
– This problem will be solved only if the resource is released by the low priority job.
– Now it appears as if the low priority thread is getting priority over the high priority thread.
– Priority inheritance method can be used for solving the problem of starvation.

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>