Real-Time Systems. Design Principles for Distributed Embedded Applications. Herman Kopetz. Second Edition (811374), страница 22
Текст из файла (страница 22)
TAI defines the second as the duration of9,192,631,770 periods of the radiation of a specified transition of the cesium3.2 Time Measurement57atom 133. The intention was to define the duration of the TAI second so that itagrees with the second derived from astronomical observations. TAI is achronoscopic timescale, i.e., a timescale without any discontinuities (e.g., leapseconds). The epoch of TAI starts on January 1, 1958 at 00:00 h GreenwichMean Time (GMT). The time base of the global positioning system GPS isbased on TAI with the epoch starting on January 6, 1980 at 00:00 h.Universal Time Coordinated (UTC). UTC is a time standard that has been derivedfrom astronomical observations of the rotation of the earth relative to the sun.
It isthe basis for the time on the wall-clock. However, there is a known offset betweenthe local wall-clock time and UTC determined by the time zone and by the politicaldecisions about when daylight savings time must be used. The UTC time standardwas introduced in 1972, replacing the Greenwich Mean Time (GMT) as an international time standard. Because the rotation of the earth is not smooth, but slightlyirregular, the duration of the GMT second changes slightly over time. In 1972, itwas internationally agreed that the duration of the second should conform to theTAI standard, and that the number of seconds in an hour would have to be modifiedoccasionally by inserting a leap second into the UTC to maintain synchronybetween the UTC (wall-clock time) and astronomical phenomena, like day andnight.
Because of this leap second, the UTC is not a chronoscopic timescale, i.e., itis not free of discontinuities. It was agreed that on January 1, 1958 at midnight, boththe UTC and the TAI had the same value. Since then the UTC has deviated fromTAI by about 30 s. The point in time when a leap second is inserted into the UTC isdetermined by the Bureau International de l’Heure and publicly announced, so thatthe current offset between the UTC and the TAI is always known.Example: In Software Engineering Notes of March 1996 [Pet96, p.
16] was the followingstory:Ivan Peterson reported on a problem that occurred when a leap second was added atmidnight on New Year’s Eve 1995. The leap second was added, but the dateinadvertently advanced to Jan. 2. Ivars heard from a source at AP radio that thesynchronization of their broadcast networks depends on the official time signal, andthis glitch affected their operation for several hours until the problem was corrected.You can’t even count on the national timekeepers to get it right all the time.Bob Huey responded that making corrections at midnight is obviously risky: (1) Theday increments to January 1, 1996, 00:00:00. (2) You reset the clock to 23:59:59,back one second.
(3) The clock continues running. (4) The day changes again, and itis suddenly January 2, 1996, 00:00:00. No wonder they had problems.3.2Time MeasurementIf the real-time clocks of all nodes of a distributed system were perfectly synchronized with the reference clock z, and all events were time-stamped with thisreference time, then it would be easy to measure the interval between any twoevents or to reconstruct the temporal order of events, even if variable583 Global Timecommunication delays generated differing delivery orders. In a loosely coupleddistributed system where every node has its own local oscillator, such a tight synchronization of clocks is not possible.
A weaker notion of a universal time reference, theconcept of global time, is therefore introduced into a distributed system.3.2.1Global TimeSuppose a set of nodes exists, each one with its own local physical clock ck thatticks with granularity gk. Assume that all of the clocks are internally synchronizedwith a precision P, i.e., for any two clocks j, k, and all microticks ijzðmicroticki Þ zðmicrotickik Þ<P:(In Sect. 3.4, methods for the internal synchronization of the clocks are presented).It is then possible to select a subset of the microticks of each local clock k for thegeneration of the local implementation of a global notion of time.
We call such aselected local microtick i a macrotick (or a tick) of the global time. For example,every tenth microtick of a local clock k may be interpreted as the global tick, themacrotick tki , of this clock (see Fig. 3.2). If it does not matter at which clock k the(macro)tick occurs, we denote the tick ti without a superscript. A global time is thusan abstract notion that is approximated by properly selected microticks from thesynchronized local physical clocks of an ensemble.Reasonableness Condition. The global time t is called reasonable, if all localimplementations of the global time satisfy the conditiong>Pthe reasonableness condition for the global granularity g. This reasonablenesscondition ensures that the synchronization error is bounded to less than one macrogranule, i.e., the duration between two (macro) ticks.
If this reasonableness condition is satisfied, then for a single event e, that is observed by any two different clocksof the ensemble,jt ðeÞ tk ðeÞb1;i.e., the global time-stamps for a single event can differ by at most one tick. This isthe best we can achieve. Because of the impossibility of synchronizing the clocksrespectivemacroticks ofclocks j and kare connectedby dotted linesFig.
3.2 Time-stamps of asingle event012342156789 referenceclock zclock jeventoccurenceclock kdenotes valueof timestamp3.2 Time MeasurementFig. 3.3 Temporal order oftwo events with a differenceof one tick59respectivemacroticks ofclocks j and kare connectedby dotted lines012event 17: 2 by j 17event 42: 3 by k3546789 referenceclock zclock j42clock k67 69 event 67: 7 by jevent 69: 6 by kperfectly, and the granularity of any digital time there is always the possibility ofthe following sequence of events: clock j ticks, event e occurs, clock k ticks. In sucha situation, the single event e is time-stamped by the two clocks j and k with adifference of one tick (Fig. 3.2).One Tick Difference – What Does It Mean? What can we learn about the temporalorder of two events, observed by different nodes of a distributed system with areasonable global time, given that the global time-stamps of these two events differby one tick?In Fig. 3.3, four events are depicted, event 17, event 42, event 67 and event 69(time-stamps from the reference clock).
Although the duration between event 17and event 42 is 25 microticks, and the duration between event 67 and event 69 isonly 2 microticks, both durations lead to the same measured difference of onemacrogranule. The global time-stamp for event 69 is smaller than the global timestamp for event 67, although event 69 occurred after event 67.
Because of theaccumulation of the synchronization error and the digitalization error, it is notpossible to reconstruct the temporal order of two events from the knowledge thatthe global time-stamps differ by one tick. However, if the time-stamps of twoevents differ by two ticks, then the temporal order can be reconstructed because thesum of the synchronization and digitalization error is always less than two granulesin a clocking system with a reasonable global time-base.This fundamental limitation in time measurement limits the faithfulness ofthe digital computer model of a controlled physical subsystem.
The time-base inthe physical part of a cyber-physical system is dense, while the time base in thecomputer system is discrete. Whenever two events in the physical subsystem occurclose together, compared to the granularity of the global time, it is not possible toreconstruct the physical temporal order of the events in the computer systemfaithfully. The only way out of this dilemma is the provision of a global timebase with a smaller granularity, such that temporal errors are reduced [Kop09].3.2.2Interval MeasurementAn interval is delimited by two events, the start event of the interval and theterminating event of the interval. The measurement of these two events relativeto each other can be affected by the synchronization error and the digitalizationerror.
The sum of these two errors is less than 2g because of the reasonableness603 Global TimeFig. 3.4 Errors in intervalmeasurement0123456789 referenceclock zclock jclock k1742length: 3 – 2 = 10123456789 referenceclock zclock jclock k2247length: 5 – 1= 4condition, where g is the granularity of the global time. It follows that the trueduration dtrue of an interval is bounded byðdobs 2gÞ<dtrue <ðdobs þ 2gÞwhere dobs is the observed difference between the start event and the terminatingevent of the interval.