ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU class(2019-2020-1) > student directories > >
homework-5 Version 0
👤 Author: by 819755696qqcom 2019-10-12 06:08:34
My understanding about banker's Algorithm:
In the bank, the amount of loans applied for by customers is limited. Each customer should declare the maximum amount of funds needed to complete the project at the first time when applying for loans. When meeting all loan requirements, the customer should return it in time. Bankers should try to meet customers'needs when the amount of loans they apply for does not exceed the maximum amount they own. In such a descr iption, a banker is like an operating system. Capital is a resource, and a customer is the process of applying for resources.

Banker's algorithm is one of the most representative deadlock avoidance algorithms. In the deadlock avoidance method, processes are allowed to apply for resources dynamically. However, before allocating resources, the system should first calculate the security of the allocated resources. If allocation does not lead to insecurity of the system, then allocation, otherwise waiting.
Example:
Consider a system with five processes P0 through P4 and four resource type A,B,C and D.
Resource type A has 12 instances, B has 7, C has 6 and D has 4.
Suppose that ,at time T0, the following snapshot of the system has been taken:



In this case, the system is not safe,we can not find a sequence to have all the processes finished.

If we change the case into the following shape:



In this case: we can find a sequence <p3, p4, p0, p1, p2, p3> satisfies the safety requirement.

when the system is in this state, a request for (1, 0, 1, 0) by P0 can be granted immediately,
because we still can find a sequence <p3, p4, p0, p1, p2, p3> satisfies the safety requirement.

Please login to reply. Login

Reversion History

Loading...
No reversions found.