Time and global states Chapter 11. Outline Introduction Clocks, events and process states...

Click here to load reader

download Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.

of 39

Transcript of Time and global states Chapter 11. Outline Introduction Clocks, events and process states...

Chapter 11

Time and global statesChapter 11OutlineIntroductionClocks, events and process statesSynchronizing physical clocksLogical time and logical clocksintroductionThe importance of time:Time is a quantity we often want to measure accurately.(e.g. e-commerce)Algorithms that depend upon clock synchronization have been developed for several problems in distribution:Maintaining the consistency of distributed dataChecking the authenticity of request sent to serverEliminating the processing of duplicate updatesImportant facts :Two events that are judged to be simultaneous in one frame of reference are not necessarily simultaneous according to observers in other frames of references that are moving relative to it.The relative order of two events can even be reversed for two different observers. But this cannot happen if one event could have caused the other to occur.The notion of physical time is also problematic in a DS because of the limitation in our ability to timestamp events at different nodes sufficiently accurately to know the order in which any pair of events occurred, or whether they occurred simultaneously introductionA collection of N processes pi, i = 1,2, .. NsiThe state of piE.g. variablesActions of piOperations that transform pis stateSend or receive message between pj

Clocks, events and process stateseEvent: occurrence of a single actionioccur before in pi , e.g. e i e`Total order of events in pihistory(pi ) = hi hi = Clocks, events and process statesA device that count oscillations occurring in a crystal at a definite frequencyHardware time: Hi(t)The counts of oscillation since an original pointSoftware time: Ci(t) = Hi(t)+Timestamp of an event Clock in computerSuccessive events will correspond to different timestamps only if the clock resolution is smaller than the time interval between successive events.The rate at which events occur depends on such factor as the length of the processor instruction cycleClock driftCrystal oscillate at different rateClock drift can not be avoidedClock skewThe instantaneous difference between the readings of any two clocksClock skew and clock driftInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 11.1Skew between computer clocks in a distributed system

Rotation of earth on its axis and about the SunDays, Years, etcSecond is 1/86400 astronomical timeStandard secondAtomic oscillatorDrift rate: one part in 1013Astronomical Time &International Atomic Timeshift between astronomical time and atomic timeThe period of the Earths rotation about its axis is gradually getting longerTidal friction, atmospheric effects, etcLeap secondAtomic time which is inserted a leap second occasionally to keep in step with astronomical timeBroadcast UTC to the WorldE.g., by GPS or WWVCoordinated Universal Time (UTC)Ci : pis clockI: an interval of real timeExternal synchronizationFor a synchronization bound D > 0, and for a source S of UTC time, |S(t)-Ci(t)| < D, for i = 1, 2, N and for all real times t in IClocks Ci are accurate to within the bound DSynchronizing physical clocksInternal synchronizationFor a synchronization bound D > 0, |Ci(t)-Cj(t)| < D for i, j =1,2, N, and for all real times t in IClocks Ci agree within the bound DIf the system is externally synchronized with a bound D, then the system is internally synchronized with a bound 2DSynchronizing physical clocksCorrectness of a hardware clock HA bounded drift rate , e.g. 10-6 seconds/second,t and t are real time(1 - )(t - t) C(t) Set clock backErrors in the make processChange the clock rateGeneral synchronization issues