Dijkstra–Scholten algorithm
   HOME

TheInfoList



OR:

The Dijkstra–Scholten algorithm (named after Edsger W. Dijkstra and Carel S. Scholten) is an
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
for detecting
termination Termination may refer to: Science *Termination (geomorphology), the period of time of relatively rapid change from cold, glacial conditions to warm interglacial condition *Termination factor, in genetics, part of the process of transcribing RNA ...
in a
distributed system A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
. The algorithm was proposed by Dijkstra and Scholten in 1980.. First, consider the case of a simple
process graph In mathematics graph theory a process graph or P-graph is a directed bipartite graph used in workflow modeling. Description With a process graph, the vertices of the graph are of two types, operation (O) and material (M). These vertex types form ...
which is a
tree In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, including only woody plants with secondary growth, plants that are ...
. A distributed computation which is tree-structured is not uncommon. Such a process graph may arise when the computation is strictly a divide-and-conquer type. A
node In general, a node is a localized swelling (a "knot") or a point of intersection (a vertex). Node may refer to: In mathematics * Vertex (graph theory), a vertex in a mathematical graph *Vertex (geometry), a point where two or more curves, lines ...
starts the computation and divides the problem in two (or more, usually a multiple of 2) roughly equal parts and distribute those parts to other processors. This process continues recursively until the problems are of sufficiently small size to solve in a single processor.


Algorithm

The Dijkstra–Scholten algorithm is a tree-based algorithm which can be described by the following: * The initiator of a computation is the root of the tree. * Upon receiving a computational message: ** If the receiving process is currently not in the computation: the process joins the tree by becoming a child of the sender of the message. (No acknowledgment message is sent at this point.) ** If the receiving process is already in the computation: the process immediately sends an acknowledgment message to the sender of the message. * When a process has no more children and has become idle, the process detaches itself from the tree by sending an acknowledgment message to its tree parent. * Termination occurs when the initiator has no children and has become idle.


Dijkstra–Scholten algorithm for a tree

* For a tree, it is easy to detect termination. When a leaf process determines that it has terminated, it sends a signal to its parent. In general, a process waits for all its children to send signals and then it sends a signal to its parent. * The program terminates when the root receives signals from all its children.


Dijkstra–Scholten algorithm for directed acyclic graphs

* The algorithm for a tree can be extended to acyclic directed graphs. We add an additional integer attribute Deficit to each edge. * On an incoming edge, Deficit will denote the difference between the number of messages received and the number of signals sent in reply. * When a node wishes to terminate, it waits until it has received signals from outgoing edges reducing their deficits to zero. * Then it sends enough signals to ensure that the deficit is zero on each incoming edge. * Since the graph is acyclic, some nodes will have no outgoing edges and these nodes will be the first to terminate after sending enough signals to their incoming edges. After that the nodes at higher levels will terminate level by level.


Dijkstra–Scholten algorithm for cyclic directed graphs

* If cycles are allowed, the previous algorithm does not work. This is because, there may not be any node with zero outgoing edges. So, potentially there is no node which can terminate without consulting other nodes. * The Dijkstra–Scholten algorithm solves this problem by implicitly creating a spanning tree of the graph. A spanning-tree is a tree which includes each node of the underlying graph once and the edge-set is a subset of the original set of edges. * The tree will be directed (i.e., the channels will be directed) with the source node (which initiates the computation) as the root. * The spanning-tree is created in the following way. A variable ''First_Edge'' is added to each node. When a node receives a message for the first time, it initializes ''First_Edge'' with the edge through which it received the message. ''First_Edge'' is never changed afterwards. Note that, the spanning tree is not unique and it depends on the order of messages in the system. * Termination is handled by each node in three steps : *# Send signals on all incoming edges except the first edge. (Each node will send signals which reduces the deficit on each incoming edge to zero.) *# Wait for signals from all outgoing edges. (The number of signals received on each outgoing edge should reduce each of their deficits to zero.) *# Send signals on ''First_Edge''. (Once steps 1 and 2 are complete, a node informs its parent in the spanning tree about its intention of terminating.)


See also

* Huang's algorithm


References

{{DEFAULTSORT:Dijkstra-Scholten Algorithm Graph algorithms Termination algorithms Edsger W. Dijkstra