Deadlock a. Is a cycle considered to be a necessary and/or a sufficient conditio
ID: 3604711 • 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
DEADLOCK IS A STATE FORM WHICH WE CANT PROCEED FURTHUR
A CIRCULAR WAIT IS NECCESSARY CONDITION FOR DEADLOCK NOT
YES,THIS STATE IS BASED ON RESOURCE ALLOCATION GRAPH
IN RAG EACH PROCESS IS REQUESTING FOR ATLEAST ONE OTHER REQUEST THAT HAS BEEN ASSIGNED TO SOME OTHER PROCESS
B.YES,THERE IS A DEADLOCK
THE WAIT FOR GRAPH IS
THERE IS A CYCLE P1P2P3P5P1
3NO DEADLOCK IS HERE
INTIAL AVAILABLE [2 1 3 3 ] OF INSTANCES OF RESOURCES
CURRENT STATE
ALLOCATION REQUEST
R1 R2 R3 R4 R1 R2 R3 R4
P1 0 1 0 0 0 0 1 0
P2 0 0 1 0 1 0 0 0
P3 1 0 1 0 0 0 0 1
P4 0 0 0 0 0 0 1 0
P5 0 0 0 1 0 1 0 0
SO NOW AVAILABLE IS [1 0 1 2] INSTANCES
SEQUENCE OF EXECUTION P1,P2,P3,P4,P5
R1 R2 R3 R4
1 0 1 2
0 0 1 0(ALLOCATING P1 REQUESTED RESOURCES)
----------------------
1 0 0 2(REMAINING AFTER P1 GOT ITS REQUESTED RESOURCES)
0 1 1 0(P1 ADDS ITS RESUOURCES TO AVAILABLE)
----------------------
1 1 2 2(AFTER CMPLETION OF P1)
IN THIS ORDER ALL PROCESSES GETS THEIR RESOURCES AFTER CMPLETION RELEASES THE RESOURCES
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.