この規格 プレビューページの目次
※一部、英文及び仏文を自動翻訳した日本語訳を使用しています。
H.3 確率的クロック同期
2 つのプロセス間の時刻同期を達成するための確率的クロック同期 (PCS) アプローチは、次のように対処します。
- PCS アルゴリズムに関する仮定。
- 指定された精度でリモートクロックを読み取る方法に関するテクニック。
- 時計の同期を維持する方法。
- ソフトウェアクロックを調整する方法。
PCS は以下に対応していません。
- 同期モデル;
- 耐障害性の達成。
- タイムスタンプの要請;
- サービス インターフェイス。
この寄稿で引用されているすべての式は、[2] と [3] にあります。
H.3.1 仮定
分散システムでは、プロセス間の通信は、予測できないランダムなリアルタイム遅延の影響を受けます。これにより、同期のタスクが困難になります。分散システムにおけるプロセス通信のメッセージ遅延に関する研究 [2] から、メッセージ遅延の分布は、図 H.6 に示されているものに似た形をしています。分布は、最小遅延 (rmin) と中央遅延 (通常は rmin に近い) の間のモード ポイントで最大密度を持ち、右側に長く細いテールがあります。 rmin 値は、送信エラーやシステム負荷がない状態で、空のメッセージを準備、送信、および受信するのに必要な時間をカウントすることによって計算できます。この rmin 値は、Probabilistic Clock Synchronization (PCS) のアルゴリズムに貢献します。
図 H.6 —メッセージの遅延
同期アルゴリズムは、次の前提に基づいています。
- 時計は、時間間隔よりもはるかに細かい解像度を持っています。
- min は最小往復メッセージ遅延 rmin の半分です。
- p は最大ドリフト率です。
- ソフトウェアによって実装されたローカルクロックは調整可能です。
プロセスの時刻を参照する場合、CTx の表記が使用されます。ここで、CT はプロセス x のクロックの時刻値です。別のプロセスの推定時間の場合、CTx(y) は、プロセス x で推定されたプロセス y の時間値を表すために使用されます。たとえば、プロセス S のクロックの時間値は CTs で示され、C によって推定されるプロセス S の時間値は CTc(s) となります。
H.3.2 リモートクロックの読み取り
S と C の 2 つのプロセスを仮定すると、C は S から時間の要求メッセージを送信します。S が要求を受信すると、時計の時刻がタイムスタンプされた時刻メッセージで応答します。プロセス C が定義済みの待機期間内に応答を受信しない場合、クロック S の読み取りの試みは失敗します。 C がプロセス S から応答メッセージを受信するときの S の時間は、次のように調整できます。
CT + 分 * (1 - p)
他の
CT + 2 * デ * (1 + 2 * p) - 最小 * (1 + p)
または、次の間隔として表すことができます。
CTs + 最小 * (1 - p) = CTc(s) = CTs + 2 * De * (1 + 2 * p) - 最小 * (1 - p)
どこ:
| CT | S のクロック値 |
| de | C で測定された半往復遅延 |
| p | C でのクロックの最大ドリフト率 |
| 少なくとも | C で測定された最小往復メッセージ遅延 rmin の半分 |
| CTc | C 上の同じインスタンスでの S のクロック値の C の推定値 |
図 H.7 は、読み取りクロック パスを示しています。
図 H.7 —リモートクロックの読み取り
また、CCTc(s) による S での推定クロック値は次のようになります。
@CTc(s) = CTs + Dc * (1 + 2 * p) - m?n * p
推定値 (または不正確さ) の最大誤差は次のとおりです。
e = DC * (1 + 2 * p) - 分
実際には、値 Dc は、プロセス C が要求メッセージを送信するときの時間と、応答メッセージを受信するときのインスタンスを取得することによって取得できます。通常、最大ドリフト レートはクロック メーカーによって指定されます。
H.3.3 指定された精度でリモートクロックを読み取る
プロセス C が特定の精度 (つまり、最大読み取りエラー) を達成するためには、たとえば「e」とします。プロセス C は、測定された実際の往復遅延 2 * Dc' が指定された最大値よりも大きい読み取り試行を破棄する必要があります。往復遅延「2 * Uc」。 「Uc」は、次の式に基づいて計算できます。
Uc = (1 - 2 * p) * (e + 分)
プロセス C が成功したラウンドトリップを観察すると、プロセス C はプロセス S と信頼関係に達したと言われます。
正確な測定を完了するには、待機期間 W' と最大試行回数 k' 再試行を考慮する必要があります。前者は、両方のプロセスが正しく維持され、一時的なネットワーク トラフィックのバーストが通信に影響を与えないようにするためのものです。精度が高ければ高いほど (つまり、's の値が低くなれば)、許容可能な最大往復 2 * Uc' が *2 * min' 値に近づくことは明らかです。より多くのメッセージを読み取ろうとすることで、プロセス間の信頼関係に達する可能性が高くなります。一方、最大往復遅延 2 * Uc' が最大メッセージ遅延により近くなるように選択された場合、アルゴリズムは決定論的になります。これにより、精度が低下し、メッセージ送信の試行回数も少なくなります。
したがって、図 H.7 に示されているように *2 * U' が「rmin」に近い値を選択すると、時計の読み取り精度が向上しますが、信頼関係に到達する際の失敗の頻度も高くなります。これは、親密な関係に到達するために、より多くの k' 試行を行うことによって達成される可能性があります。 U が最大になる傾向があるため、信頼関係に到達するための精度が低下し、k' の再試行が比較的少なくなります。信頼関係を得るために必要なメッセージの平均数「n」は、精度「p」を達成できない確率の関数として示すことができます。つまり、次のようになります。
n = 2/ (本数)
H.3.4 クロックの同期を保つ
C の時計を S と同期させておくために、C は定期的に S との親密な関係に到達しようとします。親密な関係を築くための各試みは、最大 k' 回の試行で構成され、読み取り値は W' クロック単位で区切られます。直感的には、 w > 2 * U です。'k' 回の試行が失敗した場合、S と C を特定の精度で同期させることはできません。
親密な関係と次の親密な関係の試みとの間の最大リアルタイム遅延「DNA」は、次のように表すことができます。
DNA = ((1 - p)/ p) * (sc - y) - k * W
ここで、「sc」は S と C の偏差です。「sc」が次のようになることも示されています。
sc > Uc - 分 + p*k*(l + p)*W
H.3.5 クロック調整
ソフトウェアで調整可能な速度が実装されているプロセス C のローカル クロックを考えると、C のクロックの値は、C のローカル ハードウェア クロック H と定期的に計算される調整関数 A の合計として表すことができます。したがって:
C(t) = H(t) + A(t)
他の
A(t) = m * H(t) + N
ローカル クロックの不連続 (ジャンプ) を避けるために、「A(t)」は時間の連続関数でなければならず、簡単にするために、A は線形調整関数です。 「m」と「N」の値は、次のように取得できます。
m = (CTc(s) -CTc)/ a
他の
N =CTc-(1+m)*H
' a ' は、プロセス C が S と同期した関係に続く時間単位として定義される正の誤差を伴う時計です。C で 'a' を修正する調整期間が経過した後、時計時間 CTc は次のようになります。
CTc(報告時) = CTc(s) + a
プロセス C は、次の設定により、次のラポートまでローカル ハードウェア クロックの速度で再度実行できるようになります。
メートル = 0
他の
N = 時刻調整期間の終了時の C の現地時間 - 同じ期間の終了時のハードウェア クロック
m と N は、各時間調整期間の開始時と終了時に変更されることに注意してください。
H.3.6 結論
Probabilistic Clock Synchronization (PCS) アルゴリズムは、リモート クロック値を読み取るときに制御可能な精度を提供します。ただし、プロセッサが常に指定された精度でリモート クロックを読み取ることができるという保証はありません。プロセスは、ラポールに到達するまでに十分な回数再試行することにより、任意の精度で別のプロセスのクロックを読み取ることができます。信頼関係が確立されると、プロセスは、得られた実際の読み取り精度を認識します。このアルゴリズムは、時間調整期間内に時計を継続的に調整する方法と、次の関係の時間を計算する方法も示しています。
H.3 Probabilistic clock synchronization
The Probabilistic Clock Synchronization (PCS) approach to achieving time synchronization between two processes addresses:
- an assumption about the PCS algorithm;
- a technique on how to read a remote clock with a specified accuracy;
- a method on how to keep clocks synchronized;
- a method on how to adjust a software clock.
PCS does not address:
- a synchronization model;
- the achievement of fault tolerance;
- the solicitation of timestamps;
- a service interface.
All the equations quoted in this contribution can be found in [2] and [3],
H.3.1 Assumption
In distributed systems, process to process communication is affected by an unpredictable random real-time delay. This makes the task of synchronization difficult. From the study on message delay for process communication in distributed systems [2], the distribution of the message delay has a shape resembling that illustrated in Figure H.6. The distribution has a maximum density at a mode point between the minimum delay (rmin) and the median delay, usually close to rmin, with a long thin tail to the right. The rmin value can be computed by counting the time needed to prepare, transmit and receive an empty message in the absence of transmission errors and system load. This rmin value contributes to the algorithm of Probabilistic Clock Synchronization (PCS).
Figure H.6—Message delay
The synchronization algorithm is based on the following assumptions:
- clocks have a much finer resolution than the time intervals;
- min is half of the minimum round-trip message delay rmin;
- p is the maximum drift rate;
- a local clock implemented by software is adjustable.
When referencing a time of a process, a notation of CTx, where CT is the time value of the clock at process x, is used. For an estimated time of another process, CTx(y) is used to denote the time value of process y estimated at process x. For instance, a time value of a clock at process S is denoted as CTs, whereas a time value of process S estimated by C is CTc(s).
H.3.2 Reading a remote clock
Assuming two processes, S and C, C sends a request message for a time from S. When S receives the request, it replies with a time message which is timestamped with its clock's time. If process C does not receive any response within a predefined waiting period, the attempt at reading the clock S fails. The time at S, when C receives the replies message from process S, can be calibrated as:
CTs + min * (1 - p)
and
CTs + 2 * De * (1 + 2 * p) - min * (1 + p)
or it can be expressed as an interval of:
CTs + min * (1 - p) = CTc(s) = CTs + 2 * De * (1 + 2 * p) - min * (1 - p)
where:
| CTs | The Clock value at S |
| de | The measured half round-trip delay at C |
| p | The maximum drift rate of the clock at C |
| min | Half of the minimum round-trip message delay rmin measured at C |
| CTc(s) | C's estimate of the clock value of S at the same instance on C |
Figure H.7 illustrates the reading clock path.
Figure H.7—Reading a remote clock
Also, it can be shown that the estimated clock value at S by CCTc(s) is:
@CTc(s) = CTs + Dc * (1 + 2 * p) - m?n * p
and the maximum error of the estimated value (or inaccuracy) is:
e = Dc * (1 + 2 * p) - min
In practice, the value Dc can be obtained by process C taking the time when it sends out the request message and the instance when it receives the replies message. The maximum drift rate is normally given by the clock manufacturer.
H.3.3 Reading a remote clock with a specified precision
For a process C to achieve a certain accuracy (i.e. the maximum reading error), say 'e', process C must discard any reading attempts for which the measured actual round-trip delay 2 * Dc' is greater than the specified maximum round-trip delay '2 * Uc'. 'Uc' can be calculated based on the following equation:
Uc = (1 - 2 * p) * (e + min)
When process C observes a successful round-trip, the process C is said to reach rapport with process S.
For completion of precision measurement, one has to consider the waiting period W' and maximum attempt k' retry. The former is to ensure that both processes stay correct, and any transient network traffic bursts do not affect their communication. It is evident that the higher the accuracy (i.e. the lower the value of 's), the closer the acceptable maximum round-trip 2 * Uc' is to reaching the *2 * min' value. A higher probability of reaching rapport between processes can be achieved by attempting to read more messages. On the other hand, if the maximum round-trip delay 2 * Uc'is chosen to be closer to the maximum message delay, the algorithm becomes deterministic. This also results in lower accuracy and few attempts at sending messages.
Hence as *2 * U' is chosen closer to the 'rmin' as illustrated in Figure H.7, one can achieve higher precision on the clock reading, but it would also result in higher frequency of failure in reaching rapport. This may be accomplished by taking more k' attempts to reach rapport. As U tends to max, one would result in less accuracy and relatively fewer k' retry attempts in order to reach rapport. The average number of messages 'n'required for achieving rapport can be shown as a function of probability of not achieving precision 'p', that is:
n = 2/ (l-p)
H.3.4 Keeping clocks synchronized
In order to keep a clock at C synchronized with S, C attempts periodically to reach rapport with S. Each attempt at rapport consists of at most k' attempts, where readings are separated by W' clock units. Intuitively, w > 2 * U. In the case where 'k' attempts have failed, S and C cannot be synchronized with the specific accuracy.
The maximum real-time delay, 'DNA', between a rapport and the next attempt at rapport can be expressed as:
DNA = ((1 - p)/ p) * (sc - y) - k * W
where 'sc' is the deviation between S and C. It is also shown that 'sc' should be:
sc > Uc - min + p*k*(l + p)*W
H.3.5 Clock adjustment
Given a local clock at process C with adjustable speed implemented in software, the value of clock at C can be represented as the sum of the local hardware clock H at C and a periodically computed adjustment function A; therefore:
C(t) = H(t) + A(t)
and
A(t) = m * H(t) + N
To avoid local clock discontinuities (i.e. jumps), 'A(t)'must be a continuous function of time, and for simplicity, A is a linear adjustment function. The value of'm' and 'N' can be obtained as follows:
m = (CTc(s) -CTc)/ a
and
N =CTc- (1 + m) * H
'a' is a clock with a positive error which is defined as the time units following rapport for which a process C synchronized with S. After the adjustment period which corrects for 'a' has elapsed at C, the clock timeCTcbecomes:
CTc(at rapport) =CTc(s) + a
Process C can be allowed to run again at the speed of local hardware clock until the next rapport by setting:
m = 0
and
N = local time of C at the end of the time adjustment period-hardware clock at the end of the same period
Notice that m and N are changed at the beginning and the end of each time adjustment period.
H.3.6 Conclusion
The Probabilistic Clock Synchronization (PCS) algorithm gives a controllable accuracy when reading a remote clock value. However, it does not guarantee that a processor can always read a remote clock with a specified accuracy. A process can read the clock of another process with a given accuracy with a probability as close to one as desired, by retrying a sufficient number of times while reaching rapport. When a rapport is achieved, a process knows the actual reading accuracy obtained. The algorithm also shows how to adjust a clock continuously within the time adjustment period and how to calculate the time for next rapport.