Title: Introduction to Realtime and Embedded Systems
1Introduction to Real-time and Embedded Systems
- Robert Oshana
- Engineering Manager
- Texas Instruments
- Roshana_at_ti.com
2Lecture 2
- Introduction to Real-Time Systems
3Agenda
- What is a real-time system?
- Characteristics of real-time systems
- Timing constraints
- Example
4What is a real-time system ?
5Introduction
- A real-time system is a system that is required
to react to stimuli from the environment
(including the passage of physical time) within
time intervals dictated by the environment - Oxford Any system in which the time at which
output is produced is significant - Input corresponds to some movement in the
physical world - Output has to relate to that same movement
6Introduction
- Lag from input time to output time must be
sufficiently small for acceptable timeliness. - Generally, real-time systems are systems that
maintains a continuous timely interaction with
its environment - Correctness of a computation depends not only
upon its results but also upon the time at which
its outputs are generated
7Introduction
- A real-time system must satisfy bounded response
time constraints or suffer severe consequences - If the consequences consist of a degradation of
performance, but not failure, the system is
referred to as a soft real-time system (e.g. time
adjusting system on computers over the network) - If the consequences are system failure, the
system is referred to as a hard real-time system.
(e.g. emergency patient management system in
hospitals)
8Reactive and embedded
- There are two types of real-time systems
- Reactive real-time system involves a system that
has constant interaction with its environment.
(e.g. a pilot controlling an aircraft) - Embedded real-time system used to control
specialized hardware that is installed within a
larger system. (e.g. a microprocessor that
controls the fuel-to-air mixture for automobiles)
9Signals from the environment
10Analog to digital and back
11RT event characteristics
- Real-time events fall into one of the three
categories - Asynchronous events
- entirely unpredictable
- the event that a user makes a telephone call..as
far as the telephone company is concerned, the
action of making a phone call cannot be predicted
12RT event characteristics
- Synchronous event predictable and occur with
precise regularity if they are to occur (the
audio and video in a movie take place in
synchronous fashion) - Isochronous events occur with regularity within
a given window of time (audio bytes in a
distributed multimedia application must appear
within a window of time when the corresponding
video stream arrives) - Isochronous is a sub-class of asynchronous
13Real time vs Shared
14Characteristics of real time systems
15Large and complex
- Most of the problems associated with developing
software are those related to size and complexity - This largeness is related mostly to variety
- The real world is continuously changing
- large programs, like all complex systems, must
continuously evolve - Software programs tend to exhibit the undesirable
property of largeness. This is mainly due to
continuous changeÂ
16Manipulation of real numbers
- Many real-time systems involve the control of
some engineering activity - outputs compared to a desired or reference signal
to produce an error signal - A real-time requirement of many systems is to
move to a new point set within a fixed time
period - adds to the complexity of the computations
17Reliable and safe
- The more society relinquishes control of its
vital functions to computers, the more it becomes
imperative that those computers do not fail - In hostile environments, systems must be able to
fail in a controlled way - All expected difficulties inherent in the
application must be taken into account (including
those introduced by faulty software design!)
18Concurrent control of separate system components
- Typical RT embedded system consists of computers
and sensors and actuators - Usually several co-existing external elements
which the computer must interact with
simultaneously - The very nature of these external elements is
that they exist in parallel - Actions performed by the computer must be carried
out in sequence but give the allusion of being
simultaneous - data that must be collected and processed at
various geographical points
19Real time facilities
- Response time is crucial to any embedded system
- Very difficult to design and implement systems
which will guarantee the appropriate output will
be generated at the appropriate times under all
possible conditions - Doing this and making use of all computing
resources at all times is often impossible
20Real time facilities
- Real-time systems usually constructed using
processors with considerable space capacity - ensures worst case behavior does not produce any
unwelcome delays during critical periods of the
systems operation - The designer must be cognizant of weight and
power issues!
21Real time facilities
- Given adequate processing power, a good real-time
programming language, and run-time support is
required to enable the programmer - to specify times at which actions are to be
performed - to specify times at which actions are to be
completed - to respond to situations where all timing
requirements cannot be met - respond to situations where the timing
requirements are changed dynamically (mode
changes)
22Interaction with hardware devices
- Nature of embedded real-time systems requires
them to interact with the external world - Many of the operational requirements for
real-time systems are device and computer
dependent - These devices may generate interrupts in response
to certain events and errors
23Efficient execution and the execution environment
- Real-time systems are time critical
- efficiency of their implementation is more
important than in other systems - Benefit of using a HLL is to allow the
programmer to abstract away the details and
concentrate on solving the problem - not always true in the embedded system world
- Higher level languages can be used in real-time
systems effectively
24Efficient execution and the execution environment
- A system operates in real time as long as its
actions which have time constraints are performed
with acceptable timeliness - Acceptable timeliness is defined as part of the
behavioral requirements for the system - Resource management may be performed statically
off-line or dynamically on-line - Real-time resource management comes at a cost
25Efficient execution and the execution environment
- The degree to which a system is required to
operate in real time cannot necessarily be
attained solely by hardware over-capacity (e.g.,
high processor performance) - There must exist some form of real-time resource
management - Systems which must operate in real time need an
balance of real-time resource management and
hardware resource capacity
26Efficient execution and the execution environment
- Embedded systems have interactions with physical
devices and processes whose dynamics follow their
own laws in a system-wide physical time frame - Physical (as opposed to logical) time is
necessary in real-time resource management for - relating events to their moments of occurrences
- state variables to their values -- e.g. for
action time constraints - measuring rewards or costs incurred as actions
progress to completion - history logging etc
27Timing Constraints
28Timing Constraints
- Define response time requirements for software
and/or the environment - Many simple cases
- key press response time lt 10 msec
- Four basic types of timing constraints
- stimulus-response
- response-response
- stimulus-stimulus
- response-stimulus
29Timing Constraints
- Stimulus is an action performed by the user or
environment on the system - Response is an action by the system on the user
or environment
30Stimulus-Response
- Stimulus-response constraint that the system
must produce a response in accordance with a
specified timing relationship to an earlier user
stimulus to the system
31Stimulus-Response
- Examples
- The system shall generate a dial tone within 15
seconds of a user taking the phone off the hook
(maximum constraint) - The system shall arm the door no sooner than 1
minute after the alarm on button is pressed
(minimum constraint) - Stimulus and response do not need to be adjacent
in time
32Response-Response
- Response-response used to specify a temporal
relationship that must exist between two
arbitrary system responses in the environment - Examples
- The system shall initiate the door closing
operation within 20 seconds of locking the
landing gear in the retracted state (maximum)
33Response-Response
- Examples
- The system shall generate a launch missile
command no sooner than 5 seconds after generating
a start battery warm up command (minimum)
34Stimulus-Stimulus
- Stimulus-stimulus enables us to specify
expected behavior of a user or environment of a
system in terms of maximum or minimum timing
constraints between two stimuli - Examples
- Users must type their password within 15 seconds
of typing their identification or they will be
denied access to the database (maximum)
35Stimulus-Stimulus
- Examples
- Pilots must not press the launch weapon button
sooner than 10 seconds after pressing the fire
ready button (minimum)
36Response-Stimulus
- Response-stimulus enables us to specify a
temporal relationship that must exist between a
system response and a subsequent user stimulus - Examples
- The user must dial the complete phone number
within 1 minute of hearing the dial tone
(maximum)
37Response-Stimulus
- Examples
- The user may not make a menu selection sooner
than 5 seconds after completion of the menu
display (minimum)
38System vs user ??
- S-R and R-R define timing requirements on the
system being specified - Function must be implemented in such a way as to
be fast enough (or slow enough) to meet the
timing requirement
39Timing Constraints
- S-S and R-S constraints imply the system must be
able to detect a violation of timing constraints
by the user or environment - Do not imply the software must be rapid or slow
but there must be additional software - detect inappropriate timed user stimuli
- generate alternative response to the user
- warning
- error message
40Example
41Monitoring and control systems
- Important class of real-time systems
- Continuously check sensors and take actions
depending on sensor values - Monitoring systems examine sensors and report
their results - Control systems take sensor values and control
hardware actuators
42Security system
- System is required to monitor sensors on doors
and windows to detect the presence of intruders
in a building - When a sensor indicates a break-in, system
switches on lights around the area and calls
police automatically - Includes provision for operation without a mains
power supply
43Security system
- Sensors
- Movement detectors, window sensors, door sensors.
- 50 window sensors, 30 door sensors and 200
movement detectors.
44Security system
- Actions
- When an intruder is detected, police are called
automatically. - Lights are switched on in rooms with active
sensors. - An audible alarm is switched on.
- The system switches automatically to backup power
when a voltage drop is detected.
45The R-T system design process
- Identify stimuli and associated responses
- Define the timing constraints associated with
each stimulus and response - Allocate system functions to concurrent processes
46The R-T system design process
- Design algorithms for stimulus processing and
response generation - Design a scheduling system which ensures that
processes will always be scheduled to meet their
deadlines
47Stimuli to be processed
- Power failure
- Generated aperiodically by a circuit monitor.
When received, the system must switch to backup
power within 50 ms - Intruder alarm
- Stimulus generated by system sensors. Response is
to call the police, switch on building lights and
the audible alarm
48Timing requirements
Stimulus/Response
Timing requirements
Power fail interrupt
The switch to backup power must
be completed
within a deadline of 50 ms.
Door alarm
Each door alarm should be polled twice
per
second.
Window alarm
Each window alarm should be polled twice
per
second.
Movement detector
Each movement
detector should be polled twice
per second.
Audible alarm
The audible alarm should be switched
on within
1/2 second of an alarm being raised by a sensor.
Lights switch
The lights should be switched on
within 1/2
second of an alarm being raised by a sensor.
Communications
The
call to the police should be started within 2
seconds of an alarm being raised by a sensor.
Voice synthesiser
A synthesised message should be available
within
4 seconds of an alarm being raised by a sensor
49Summary
- Embedded systems and real-time systems are unique
- Must understand the constraints of these systems
- Failure to specify and define these constraints
early can lead to trouble down the road - Complexity and size is growing!