In: Computer Science
In terms of resources, what is the difference between deadlock and starvation? max 200 words
Deadlock occurs, when each process holds a resource and wait for some other resource. Mutual exclusion, keeping and waiting, no preemption, and circular waiting are the essential conditions for deadlock. In this method, no one resource holds and expects another to be executed. For eg, the process 1 below holds resource 1 and awaits resource 2 acquired via process 2 and process 2 awaits resource 1 , respectively. There is therefore a deadlock between both process 1 and process 2.
Starvation is the dilemma that happens when processes of high priority continue to run and processes of low priority are blocked indefinitely. A steady stream of higher-priority processes in highly loaded computer systems will prevent the CPU from ever reaching a low-priority process. High priority systems are continually used in starvation resources. Ageing will solve the issue of starvation. When long waiting processes get aged, priorities are growing gradually.
DEADLOCK |
STARVATION |
|
1. |
Every processes have to wait for each other to finish and none is executed |
Processes of high priority continue to execute and processes of low priority are blocked |
2. |
Resources are blocked by the processes |
Resources are continuously utilized by high_priority processes |
3. |
Necessary conditions Mutual Exclusion, No preemption, Circular_Wait, Hold and Wait |
Priorities are assigned to the processes |
4. |
Also known as Circular_wait |
Also know as lived_lock |
5. |
It can be prevented by avoiding the necessary conditions for deadlock |
It can be prevented by Aging |