13.05.2015 1 modelling time in real-time systems lap 8780 and isp 9010 tallinn university of...
TRANSCRIPT
18.4.2023 1
Modelling time in Real-time Systems
LAP 8780 and ISP 9010
Tallinn University of Technology
Professor Leo Motus
18.4.2023 ©L.Motus, 2004 2
Why should we study time?
A man with a watch knows what time is;
a man with two watches isn’t so sure.
Anonymous
18.4.2023 ©L.Motus, 2004 3
Contents
1. Computer science has abstracted the time away
2. Real-time systems, and related software is based on sciences of the artificial – i.e. synthesis based theory
3. The role of time in software
4. Examples of time usage
5. Philosophical and physical time
6. Metric time in OMG products
7. Timing analysis in RT UML and elsewhere
18.4.2023 ©L.Motus, 2004 4
E.A. Lee (1999) about conventional computing science
Quantitative (metric) time has been systematically removed from theories of computation.
Most of the temporal logics research deals with “eventually” and “always”, where time is not a quantifier but rather a qualifier.
Management of concurrency is trivialNon-terminating programs fall into equivalence class of
defective programs – such programs form a major class of programs in embedded systems
E.A.Lee “Embedded software –an agenda for research”, 1999
18.4.2023 ©L.Motus, 2004 5
Analysis based approach versus synthesis based approach
H.A. Simon (1996) The Sciences of the Artificial, MIT PressScience describes existing objects and their interactions,
while sciences of the artificial depart from a predefined goal and synthesise objects with required properties.
Static environment assumption holds for Sciences (i.e. natural sciences) and does not necessarily hold for Sciences of the Artificial, because the synthesised artefacts are usually at the interface of several inhomogeneous domains
Sophisticated time is needed to match the properties of different interacting domains – e.g. to complete computation while static environment assumption holds.
18.4.2023 ©L.Motus, 2004 6
Evolution of the role of time in software
Quantitative time has been gradually introduced to computers and software in order to:• Satisfy requirements on the overall duration of
computations – to measure performance (1965)• Invoke programs so as to meet their deadlines and
improve performance of the system – scheduling theory and temporal logics (since 1973)
• Directly monitor and influence the environment – timing of interactions, validity of data, etc (since 1977)
18.4.2023 7
Examples of time usage
1. In natural science
2. In data and information processing
3. In simulation systems
4. In real-time systems
18.4.2023 ©L.Motus, 2004 8
What is time (pragmatically)?
Observation: More complex systems (societies) rely more heavily on
the notion of time, as a basis for coordinated activities
The same applies to computer systems:• transformation / number crunching oriented
systems – time as ordering of events is usually sufficient
• embedded / real-time / proactive systems – more sophisticated features of time are required
18.4.2023 ©L.Motus, 2004 9
What is time (philosophically)?
The essence of time is still an object of research – it is increasingly believed to be a subjective category rather than an objective category.
In computer systems the major role of time is to:• approximate incompletely known causal relations• enable the match between the behaviour of a
computer system and that of its environment• compensate our insufficient capability to take the
known causal relations into account
18.4.2023 ©L.Motus, 2004 10
Time as used in natural sciences
Each mature science relies on a single concept of time:• theoretical physics – time is just another coordinate
in a four dimensional space, i.e. time is fully reversible
• thermodynamics and biology – time has strict intrinsic direction and, as a rule, is not reversible
• psychology, and other sciences about conscious awareness – time has strict intrinsic direction, it has moving origin (the origin of time is always at the present moment)
18.4.2023 ©L.Motus, 2004 11
Time as used in data and information processing systems
Topological (non-metric) time – that can be reduced to linear ordering of events, and distance between those events is not of interest. Topological time is fully reversible.
Topological time is represented by an instruction counter in programs, or by the order of historical events recorded by a history writer without applying quantitative time labels.
Fully reversible metric time – in the cases if the distance between events becomes important, e.g. some temporal logics
18.4.2023 ©L.Motus, 2004 12
Time as used in simulation systems
Major difference from data processing is the necessity for multiple, fully reversible times
Separate time counting is required for each concurrently running simulated entity. The use of metric time prevails over the topological time.
Virtual time and time warp mechanism demonstrate the most complex use of this concept – developed in UCLA (approximately 1986)
Rumours – this system was used to guide and manage the 1st Gulf war.
18.4.2023 ©L.Motus, 2004 13
Time as used in real-time, embedded systems (1)
In addition to the time as used in data processing and simulation systems, we need:• strictly increasing time – not all the completed
actions can be redone• time with the moving origin – for ensuring time-
selective interactions
All these different time counts must be operational simultaneously
18.4.2023 ©L.Motus, 2004 14
Time as used in real-time, embedded systems (2)
• each process functions in increasing (thermodynamic) time, which advances in grains
• inside each grain the time is fully reversible• inside each grain a process may have many relative,
strictly increasing times (in addition to a fully reversible time)
• for each pair of communicating processes there is a separate relative time with moving origin (in addition to all other times)
This example is taken from the Q-model
18.4.2023 ©L.Motus, 2004 15
Evolution of the role of observations in physics and computer science
R. Milner, 1980, Calculus for Communicating Systems, LNCS no.92
The only way to observe a system is to interact with it. To make two components to interact, means to let them observe each other.
Peter Wegner (1998) “Towards empirical computer science”, 27 pp.
Newtonian, relativity, and quantum theories can be distinguished by their models of the relation between observers and observed systems
18.4.2023 ©L.Motus, 2004 16
More about observers in physics (1)
• Newtonian theory – observer is an external recorder of behaviour (absolute space and time)
• Relativity theory – observer is part of the observed system and distinguishes between properties that• are invariant for all observers (e.g. causality)• depend on an observer (e.g. mass, length,
simultaneity)Properties of objects (mass, length) and relations among
events (simultaneity) have meaning only relative to an observer (i.e. they loose absolute,Newtonian meaning)
18.4.2023 ©L.Motus, 2004 17
More about observers in physics (2)
• Quantum theory – takes the relativity of observers to its logical conclusion, viewing independently existing absolute relativity as unnecessary.
Quantum theorists have moved away from the view that events are caused by an independently existing reality, they believe that observed events do not require causal explanation.
Observations involve an irreversible transfer of knowledge from the observed system to the observer
18.4.2023 ©L.Motus, 2004 18
Different users of time in software process (on the macroscopic scale)
Environment including Humans
Computer system
*Observer of the specification stage (“specifier”)
*Observer of the design and verification stage (“verifier”)
* Observer of the implementation stage (“implementor”)
18.4.2023 ©L.Motus, 2004 19
Time bound terms used by “implementor” (1)
• Physical time – counting cycles of a strictly periodical physical process
• Logical time – counting significant events occurring during program execution
• Absolute time – a reference is established in relation to a global event (origin of time) for the system
• Relative time – a reference is established in relation to a local event (origin of time) for the system
These primitives form the basis for defining more sophisticated terms
18.4.2023 ©L.Motus, 2004 20
Time bound terms used by “implementor” (2)
• Global time – a reference is valid for the whole system (e.g. distributed systems)
• Local time – a reference is valid only for a part of the system
• Synchronisation of computer times with Universal Time Coordinate (UTC)
Conventionally,these terms have been oriented to a single execution of a program (in concordance with the algorithm theory)
None of these time count mechanisms accepts explicit influence from outside of the computer system.
18.4.2023 ©L.Motus, 2004 21
Time bound terms used by a “verifier” (1)
Verification has to demonstrate that all the behaviours required by users, and fixed in the specification, and only those, are generated by the implementation.
Verifiers often use logical time (qualitative order of events) to reason about real-time properties in reactive systems.
The use of metric time (quantitative order of events) enable to reason about time correctness in a larger class of applications.
Verifiers work with models – since they must rely on formal theories.
18.4.2023 ©L.Motus, 2004 22
Time bound terms used by a “verifier” – a case of temporal logic (2)
http://plato.stanford.edu/entries/logic-temporal • Temporal logic (usually a kind of modal logic) studies
how to represent temporal information in logical framework (Arthur Prior, 1960)
• Philosophical discussions about time in temporal logic:• If based on modal logic – past, present, and future• If based on first order logic – earlier and later, but no
presence• Founders – natural languages (A.Prior, 1967), AI
(J.F.Allen, 1984), computer science (A.Pnueli, 1977)
18.4.2023 ©L.Motus, 2004 23
Time bound terms used by a “verifier” – a case of temporal logic (3)
Examples of temporal operators are:before, after, during, since, until, always, …
F - it will some time be the case… ; G - it will always be the case …
Fp Gp Gp Fp• In metric time each temporal operator may have
several time-bound versions – typically upper-bound, and lower-bound operators:• upper-bound properties resemble liveness
properties• lower-bound properties resemble safety properties