Monday, April 9, 2012

Deadlock Avoidance


  • Deadlock Avoidance


This approach to the deadlock problem anticipates deadlock before it actually occurs. This approach employs an algorithm to access the possibility that deadlock could

occur and acting accordingly. This method differs from deadlock prevention, which guarantees that deadlock cannot occur by denying one of the necessary conditions of  deadlock.


http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/deadlockAvoidance.htm



  • Deadlock Avoidance


Deadlock can be avoided if certain information about processes are available to the operating system before allocation of resources, such as which resources a process will consume in its lifetime

One known algorithm that is used for deadlock avoidance is the Banker's algorithm, which requires resource usage limit to be known in advance. However, for many systems it is impossible to know in advance what every process will request. This means that deadlock avoidance is often impossible.

Two other algorithms are Wait/Die and Wound/Wait, each of which uses a symmetry-breaking technique. In both these algorithms there exists an older process (O) and a younger process (Y). Process age can be determined by a timestamp at process creation time. Smaller timestamps are older processes, while larger timestamps represent younger processes.


en.wikipedia.org/wiki/Deadlock#Distributed_deadlock_prevention




  • Deadlock Avoidance


Tries to anticipate deadlock

Will deny resource requests if algorithm decides that granting the request could lead to deadlock.

Because of nondeterminacy of OS, algorithm is not always correct, and denies requests that would not have led to deadlock.

Deadlock does not occur immediately after allocating a resource, so cannot simply make projection on state graph and then run deadlock detection algorithm


http://staff.um.edu.mt/csta1/courses/lectures/csm202/os7.html#2