Logical Time: (Scalar Time, Vector Time, and Matrix Time)
Logical Time: (Scalar Time, Vector Time, and Matrix Time)
Logical clock
In a system of logical clocks, every process
implementation requires
two issues :
1. Data
structures local to every
process to represent logical time
2. A protocol (set of rules) to update the
data
structures
to
ensure
the
consistency condition.
A protocol
structures
to
update
the
data
Scalar time
The scalar time representation was proposed
pi and its
as follows:
10
11
12
13
14
Tie braking
The third event of process P1 and the second event of
process P2 have identical scalar timestamp. Thus, a tiebreaking mechanism is needed to order such events.
A tie is broken as follows:
Process identifiers are linearly ordered and a tie among
events with identical scalar timestamp is broken on the
basis of their process identifiers.
The lower the process identifier in the ranking, the
higher the priority. The timestamp of an event is
denoted by a tuple (t, i); where t is its time of
occurrence and i is the identity of the process where it
occurred.
The total order relation
denoted as on two
events x and y with timestamps (h, i) and (k, j),
respectively, is defined as follows:
15
Event counting
If the increment value d is always 1, the scalar time has
17
No strong consistency
The system of scalar clocks is not strongly
18
No strong consistency
The reason that scalar clocks are not strongly
19
20
Questions
22
Vector clocks
The system of vector clocks was developed
independently by Fidgety, Mattern and
Schmuck
23
Vector Times
The system of vector clocks was developed
progress at process Pj
a single value.
vti is the clock at process i; it has a component for
25
Vector clocks
The time domain is represented by a set of n-
27
28
29
(2,0,
0)
(3,2,
3)
(2,1,
0)
(2,2,
0)
(0,0,
1)
(2,2,
3)
(2,2,
2)
31
33
34
35
36
between successive
message sends to the same process, only a few entries of
the vector clock at the sender process are likely to
change.
When a process pi sends a message to a process pj , it
piggybacks only those entries of its vector clock that differ
since the last message sent to pj .
cuts down the message size, communication bandwidth
and buffer (to store messages) requirements.
37
differential
technique is based on the observation that
between successive message sends to the
same process, only a few entries of the vector
clock at the sender process are likely to change.
This
is more likely when the number of
processes is large because only a few of them
will interact frequently by passing messages.
In this technique, when a process pi sends a
message to a process pj , it piggybacks only
those entries of its vector clock that differ since
the last message sent to pj .
38
Working of SinghalKshemkalyanis
differential technique
39
40
41
messages
Vi[i] is only incremented when sending
When k gets a msg from j, with
ts[j] = Vk[j] + 1
(timestamp
Causally-Ordered Multicasting
P2 [0,0,0]
P1 [0,0,0]
P3
[0,0,0]
Post a
[1,0,0] a
[1,0,0]
[1,0,0]
r: Reply a
[1,0,1]
[1,0,1]
[1,0,1]
43
Two messages:
message a from P1;
message r from P3 replying to message a;
Scenario1: at P2, message a arrives before the reply r
P1 [0,0,0]
P3 [0,0,0]
Post a
[1,0,0] a
[1,0,0]
[1,0,1] r: Reply a
Buffered
b
[1,0,1]
c
[1,0,0]
Deliver r
Ordered Communication
Totally ordered multicast
Use Lamport timestamps
Causally ordered multicast
Use vector timestamps
45
46
P2
e11
e21
e12
e22
e13
e23
e14
e15
e16
e24
e17
e25
Matrix time
49
Matrix Time
Vector time contains information about
Matrix Time
A system of matrix clocks was first informally
51
52
53
54
55
56
Let
58
59
in the
order of scalar, vector, and matrix, but so do the
complexity and the overheads.
60
61
Introduction
In virtual time, the reverse of the above
62
63
Virtual send time is the virtual time at the sender when the
68
69
5. Virtual
71
72
73
Exercises
Exercise
A system of four processes, (P1, P2, P3, P4),
g).
P2executes a local event.
P2receives a message from P3(from event f).
P3receives a message from P1(from event a).
P3sends a message to P2(to event d).
P3sends a message to P1(to event b).
P4executes a local event.
When taking place on the same processor, the
75
Assign
76
Exercise
77
Exercise
Assign
78
Exercise
You are synchronizing your clock from a time
Exercise
You are synchronizing your clock from a time
81