1.

What is the difference between deadlock and starvation in the context of Operating Systems?

Answer»

Deadlock - When each process possesses a resource and waits for ANOTHER process to retain a resource, a deadlock ensues. Mutual Exclusion, Hold and Wait, No Preemption, and Circular Wait are all necessary circumstances for the deadlock to occur. No process that is holding one resource while waiting for another is performed in this scenario.

Starvation - When high priority processes continue to RUN while low priority processes are stalled for an indeterminate time, this is known as starvation. A continual stream of higher-priority processes in a densely loaded computer system can prevent a low-priority operation from ever receiving the CPU. When resources are SCARCE, high-priority processes consume them continuously. Ageing can help to tackle the problem of starvation. The importance of LONG waiting processes is increasingly raised as processes age.

The following table lists the differences between deadlock and starvation:

DeadlockStarvation
In the case of deadlock, none of the processes is EXECUTED since they are waiting for each other to finish.In case of starvation, high-priority processes continue to run, whereas low-priority activities are halted.
In this case, processes are preventing resources from being used.In this case, high-priority processes consume resources constantly.

The necessary conditions for deadlock are:

  • No Preemption
  • Hold and Wait
  • Circular Wait
  • Mutual Exclusion
The necessary condition for starvation includes that the process must be having low priority and there must be other high priority resources that are continuously occupying the resources.
It can be avoided by avoiding the conditions that lead to deadlock.Starvation can be avoided with the concept of ageing.


Discussion

No Comment Found