0% found this document useful (0 votes)
2 views

lecture01e

This module introduces real-time systems, focusing on programming languages and operating system facilities necessary for embedded and networked systems. Participants will learn to differentiate between soft and hard real-time systems, analyze scheduling mechanisms, and design small concurrent real-time systems. The course covers various topics including job scheduling, resource access control, and real-time communication, with a strong emphasis on practical engineering issues.

Uploaded by

noejr.setenta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

lecture01e

This module introduces real-time systems, focusing on programming languages and operating system facilities necessary for embedded and networked systems. Participants will learn to differentiate between soft and hard real-time systems, analyze scheduling mechanisms, and design small concurrent real-time systems. The course covers various topics including job scheduling, resource access control, and real-time communication, with a strong emphasis on practical engineering issues.

Uploaded by

noejr.setenta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Introduction to

Real-Time Systems

COE186 | Real-Time Systems Development

Slides from
Dr Colin Perkins
Real-Time and Embedded Systems
University of Glasgow
1
Aims of This Module
• To introduce and explore the programming language and
operating systems facilities essential to the implementation
of real-time, reactive, embedded and networked systems.
• To provide the participants with an understanding of the practical
engineering issues raised by the design and programming of real-
time, reactive, embedded and networked systems.

Introduction to Real-Time Systems 2


Intended Learning Outcomes
• By the end of this module participants should be able to:
– Clearly differentiate the different issues that arise in designing soft and
hard real-time, concurrent, reactive, safety-critical and embedded systems.
– Explain the various concepts of time that arise in real-time systems.
– Analyse and apply a variety of static and dynamic scheduling mechanisms
suitable for soft and hard real-time systems. Conduct simple performance
and schedulability analysis to demonstrate that a system can successfully
meet real-time constraints.
– Explain the additional problems that arise in developing distributed and
networked real-time systems.
– Describe the design and implementation of systems that support real-time
applications. Justify and critique facilities provided by real-time operating
systems and networks.
– Design, construct and analyse a small, concurrent, reactive, real-time
system. Select and use appropriate engineering techniques, and explain the
effect of your design decisions on the behaviour of the system.
Introduction to Real-Time Systems 3
Prerequisites
• Students are expected to have done degree-level studies in, and
be familiar with, operating systems design and implementation,
concurrency and threaded programming, and software analysis
and design.

• Some basic familiarity with formal reactive systems modelling


techniques and safety critical system design would complement
the engineering issues addressed in this module
– The MRS4 and SCS4 modules cover that material, but are not formal co-
or pre-requisites

Introduction to Real-Time Systems 4


Module Outline
• Introduction to Real-Time and Embedded Systems
– Reference Model
– Hard versus soft real-time
• Job Scheduling
– Clock driven scheduling algorithms
– Priority driven scheduling algorithms
– Schedulers in commodity and real-time operating systems
• Resource access control
– Algorithms
– Implementation
• Real-time communication
– On best-effort networks
– Enhanced quality of service
• Other implementation considerations
Introduction to Real-Time Systems 5
Reading
• Jane W. S. Liu, “Real-Time Systems”, Prentice-
Hall, 2000, ISBN 0130996513
– This book comprises the lecture notes for the module
and is required reading for all students
– All material in this book is examinable

• Bill Gallmeister, “POSIX.4: Programming for the


Real-World”, O’Reilly and Associates, 1995,
ISBN 1565920740
– Optional, but provides further detail on the practical
aspects of the module

Introduction to Real-Time Systems 6


Real-Time and Embedded Systems
• A real-time system must deliver services in a timely manner
– Not necessarily fast, but must meet some timing deadline
• An embedded system is hidden from view within a larger system
• Many real-time and embedded systems exist, often without the
awareness of their users
– Washing machine, photocopier, mobile phone, car, aircraft, industrial
plant, microwave oven, toothbrush, CD player, medical devices, etc.

• Must be able to validate real-time systems for correctness


– Some embedded real-time systems are safety critical – i.e. if they do not
complete on a timely basis, serious consequences result
– Bugs in embedded real-time systems are often difficult or expensive to fix

Introduction to Real-Time Systems 7


Real-Time and Embedded Systems
• This module will discuss several representative classes of real-
time and embedded system:
– Digital process control
– Higher-level command and control
– Tracking and signal processing
– Real-time databases
– Telephony and multimedia
• Algorithms for scheduling tasks such that those systems complete
in a reliable and timely fashion
• Implementation techniques, operating systems and languages for
building such systems

Introduction to Real-Time Systems 8


Digital Process Control
• Controlling some device (the “plant”) using an actuator, based on
sampled sensor data
– y(t) is the measured state of the plant
– r(t) is the desired state of the plant
– Calculate control output u(t) as a function of y(t), r(t)

controller
reference control-law
input: r(t) A/D D/A
rk computation uk

A/D
yk

y(t) u(t)

Sensor Plant Actuator

Introduction to Real-Time Systems 9


Digital Process Control
• Pseudo-code for the controller:
set timer to interrupt periodically with period T;
at each timer interrupt, do
do analogue-to-digital conversion of y(t) to get yk;
compute control output uk based on reference rk and yk;
do digital-to-analogue conversion of uk to get u(t);
end do;

• Effective control of the plant depends on:


• The correct control law computation and reference input
• The accuracy of the sensor measurements:
• Resolution of the sampled data (i.e. bits per sample)
• Timing of the clock interrupts (i.e. samples per second, 1/T)

Introduction to Real-Time Systems 10


Digital Process Control
• The time T between any two consecutive measurement of y(t), r(t)
is the sampling period
– Small T better approximates the analogue behaviour
– Large T means less processor-time demands
– Must achieve a compromise
• If T is too large, oscillation will result as the system tries to adapt
Desired
Large T

y(t) umax

0 u(t)

-umax
Measured State Control Output

Introduction to Real-Time Systems 11


Digital Process Control
• How to choose sampling period?
– Rise time – the amount of time that the plant takes to reach some small
neighbourhood around the final state in response to a step change in the
reference input
– If R is the rise time, and T is the period, a good rule of thumb is that the
ratio 10 ≤ R/T ≤ 20
• Must be chosen correctly, and accurately implemented to ensure
stability

• Multi-rate systems – system is composed of multiple sensors and


actuators, each of which require different sampling periods
– Need to run multiple control loops at once, accurately
– Usually best to have the sampling periods for the different degrees of
freedom related in a harmonic way

Introduction to Real-Time Systems 12


Example: Helicopter Flight Control
Do the following in each 1/180-second cycle:
• Validate sensor data and select data source; on failure reconfigure the system
• Do the following 30-Hz avionics tasks, each once every 6 cycles:
– Keyboard input and mode selection
– Data normalization and coordinate transformation
– Tracking reference update
• Do the following 30-Hz computations, each once every 6 cycles
– Control laws of the outer pitch-control loop
– Control laws of the outer roll-control loop
– Control laws of the outer yaw- and collective-control loop
• Do each of the following 90-Hz computations once every 2 cycles, using
outputs produced by the 30-Hz computations
– Control laws of the inner pitch-control loop
– Control laws of the inner roll- and collective-control loop
• Compute the control laws of the inner yaw-control loop, using outputs from the
90-Hz computations
• Output commands to control surfaces
• Carry out built-in-test
Introduction to Real-Time Systems 13
Digital Process Control
• Digital controllers make three assumptions:
– Sensor data give accurate estimates of the state-variables being monitored
and controlled - noiseless
– The sensor data gives the state of the plant – usually must compute plant
state from measured values
– All parameters representing the dynamics of the plant are known
• If any of these assumptions are not valid, a digital controller must
include a model of the correct system behaviour
– Estimate actual state based on noisy measurement each iteration of the
control loop
– Use estimated plant state instead of measured state to derive control output
– Often requires complex calculation, modelling

• We’ll cover scheduling dynamics; the system model is domain-


specific
Introduction to Real-Time Systems 14
Higher-Level Control
• Controllers often organized in a hierarchy
– Multiple control loops, higher level controllers monitoring the behaviour of
low-level controllers
– Time-scale, complexity of decision making, increases as go up hierarchy;
Move from control to planning
State Air traffic
– Higher level planning must Estimator control

still be done in real-time, Navigation


although deadlines are less
State Flight
tight Estimator Management

State Flight
Estimator control

Air data

Introduction to Real-Time Systems 15


Real-Time Communications
• Real-time systems are increasingly distributed, including
communication networks
– Control loop may include a communication step
– System may depend on network stimuli

• Not only does a system need to run a control law with time
constraints, it must also schedule communications, sending
and receiving messages according to deadlines

Introduction to Real-Time Systems 16


Example: Drive by Wire
Steering Brake Accelerator Gears

Brake
actuator Controller Engine
area network controls

Wheel Engine
sensors sensors
Control
system

• All data must be delivered reliably


– Bad if you turn the steering wheel, and nothing happens
• Commands from control system have highest priority, then sensors and actuators, then
control inputs
– Anti-lock brakes have a faster response time than the driver, so prioritise to ensure the
car doesn’t skid
• Network must schedule and prioritise communications

Introduction to Real-Time Systems 17


Example: Packet Voice

Packet switched
voice network

• Voice is digitised and sent as a sequence of packets


– Constant spacing, every 10-30ms depending on codec
• Strict timeliness requirement
– Mouth to ear delay needs to be less than approximately 150ms
– Packets must be played out with equal spacing
• Relaxed reliability requirement
– Some small fraction of packets can be lost, and just sound like crackles on
the wire; most need to arrive
• Emergency calls may have priority
Introduction to Real-Time Systems 18
Types of Real-Time Application
• Purely cyclic • Asynchronous: mostly predictable
– Every task executes periodically – Most tasks are not periodic
– Demands in (computing, – The time between consecutive
communication, and storage) executions of a task may vary
resources do not vary significantly considerably, or the variations in
from period to period resource utilization in different
– Example: most digital controllers periods may be large
and real-time monitors – These variations have either
• Mostly cyclic bounded ranges or known statistics
– Most tasks execute periodically • Asynchronous: unpredictable
– The system must also respond to – Applications that react to
some external events (fault asynchronous events and have tasks
recovery and external commands) with high run-time complexity
asynchronously – Example: intelligent real-time
– Example: modern avionics and control systems
process control systems

Introduction to Real-Time Systems 19


Types of Real-Time Application

• As we will see later, the type of application affects how we


schedule tasks, prove correctness
• It is easier to reason about applications that are more cyclic,
synchronous and predictable
– Many real-time systems designed in this manner
– Safe, conservative, design approach, if it works for your application

Introduction to Real-Time Systems 20


Implementation Considerations
• Some real-time embedded systems are complex, implemented on
high-performance hardware
– Industrial plant control
– Civilian flight control
• Many must be implemented on hardware chosen to be low cost,
low power, light-weight and robust; with performance a distant
concern
– Military flight control, space craft control
– Consumer goods

• Often-times implemented in C or assembler, fitting within a few


kilobytes of memory
– Correctness a primary concern, efficiency a close second

Introduction to Real-Time Systems 21


Summary
• Outline of the module structure, assessment, etc.
• Introduction to real-time and embedded systems
– Examples of digital control, higher-level control, communication
• Types of real-time system
– Cyclic synchronous vs. asynchronous and unpredictable
• Implementation considerations

[Liu chapter 1]

Introduction to Real-Time Systems 22

You might also like