Open In App

Difference between Deadlock and Starvation in OS

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Deadlock: 

Deadlock occurs when each process holds a resource and wait for other resource held by any other process. Necessary conditions for deadlock to occur are Mutual Exclusion, Hold and Wait, No Preemption and Circular Wait. In this no process holding one resource and waiting for another get executed. For example, in the below diagram, Process 1 is holding Resource 1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource 1. Hence both process 1 and process 2 are in deadlock.

 Starvation: 

Starvation is the problem that occurs when high priority processes keep executing and low priority processes get blocked for indefinite time. In heavily loaded computer system, a steady stream of higher-priority processes can prevent a low-priority process from ever getting the CPU. In starvation resources are continuously utilized by high priority processes. Problem of starvation can be resolved using Aging. In Aging priority of long waiting processes is gradually increased. 

Difference between Deadlock and Starvation:

S.NO                                        Deadlock                                            Starvation
1. All processes keep waiting for each other to complete and none get executed High priority processes keep executing and low priority processes are blocked
2. Resources are blocked by the processes Resources are continuously utilized by high priority processes
3. Necessary conditions Mutual Exclusion, Hold and Wait, No preemption, Circular Wait Priorities are assigned to the processes
4. Also known as Circular wait Also known as lived lock
5. It can be prevented by avoiding the necessary conditions for deadlock It can be prevented by Aging

Last Updated : 09 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads