Four processes (P1, P2, P3, and P4) are sharing three resources (R1, R2 and R3)
ID: 3801948 • Letter: F
Question
Four processes (P1, P2, P3, and P4) are sharing three resources (R1, R2 and R3) in a system. The system has a total of 9 instances of R1, 3 instances of R2 and 6 instances of R3. These four processes' initial resource demands are represented with Matrix M. At time T_1, these processes have resource allocation as described by Matrix a. a) Can you leverage the safety assessment algorithm to evaluate whether each process is able to complete and eventually if the system is safe? Be sure to show the detailed steps. b) If P1 now makes a request for one instance of R1 and one instance of R3, using deadlock avoidance algorithm please determine whether this request will be granted or not. Be sure to show the detailed steps.Explanation / Answer
total resources R1 :9 R2: 3 R3: 6
we need to calculate the need maatrix at T1 which will equal = total resource needed matrix - current allocation matrix.
therefore need matrix = M - A
available R1 = total instances of R1 - allocated R1 at T1 = 9 - 9 = 0
R2 = 3-2 = 1
R3 = 6-5=1
now for P1 : it currently needs(look at needs matrix) 2,2,2 of R1, R2, and R3 , but we only have 0,1,1 so P1's finish flag is set to false!
for P2: needs 0,0,1 we have 0,1,1! Bingo! so we use the resources to finish it. it's finish flag is now TRUE! also, since it's finished it shouldd free the resoursces it was using - free up resources of P2 from mat A! now ur R1 = 6, R2 = 2, R3 = 3
for P3 : needs 1,0,3 we have 6,2,3 . it;ll also finish just like P2, and the uupdated values will be R1 = 8,3,4
for P4 : needs 4,2,0 we have 8,3,4 : it;s finish flag set to TRUE , values upaadates as R's = 8,3,6.
now we'll check for those which have finish flag as false.
we get P1
P1 needs 2,2,2 we have 8,3,6 . It'll also finish ! set flag to true. and updated values become R's = 9,3,6!
therefore P2,P3,P4 then P1 is the order in which the processes needs to finished according to the algorohtm.
------------------------------------
the question (b) is ambigious. if we consider that it is talking about the time after all processes have finished as "now"then -
yes, P1 will be granted the request! since as we saw earlier we have got R1 R2 R3 as 9,3,6 back!
-------------------------------------------------------
2 2 2 0 0 1 1 0 3 4 2 0Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.