Content deleted Content added
Fixed link to spanning tree |
m Move comma in parentheses. |
||
(32 intermediate revisions by 23 users not shown) | |||
Line 1:
The '''Dijkstra–Scholten algorithm''' (named after [[Edsger W. Dijkstra]] and [[Carel S. Scholten]]) is an [[algorithm]] for detecting [[Termination analysis|termination]] in a [[distributed system]].<ref>{{citation|title=Distributed Systems: An Algorithmic Approach|first=Sukumar|last=Ghosh|publisher=CRC Press|year=2010|contribution=9.3.1 The Dijkstra–Scholten Algorithm|pages=140–143|url=https://books.google.com/books?id=aVjVzuav7cIC&pg=PA140|isbn=9781420010848}}.</ref><ref>{{citation|title=Distributed Algorithms: An Intuitive Approach|first=Wan|last=Fokkink|publisher=MIT Press|year=2013|isbn=9780262318952|pages=38–39|url=https://books.google.com/books?id=QqNWAgAAQBAJ&pg=PA38|contribution=6.1 Dijkstra–Scholten algorithm}}.</ref> The algorithm was proposed by Dijkstra and Scholten in 1980.<ref>{{citation
| last1 = Dijkstra | first1 = Edsger W.
| last2 = Scholten | first2 = C. S.
| doi = 10.1016/0020-0190(80)90021-6
| issue = 1
| journal = Information Processing Letters
| mr = 585394
| pages = 1–4
| title = Termination detection for diffusing computations
| url = http://www.cs.mcgill.ca/~lli22/575/termination3.pdf
| volume = 11
| year = 1980}}.</ref>
First,
==
▲Dijkstra-Scholten's 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
** If the receiving process is already in the computation: the process immediately sends an
* When a process has no more children and has become idle, the process detaches itself from the tree by sending an
* Termination occurs when the initiator has no children and has become idle.
==Dijkstra–Scholten algorithm for a tree==
== 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
▲* The algorithm for a tree can be extended to acyclic directed graphs. We add an additional edge [[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.
Line 27 ⟶ 35:
* 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
* 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.
Line 38 ⟶ 45:
*# 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.)
==
==References==
▲[[ Huang's Algorithm ]]
{{reflist}}
{{Edsger Dijkstra}}
[[Category:Algorithms]]▼
[[Category:Termination algorithms]]
[[Category:Edsger W. Dijkstra]]
|