Lecture2 2023
Lecture2 2023
Vector Time
Time is represented by n-dimensional non-negative integer
vectors.
Each process pi maintains a vector vti [1..n], where vti[i] is the
local logical clock of pi and describes the logical time progress
at process pi.
Vti[j] represents process pi ’s latest knowledge of process pj
local time.
If vti [j]=x, then process pi knows that local time at process pj
has progressed till x.
The entire vector vti constitutes pi ’s view of the global logical
time and is used to timestamp events.
The timestamp of an event is the value of the vector clock of
its process when the event is executed. 2
Data Structures Week 1
4
Data Structures Week 1
6
Data Structures Week 1
7
Data Structures Week 1
8
Data Structures Week 1
9
Data Structures Week 1
10
Data Structures Week 1
What are the limitations of the vector clock?
11
Data Structures Week 1
What can we do to reduce the load?
12
Data Structures Week 1
13
Data Structures Week 1
Optimizations
Consider a message from Pi to Pj.
The message includes the vector time at Pi.
Of the n components of the vector time, only few
would have changed since the last time Pi sent a
message to Pj.
Need to include only those tuples.
(i1, t1), (i2, t2), ...
Update rule changes slightly so that:
Pj updates the component k of its vector time to
max{vtj[k], tk} where tk is the time reported by Pi with
Are we missing
14 something?
the tuple (k, tk)
Data Structures Week 1
Optimizations
Message sizes decrease in general, but local
storage may increase.
Need to know the vector time at Pi when the last
message was sent to Pj, for each j.
15
Data Structures Week 1
Singhal- Kshemkalyani Differential
Technique
• Process pi maintains the following two additional vectors:
LUi[i] =vti[i] ?
Home Work !!
Think about whether vector clocks can detect out of order msgs.
Homework
• Suppose every process can only broadcast messages. Now, I want
to design an algorithm that ensures causal ordering. That is, when
two messages arrive at say Pi; they should be delivered in the order
they have been sent.
Consider these broadcast msgs that reach out of order where msg b
reaches before a.
First P1a
• Next P1 c
• Then, c P3
Teasers-1
• Suppose an updation event at site D at time t was
propagated(broadcasted) to all sites
Teasers-1
• Can I decipher looking at B’s vector sent to me if B has received
the msg from D?
B updates as
VB[D]= max(VB[D], VC[D]).
Hence we do not know if VB[D] is update from C or an update B
already had from D.
Data Structures Week 1
Consider:
• A sends msg to B
• B sends to C
• A sends to C
At C: C receives two msgs. One from A and other from B. However, the
msg sent by B to C is causually ordered after the msg send by A to C.
Hence, msg sent by B to C should be received after msg sent by A to C
Data Structures Week 1
Teasers-2
• Suppose I want to know whether an updation event at site D at time t
which was propagated to all sites has reached everyone assuming
causal order and no lost messages:
Teasers-2
• Let us assume that B got D’s news through C.
Now, that means there were two msgs with recipient as B. One Is the msg
from D and another is a msg from C due to which VB[D]=VC[D].
Now by causual order if two msgs are intended for the same destination;
then the one sent first should reach first.
Can the msg from C to B with D’s update be sent before D’s msg to B?
No as D had broadcast all its msgs. So C can be sending the update on D to
B only after D sent a msg to B.
Hence D’s msg to B will reach first and the update could not have come
through anyone else
Data Structures Week 1
Teasers-3