Lecture-05. Matrix Virtual
Lecture-05. Matrix Virtual
Matrix clocks
(That is, update its row mt i [i , ∗] with the pj ’s row in the received timestamp, mt)
•Execute R1
•Deliver message m
Matrix Time : Example 1
[0 0 0] [1 0 0]
[0 0 0] [0 0 0]
[0 0 0] [0 0 0]
P1
[0 0 0] e11
[0 0 0]
[0 0 0]
P2
[0 0 0]
[0 0 0]
[0 0 0]
P3
[1 0 0] [2 1 0]
[0 0 0] [1 1 0]
[0 0 0] [0 0 0]
P1
e1 1 e1 2
[1 0 0] [1 0 0] [2 1 0]
[1 1 0] [1 2 1] [2 3 1]
[0 0 0] [0 0 1] [0 0 1]
P2
e21 e22 e23
[0 0 0] [2 1 0]
[0 0 0] [2 3 1]
[0 0 1] [2 3 2]
P3
e31 e32
Working of principal and non-principal vector in matrix clock
Basic Properties
• Vector mt i [i , .] contains all the properties of vector clocks. In addition,
matrix clocks have the following property:
• mink (mt i [k , l ]) ≥ t ⇒ process pi knows that every other process pk knows
that pl ’s local time has progressed till t.
• If this is true, it is clear that process pi knows that all other processes know
that pl will never send information with a local time ≤ t.
• In many applications, this implies that processes will no longer require
from pl certain information and can use this fact to discard obsolete
information.
• If d is always 1 in the rule R1, then mt i [k , l ] denotes the number of events
occurred at pl and known by pk as far as pi ’s knowledge is concerned.
Virtual Time
• Virtual time system is a paradigm for organizing and
synchronizing distributed systems.
• This section provides description of virtual time and its
implementation using the Time Warp mechanism.
• The implementation of virtual time using Time Warp mechanism
works on the basis of an optimistic assumption.
• Time Warp relies on the general lookahead-rollback mechanism
where each process executes without regard to other processes
having synchronization conflicts.
Virtual Time
• If a conflict is discovered, the offending processes are rolled
back to the time just before the conflict and executed forward
along the revised path.
• Detection of conflicts and rollbacks are transparent to users.
• The implementation of Virtual Time using Time Warp
mechanism makes the following optimistic assumption:
synchronization conflicts and thus rollbacks generally occurs
rarely.
Virtual Time
• “Virtual time is a global, one dimensional, temporal coordinate
system on a distributed computation to measure the computational
progress and to define synchronization.”
• A virtual time system is a distributed system executing in
coordination with an imaginary virtual clock that uses virtual time.
• Virtual times are real values that are totally ordered by the less than
relation, “<”.
• Virtual time is implemented a collection of several loosely
synchronized local virtual clocks.
• These local virtual clocks move forward to higher virtual times;
however, occasionally they move backwards.
Virtual Time: Definition
• Processes run concurrently and communicate with each other by exchanging
messages.
• Every message is characterized by four values:
• This is highly undesirable and restrictive because process speeds and message
delays are likely to highly variable.
• It natural for some processes to get ahead in virtual time of other processes.
Time Warp Mechanism
• It is impossible for a process on the basis of local information alone to
block and wait for the message with the next timestamp.
• It is always possible that a message with earlier timestamp arrives
later.
• So, when a process executes a message, it is very difficult for it
determine whether a message with an earlier timestamp will arrive
later.
• This is the central problem in virtual time that is solved by the Time
Warp mechanism.
• The Time warp mechanism assumes that message communication is
reliable, and messages may not be delivered in FIFO order.
Time Warp Mechanism
Time Warp mechanism consists of two major parts:
(i) local control mechanism and (ii) global control mechanism
• Due to different clocks rates, the clocks at various sites may diverge with
time and periodically a clock synchronization must be performed to correct
this clock skew in distributed systems.
• Clocks that must not only be synchronized with each other but also have to
adhere to physical time are termed physical clocks.
Clock Inaccuracies
• Physical clocks are synchronized to an accurate real-time standard like
UTC (Universal Coordinated Time).
•Figure 5.3 illustrates the behavior of fast, slow, and perfect clocks
with respect to UTC.
Clock Inaccuracies
Clock time, C
Perfect Clock dC/dt = 1
UTC, t
Figure 5.3: The behavior of fast, slow, and perfect clocks with respect to UTC.
Offset delay estimation method
• The Network Time Protocol (NTP) which is widely used for clock
synchronization on the Internet uses the Offset Delay Estimation
method.
(i) The primary server at the root synchronizes with the UTC.
(ii) The next level contains secondary servers, which act as a backup to
the primary server.
(iii) At the lowest level is the synchronization subnet which has the
clients.
Clock offset and delay estimation:
• In practice, a source node cannot accurately estimate the local time on the
target node due to varying message or network delays between the nodes.
• Figure 5.4 shows how NTP timestamps are numbered and exchanged
between peers A and B.
• Let T1, T2, T3, T4 be the values of the four most recent timestamps as shown.
Assume clocks A and B are stable and running at the same speed.
Clock offset and delay estimation:
T1 T2
B
A
T3 T4
• Each NTP message includes the latest three timestamps T1, T2 and T3, while
T4 is determined upon arrival.
• Thus, both peers A and B can independently calculate delay and offset using
a single bidirectional message stream as shown in Figure 5.5.
Server A Ti − 2 Ti − 1
Server B Ti − 3 Ti