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

Deadlock a. Is a cycle considered to be a necessary and/or a sufficient conditio

ID: 3605741 • Letter: D

Question

Deadlock

a. Is a cycle considered to be a necessary and/or a sufficient condition for deadlock? Explain. Is the answer dependent on any particular characteristic of the resource allocation graph being considered? Justify your answer (provide as well-reasoned a justification as you can based on the concepts discussed in class related to deadlock, and the content of the class slides).

b. Suppose a system has 5 processes, P = {P1, P2, P3, P4, P5}, and 4 resources types, R = {R1, R2, R3, R4}. Further, assume one instance of each resource type. The current state of the system is defined by the following requests and assignments;

P1 is requesting R3 and has been assigned R2

P2 is requesting R1 and has been assigned R3

P3 is requesting R4 and has been assigned R1

P4 is requesting R3

P5 is requesting R2 and has been assigned R4

Is there deadlock in this system (Explicitly state that there is or is not)? If applicable, draw a wait-for graph or resource-allocation graph, and use the appropriate graph to justify your answer, or, if you conclude there is no deadlock, your justification should contain a sequence of execution for the processes which shows that all processes can execute to completion.

c .Suppose a system has 5 processes, P = {P1, P2, P3, P4, P5}, and 4 resources, R = {R1, R2, R3, R4}, where W = {2, 1, 3, 3}. The current state of the system is defined by the following requests and assignments;

P1 is requesting an instance of R3 and has been assigned an instance of R2

P2 is requesting an instance of R1 and has been assigned an instance of R3

P3 is requesting an instance of R4 and has been assigned an instance of R1 and an instance of R3

P4 is requesting an instance of R3

P5 is requesting an instance of R2 and has been assigned an instance of R4

Is there deadlock in this system (Explicitly state that there is or is not)? If applicable, draw a wait-for graph or resource-allocation graph, and use the appropriate graph to justify your answer, or, if you conclude there is no deadlock, your justification should contain a sequence of execution for the processes which shows that all processes can execute to completion.

Explanation / Answer

a)   p1 ----requesting---->R3 -----holding----R2
     p2----reqiesting---->R1   ------holding---R3
     p3----requesting-----R4   -------holding---R1
     p4----requesting----R3
     p5----requesting----R2   ----holding----R4


    It is a clear case of deadlock. p1 waiting for R3, R3 is held by p2 and
    p2 wants R1, R1 is with P3 , P3 is waiting for R4 held by P5, P4 is waiting for R3 held by p2,

    Till p4 gets released, deadloc will not go and that can not happen as p1 is holding R2


b)   p1 ----requesting---->R3 -----holding----R2
     p2----reqiesting---->R1   ------holding---R3
     p3----requesting-----R4   -------holding---R1
     p4----requesting----R3
     p5----requesting----R2   ----holding----R4

    So we are having 2 instances of R1, 1 inatance of R2, 3 instances of R3
     3 instances of R4.

    No deadlock as resources are availbale for all the processes. p1 wants R3 and P4 wants R3. We have 3 R3s. One is held by p2 so the other two can be given to p1 and p4. p2 wants R1. We have 2 R1s , one is held by p3 so the other can be given to p2.p3 wants R4, 3 R4s are there, one is held by p5, 2 are free so one can be given to p3. p5 can get R2 as p1 will reklease it.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote