0% found this document useful (0 votes)
11 views

Termination Detection Topic 3, Distributed Algorithms Chapter 6

The document discusses termination detection in distributed systems, outlining key concepts and various algorithms such as Dijkstra-Scholten, Weight-throwing, Rana's, and Safra's algorithms. It explains the importance of termination detection and provides rules and examples for each algorithm. The document concludes with a comparison of the algorithms based on their reliability, complexity, and suitability for different system architectures.

Uploaded by

Havuç Ağacu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Termination Detection Topic 3, Distributed Algorithms Chapter 6

The document discusses termination detection in distributed systems, outlining key concepts and various algorithms such as Dijkstra-Scholten, Weight-throwing, Rana's, and Safra's algorithms. It explains the importance of termination detection and provides rules and examples for each algorithm. The document concludes with a comparison of the algorithms based on their reliability, complexity, and suitability for different system architectures.

Uploaded by

Havuç Ağacu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Termination

Detection
Chapter 6
Topic 3, Distributed Algorithms

Hüseyin Safa Ünlü 477019


M784 Seminar on Topics in Computer
Engineering
Table of
Contents

3 What is Termination 11 Rana’s algorithm (3)


Detection?
4 Key Concepts 13 Safra’s algorithm (4)

6 Introduction To Algorithms 14 Resources

9 Dijkstra-Scholten algorithm 15 Questions?


(1)
10 Weight-throwing algorithm
(2)
Termination Detection What is Termination Detection? 3

What is
Terminated
Distributed
System?
What is Termination
Detection?

Why Termination
Detection is
important?
Termination Detection 4

Key Concepts
Process Active & Passive State Message & Acknowledge & Control &
Token
A process is an individual unit of A process is in an active state if it is A message is communication sent
computation. still working or has sent a message. from one process to another.
In embedded or IoT systems, a process
can be a sensor, or traffic light node A process is passive if it has finished An acknowledgment is a reply
connected via wireless ( BLE) or wired and is waiting, doing nothing. A confirming receipt of a message or
(SPI) communication. process can turn passive when its action.
instructions finishes.
A control message sent when a
process turns passive.
Termination Detection 5

Key Concepts
Initiator Parent-Child Termination & Announce

The process that starts first. Initiator is If a process activated the other one by Termination happens when all
usually parent of rest of the processes. sending a message, processes are passive and no
messages are in transit.
● Message sender is the parent
● Message receiver is the child After detecting termination, when
● A child can have children. initiator has no child, initiator
● A parent have multiple children Announces.
Termination Detection

Introduction To Major Termination Detection


Algorithms
Dijkstra-Scholten algorithm Weight-throwing algorithm
● Tree structure ● Simple Weight Method
● System gets activated with ● Parents give weights to children.
initiator(Root). ● When all weight returns the parent
● P can disappear leave the tree when it TERMINATION DETECTED.
has no child and it is passive.
● When every P disappears TERMINATION
DETECTED.

Rana’s algorithm Safra’s algorithm


● Decentralized structure ● Ring structure
● Every message return message with time ● A token rings in the system checks
● Time-Wave systems controls termination.
TERMINATION. ● If token returns unchanged
TERMINATION DETECTED.
6
Termination Detection 7

Dijkstra-Scholten Algorithm
Rules (1)

● Tree structure, undirected network


● System gets activated with
initiator(Root).
● A process gets activated by
message.
● Message sender is parent, receiver
is child.
● A process can leave the tree when
it has no child and it is passive.
● Processes have child count.
● If a process leaves the tree it should
send ACK to its parents.
● If message receiving process is
active, it sends ACK.
● When every process disappears
from the tree and there is no
message in transmission
TERMINATION DETECTED.
Termination Detection 8

Dijkstra-Scholten Algorithm
Example

Child algorithm of Dijkstra-Scholten, Shavit-Francez algorithm has multiple trees like


a forest. Only Announce part diffires. All the trees needs to finish for Termination. So
every tree that terminated send message to its disjoint tree which starts a chain
Termination Detection 9

Weight-throwing Algorithm
Rules (2)
● Every process has weight w>=0.
● An Active process has w>0
passive has w=0.
● Initiator can send its weight to
its children.
● Iıtıator understands termination
detection by the weight it
started.
● Every process can send a
message to reduce its weight.
● When a process turns passive, it
sends a control message and
its weight returns to its parent.
● When initiator returns to its
starting weight TERMİNATION
DETECTED and it announces .
Termination Detection 10

Weight-throwing Algorithm
Example

Simple method but, weight can be divided too much. To fix underflow a
process can give weight to itself or P can wait for its child to be passive
Termination Detection 11

Rana’s Algorithm Rules (3)


Each process keeps a logical clock starting at 0. When it sends,
receives, or acknowledges a message, it updates its clock to reflect
the event time.

Every basic message must be acknowledged. The acknowledgment


includes the sender’s clock value, and the receiver updates its
clock to max(current clock, sender time + 1).

A process becomes quiet when it is passive (not doing work) and


has received ACKs for all basic messages it sent.

When a process becomes quiet, it starts a wave tagged with its ID


and current clock value t.
Source: Fokkink, W. (2013). Distributed
A process joins a wave only if it has been quiet continuously since a algorithms: an intuitive approach. MIT Press.
time ≤ t. When joining, it updates its clock to max(current clock, t).

If a wave returns to its initiator after visiting all eligible quiet


processes, the initiator calls Announce to declare that the system
has terminated.

If one wave cannot complete, newer waves with larger timestamps


Termination Detection 12

Rana’s Algorithm
Example
Termination Detection 13

Safra’s Algorithm Rules (4)


● Traversal-Ringing type termination.
● Base form all P white and passive.
● Every process (P) has a counter.
● Process count= (sent messages) - (received messages).
● P getting message turn black.

● A token visits each process in a fixed order.


● The token travels every process (P) at its route and only passive P passes through.
● The token has a counter on it.
● Only passive processes can forward the token.
● When a process receives the token, it adds its counter value to the token's counter.
● If the process is white, it leaves the token color unchanged.
● If the process is black, it turns white and colors the token black.
● The token carries the sum of counters and its color.
● When the token returns to the initiator:
● – if the initiator is white,
● – and the token is white,
● – and the token counter is 0,
● then the initiator calls announce: TERMINATION DETECTED.
● Otherwise, the initiator waits until it becomes passive again, and sends a new white
token with counter 0.
Termination Detection 14

Safra’s Algorithm Example


Termination Detection

Result

Dijkstra-Scholten algorithm Weight-throwing algorithm


● Reliable ● Simple
● Requires Central ● Over floating
Initiator ● Can be
inaccurate
● Centralized

Rana’s algorithm Safra’s algorithm


● Fully ● Less messages
Decentralized ● Centralized
● Complex Clock ● Mostly used in
System ring topologies
15
Introduction to DNA References 16

References
● Fokkink, W. (2013). Distributed algorithms: an intuitive approach.
MIT Press.
● Rana’s algorithm:
https://www.youtube.com/watch?v=egX7JxDlri4
● Fokkink, W. (2021) Fault-Tolerant Termination Detection with
Safras Algorithm

16
Introduction to DNA Questions? 17

QR to Slide
Questions?

Questions?

You might also like