Time in Embedded and Real Time Systems Lecture - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Time in Embedded and Real Time Systems Lecture

Description:

Reference Clock ... Ideally, no error with 'real world' time (Grennich or Zulu) ... 'Wall Clock' Time based on astronomical observations ... – PowerPoint PPT presentation

Number of Views:210
Avg rating:3.0/5.0
Slides: 24
Provided by: DAnd81
Category:

less

Transcript and Presenter's Notes

Title: Time in Embedded and Real Time Systems Lecture


1
Time in Embedded and Real Time SystemsLecture 6
  • David Andrews
  • dandrews_at_eecs.ukans.edu

2
What We Will Cover Today
  • Time and Order
  • Causal Order
  • Temporal Order
  • Delivery Order
  • Measuring Time
  • Global Time
  • Precision/Accuracy
  • Sparse Time
  • Clock Synchronization
  • Internal Synchronization
  • External Synchronization

3
Time and Order
  • Time is relative
  • We can provide time ordering in different ways
  • Temporal (Think continuous timeline)
  • Time period we are interested in is the duration
  • Can develop ordering
  • If ta
  • T is infinite ordered set of instants
  • Event a takes place at an instant of time ta
  • Causal (directed dependency ordering)
  • Can be used to find out who done it.
  • E1 the road ices
  • E2 car slides on road
  • E1 - E2 However, E2 cannot cause E1
  • Causal events occur temporally
  • However, causal ordering focuses on cause -
    effect, not time taken to occur
  • Delivery Orders in distributed systems

4
Reference Clock
  • Time is measured against a (theoretically
    perfect) clock called the reference clock. In
    actuality, the reference clock isnt perfect !
  • Reference Clock (z clock)
  • External observers absolute time
  • Ideally, no error with real world time
    (Grennich or Zulu)
  • Frequency fz, where 1/fz 10-15 (1
    femtosecond)
  • Quantization error not measurable
  • Timestamping
  • Timestamp is value of clock for an observed event
  • z(e) is absolute timestamp
  • clock(e) value of system clock for event

5
Definitions Against Reference Clock
Nk mticks between two consecutive ticks of
local clock
Granularity (two definitions used in book) 1.
Nk in terms of ticks 2. z(mtick i1)
z(mtick i) in terms of time
6
Physical Clocks
  • Register counts up at mtick intervals
  • Quantization error set by frequency
  • Linux 10 msec mtick interval (resolution)
  • 32 bit register encodes how much time ?
  • 232 x 10 msec 42949672 sec 715827 minutes
    11930 hrs 497 days

7
Phsical Clock Errors - Drift
  • Clock Drift the drift of a physical clock k
    between mtick i and mtick i1 is frequency ratio
    between physical clock and reference clock at
    instance of mtick i.

8
Real Drift Rates
  • Ideal case not real world. Clocks actually
    drift.

9
Drift rate rki
  • Environmental changes can affect the crystal
  • Drift can be plus/minus
  • Take absolute value
  • Specs usually give maximum drift rate rkmax
  • Typical specs of rkmax 10-2 to 10-7 sec/sec

10
Effects of Drift
  • Drift can be additive on free running clocks
  • Fc 10 Mhz
  • 1/fc 10-5
  • If clock drifts 10-9 per clock, then you can miss
    a cycle every 10,000 clocks !

11
Precision and Accuracy
Granularity Clock a 10
Granularity Clock b 10
Offset mticks difference (example shows 3)
Precision max offset
12
Time to standardize..
  • International Atomic Time (TAI Temps Atomique
    Internationle)
  • 1 sec 9,192,631,770 periods of the radiation
    of a specified transition of the cesium atom 133.
  • Universal Time Coordinated (UTC)
  • Wall Clock Time based on astronomical
    observations
  • Not perfect due to earths slightly less than
    perfect rotation
  • 1 sec TAI second
  • However, number of seconds in an hour must be
    modified by leap second
  • January 1, 1958 TAIUTC
  • Since then, UTC deviated by approx. 30 seconds

13
Global Time
  • In distributed systems, we assume all are
    operating on clocks of same frequency.
  • We acknowledge clocks have certain drifts
  • We acknowledge clocks start at slightly
    different origins.
  • Assume all clocks are accurate within precision P
  • For any two clocks, z(mtickji z(mtickki)
  • Reasonableness condition g P
  • Says all granularities are larger than max offset
    (Precision P)
  • If reasonableness condition met, then tj(e)
    tk(e)
  • Says Observer May See 1 clock difference between
    same event measured by two different local
    clocks. Lets see.

14
Global Time
  • Event a occurs at
  • Macrotick 1 node a
  • Macrotick 1 node b
  • Simultaneous event
  • Event b occurs at
  • Macrotick 1 node a
  • Macrotick 2 node b

15
Global Time
d e
a b
c
Event c _at_ 21 Event d _at_29 Both Reported as
macrotick 2
Event e _at_ 32
Event a occurs at mtick 5 Event b occurs at mtick
8 Both Reported as macrotick 1
16
Global Time
A occurs at mtick 28 B occurs at mtick 30
Clock i reports macrotick 3 for A Clock j reports
macrotick 2 for B
17
p/D Precedence
  • Events are measured within p, implying the same
    time
  • Subsequent events must occur at least a duration
    of D
  • 0/1g, 0/2g no temporal order can be established
  • 0/3g temporal order can be established

18
Fundamental Limits of Time Measurement
  • Time stamps on two nodes for single event may
    differ by 1 tick.
  • Also, cannot impart temporal order on events that
    differ by only 1 tick
  • When measuring an interval (dobs), the true
    duration dtrue is bounded by
  • (dobs 2g)
  • Temporal order can be recovered by timestamps if
    difference 2 ticks
  • Temporal order can always be recovered if at
    least 0/3g

19
Internal Clock Synchronization
  • Need to Guarantee that all clocks are within
    precision P
  • Local clocks get synched up periodically Rint
  • Convergence function O denotes offset of the time
    values immediately after resynchronization
  • Drift offset max divergence of any two clocks
    (depends on Rint and drift rate r of clock

Drift offset 2rRint
20
Synchronization Criteria
  • Ensemble of clocks can be synchronized if
  • Convergence offset drift
  • Says best correction allowable drift cannot
    wander out of precision range
  • Need a Picture..

21
Synchronization Techniques
  • Central Master
  • A node is designated master
  • Master sends value of time counter to all other
    (Slave) nodes
  • Slave Drift master value current slave value
    transit time
  • Slave Corrects by drift value
  • Distributed Synchronization
  • All nodes broadcast their time counter to all
    other nodes
  • Each node checks to see if within convergence
    criteria
  • If not, node sleeps
  • All live nodes calculate correction and updates
    clock
  • Different algorithms for doing this.

22
Global Time Jitter
  • Assume node sends counter time to all other nodes
  • If delay for each node known, then correction is
    accurate
  • However, Jitter may occur
  • Network congestion (usecs)
  • Interrupt latencies (usecs)
  • OS latencies (10 100 usecs)
  • Application Software Latencies (500 usec 5
    msec)
  • Different techniques applied to reduce jitter in
    app layer

23
External Clock Synchronization
  • Can broadcast a time message from global time
    server
  • Local clusters use previous techniques to
    synchronize
Write a Comment
User Comments (0)
About PowerShow.com