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

1. Fig. 1 shows the directed graph of a computer system. The white circles insid

ID: 3705142 • Letter: 1

Question

1. Fig. 1 shows the directed graph of a computer system. The white circles inside the rectangle show the number of that type resource. For example, the rectangle labeled with r2 means there are two r2-type resource. Answer the following questions: (1) Find existing resource vector E (2) Find resource allocation matrix C: (3) Find resource request matrix R; (4) Find available resource vector A (5) Is the system deadlocked? If not, what is the order to let all processes run to completion? pl r3 p3 1g

Explanation / Answer

Let us understand the notation of the graphical representation first

1) An edge from a resource to process means resource is occupies by that process

2) and edge from a process to resource means process is requesting for that resource

One more thing to know is if there exixts a cycle in the graph and no resource instance is available in the cycle, this means system is in the deadlock

Now, let us answer each of the question:

1) resource vector E

This vector shows the total number of instance of each ofthe resource present in the system. We have 3 types of resurces, so size of the vecor will be 3.

E = { 3, 2, 2 }.

2) Allocation matrix C

for a system with n processes and m resources, allocation matrix is a nxm matrix in which each row of the matrix tells the instances of various resources allocated to a process. in our case, n=4 and m=3,

E = { 1, 0, 0 ; 0, 2, 0; 1, 0, 0; 0, 0, 2};

3)Resource request matrix R

for a system with n processes and m resources, allocation matrix is a nxm matrix in which each row of the matrix tells the requirement of each of the process, in our case n=4, m=3.

R = { 0, 1, 0 ; 1, 0, 1 ; 0, 1, 0 ; 1, 0, 0}

4) Available resource vector E

It is vector that tells about the various resource instances available

E ={ 1, 0, 0 }

5) We can observe in the graph there are cycles but one instance of the r1 is available. we can give this instance to p4, which will on completion will release 2 instances of r3 and 1 instance of r1, which can then be allocated to p2, which on completion will release 1 instance of r1, 1 instance of r3 and 2 instances of r2.which can then be allocated to p1 and p3 in any order.

So, system is not in deadlock, the possible order of completion are

p4==> p2 ==> p1 ==> p3

and

p4==> p2 ==> p3 ==> p1

1 0 0 0 2 0 1 0 0 0 0 2