• support@answerspoint.com

What is difference between DEADLOCK and STARVATION?

12296

Help me to know difference between Operating and Starvation

4Answer


0

What is the difference between Deadlock and Starvation?

• Process:

• In deadlock, the two threads or processes will wait for each other and both do not proceed forward.

• In starvation, when two or more threads or processes wait for the same resource, one will roll back and let the others use the resource first and next the starving thread or process will try again . Therefore, all threads or processes will anyhow proceed forward.

• Rolling Back:

• In a deadlock, both high priority threads/processes, as well as low priority threads/processes, will wait for each other infinitely. It never ends.

• But, in a starvation, low priority ones will wait or roll back but high priority ones will proceed.

• Waiting or Lock:

• A deadlock is a circular waiting.

• A starvation is a kind of a livelock and sometimes helps to get out from a deadlock.

• Deadlock and Starvation:

• A deadlock causes starvation, but starvation does not cause a deadlock.

• Causes:

• A deadlock will occur due to mutual exclusion, hold and wait, no preemption or circular waiting.

• Starvation occurs due to scarcity of resources, uncontrolled management of resources, and process priorities.

Summary:

Deadlock vs. Starvation

Deadlock and starvations are some of the problems that occur due to data races and race conditions that occur during programming as well as implementing hardware. In a deadlock, two threads will infinitely wait for each other without executing while, in a starvation, one thread will roll back and let the other thread to use the resources. A deadlock will cause starvation whereas starvation will help a thread to get out from a deadlock.

  • answered 8 years ago
  • Sunny Solu

0

A deadlock occurs when two (or more) threads have created a situation where they are all blocking each other. Imagine that threads T1 and T2 need to acquire both resources A and B in order to do their work. If T1 acquires resource A, then T2 acquires resource B, T1 could then be waiting for resource B while T2 was waiting for resource A. In this case, both threads will wait indefinitely for the resource held by the other thread. These threads are said to be deadlocked.

Starvation occurs when a scheduler process (i.e. the operating system) refuses to give a particular thread any quantity of a particular resource (generally CPU). If there are too many high-priority threads, a lower priority thread may be starved. This can have negative impacts, though, particularly when the lower-priority thread has a lock on some resource.

Race conditions occur when two threads interact in a negatve (buggy) way depending on the exact order that their different instructions are executed. If one thread sets a global variable, for example, then a second thread reads and modifies that global variable, and the first thread reads the variable, the first thread may experience a bug because the variable has changed unexpectedly.

  • answered 8 years ago
  • G John

0

DEADLOCK:
1) Deadlock process is permanently blocked because the required resource never   becomes available.
2) The resource under contention is not in continuous use.


STARVATION:
1) In starvation, it is not certain that a process will ever get the requested resources.
2) the resource under contention is in continuous use
.

  • answered 8 years ago
  • Sandy Hook

0

Consider following very simple definitions of both :

Deadlock: This is very common thing that occur in chinden’s fight , when two children fight thay usualy holds anothers hairs and  the first child say – “First you leave my hairs then i will.”
But second one says – “First you leave my hairs then i will.”
So process stuck for the demands of both at the same time.This is deadlock.


Starvation: Suppose you are very hungry but you are too young of 16 years only.Now in your hostle there is a rule that “Older boy gets food first.”And all the other boys are older than you , So this strategy of feeding will kill you.This type of long waiting to any transaction is called starvation where one transaction has to wait to long because some other preocess are executing with the data that you want.

  • answered 8 years ago
  • Gul Hafiz

Your Answer

    Facebook Share        
       
  • asked 8 years ago
  • viewed 12296 times
  • active 8 years ago

Best Rated Questions