Difference Between Similar Terms and Objects

Difference Between Deadlock and Starvation in Operating System OS

The operating system is the most fundamental software that runs on a computer. It is responsible for managing the computer’s memory and processes, as well as shielding the details of the hardware from the application programs using it. A computer’s operating system also ensures fair allocation of resources to users and programs as opposed to equal distribution among processes. A fair scheduling system allows one process to use the CPU while the other is waiting in the queue. As a result each thread gets enough access to limited resources preventing the two most common conditions that would have delayed the process otherwise: Deadlock and Starvation. Both are related concepts where the processes do not have access to the resources. This article highlights some key points comparing the two on various fronts.

What is Deadlock?

Deadlock is a condition where a set of threads are blocked because each process holding a resource is trying to access some other resources that is being held by another process eventually preventing a fair system scheduling. A deadlock situation arises when the following four condition hold true: Mutual exclusion means only one process can access a resource at a time; No preemption condition means a resource can only be released voluntarily by the process holding the resource; Hold & wait means a process holding resources may request additional resources held by other processes and; Circular wait means two or more processes are stuck in a circular chain waiting for each process to release their respective resources.

 

What is Starvation?

Starvation is a condition which arises when a process goes into the waiting period indefinitely as a low priority process never gets the chance to access the resource due to a constant flow of high priority processes accessing the same resource. It is a resource management problem because a process is denied access to the resource it requires thereby pushing the process into an indefinite waiting period. It happens because the resource it requires is never allocated to the process causing the process to starve for resources, hence the name. The best way to avoid starvation is to use the aging technique which gradually increases the priority of processes that are in the waiting period for a long time in order to ensure a fair scheduling system.

 

Difference between Deadlock and Starvation in OS

  1. Definition of Deadlock and Starvation

Both deadlock and starvation are related concepts that prevent a fair system scheduling where the processes are blocked from gaining access to the resources. Deadlock, as the name suggests, refers to a condition where a set of threads or processes are blocked because each process is waiting to acquire a resource that is being held by another process thereby resulting in a deadlock situation where the programs cease to function. Starvation, on the other hand, is triggered by a deadlock which causes a process to freeze because a low priority process is denied access to a resource that is allocated to a high priority process.

  1. Condition

A deadlock refers to a specific condition that occurs when a thread or a process goes into a waiting period because the system resource it requested is being held by another process, which in turn is waiting for another process to release its resource thereby creating a deadlock. This is caused by poor resource utilization. Starvation is an indefinite postponement condition where a low priority process is denied access to the resources it requires because the resources are being allocated to another high priority process. It is a resource management problem which forces the system to allocate resources to only high priority processes.

  1. Characterization of Deadlock and Starvation

Deadlock is the ultimate form of starvation that is caused when the following four conditions occur concurrently: Mutual Exclusion, No Preemption, Hold & Wait, and Circular Wait. A deadlock condition occurs only in systems in which all the four conditions hold true. Starvation occurs based on different conditions such as when there aren’t enough resources to go around and priority of processes starts getting lower or when processes start handing resources to other processes without control. If a low priority process requests a resource reserved for highest priority processes, the process starves forever. Starvation also occurs when resources are allocated arbitrarily causing processes to wait for a longer period of time.

  1. Prevention

Starvation can be prevented by using a proper scheduling algorithm with priority queue that in fact also uses the aging technique – a scheduling technique which adds the aging factor to the priority of each request meaning it increases the priority level of low priority processes that have been waiting for a long time. Also providing more resources to programs should avoid continued congestion of resources. To prevent the system from going into a deadlock, processes must be denied access to one or more resources while simultaneously waiting for others and only one process should be allowed to access a resource at a time.

Deadlock vs. Starvation: Comparison Chart

 

Summary of Deadlock VS. Starvation

Both deadlock and starvation are related concepts in multiprocessing operating systems or distributed systems which cause one or more threads or processes to stuck in waiting for the resources they need. Deadlock is a situation which arises when one or more processes request access to the same resource causing the process to freeze, whereas starvation is caused by deadlock which pushes the process off to an indefinite postponement state because processes are denied access to a resource held by a high priority process and need to wait forever.


Search DifferenceBetween.net :

Custom Search


Help us improve. Rate this post! 1 Star2 Stars3 Stars4 Stars5 Stars
Loading...

Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.



Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

References :


[0]Tanenbaum, Andrew. Modern Operating Systems. New Jersey: Prentice Hall, 2001. Print

[1]Nir, Shavit and Maurice Herlihy. The Art of Multiprocessor Programming. Burlington: Morgan Kaufmann, 2011. Print

[2]Raynal, Michel. Concurrent Programming: Algorithms, Principles, and Foundations. Berlin: Springer, 2012. Print

[3]Image credit: https://pixabay.com/en/program-operating-system-coding-3189121/

[4]Image credit: https://www.maxpixel.net/static/photo/640/At-Ball-Information-Http-Crash-Administrator-Www-63527.jpg

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.


See more about : ,
Protected by Copyscape Plagiarism Finder