embedded real time systems -...
TRANSCRIPT
![Page 1: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/1.jpg)
Embedded Real Time Systems
Prof. Davide Brugali
Università degli Studi di Bergamo
Embedded Real Time Systems
![Page 2: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/2.jpg)
Embedded systems
A real-time computer system is a computer system in which the correctness
of the system behavior depends not only on the logical results of the
computations, but also on the physical instant at which these results are
produced.
A real-time computer system is always part of a larger system–this larger
system is called a real-time system.
A real-time system changes its state as a function of physical time, e.g., a
chemical reaction continues to change its state even after its controlling
computer system has stopped.
![Page 3: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/3.jpg)
Embedded systems
They are computing systems hidden in an object (e.g. a car) to control
its functions, enhance its performance, manage the available resources
and simplify the interaction with the user.
They monitor and control their environment through sensors and
actuators: Sensors: Collect data from the system environment
Actuators: Change (in some way) the system's environment 3
Embedded
computer
Actua tor Actua tor Actua tor Actua tor
Sensor Sensor Sensor Sensor Sensor Sensor
![Page 4: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/4.jpg)
Correctness of Embedded Systems
Correctness
![Page 5: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/5.jpg)
Response Time and Deadline
![Page 6: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/6.jpg)
Real Time Systems
![Page 7: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/7.jpg)
Segway
![Page 8: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/8.jpg)
Online Trading
![Page 9: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/9.jpg)
Controller design and implementation
![Page 10: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/10.jpg)
Controller design and implementation
![Page 11: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/11.jpg)
What is special in ERTS
![Page 12: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/12.jpg)
What is the purpose of concurrency?
• To better exploit the processor
10 -7
10 -6
10 -5
10 -4
10 -3
10 -2
10 -1
10 2
10 1
10 -8
10 -9
Res
ponse
tim
e in
sec
onds
10 0 human tape
floppy
CD
memory
processor
UNIBG - Embedded Real Time Systems - Brugali
![Page 13: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/13.jpg)
What is the purpose of concurrency?
CPU I/O Device
Initiate I/O
Operation Process I/O
Request
Signal Completion
Interrupt I/O
Routine
I/O Finished Continue with
Outstanding Requests
UNIBG - Embedded Real Time Systems - Brugali
idle
idle
![Page 14: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/14.jpg)
What is the purpose of concurrency? • To model parallelism in the real world
• The alternative is to use sequential programming techniques
• The programmer must implement the application in such a way that the various activities are carried out in a predefined sequence
UNIBG - Embedded Real Time Systems - Brugali
![Page 15: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/15.jpg)
16
CRUISE CONTROL Regulate the speed of a car by adjusting the throttle:
Input by the driver sets a speed and car maintains it.
Measures the speed through device connected to the motor shaft
Disturbances: road surface and slope, wind
Real-Time Embedded control
![Page 16: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/16.jpg)
Real-Time Embedded control The responsiveness of the system (Car) can be measured by its rise
time R.
R is the time it takes to get close to its final state after the input
changes.
A good rule of thumb is the ratio R/T of rise time to sampling period is
from 10 to 20.
The faster a system respond to changes, the shorter the sampling
period is.
17
Speed
Controller Actuator Car
Sensor
+ + +
-
+
+
PERIODICALLY T
R Road slope, surface
Actual
speed
SPORADICALLY
Desired
speed
![Page 17: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/17.jpg)
Real-Time Embedded control
18
Speed
Controller Actuator Car
Sensor
+ + +
-
+
+
PERIODICALLY
Set timer to interrupt periodically with Period T;
at each interrupt, do;
read data from Sensor;
compute control output u;
write command to Actuator;
end do;
T
Road slope, surface
Actual
speed
SPORADICALLY
Desired
speed
R
![Page 18: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/18.jpg)
Real-Time Embedded control
19
T
read comp write
CPU
Speed
Controller Actuator Car
Sensor
+ + +
-
+
+
PERIODICALLY T
Road slope, surface
Actual
speed
SPORADICALLY
Desired
speed
R
![Page 19: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/19.jpg)
Real-Time Embedded control
Embedded PC
with OS Microcontroller
without OS
Real Time
Software
Speed
Controller Actuator Car
Sensor
+ + +
-
+
+
PERIODICALLY T
Road slope, surface
Actual
speed
SPORADICALLY
Desired
speed
R
![Page 20: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/20.jpg)
Real-Time Embedded control
21
CRUISE CONTROL WITH OBSTACLE DETECTION Regulate the speed of a car by adjusting the throttle:
Input by the driver sets a speed and car maintains it.
Measures the speed through device connected to the motor shaft
Disturbances: road surface and slope, wind
Automatically regulates the speed according to the distance to the preceding car
Min distance
![Page 21: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/21.jpg)
Concurrent Real-Time Embedded control
22
Speed
Controller Actuator Car
Sensor
+ + +
-
+
+ Desired
speed
Actual
speed
Distance
Monitor Environment
Obstacle distance
PERIODICALLY
PERIODICALLY
Sensor
T1
Road slope, surface
T2
T1
T2 CPU {
communication
![Page 22: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/22.jpg)
Distributed Real-Time Embedded control
23
Speed
Controller Actuator Car
Sensor
+ + +
-
+
+ Desired
speed Actual
speed
Distance
Monitor Environment
Obstacle distance
PERIODICALLY
PERIODICALLY
Sensor
T1
T2
T1
Network
T2
CPU 1
CPU 2
Network
Road slope, surface
![Page 23: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/23.jpg)
Concurrent Real-time Applications
Real-time
Operating System
Hardware
Real-time Application
Task
1
Task
2 ...
Hardware
Real-time Application
Interrupt
Handler
1
Interrupt
Handler
2
...
RT-Operating System
Scheduler
NO
RT-Operating System
Cyclic Executive &
Interrupt Handlers
24
![Page 24: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/24.jpg)
Distributed Real-time Applications
Real-time
Operating System
Hardware
Real-time Application
Task
1
Task
2 ...
Hardware
Real-time Application
Interrupt
Handler
1
Interrupt
Handler
2
...
CAN
Transceiver
25
![Page 25: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/25.jpg)
Distributed Real-time Applications
Real-time
Operating System
Hardware
Real-time Application
Task
1
Task
2 ...
Middleware
Real-time
Operating System
Hardware
Real-time Application
Task
1
Task
2 ...
Middleware
Ethernet / Ethercat
Data / Events
26
![Page 26: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/26.jpg)
27
Need for Special Network Technologies
General-purpose networks, such as Ethernet, exhibit random and nondeterministic behaviour due to the conflict arbitration methods used (e.g., CSMA/CD)
Results in nondeterministic delays, including arbitrarily long delays in
the worst-case
Results in packet dropping during periods of heavy network activity
Fieldbus, used in process and factory automation
PROFIBUS, used in factory and process automation
CANBUS, used in automotive
EtherCAT, Ethernet for Control Automation Technology
![Page 27: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/27.jpg)
Classification of RT Systems
Slides based on the book “Real-Time Systems: Design Principles
for Distributed Embedded Applications”, by H. Kopetz
![Page 28: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/28.jpg)
Hard RT System versus Soft RT System
29
The design of a hard real-time system, which must produce the
results at the correct instant, is fundamentally different from the
design of a soft-real time or an on-line system, such as a
transaction processing system.
![Page 29: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/29.jpg)
Hard RT System versus Soft RT System
![Page 30: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/30.jpg)
Hard RT System versus Soft RT System
![Page 31: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/31.jpg)
Hard RT System versus Soft RT System
![Page 32: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/32.jpg)
Fail-safe versus Fail-Operational For some hard real-time systems one or more safe states which can be reached
in case of a system failure, can be identified. Consider the example of a railway
signaling system. In case a failure is detected, it is possible to stop all the trains
and to set all the signals to red to avoid a catastrophe. If such a safe state can
be identified and quickly reached upon the occurrence of a failure, then we call
the system fail-safe.
Fail-safeness is a characteristic of the controlled object, not the computer
system. In fail-safe applications the computer system must have a high error-
detection coverage, i.e., the probability that an error is detected, provided it has
occurred, must be close to one.
There are, however, applications where a safe state cannot be identified, e.g., a
flight control system aboard an airplane. In such an application the computer
system must provide a minimal level of service to avoid a catastrophe even in
the case of a failure.
This is why these applications are called fail-operational.
![Page 33: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/33.jpg)
Guaranteed Response Paradigm Guaranteed response systems are based on the principle of resource adequacy,
i.e., there are enough computing resources available to handle the specified
peak load and the fault scenario.
Many non safety-critical real-time system designs are based on the principle of
resource inadequacy. It is assumed that the provision of sufficient resources to
handle every possible situation is not economically viable, and that a dynamic
resource allocation strategy based on resource sharing and probabilistic
arguments about the expected load and fault scenarios is acceptable.
Hard real-time systems must be designed according to the guaranteed response
paradigm that requires the availability of adequate resources.
![Page 34: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/34.jpg)
Event-Triggered versus Time-Triggered
• In event-triggered systems, all processing activities are driven by some event in the environment
• The computer system receives the event via an I/O interrupt
• In time-triggered systems, all processing activities are initiated at periodic intervals
• There is a single interrupt associated with a clock to pace the system
• The occurrence of events in the environment are detected via periodic polling
![Page 35: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/35.jpg)
Course content and organization
![Page 36: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/36.jpg)
Course syllabus
38
Part one: embedded system programming Arduino (periodic and reactive programming)
Introduction to operating systems and RT OS
Concurrent programming with POSIX
RT Communication : CANBUS, DDS
Part two: Real Time scheduling Priority-driven scheduling
Shared resources
Oveload management
Scheduling Aperiodic tasks
Response Time Analysis
Part three: designing Real Time application Component-based development
UML MARTE
![Page 37: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/37.jpg)
Teaching material
39
Textbook Giorgio C. Buttazzo, «Sistemi in Tempo Reale»,
Pitagora Editrice Bologna, 3° edizione
Giorgio C. Buttazzo, Hard Real-Time Computing
Systems, Springer
Course web site http://robotics.unibg.it/teaching/srt/
![Page 38: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/38.jpg)
![Page 39: Embedded Real Time Systems - Unibgrobotics.unibg.it/teaching/srt/pdf/01_ERTS_Introduction.pdfEmbedded systems A real-time computer system is a computer system in which the correctness](https://reader035.vdocuments.us/reader035/viewer/2022081400/5f0d53c77e708231d439ccaf/html5/thumbnails/39.jpg)
Exam
Written exam only • Theoretical questions • Scheduling exercises
Preappello • Monday December 16th 2019
41