Difference Between Deadlock and Starvation in Operating System OS (With Table)

The computer is considered one of the most successful inventions of mankind and has managed to serve us with hassle-free experiences while completing certain tasks. It has created a feasible space for us by helping us make our work life and even social life better. When we perform certain tasks on computers, there ought to happen some problems because of some technical issues. Two of such difficulties are 1. Deadlock and 2. Starvation in Operating System OS.

Deadlock vs Starvation in Operating System OS

The difference between deadlock and starvation in an operating system os is the time when they occur. Deadlock occurs when a resource is held by processes and waits for other process-held resources. On the other hand, starvation in the operating system os occurs when processes with low priority are blocked, and execution of high priority processes take place.

The state in which a resource requested to perform a certain process is held by another waiting process is known as deadlock. Deadlock is generally witnessed in both multiprocessing and distributed systems and also in parallel computing. In a deadlock, shared resources of the processes are adjudicated by hardware and software locks for implementation of process synchronization. The reason for the occurrence of deadlock in communication systems is the loss or corruption of signals.

The occurrence of a problem when processes of low priority are blocked, and the processes with high priority are carried out is known as starvation in the operating system os. Starvation is the major problem in the priority scheduling algorithm as it causes uncertain waiting of the low priority procedures. Starvation also occurs in concurrent computing. Some of the causes of starvation include errors in scheduling, resource leaks etc. An example of starvation is the third task in a multitasking system that switches between its first two tasks is never carried out or is starved because of CPU time.

Comparison Table Between Deadlock and Starvation in Operating System OS

Parâmetros de comparação Deadlock in Operating System OSStarvation in Operating System OS
Significado The state in which a resource requested to perform a certain process is held by another waiting process is known as deadlock.When processes of low priority are blocked and are not allowed, the resources and the processes with high priority are carried out by allowance of resources is known as starvation in the operating system os.
Também conhecido como Circular waitLived Lock
RecursosResources are held by another waiting process. High priority processes use resources.
CausasThe simultaneous occurring of no preemption and circular wait, Mutual exclusion, hold and wait.Errors in scheduling, No control over resource management, Limitations in resources.
PreventionAllowance of preemption.Aging.

What is Deadlock in Operating System OS?

The state in which a resource requested to perform a certain process is held by another waiting process is known as deadlock. A deadlock is known as Circular wait. Both multiprocessing and distributed systems and also parallel computing witness deadlock situation. It is also observed in a communication system.

The occurrence of deadlock is because of reasons like Simultaneous occurring of no preemption and circular wait, Mutual exclusion, hold and wait. If these four things take place simultaneously, then a deadlock will take place. The occurrence of deadlock in communication systems takes place because of the loss or corruption of signals.

The primary example of deadlock is, Process 1 is using Resource 2 of Process 2 and Process 2 is still carried out. Deadlock can be prevented by an allowance of preemption, using a resource allocation graph etc. These resource allocation graphs can also be helpful to detect a deadlock when a certain task or algorithm is executed.

Different operating systems handle the situation of deadlock differently. The approaches towards a deadlock situation include ignoring deadlock, detection, prevention etc. There exist distributed deadlocks that occur in distributed systems because of distributed transaction or usage of concurrency control. Distributed deadlocks are avoided by drafting a global wait-for graph or by carrying out a distributing algorithm.

What is Starvation in Operating System OS?

The occurrence of a problem when processes of low priority are blocked and are not allowed the resources and the processes with high priority are carried out by allowance of resources is known as starvation in the operating system os. The starvation in operating system OS is also known as Lived Lock.

The reasons behind the occurrence of starvation in the operating system are Errors in scheduling, No control over resource management, Limitations in resources. The third task in a multitasking system that switches between its first two tasks is never carried out or is starved because CPU time is a prominent example of starvation.

The priority processes in the system that wait for a long time are gradually increased. This process is called Aging. The process of Aging is one of the measures of prevention or rather is a solution for starvation in the operating system. Generally, in a heavily loaded computer system, the low priority processes are prevented by high priority processes from ever getting the CPU.

The prevention of starvation in the operating system can be done by other methods such as avoiding processes that cause starvation such as avoid selecting random processes for resource allotment. The algorithm where starvation is not possible is called starvation-free or lockout-freed.

Main Differences Between Deadlock and Starvation in Operating System OS

  1. A deadlock takes place whenever a resource is held by processes and waits for other process-held resources on the other hand starvation in the operating system occurs when processes with low priority are blocked and execution of high priority processes take place.
  2. The prevention measures for deadlock include an allowance of preemption and avoidance of mutual exclusion on the other hand starvation in the operating system can be avoided by the execution of the process of aging.
  3. The condition of the resources is varied in both situations. In a deadlock, resources are held by other waiting processes and in starvation in the operating system resources are utilized by high priority processes.
  4. The raising condition of deadlocks includes an occurrence of four simultaneous cases on the other hand starvation arises because of several reasons like poor resource management.
  5. The rolling back of processes in both the situations is different, in deadlock both high and low priority processes wait for each other and none of the processes rolls back which results in making the process an infinite one on the other hand in starvation, low priority processes rollback.
  6. Starvation in the operating system can be caused because of deadlock but deadlock is not caused because of starvation.

Conclusão

Both, deadlock and starvation in the operating system are the difficulties that are ought to arise because of data clans or programming conditions that occur during implementation of hardware. These difficulties might hinder the hassle-free experience of an user while using the computer.

These issues can be resolved by taking necessary steps and preventive procedures. It is a user’s responsibility as well to make optimum use of the device and avoid such difficulties.

Referências

  1. https://dl.acm.org/doi/abs/10.1145/800222.806755
  2. https://www.tandfonline.com/doi/abs/10.1080/03081078908935036