ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU class(2019-2020-1) > student directories > 2017329600011_曾文哲 >
homework-5 Version 0
👤 Author: by vanjiazenggmailcom 2019-10-13 03:20:04
My understandings about Banker’s Algorithm:

The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating the allocation for predetermined maximum possible amounts of all resources, then makes an “s-state” check to test for possible activities, before deciding whether allocation should be allowed to continue.

 

Example:

Considering a system with four processes P1 through P4 and total system resources are 15.

     




























Process required resources needed resources
P1 6 4
P2 8 5
P3 8 6
P4 10 7

 

Suppose that ,at time T0, the following snapshot of the system has been taken:






































Process required allocated Available needed
P1 6 2 5 4
P2 8 3   5
P3 8 2   6
P4 10 3   7

 

In this case, the system is safe. Because, we can find a sequence < P1, P2, P3, P4> satisfies the safety requirement. And there is no deadlock.

 

What if we reduce total system resources to 11.






































Process required allocated Available needed
P1 6 2 1 4
P2 8 3   5
P3 8 2   6
P4 10 3   7

 

In this case, the system is not safe. Because there are only one rest available resources. The minimum need of resource requirements is 4. It’s impossible to execute any process. So, we can’t find a sequence to have all the processes finished.

Please login to reply. Login

Reversion History

Loading...
No reversions found.