• No results found

3.1 Clock Synchronisation

N/A
N/A
Protected

Academic year: 2021

Share "3.1 Clock Synchronisation"

Copied!
11
0
0

Loading.... (view fulltext now)

Full text

(1)

• the synchronisation of the different channels, through the construction 1

of a global clock, 2

• the exchange of data between channels, through interactive consistency 3

(consensus) on non-replicated data 4

For each of these two functions, this chapter describes the rationale 5

behind the choice of a particular solution, and then details the adopted 6

solution for GUARDS. At last, a third section focuses on the way inter-7

channel messages are authenticated, taking into account the tight 8

performance constraints of a real-time system. 9

3.1

Clock Synchronisation

10

This section first presents some commonly-used definitions and notations 11

in the field of the clock synchronisation problem, and then gives an 12

overview of the known solutions that fits to the GUARDS constraints. At 13

last, the GUARDS synchronisation algorithm is detailed, including the 14

initial synchronisation. 15

3.1.1 Definitions and Notations

16

We consider a set of fully connected nodes. Each node has a physical 17

clock, and computes a logical clock time. 18

Definition 1: Clock time

19

Each node maintains a logical clock time T = C(t), meaning that at real-20

time t the clock time of the local node is T. 21

By convention, variables associated with clock time (local to a given 22

node) are in uppercase, whereas variables associated with real time 23

(measured in an assumed global Newtonian frame) are in lowercase. 24

Definition 2 : drift rate

(2)

A nonfaulty physical clock C has a maximum drift rate ρ if and only if for 1 any t2 > t1: 2 1 2 1 1 2 1 − < − − < + ρ C t C t ρ t t ( ) ( ) 3 Definition 3 : agreement 4

The agreement condition is satisfied if and only if the skew δ between any 5

nonfaulty logical clocks Ci and Cj is bounded: 6

C ti( )−C tj( ) ≤δ 7

Definition 4 : accuracy

8

The accuracy condition is satisfied if and only if any nonfaulty logical clock 9

Ci stay within a linear envelop of real time. That is, there exists a constant 10

γ>0 and two constants a and b (that depend on initial conditions) such that: 11

(1−γ)t a C t+ ≤ i( ) (≤ 1+γ)t b+ 12

Definition 5 : synchronisation algorithm

13

A synchronisation algorithm is an algorithm which satisfies the agreement 14

and accuracy conditions. 15

16

Some typical values of the parameters introduced so far or used in the 17

sequel of the section are given in $$$Table 1. 18

19

Variable Content Typical value

ρ Maximum drift rate of all physical clocks 10-4 f Quartz frequency of physical clocks 10 MHz δ Maximum skew between any two nonfaulty logical clocks less than 100 µs

(3)

Variable Content Typical value d Upper bound on the transmission delay 50 µs

ε Upper bound on the read error2 1 µs

n Number of clocks at most 4

m Maximum number of (arbitrarily) faulty clocks 1 R Resynchronisation interval 500 ms

Table 1 : Typical values 1

Note that the maximum skew between any two logical clocks is necessarily 2

greater than the skew between their physical clocks, and that this latter 3

skew can easily be obtained through the simple formula δphysical = 2ρR, 4

where R is the interval between two resynchronisations. With the values 5

given in $$$Table 1, this gives δphysical = 2*10-4*500 ms = 100 µs. Hence 6

the fact that the typical value of δ in $$$Table 1 is greater than 100 µs (see 7

section $$$3.1.1.3 for a more precise estimation of δ). 8

3.1.2 Existing Algorithms

9

A lot of clock synchronisation algorithms are described in the literature. 10

[Ramanathan et al. 1990] provides a good survey of these algorithms. 11

Restricting only to software implemented algorithms3 yields three main 12

kinds of algorithms (see $$$Figure 1): 13

2

The read error is mainly due to the transmission delay incertitude. Thus, d-2ε is the minimum message transit delay between any two nodes in the system.

3 In order to minimize the amount of specific hardware, in conformance to the GUARDS requirement to use as much COTS components as possible.

(4)

• Convergence algorithms, where nodes periodically resynchronise by 1

exchanging synchronisation messages. 2

• Consistency algorithms, where nodes use an interactive consistency 3

algorithm to achieve agreement on clock values. The little amount of 4

literature on this kind of algorithm [Lamport & Melliar-Smith 1985] 5

does not allow us to use them within GUARDS without spending 6

significant efforts on carefully studying them. 7

• Probabilistic algorithms [Cristian 1989], where nodes can make the 8

worst-case skew as small as desired, but with an increasing probability 9

of loss of synchronisation. This is clearly unacceptable in the field of 10

safety-critical applications. 11

Focusing on convergence algorithms, we see that there exists two main 12

kinds of such algorithms: 13

• Convergence-averaging algorithms, where each node resynchronises 14

according to clock values obtained through periodic one-round clock 15

exchanges. On each node, the other clocks can be taken into account 16

through a mean-like function [Lamport & Melliar-Smith 1985], or a 17

median-like function [Lundelius-Welch & Lynch 1988]. 18

• Convergence-nonaveraging algorithms, where each node periodically 19

seeks to be the system synchroniser. To deal with possible byzantine 20

behaviors, the exchanged messages can be authenticated or broadcast 21

[Srikanth & Toueg 1987; Dolev et al. 1995]. 22

(5)

Software algorithms

Convergence Probabilistic

Non-averaging Averaging

Median

Mean Authentication Broadcast Consistency

1

Figure 1 : Synchronisation algorithms

2

3.1.2.1 Convergence-averaging Algorithms

3

These synchronisation algorithms can tolerate m arbitrary faulty nodes in a 4

(fully connected) network of n nodes, under the sufficient condition4 that 5

n ≥ 3m+1. This implies in particular that they cannot tolerate a byzantine 6

faulty clock in a three node system (see $$$Figure 2). 7

The basic idea of these algorithms is as follows. The 8

resynchronisation is performed periodically: each node broadcasts a 9

resynchronisation message when its local clock time has counted R 10

seconds since the last resynchronisation period. At the same time, the node 11

collects during a given waiting period (which is far shorter than R) the 12

resynchronisation messages broadcast by other nodes: it records the arrival 13

time (according to its local clock time) of each received resynchronisation 14

message. After the waiting period, it uses a fault-tolerant averaging 15

function on the arrival times to compute an averaged clock time. It then 16

(6)

corrects its own clock time by setting it to the averaged clock time before 1

the next resynchronisation period. 2

In [Lamport & Melliar-Smith 1985], the fault-tolerant averaging 3

function F is the mean of all values (with values differing from the local 4

value by more than δ replaced by the local value). 5

In [Lundelius-Welch & Lynch 1988], the function F is a median-like 6

function. It consists in rejecting the m highest and m lowest values, and 7

then performing the average of all remaining values. 8

With three clocks, the above fault synchronisation function F 9

consists simply in taking the median value. So a byzantine faulty clock can 10

send synchronisation messages to two other nodes in such a way that they 11

find themselves as being always the median: the byzantine faulty clocks 12

has only to send synchronisation messages so that the earliest (respectively 13

latest) nonfaulty clock receive the Byzantine synchronisation message 14

before (respectively after) its own synchronisation emission. Thus each 15

nonfaulty node keeps its own value and the two nonfaulty clocks drifts 16 apart progressively. 17 Nonfaulty clock Nonfaulty clock Byzantine clock 18

(7)

Figure 2 : Desynchronisation of two nonfaulty clocks in presence of a byzantine 1 clock 2 3.1.2.2 Convergence-nonaveraging Algorithms 3

When authentication is used for inter-node message exchanges, these 4

synchronisation algorithms can tolerate m arbitrary faulty node with only 5

n ≥ 2m+1 nodes. This implies in particular that they can tolerate a 6

byzantine faulty clock in a three node system. 7

In these algorithms [Srikanth & Toueg 1987; Dolev et al. 1995], 8

each node seeks to be the system synchroniser, and succeeds if it is the 9

fastest nonfaulty node. More precisely, each node broadcasts its 10

resynchronisation message and collects during a given waiting period the 11

resynchronisation messages broadcast by other nodes (like in convergence-12

averaging algorithms). As soon as it has received m+1 resynchronisation 13

messages (including possibly its own), it restarts its local clock for the next 14

period and relays the m+1 resynchronisation messages to all other nodes. 15

It should be noted that the worst case skew of all such algorithms 16

proposed so far is greater than the transmission delay: δ ≥ d. 17

To better understand the mechanisms involved here, we will detail 18

the algorithm proposed in [Srikanth & Toueg 1987]. In this algorithm, 19

each node starts a new local clock Ck(t) at each successive resynchronisation

20

round. The core of the algorithm can be described by the following pseudo-21

code (the constant a being chosen so that clock-time does not go backward

22

when resynchronisation occurs, i.e. Ck(t) > Ck-1(t)):

23

If Ck-1(t) = kR

24

Then sign and broadcast (round k)

25

/ /

26

If (m+1) signed (round k) messages received

27

Then Ck(t) = kR + a

28

Relay all (m+1) messages to all

(8)

When a node broadcasts its synchronisation message, it is assumed that it 1

receives it immediately (because for the local node, there is no transmission 2

delay for the reception of its own synchronisation message). So, the test of 3

reception of (m+1) signed messages includes the possible locally emitted

4

synchronisation message. 5

$$$Figure 3 gives an example of tolerance of a byzantine faulty clock 6

in a three node system (m is equal to 1). The faulty clock (clock number 3

7

on the figure) broadcasts its (signed) resynchronisation message5 so that 8

the fastest nonfaulty clock (clock number 1 on the figure) receives this 9

message before the end of its own resynchronisation interval and the 10

slowest nonfaulty clock (clock number 2 on the figure) receives it after the 11

end of its own resynchronisation interval. We have seen that such an 12

inconsistent broadcast can desynchronise the two nonfaulty clocks under a 13

convergence-averaging synchronisation algorithm. Let us analyze what 14

happens here: 15

• The fastest nonfaulty clock receives the resynchronisation message of 16

clock 3. A short time after, this non-faulty clock reaches the end of its 17

own resynchronisation interval. According to the algorithm, it has 18

received at this time m+1 resynchronisation messages (the one coming 19

from clock 3 and its own). So it starts its new local clock (horizontal 20

bold arrow on the figure) and relays to the two other nodes two (signed) 21

resynchronisation messages. 22

• The slowest nonfaulty clock receives the two signed resynchronisation 23

messages (just emitted by the clock 1), and thus according to the 24

algorithm restarts its new local clock (horizontal bold arrow on the 25

figure) and relays to the two other nodes these two (signed) 26

resynchronisation messages. A short time after, this clock 2 reaches the 27

end of its own resynchronisation interval and then broadcast its own 28

resynchronisation message. A short time after, this clock 2 receives the 29

(9)

resynchronisation message from clock 3 which it may identify as being 1

faulty. 2

We can see that the clock 2 starts its new local clock at most d seconds

3

(maximum transmission time) after clock 1 has started its own. 4 Nonfaulty clock Nonfaulty clock Byzantine clock T3 T3:3 T3:3 T1:1 T3:3:1 T1 T2 T1:1:2 T3:3:1:2 T2:2 5

Figure 3 : Tolerance of a byzantine clock in a 3 node system

6

3.1.2.3 Maximum Skew Estimation

7

One of the most important characteristics of a synchronisation algorithm is 8

its ability to achieve a small maximum skew between non-faulty clocks. 9

Therefore, it is important that we estimate and compare the maximum 10

skew of [Lundelius-Welch & Lynch 1988] (hereafter denoted by LL) and 11

[Srikanth & Toueg 1987] (hereafter denoted by ST). 12

Theoretical results provide us with the two following formulas: 13

(10)

• for the LL convergence-averaging algorithm (theorem 16, page 21)6: 1

δ = β + ε + ρ(7β+3d+4ε) + 4ρ2(2+ρ)(β+d), with β = 4(ε+ρR) 2

• for the ST convergence-nonaveraging algorithm (lemmas 6 and 8, page 3

630-631): δ = [R(1+ρ) + d][ρ(2+ρ)/(1+ρ)] + d(1+ρ) 4

Using the typical values given in $$$Table 1, we have ε = 10-6 s, ρR = 5

5.10-5 s, d = 5.10-5 s, and we can see that terms including factors like ρ2, 6

ρε, ρd are negligible. By dropping these higher order terms, we obtain: 7

• for the LL algorithm: δ ~ 5ε + 4ρR 8

• for the ST algorithm: δ ~ d + 2ρR 9

We can see that the maximum skew δ is of the same order of magnitude in 10

the two algorithms (a few hundreds of microseconds). However, several 11

remarks must be made: 12

• We have taken a rather pessimistic maximum drift rate of 10-4 for 13

physical clocks. For example, ρ is estimated at 10-6 by [Ramanathan et 14

al. 1990], leading to ρR = 5.10-7 s. If we take such a smaller value for ρ, 15

then LL becomes better than ST. 16

• We have taken a rather optimistic maximum transmission delay d, 17

taking into account that GUARDS channels are expected to be near each 18

other (typically a few decimeters). If channels are distributed over 19

longer distances, then this could lead to an increase of d, thus making 20

again LL better than ST. 21

6 The factorisation of this fomula follows actually those given in [Ramanathan et al. 1990]. But note that the exact reformulation of [Ramanathan et al. 1990] is incorrect (omission of the scalar 3 in front of d in the third factor).

(11)

• From a practical viewpoint, it is not clear whether the transmission 1

delay d is the same for LL and for ST. Indeed, LL is a single-round 2

algorithm where synchronisation messages are deterministically and 3

synchronously broadcast. Thus d corresponds to the maximum time 4

required for a message to be prepared by a node, broadcast to all other 5

nodes and processed by these other nodes. For ST the issue is that a 6

node may have to broadcast its synchronisation message (first round), 7

and then to relay immediately after the synchronisation messages it 8

received (second round), precisely because it received the (m+1)th 9

signed synchronisation message just after having sent its own 10

synchronisation message. The maximum transmission delay has to take 11

into account this unfavorable case (which is likely to happen precisely 12

when clocks are well synchronised), thus leading to a larger value. 13

3.1.3 GUARDS Synchronisation Algorithm

14

At this stage, we are in position of making a choice between the two main 15

candidate solutions for GUARDS (LL or ST-based algorithm). A 16

carefully-conducted technical trade-off has allowed us to definitively select 17

and implement the GUARDS synchronisation algorithm. 18

3.1.3.1 Technical Trade-off

19

A given GUARDS instance is composed of at most 4 channels, fully 20

connected together through the Inter-Channel Network (ICN). For the sake 21

of simplicity, we assume that each channel contains only one node (the 22

problem of synchronising all the nodes inside a given channel is an 23

independent issue). So, we are interested in synchronising at most 4 clocks. 24

Building on section $$$3.1.2, we consider only convergence 25

algorithms. These algorithms are based on a periodic resynchronisation 26

interval. 27

References

Related documents

start a new checkpoint. In other words, if the last completed checkpoint was checkpoint number c, then it starts checkpoint c+1. The processor requests the checkpoint

The algorithms assume a network of processes, in which each node has a local clock that runs at approximately the correct rate, and some nodes also have direct access to Universal

The device has four hardware output enable pins for enabling the outputs, and one hardware pin to control spread spectrum on PCIe clock outputs.. In addition to the hardware

activity in term of oxidation (electron transfer and/or hydrolysis) is occurring at the sulphur center of the thiocarbonyl compound, DMTU; (c) there is

The time t(i) at which the i-th byte enters the T-STD is defined by decoding the program clock reference (PCR) fields in the input stream, encoded in the Transport Stream

A new method, the X-Means Clustering Algorithm, was proposed to solve this problem, which starts with an initial partition, then recursively runs a local K- Means in each cluster

The DDR2 SDRAM starts an auto precharge operation on the rising clock edge that is AL + (BL/2) cycles later than the read with auto precharge command provi- ded t RAS (MIN) and t

Sendo assim, o objetivo primário do presente estudo foi avaliar a presenc ¸a de associac ¸ão entre o genótipo 3111 T/C do gene CLOCK e a presenc ¸a de excesso de peso, bem como