homework-5 Version 0 |
|
👤 Author: by theliyunzealiyuncom 2019-12-11 02:50:18 |
describe your understadings about Banker's Algorithm, and give your own demo example.
Available, It is an array of length m. It represents the number of available resources of each type. If Available[j] = k, then there are k instances available, of resource type R(j).Max,It is an n x m matrix which represents the maximum number of instances of each resource that a process can request. If Max[i][j] = k, then the process P(i) can request atmost k instances of resource type R(j).Allocation It is an n x m matrix which represents the number of resources of each type currently allocated to each process. If Allocation[i][j] = k, then process P(i) is currently allocated k instances of resource type R(j).Need It is an n x m matrix which indicates the remaining resource needs of each process. If Need[i][j] = k, then process P(i) may need k more instances of resource type R(j) to complete its task.Need[i][j] = Max[i][j] - Allocation [i][j].
Available, It is an array of length m. It represents the number of available resources of each type. If Available[j] = k, then there are k instances available, of resource type R(j).Max,It is an n x m matrix which represents the maximum number of instances of each resource that a process can request. If Max[i][j] = k, then the process P(i) can request atmost k instances of resource type R(j).Allocation It is an n x m matrix which represents the number of resources of each type currently allocated to each process. If Allocation[i][j] = k, then process P(i) is currently allocated k instances of resource type R(j).Need It is an n x m matrix which indicates the remaining resource needs of each process. If Need[i][j] = k, then process P(i) may need k more instances of resource type R(j) to complete its task.Need[i][j] = Max[i][j] - Allocation [i][j]
max:
P0 : 0 0 1 2
P1 : 1 7 5 0
P2 : 2 3 5 6
P3 : 0 6 5 2
P4 : 0 6 5 6
Allocation:
P0 : 0 0 1 2
P1 : 1 0 0 0
P2 : 1 3 5 4
P3 : 0 6 3 2
P4 : 0 0 1 4
Available: 1 5 2 0
Current system is safe.
The safe process sequence is:
P0->P2->P1->P3->P4
If P1 request resources: 0 4 2 0
Current system is till safe.
The safe process sequence is:
P0->P2->P1->P3->P4
The number of resources available for the system is: 1 1 0 0
need:
Process P0: 0 0 0 0
Process P1: 0 3 3 0
Process P2: 1 0 0 2
Process P3: 0 0 2 0
Process P4: 0 6 4 2
Allocation:
Process P0: 0 0 1 2
Process P1: 1 4 2 0
Process P2: 1 3 5 4
Process P3: 0 6 3 2
Process P4: 0 0 1 4