0
6.0kviews
Consider the given snap of the system
Process Allocation Max Available
--- A B C A B C A B C
P0 1 1 2 4 3 3 2 1 0
P1 2 1 2 3 2 2 ---
P2 0 2 0 4 4 2 ---
P3 0 6 3 2 6 3 ---
P4 1 1 2 2 2 3 ---

Answer the following questions using bankers algorithm

i)Determine the total amount of resources of each type?

ii)what is the content of matrix needed?

iii)Determine the system in safe state using safety algorithm?

iv)if a request for p1 arrives for (1,1,0) can the request be granted immediately?

1 Answer
0
486views

i) Determine the total amount of resources of each type?
Available
total amount of resources of each type A , B & C is 6 , 12 & 9 respectively.

ii)What is the content of matrix needed?
Matrix

iii)Determine the system in safe state using safety algorithm?

  1. Need for process P0 is (3,2,1) and available (2,1,0)
    Need < = available => False
    Move to the next process

  2. Need for process P1 is (1,1,0) and available (2,1,0)
    Need < = available => True
    The request for P1 is granted and process will be release resources.
    Work = Available + Allocation
    = (2,1,0) + (2,1,2)
    = (4,2,2)

  3. Need for process P2 is (4,2,2) and available (4,2,2)
    Need < = available => True
    The request for P2 is granted and process will be release resources.
    Work = Available + Allocation
    = (4,2,2) + (0,2,0)
    = (4,6,2)

  4. Need for process P3 is (2,0,0) and available (4,6,2)
    Need < = available => True
    The request for P3 is granted and process will be release resources.
    Work = Available + Allocation
    = (4,6,2) + (0,6,3)
    = (4,12,5)

  5. Need for process P4 is (1,1,1) and available (4,12,5)
    Need < = available => True
    The request for P4 is granted and process will be release resources.
    Work = Available + Allocation
    = (4,12,5) + (1,1,2)
    = (5,13,7)

    6.Need for process P0 is (3,2,1) and available (5,13,7)
    Need < = available => True
    The request for P0 is granted and process will be release resources.
    Work = Available + Allocation
    = (5,13,7) + (1,1,2)
    = (6,14,9)

Safe Sequence is (P1, P2, P3, P4, P0)

iv)If a request for p1 arrives for (1,1,0) can the request be granted immediately?
Yes if P1 arrives for (1,1,0) the request can be granted immediately.as available resources are 2,1,0

  1. Need for process P0 is (3,2,1) and available (2,1,0)
    Need < = available => False
    Move to the next process

  2. Need for process P1 is (1,1,0) and available (2,1,0)
    Need < = available => True
    The request for P1 is granted and process will be release resources.
    Work = Available + Allocation
    = (2,1,0) + (2,1,2)
    = (4,2,2)

Please log in to add an answer.