Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

11. Consider the following snapshot of a system with five processes(p1,...p5) an

ID: 3726832 • Letter: 1

Question

11. Consider the following snapshot of a system with five processes(p1,...p5) and four resources (r1,...r4). There are no current outstanding queued unsatisfied requests.
currently available resources


a. Compute what each process still might request and fill in the "still needs" columns. b. Is this system currently deadlocked, or will any process become deadlocked? Why or why not? If not, give an execution order c. If a request from p3 arrives for (0,1,0,0), can that request be safely granted immediately? In what state (deadlocked, safe, unsafe) would immediately granting the whole request leave the system? Which processes, if any, are or may become deadlocked if this whole request is granted immediately?

currently available resource:s 1 0 0 current allocationlmax demand still needs p2 p3 p4 Ded Process r1 r2 r3 r4r1 r2r3 r4r1 r2r3 r4 0 0 1 2 0 0 1 2 20 l0 (0 2 7 50 0 0 3 4 6 6 56 2354A356 0 3 3 2 0 6 5 2

Explanation / Answer

b)

P1 executes first as still needs = <0 0 0 0> , work = available + current allocation = <2 1 0 0> + <0 0 1 2>

= <2 1 1 2>

P4 executes , work = available + current allocation = <2 1 1 2> + <2 3 5 4> = <4 4 6 6>

P5 executes , work = available + current allocation = <4 4 6 6> + <0 3 3 2> = <4 7 9 8>

P2 executes , work = available + current allocation = <4 7 9 8> + <2 0 0 0> = <6 7 9 8>

P3 executes , work = available + current allocation = <6 7 9 8> + <0 0 3 4> = <6 7 12 12 >

execution order = <p1,p4,p5,p2,p3>

The system is not in deadlock state.

c.

The request from p3 arrives for (0,1,0,0), can be safely granted immediately and the system will still be in safe state.

process current allocation max demand a)still needs = max demand - current allocation <r1 r2 r3 r4> <r1 r2 r3 r4> <r1 r2 r3 r4> p1 <0 0 1 2> < 0 0 1 2> <0 0 0 0> p2 <2 0 0 0> <2 7 5 0> <0 7 5 0> p3 <0 0 3 4> <6 6 5 6> <6 6 2 2> p4 <2 3 5 4> <4 3 5 6> <2 0 0 2> p5 <0 3 3 2> <0 6 5 2> <0 3 2 0>