home page -> teaching -> parallel and distributed programming -> Lecture 10 - Basic distributed protocols

Lecture 10 - Basic distributed protocols

Issues

Causal relations

a happens-before b if either:

Note: non causally related events are called concurrent.

Consistent chronology problem

Problem

We want that all nodes agree on the order some events happen.

We want to assing to each event a distinct timestamp, such that all timestamps are totally ordered and, furthermore, the order is compatible with causal relations (if event A happens-before event B, then the timestamp of A must be smaller than the timestamp of B).

Lamport clocks

Each node keeps the current time as an integer (node: this integer has no relation with the real, physical time; it is just a number that increases as time goes by).

Each time a local event happens on a node, that node increments its clock;

Each message carries the sending timestamp;

When a message is received, the destination sets the clock forward if needed, so that the local clock is larger than the message timestamp;

If we need a strict order of the events, we use the node ID as a tie-break to distinguish events that otherwise have the same timestamp (note that such events can only be concurrent).

Finding causal relations: vector clocks

Each node keeps a local clock, plus, for each of the other nodes, the most recent value of the clock of that node.

Each timestamp is a vector with the clocks of all processes.

A local event leads to incrementing the local clock, but keeping fixed all other clocks (on the node the event happens).

Each message carries its sending timestamp (the vector of all clock values on the source node).

When receiving a message, the local clock is incremented and then each clock of the receiving node is set to the maximum of the current value and the value from the message timestamp.

Causal relation = all components are in larger than or equal to relation.

Consistency models (for shared memory and for broadcast of events)

Distributed transactions

Distributed shared memory

Radu-Lucian LUPŞA
2016-12-20