You are on page 1of 4

cs604 assignment no solution:

mc170403687:

Question no 1

Consider the below given snapshot of the system. P1 to P5 represent the 5 processes currently running
on the system. M, N, O and P represent the resources whereas M, N, O and P have 13, 11, 9 and 16
instances respectively.

Processes Allocation Max


M N O P M N O P
P1 0 0 1 2 4 3 2 2
P2 3 1 2 1 5 2 4 2
P3 2 1 0 3 4 4 2 6
P4 1 3 1 2 3 3 3 4
P5 1 4 3 2 4 5 5 5

(a) What will be the content of the matrix Available?

processes Available
M N O p
P1 6 2 2 6
P2 9 3 4 7
P3 11 4 4 10
P4 12 7 5 12
P5 13 11 9 14
Q2 What will be the content of the matrix Need?

processes Need
M N O p
P1 4 3 1 0
P2 2 1 2 1
P3 2 3 2 3
P4 2 0 2 1
P5 3 1 2 3

Is the system in a safe state Yes/No? If yes, then identify the safe sequence.

<p2,p3,p4,p5,> is a safe sequence in this state.

processe Allocation Need Available


s
M N O P M N O P M N O P
P1 0 0 1 2 4 3 1 0 6 2 2 6
P2 3 1 2 1 2 1 2 1 9 3 4 7
P3 2 1 0 3 2 3 2 3
P4 1 3 1 2 2 0 2 1
P5 1 4 3 2 3 1 2 3
Safe sequence <p2>
processes Allocation Need Available
M N O P M N O P M N O P
P1 0 0 1 2 4 3 1 0 6 2 2 6
P2 3 1 2 1 2 1 2 1 9 3 4 7
P3 2 1 0 3 2 3 2 3 11 4 4 10
P4 1 3 1 2 2 0 2 1
P5 1 4 3 2 3 1 2 3
Safe sequence <p2,p3>

processes Allocation Need Available


M N O P M N O P M N O P
P1 0 0 1 2 4 3 1 0 6 2 2 6
P2 3 1 2 1 2 1 2 1 9 3 4 7
P3 2 1 0 3 2 3 2 3 11 4 4 10
P4 1 3 1 2 2 0 2 1 12 7 5 12
P5 1 4 3 2 3 1 2 3
Safe sequence <p2,p3,p4>

processes Allocation Need Available


M N O P M N O P M N O P
P1 0 0 1 2 4 3 1 0 6 2 2 6
P2 3 1 2 1 2 1 2 1 9 3 4 7
P3 2 1 0 3 2 3 2 3 11 4 4 10
P4 1 3 1 2 2 0 2 1 12 7 5 12
P5 1 4 3 2 3 1 2 3 13 11 9 14
Safe sequences <p2,p3,p4,p5>

Question No 2

Consider the following resource allocation graph. Is there any deadlock in this graph or not? If yes, then
mention the dead lock sequence.

This graph is show cycle and p1, p2, p3 are a deadlock sequences but p4 is not dead lock sequences.

You might also like