Amit Singh Tomar
Amit Singh Tomar

Reputation: 8610

How do i find deadlock in given diagram?

I have given with two Diagrams, one of the diagram says there exist deadlock and other says there in no deadlock. But I could not find how one says there is no deadlock and one says there is deadlock.

Where is the deadlock in the following diagram??

enter image description here

Upvotes: 0

Views: 2334

Answers (4)

Khan
Khan

Reputation: 1

@Amit singh toamr..i think you are probably asking about the condition when it make a cycle with just two processes..well i have seen that there P2 and P4 are not requesting any resource so i do not make a cycle and for a deadlock to occur it must be a cycle. Hope it help.

Upvotes: 0

Khan
Khan

Reputation: 1

Every process is requesting a resource and holding its own resource as well, it satisfies the conditions of mutual exclusion, no preemption, hold and wait and circular wait condition of deadlock as well so it is a deadlock.

Upvotes: 0

Priyank Bhatnagar
Priyank Bhatnagar

Reputation: 814

Have :-
   R1 R2 R3 R4
P1 0  1  0  0
P2 1  1  0  0
P3 0  0  1  0

Need :-
   R1 R2 R3 R4
P1 1  0  0  0
P2 0  0  1  0
P3 0  1  0  0

Available
R1 0
R2 0
R3 0
R4 3

You can see that in the current state you cannot complete the request of any process, and processes are waiting for other process to free the resources. Thus, its a deadlock.

Upvotes: 4

Anil
Anil

Reputation: 385

Arrows completing a full cycle forms deadlock. In this case R2-P2-R3-P3-R2 is a complete cycle. so deadlock may occur.

Upvotes: 0

Related Questions