most operating systems do not provide provisions for deadlock avoidance, why?

Asked by Swapnil Sunil Gondkar

why does many real world operating system does not keep provision for deadlock avoidance even when sophesticated algorithms like Banker's algo. are availaible

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Swapnil Sunil Gondkar
Solved:
Last query:
Last reply:
Revision history for this message
Lesmana Zimmer (lesmana) said :
#1

i will asume that what you mean with "real world operating systems" are "general purpose desktop operating systems" like ubuntu or windows. there are real time operating systems and they are also "real world".

the reason why the banker's algorithm (BA from now on) is not implemented in general purpose OSes would be practicability. for the rest of this explanation to make any sense you should understand how the BA works, i asume you understand how BA works.

BA is expensive. BA needs to be calculated for every resource request to decide wether to grant or reject that request. that means every malloc needs to calculate BA. that price would not be acceptable for a general purpose OS.

BA is conservative. a safe state guarantees that no deadlock will occur, but an unsafe state only says that a deadlock *may* occur, thus unsafe. a system can run deadlock free forever even when it is in an unsafe state.

BA needs to know the maximum amount of resource every process might request in it's lifetime. that is practically impossible for the use cases of a general purpose OS. how much memory will a movie encoder request? can you know that in advance for every process on your desktop?

BA assumes that every process terminates *eventually* and hopes that eventually is "soon enough". although every process in a general purpose OS will terminate *eventually* (when the PC shuts down), some processes run for days or weeks or potentially forever (as long as the PC does not shut down). so we have BA rejecting requests because the state will become unsafe, it might reject those requests forever while waiting for the webserver to terminate...

furthermore BA assumes that the amount of resources stay fixed. this is also not true for todays general purpose OS. for example a usb scanner can plugged in and out at any time.

in a "real time" environment thing are quite different. there is a fixed set of processes, the maximum amount of resource for every process is known, the life time for every process is short, and the amount of resources is fixed. even then the BA is not used all the time because of the disadvantages. there are other ways to detect and/or prevent deadlocks, for example ICPP.

Revision history for this message
Swapnil Sunil Gondkar (chanakya-ssg-yahoo) said :
#2

ya thanks for detailed explanation.