2,842 views

1 Answer

Best answer
2 votes
2 votes

The four necessary conditions for Deadlock are

                  1) Mutual Exclusion

                  2) No Preemption

                  3) Hold & Wait

                 4) Circular Wait ( Cycles)

Deadlock handling methods:

      Deadlock preventions, Deadlock avoidance, and Deadlock detection

                 1) Deadlock preventions: Disable at least one of the above condition which causes dead lock. This resulting in Deadlock free process.

                 2) Deadlock avoidance: In simple words, this is Banker's algorithm. Visit https://www.geeksforgeeks.org/operating-system-bankers-algorithm/

                 3) Deadlock detection: Deadlocks are detected and then recovered to get a deadlock free process. Detection is mainly divided in 2 ways.

                 1) Single instance ( A resource can be used by only one process )

                               In this case if a cycle is detected in resource allocation graph, then its Deadlock.

                                     

             2) Multiple Instance: ( When a single resource can be used by many process simultaneously)

                               In this case, Safety algorithm is used. 

 

 

 

selected by

Related questions