Time, Clocks, and the Ordering of Events in a Distributed System
Concepts
Distributed system
A collection of distinct processes which are spatially separated, and which communicate with each other by exchanging messages
Each process contains a sequence of events
Three important concepts
Time
Clock
Ordering of events
"Happen before": partial ordering of the events in the system, without using physical clocks
Though: problem of failures is a difficult one
The entire concept of failure is only meaningful in the context of physical time
Without it, there is no way of distinguish a failed process from one which is just puasing between events
The partial ordering
-->: "happen before" relation.
If a and b are events in the same process, and a comes before b, then a --> b
If a is the sending of a message by one process and b is the receipt of the same message by another process, then a --> b
If a --> b and b --> c then a --> c
Two distinct events a and b are said to be concurrent if
and
Irreflexive partial ordering on the set of all events in the system
Logical clocks
Clocks: a way to assign number to the event, where the number is thought of as the time at which the event occurred
Clock for each process is a function which assigns a number to any event in that process (logical clock)
if b is an event in process
But the converse condition is not true!
Total ordering of the events
Define relation => as follows
If a is an event in process and b is an event in process , then a => b if and only if either
This relation is a way of completing the "happened before" partial ordering to a total ordering
Clock condition implies that if a-->b then a ==> b
This ordering depends upon the system of clock , and is not unique
Different choice of clocks which satisfy the clock condition yields different relation =>
It is only the partial ordering --> which is uniquely determined by the system of events
Why do we need total ordering?
The reason for implementing a correct system of logical clock is to obtain such total ordering
é»č¾ę¶é设讔ēęē»ē®ēå°±ęÆäøŗäŗå¾å°äøē§äŗä»¶å Øå±ęåŗēęŗå¶
Scenarios
System composed with a fixed collection of processes which share a single resource
Only one process can use the resource at a time, so the processes must synchronize themselves to avoid conflict
Find an algorithm for granting the resource to a process which satisfies the following condition
A process which has been granted the resource must release it before it can be granted to another process
Different requests for the resource must be granted in the order in which they are made
If every process which is granted the resource eventually releases it, then every request is eventually granted
Anomalous Behavior (cite)
Person issues a request A on a computer A, and then telephones a friend in another city to have him issue a request B on a different computer B. It is possible for request B to receive a lower timestamp and be ordered before request A.
This can happen because the system has no way of knowing that A actually preceded B, since that precedence information is based on messages external to the system.
Two possible ways
Explicit introduce into the system about necessary information about the ordering
I.e. friend could specify that B be given a timestamp latter than T_A
This gives users the responsibility to avoid anomalous behavior
Construct a system of clocks which satisfies (i.e. properly synchronized physical clocks)
Stronger than ordinary clock condition because --> is a stronger relation than ->
The discussion on the physical clock references the paper (the following materials are from the reference reading) --> need to understand and revisit this part
Goal: éčæčæč”äøäøŖę¶éåę„ē®ę³ļ¼äæčÆę¶é对äŗä»»ä½äŗä»¶ęäøēę¶é“ę³é½äøäŗ§ēåé¢ēå¼åøøč”äøŗļ¼anomalous behaviorļ¼ćä¹å°±ęÆčÆ“ļ¼åƹäŗä»»ę两个ęååŗå ³ē³»ēäŗä»¶ļ¼ęč 诓åÆč½åØå ęę§äøäŗ§ēå½±åē两个äŗä»¶ļ¼ļ¼ę们ēē©ēę¶éč¦äæčÆę»ęÆä¼äøŗåäøäøŖäŗä»¶ęäøäøäøŖę“大ēę¶é“ę³ćč¦å®ē°čæäøŖē®ę ļ¼ę们é¢äø“ēéē¢äø»č¦ę„ęŗäŗē©ēę¶éēäø¤ē§čÆÆå·®ļ¼
ę¶éēčæč”éēč·ēå®ę¶é“ēęµééēåÆč½ęå·®å¼ļ¼
ä»»ę两个ę¶éēčæč”éēęå·®å¼ļ¼å®ä»¬ē读ę°ä¼ę¼ē§»å¾č¶ę„č¶čæć
LamportåØč®ŗęäøęåŗēē©ēę¶éåę„ē®ę³ å°čæäø¤ē§ę¶é误差ččåØå ļ¼äøęå°åƹåäøŖčæēØę¬å°ēē©ēę¶éčæč”å¾®č°ļ¼ę误差ę§å¶åØč½å¤ę»”č¶³Strong Clock Conditionēčå“å ć
åå«čččæēØå ēäŗä»¶åč·ØčæēØēäŗä»¶ļ¼
对äŗčæēØå åēēäøåäŗä»¶ļ¼åæ é”»äæčÆååēēäŗä»¶ęÆå åēēäŗä»¶ę¶é“ę³č¦å¤§ćčæå®é äøęÆč¦ę±ę们äæčÆęÆäøŖē©ēę¶éå®ä¾ē读ę°ę»ęÆåč°éå¢ēćčæęÆęÆč¾å®¹ęå®ē°ēļ¼ę们åŖéč¦åØå¾®č°ę¶é读ę°ēę¶åļ¼åŖę读ę°č°å¤§čäøę读ę°č°å°ć
对äŗåēåØäø¤äøŖäøåčæēØäøēäŗä»¶
äøŗäŗäæčÆäøåŗē°å¼åøøč”äøŗļ¼ę们就č¦ę±ļ¼äøē®”AåBä¼ éäæ”ęÆčæäøŖčæēØåēēéåŗ¦ęå¤åæ«ļ¼ęåæ«åÆä»„č¾¾å°å éļ¼ä½åØå®é ē³»ē»äøļ¼ē±äŗē½ē»å»¶čæåē¼åēåå ä¼ę ¢å¾å¤ļ¼ļ¼čÆ·ę±Båēę¶ēę¶é读ę°é½åæ 锻大äŗčÆ·ę±Aåēę¶ēę¶é读ę°ć
čæäøŖč¦ę±åÆč½ę²”ę³č¢«ę»”č¶³ēåå åØäŗäø¤č¾¹ēē©ēę¶éåÆč½ę误差ć
å ę¤ļ¼å°±éč¦åØäøåēē©ēę¶éä¹é“äŗ¤ę¢äæ”ęÆļ¼å¹¶åå©čæäŗäæ”ęÆåę„ę¶é读ę°ć
Expect åÆä»„ęę¶éä¹é“ē误差ę§å¶åØäøå®čå“å ļ¼åŖč¦ę们åØę¶éä¹é“äŗ¤ę¢äæ”ęÆč¶³å¤é¢ē¹ļ¼ćčæęÆäø¤ē§ęŗå¶ēčµč·ļ¼
äøę¹é¢ļ¼Aéčæē³»ē»å¤ēę¹å¼åBä¼ éäæ”ęÆļ¼åŖč¦čæäøŖčæēØč¶³å¤åæ«ļ¼ä»ä»¬å°±ęåÆč½āēå°āę¶é误差é ęēę¶é读ę°åéļ¼ä¹å°±ęÆåŗē°äŗå¼åøøč”äøŗļ¼
å¦äøę¹é¢ļ¼ē©ēę¶éåę„ē®ę³éčæåØę¶éä¹é“äøęäŗ¤ę¢äæ”ęÆå¹¶ęē §äøå®č§åč°ę“ę¶é读ę°ļ¼å°ę¶é误差ę§å¶åØäøå®čå“å ćåŖč¦ē®ę³ēåäøŖåę°č®¾ē½®å¾å½ļ¼å°±č½äæčÆļ¼å³ä½æAåBä¼ éäæ”ęÆēé度达å°ē©ēęéāāå éļ¼ä»ä»¬ä¹ę ę³āēå°āę¶é读ę°ēåéē°č±”ćäŗęÆļ¼Strong Clock Condition就被滔足äŗć
Last updated
Was this helpful?