Messages

Lesson 2 – Distributed Systems
Distributed systems
Module 2 - Distributed algorithms
Teaching unit 1 – Basic techniques
Ernesto Damiani
University of Bozen
Leader election
• Assumptions
– Ring topology
– Synchronous network
– No failures
• Goal
– Exactly one process says: “I am the leader”
Algorithms
• Basic
– Time: O(n) rounds
– Message complexity: O(n2)
• More complicated
– Time: O(n) rounds
– Message complexity: O(n log n)
Lower bounds - Messages
• Comparison based algorithms
– O(n log n) messages
• In general
– O(n) messages
• Asynchronous networks
– O(n log n)
Shortest path routes
• Input
– Connected, undirected graph
– Destination
• Output
– Shortest route to destination
• Model: self-stabilizing
– Asynchronous
– Arbitrary failures (corrupt state)
– Eventual stabilization
Bellman-Ford
• Every so often:
– Ask all neighbors distance
– Set distance to minimum
• Destination always: distance=0
• Stabilizes after n “rounds”
Consensus
• Input
– 1 or 0 to each node
• Output
– Agreement: all nodes decide either 0 or 1
– Termination: all nodes eventually decide
– Validity: if all inputs 1, then decide 1
Motivation
• Many problems equivalent to consensus
– Read-Modify-Write Memory
– Database commit
– Transactional filesystem
– Totally ordered broadcast
– Distributed firing squad
Universality result
• Assume consensus service
• Assume non-fault tolerant sequential algorithm
(date object) A
• Then
– There exists a fault-tolerant, wait-free distributed
implementation A’ of algorithm A
Asynchronous consensus
• Assume 1 stopping failure
• Impossible! [FLP 1985]
• If consensus algorithm C guarantees agreement
and validity
• Then
– There exists an execution of C that does not terminate
More consensus models
• Synchronous
– f+1 rounds if f failures
• Asynchronous plus eventual synchrony
– Eventual synchronized clocks
– Eventual message delivery bound d
– Consensus terminates
 0((f+4)*d) after stabilization
Failure detectors
• Assume total asynchrony
• Assume failure detector service
– Notifies node i when node j fails
– Eventually…
• Allow solving consensus
– Weakest failure-detector?
– Leader-election failure-detector
Byzantine consensus
• What if some nodes lie?
• Synchronous model
• f stopping failures
• n nodes
• 2f+1 ≤ n
Other consensus problems
• Weak consensus
– Not feasible
• Weak Byzantine consensus
– Not feasible
• k-set consensus
– f < k => feasible
• Approximate consensus
Current research
• Dynamic networks
– Joins/Leaves/Failures
– Peer-to-peer networks
– Mobile networks
– Unknown participants
• Large scale networks
– Data warehouses
– Internet sized applications
– Non-blocking, wait-free implementations
Formal methods
• IOA language and compiler
• Simulator
• Proof tools
– Larch prover
– Daikon invariant detection
• Java code generator (in progress)
Summary of results (1)
Summary of results (2)
Models
• Nodes
– Bounded/unbounded
– Unique ids
– Known/unknown participants
• Communication
– Network links
 Known/unknown topology
– Shared memory
Atomic memory
• Definition
• Motivation
• Algorithms?
Mutual exclusion
• Dijkstra
• Dining philosophers
• Resource allocation
FINE