Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Happened-before relation, concurrent events, Lamport clock, vector clock?

Ook bekend als: happened-before relation · concurrent events · Lamport clock · vector clock

Definition 25.6 University Computer Science — Year 3 · Hoofdstuk 25 — Distributed Systems: Time, Failures and Remote Calls

The happened-before relation →\to on the events of a run is the smallest transitive relation such that e→fe \to f if ee comes before ff in the same process, or ee sends a message that ff receives. Two distinct events are concurrent events, written e∥fe \parallel f, if neither e→fe \to f nor f→ef \to e. A Lamport clock is a counter in each process: before each event the process adds 1 to it, a message carries the sender’s counter, and a receive first sets the counter to the larger of its own and the message’s. The value L(e)L(e) after the event is its timestamp. A vector clock keeps, in each of nn processes, a vector of nn counters: before each event, process ii adds 1 to entry ii; a message carries the sender’s vector, and a receive first takes the entrywise maximum of its own and the message’s. V(e)V(e) is the vector after the event. For vectors, u≤vu \le v means uk≤vku_k \le v_k for every kk, and u<vu < v means u≤vu \le v and u≠vu \ne v.

A space–time diagram of the run of lamport.py: time runs to the right on each process’s line, and each arrow is a message. Each event shows its Lamport timestamp. c1 has the smaller timestamp than a2, yet no chain of messages leads from one to the other.
A space–time diagram of the run of lamport.py: time runs to the right on each process’s line, and each arrow is a message. Each event shows its Lamport timestamp. c1 has the smaller timestamp than a2, yet no chain of messages leads from one to the other.
The same run with vector clocks, each vector written as its three entries, (220) for [2, 2, 0]. The circled events c2 = [2, 2, 2] and b3 = [2, 3, 0] are concurrent: each vector has an entry larger than the other’s.
The same run with vector clocks, each vector written as its three entries, (220) for [2,2,0][2, 2, 0]. The circled events c2 =[2,2,2]= [2, 2, 2] and b3 =[2,3,0]= [2, 3, 0] are concurrent: each vector has an entry larger than the other’s.
Lees in het hoofdstuk →