L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 ·...
Transcript of L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 ·...
Embedded Real time systems - an Introduction - Lecture slides 2006 1
Roger Johansson
Embedded Real time systems –an Introduction
What’s a ”Real time system”? The concept of control.Embedded real time control – some examplesSome terminology”Scheduling” – determination of actions”Execution time analysis” – a prerequisite for scheduling
Embedded Real time systems - an Introduction - Lecture slides 2006 2
Roger Johansson
In Control ?
Embedded Real time systems - an Introduction - Lecture slides 2006 3
Roger Johansson
In Control ?
Embedded Real time systems - an Introduction - Lecture slides 2006 4
Roger Johansson
In Control ?Swedish fighter JAS 39 GRIPEN
Embedded Real time systems - an Introduction - Lecture slides 2006 5
Roger Johansson
In Control ? Swedish fighter JAS 39 GRIPEN
Embedded Real time systems - an Introduction - Lecture slides 2006 6
Roger Johansson
In Control ? Swedish fighter JAS 39 GRIPEN
Embedded Real time systems - an Introduction - Lecture slides 2006 7
Roger Johansson
In Control ? but even big planes crash ...
Embedded Real time systems - an Introduction - Lecture slides 2006 8
Roger Johansson
In Control ? and helicopters ...
Embedded Real time systems - an Introduction - Lecture slides 2006 9
Roger Johansson
In Control ? Control requires feedback
Embedded Real time systems - an Introduction - Lecture slides 2006 10
Roger Johansson
In Control ?
A control system is a feedback system
Time properties (temporal aspects) is fundamental for a well designed control system.
A computer designed for control has to handle REAL-TIME as desired by the controlled object.
Embedded Real time systems - an Introduction - Lecture slides 2006 11
Roger Johansson
traffic control
local control
train (consist) control
((( )))
((( )))
wayside control
traffic control
local control
train (consist) control
((( )))
((( )))
wayside control
Real time control applications
Embedded Real time systems - an Introduction - Lecture slides 2006 12
Roger Johansson
The “F-8 Digital Fly-By-Wire (DFBW)”validated fundamental concepts still used today. The first “by-wire” flight was in the 25’th of May in 1972. The project lasted for 13 years.
hydraulic information
carrier
electronic information
carrier
steer ”by-wire”
Embedded Real time systems - an Introduction - Lecture slides 2006 13
Roger Johansson
Computers in space…
Embedded Real time systems - an Introduction - Lecture slides 2006 14
Roger Johansson
..development of Automotive electronics
Embedded Real time systems - an Introduction - Lecture slides 2006 15
Roger Johansson
..and within marine applications.
Embedded Real time systems - an Introduction - Lecture slides 2006 16
Roger Johansson
control characteristics in a car
simple reactive (ON/OFF) …climate, windows …
reactive, autonomous …engine- and gear- control, anti-brake-lock, anti-spin, etc.
safety criticalairbag ...
others..navigation, audio-video ...
Embedded Real time systems - an Introduction - Lecture slides 2006 17
Roger Johansson
A control system
A/D
A/D
Computationscontrol laws D/A
actuatorsensor object
r(t)
y(t) u(t)
yk
rk
uk
Embedded Real time systems - an Introduction - Lecture slides 2006 18
Roger Johansson
Time triggered implementations
object
initiate
input
calculate
output
Pros
Easy to understand, easy to implement.
Cons
Time synchronization is tied to underlying hardware.
Difficult to anticipate and handle unordered events.
Software complexity depends on object .
Embedded Real time systems - an Introduction - Lecture slides 2006 19
Roger Johansson
activity..
initiate
object
wait...
Event triggered implementations
Pros
Easy to understand.
Short response times (good feedback performance)
Cons
Exteremely complex software when object becomes complex.
Embedded Real time systems - an Introduction - Lecture slides 2006 20
Roger Johansson
A software task
actuator
actuator
sensor
micro computer
sample input from
sensor
update actuators
compute new values
(control laws)
t
task 1 task 2 task 3
Embedded Real time systems - an Introduction - Lecture slides 2006 21
Roger Johansson
Computational model
sensorsactuators
stimuli response
tasks
Embedded Real time systems - an Introduction - Lecture slides 2006 22
Roger Johansson
Scheduling strategies
task 1 task 2 task 3
task switch
t
Non-preemptive
(serial)
task 1
task 2
task 3
task switch
t
Preemptive
(parallel)
Embedded Real time systems - an Introduction - Lecture slides 2006 23
Roger Johansson
Scheduling methods
Pre run-time scheduling• static scheduling
• fixed priority scheduling
• ….
Run-time scheduling
• EDF (earliest deadline first)
• FCFS (first comes first served)
• ….
Embedded Real time systems - an Introduction - Lecture slides 2006 24
Roger Johansson
Task characteristics
while(1){
A = read_sensor(…);
nA = compute(A);
write_sensor(nA);
delay( 10 );
}
P(ri,c,d,pmin)
Embedded Real time systems - an Introduction - Lecture slides 2006 25
Roger Johansson
time
r S C
d
c
P(r,c,d)
Task characteristics
Embedded Real time systems - an Introduction - Lecture slides 2006 26
Roger Johansson
time
r1 r2 r3 r4
p p p
Periodic tasks
P(ri,c,d,p)
Embedded Real time systems - an Introduction - Lecture slides 2006 27
Roger Johansson
time
r1 r2 r3
Aperiodic tasks with multiple start times
pmin
P(ri,c,d,pmin)
Embedded Real time systems - an Introduction - Lecture slides 2006 28
Roger Johansson
Measurements, program under test is executed a number of times. A Worst Case Execution Time is estimated.
Code analysis, determine the most time consuming path through the program and determine execution time for this path.
Task Execution time analysis
Embedded Real time systems - an Introduction - Lecture slides 2006 29
Roger Johansson
// Example
t_start = C(t);P();t_finish = C(t);
t_exec = t_finish – t_start;
Execution time measure
Embedded Real time systems - an Introduction - Lecture slides 2006 30
Roger Johansson
BB 1BB2
BB3
start
stop
label:..instr 1..instr 2..instr 3
...
..instr n
bra ...
label:..instr 1..instr 2..instr 3
...
..instr n
bra ...
Execution time analysis, basic blocks
Embedded Real time systems - an Introduction - Lecture slides 2006 31
Roger Johansson
BB 1
BB 2
BB 3
start
stop
A Control Flow Graph represents all possible execution paths in a program. Contributions from all basic blocks are summed.
A Control Flow Graph represents all possible execution paths in a program. Contributions from all basic blocks are summed.
Σ BB
start
stop
Execution time analysis, Control Flow Graphs
Embedded Real time systems - an Introduction - Lecture slides 2006 32
Roger Johansson
Conclusions
we have got a brief introduction towe have got a brief introduction to
which finishes today’s lecture ...which finishes today’s lecture ...
The concept of control.Embedded real time control Real Time Systems terminologyTask SchedulingExecution time analysis