os

What do you mean by Deadlock and also specify the various deadlock handling methods in detail

What do you mean by Deadlock and also specify the various deadlock handling methods in detail

os

What do you mean by Deadlock and also specify the various deadlock handling methods in detail

Deadlock is a situation where a process or a set of processes is blocked, waiting for some other resource that is held by some other waiting process. It is an undesirable state of the system. The following are the four conditions that must hold simultaneously for a deadlock to occur.

Mutual Exclusion – A resource can be used by only one process at a time. If another process requests for that resource then the requesting process must be delayed until the resource has been released.

Hold and wait – Some processes must be holding some resources in the non-shareable mode and at the same time must be waiting to acquire some more resources, which are currently held by other processes in the non-shareable mode.

No pre-emption – Resources granted to a process can be released back to the system only as a result of voluntary action of that process after the process has completed its task.

Circular wait – Deadlocked processes are involved in a circular chain such that each process holds one or more resources being requested by the next process in the chain.

Methods of handling deadlocks:

There are four approaches to dealing with deadlocks.

1) Deadlock Prevention : The strategy of deadlock prevention is to design the system in such a way that the possibility of deadlock is excluded. The indirect methods prevent the occurrence of one of three necessary conditions of deadlock i.e., mutual exclusion, no pre-emption, and hold and wait. But this prevention does not yield good results because:

●  long waiting time required

●  inefficient use of allocated resource

●  A process may not know all the required resources in advance

2) Deadlock avoidance (Banker’s Algorithm) : The deadlock avoidance Algorithm works by proactively looking for potential deadlock situations before they occur. It does this by tracking the resource usage of each process and identifying conflicts that could potentially lead to a deadlock. If a potential deadlock is identified, the algorithm will take steps to resolve the conflict, such as rolling back one of the processes or pre-emptively allocating resources to other processes. The Deadlock Avoidance Algorithm is designed to minimise the chances of a deadlock occurring, although it cannot guarantee that a deadlock will never occur.

Two techniques to avoid deadlock :

●  Process initiation denial

●  Resource allocation denial

Advantages of deadlock avoidance techniques:

●  Not necessary to pre-empt and rollback processes

●  Less restrictive than deadlock prevention

Disadvantages :

●  Future resource requirements must be known in advance

●  Processes can be blocked for long periods

●  Exists a fixed number of resources for allocation

 

Banker’s Algorithm  (click to know more)

 

3) Deadlock detection & recovery : Deadlock detection is used by employing an algorithm that tracks the circular waiting and kills one or more processes so that the deadlock is removed. The system state is examined periodically to determine if a set of processes is deadlocked. A deadlock is resolved by aborting and restarting a process, relinquishing all the resources that the process held.

●  This technique does not limit resource access or restrict process action.

●  Requested resources are granted to processes whenever possible.

●  It never delays the process initiation and facilitates online handling.

●  The disadvantage is the inherent pre-emption losses.

4) Deadlock Ignorance (Ostrich Method) : In the Deadlock ignorance method the OS acts like the deadlock never occurs and completely ignores it even if the deadlock occurs. This method only applies if the deadlock occurs very rarely. The algorithm is very simple. It says ” if the deadlock occurs, simply reboot the system and act like the deadlock never occurred.” That’s why the algorithm is called the Ostrich Algorithm.

Advantages:

●  Ostrich Algorithm is relatively easy to implement and is effective in most cases.

●  It helps in avoiding the deadlock situation by ignoring the presence of deadlocks.

Disadvantages:

●  Ostrich Algorithm does not provide any information about the deadlock situation.

●  It can lead to reduced performance of the system as the system may be blocked for a long time.

●  It can lead to a resource leak, as resources are not released when the system is blocked due to deadlock.

 


 

Topics Covered :

  • what is operating system and its types
  • operating system in computer
  • operating system responsibilities
  • operating system definition
  • operating system kya hai
  • operating system in hindi
  • operating system pdf
  • operating system ppt
  • operating system full course
  • types of operating system
  • functions of operating system
  • operating system in detail
  • what is operating system full information
  • use of operating system
  • operating system
  • why operating system
  • what is operating system
  • deadlock in os
  • deadlocks
  • what is deadlock in os
  • deadlock example in os
  • deadlock in os tutorial
  • deadlocks in os example
  • deadlock in operating system
  • deadlock operating system
  • what is deadlock in os with example
  • what is deadlock in operating system
  • deadlock real life example
  • deadlock examples in operating system
  • hold and wait in os
  • conditions for deadlock in operating system
  • hold and wait deadlock
  • no preemption deadlock
  • no preemption in deadlock prevention

 

 


 

Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.

Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.

 

🧑‍💻🧑‍💻 Social Media Links of Tech DCode :

👉🏻 YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
👉🏻 Instagram : https://www.instagram.com/thetechdcode/
👉🏻 Facebook Page : https://www.facebook.com/thetechdcode
👉🏻 Twitter : https://twitter.com/thetechdcode
👉🏻 Telegram Channel : https://t.me/thetechdcode
👉🏻 Tech DCode Linktree : https://linktr.ee/thetechdcode
👉🏻 My Personal Handles : https://linktr.ee/virtualshivamin

🧑‍💻🧑‍💻 Social Media Links of SHIVAM SINGH (OWNER) :

👉🏻 Instagram : https://www.instagram.com/virtualshivamin/
👉🏻 Facebook Page : https://www.facebook.com/virtualshivamin/
👉🏻 Twitter : https://twitter.com/virtualshivamin/
👉🏻 Personal Linktree : https://linktr.ee/virtualshivamin 

 

Leave a Reply

Your email address will not be published. Required fields are marked *