[Solved]: Algorithm for wait-for graph

Problem Detail: During the process of deadlock detection, the wait-for graph can be obtained from the resource-allocation graph. To detect whether there is a deadlock using the wait-for graph, can topological sort be used? By making a slight modification, i.e., instead of removing the source as done in usual topological sort, we can remove the node (here, node represents a process) which does not point to another node first and proceed in this manner. As soon as the algorithm detects that it cannot proceed further and there are still nodes existing in the wait-for graph, it can be concluded as deadlock. Other tags are topological-sort and deadlock-detection.

Asked By : user2555595

Answered By : Yuval Filmus

Hint: There is deadlock in the wait-for graph if the graph has directed cycles (why?). Perhaps topological sort is useful for detecting these.
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/18274

Leave a Reply