125 views

Definition of a set of deadlocked Processes:

“A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause.”

P1, P2, and P3 have caused deadlock but every process including P4 is in the deadlocked set of processes, isn’t it?

I think $P1,P2,P3$ is the set of deadlock process because it is the  maximal set of processes where each process holding a resources and waiting to acquire a resources which held by another process in the set . Now P4 waiting for a resource to be free so that it can acquire it but it is not holding any resources which the set of deadlock process maintain .

As per the definition given by you ,

“A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause.”

By this also P4 should not be included as P1,P2,P3 is not waiting for P4 to do any event  only P1,P2,P3 waiting for each other .

Please correct me if I am wrong 🙇‍♂️

Actually, that’s not my definition. It’s the standard definition that I saw in both Galvin and Tanenbaum. I copy pasted that definition from Tanenbaum.

Let’s say there is a set of four processes, {P1, P2, P3, P4}.

Here,

P1 is waiting for release_R2 which can be caused by P2

P2 is waiting for release_R3 which can be caused by P3

P3 is waiting for release_R1 which can be caused by P1

and

P4 is waiting for release_R1 too which can be caused by only P1

Every process in this set is waiting for an event(release event) that only another process in the set can cause.

Therefore, By definition, this set is a set of deadlocked processes, Where P1, P2, and P3 have caused that deadlock by participating in circular wait condition.

@jomboy how the set {p1,p2,p3 } waiting for p4 ? By the definition each process in the set should waiting for an event caused by another process so if we include P4 in the set {p1,p2,p3} then in the set {p1,p2,p3,p4} any other process except p4 should waiting for an event caused p4 but no process waiting for p4 and even if you remove p4 it does not affect the deadlock anyway but if you remove any process from {p1,p2,p3} then it affect the deadlock  which is maximal also.

yes, {P1, P2, P3} is a set of deadlocked processes for that resource allocation graph. In fact, this is the set that caused the deadlock. But that set doesn’t show every deadlocked process for that resource allocation graph. In the set {P1, P2, P3, P4}, P4 is included because it depends on an event that can be caused by only P1, which is in the set. No process is depending on P4, because they depend on processes other than P4. But P4 is depending on only P1 which is in the set, and that is enough for the inclusion of P4 in the deadlocked set of processes. Please read the definition again. If P4 depends on any process in the set that caused deadlock, it's enough for its inclusion. No process has to depend on it.