type in the microsoft word and then take a picture uploaded it The following is
ID: 3877722 • Letter: T
Question
type in the microsoft word and then take a picture uploaded it
The following is asystem snapshot of four processes and three resources Max Allocation Available ABC ABC AB C P0 0 00 1 P 7510 0 P 23 5 13 5 P,065 06 3 2 9 9 Total 1 5 2 a) How many resources are there of type (A, B, C)? b) What is the contents of the Need matrix? A B C c) Is the system in a safe state? Why or why not? d) Ifa request from process Piarrives for additional resources of (0,5,2), can the Ba algorithm grant the request immediately? CS317 Banker's Algorithm Homework e) What would be the new system state after the allocation? Max Allocation Need Available A BCA BC ABCABC Po 0 0 1 17 5 2 3 5 0 6 5 TotalExplanation / Answer
Example 1:
a) Number of Resources
A = 2+ 1= 3
B = 9+ 5 = 14
C = 9+ 2 = 11
b) Need Matrix = Max - Allocation
c) Safe State?
P0 executes first as Need = <0 0 0> Available = Available + Allocation = < 1 5 2> + <0 0 1> = < 1 5 3>
P2 executes next as Need = <1 0 0> Available = <1 5 3> +< 1 3 5> = <2 8 8 >
Now P1 can execute as Need = <0 7 5> can be fulfilled with available resources . After execution Available = <2 8 8> + < 1 0 0> = < 3 8 8>
P3 executes next , Available = < 3 8 8> + < 0 6 3> = < 3 14 11>
So system is in safe state and safe sequence is < P0,P2,P1,P3>
d) Need of process P1 = < 0 12 7>
P0 executes first as Need = <0 0 0> Available = Available + Allocation = < 1 5 2> + <0 0 1> = < 1 5 3>
P2 executes next as Need = <1 0 0> Available = <1 5 3> +< 1 3 5> = <2 8 8 >
P3 executes next , Available = < 2 8 8> + < 0 6 3> = < 2 14 11>
P1 executes next as Available > Need , Available = <2 14 11> + < 1 0 0> = < 3 14 11>
So system is in safe state and safe sequence is < P0,P2,P3,P1>. So additional resource request by P1 can be granted.
e.
Example 2
P1 executes first , Available = < 3 3 2> + < 2 0 0 > = < 5 3 2>
P3 executes , Available = < 5 3 2> + < 2 1 1> = < 7 4 3>
P0 executes next, Available = < 7 4 3 > + <0 1 0> = < 7 5 3>
P2 executes , Available = < 7 5 3> + < 3 0 2> = < 10 5 5>
P4 executes , Available = < 10 5 5 > + < 0 0 2> = < 10 5 7>
Yes, it is safe state and safe sequence = < P1,P3,P0,P2,P4>
b)
P1 executes First as Need < Available , Available = < 2 3 0> + < 3 0 2> = < 5 3 2>
P3 executes next , Available = < 5 3 2> + < 2 1 1> = < 7 4 3>
P0 executes,Available = < < 7 4 3> + < 0 1 0> = < 7 5 3>
P2 executes , Available = < 7 5 3> + < 3 0 2> = < 10 5 5>
P4 executes ,Available = < 10 5 5> + < 0 0 2> = < 10 5 7>
Yes, The system is in safe state and the safe sequence is < P1,P3,P0,P2,P4>
Example 3:
P1 executes first , Available = < 3 3 2> + < 2 0 0 > = < 5 3 2>
P3 executes , Available = < 5 3 2> + < 2 1 1> = < 7 4 3>
P0 executes , Available = < 7 4 3> + < 0 1 0> = < 7 5 3>
P2 executes,Available = < 7 5 3> + < 3 0 2> = <10 5 5>
P4 executes,Available = < 10 5 5> + < 0 0 2> = < 10 5 7>
So safe sequence is < P1,P3,P0,P2,P4>
the request can be granted immediately for P1 as Available is < 3 3 2>
A B C P0 0 0 0 P1 0 7 5 P2 1 0 0 P3 0 0 2Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.