l3 - embedded real time systems - chalmerssvenk/it_university/embedded_systems... · 2006-09-10 ·...

16
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 examples Some 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 ?

Upload: others

Post on 13-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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 ?

Page 2: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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

Page 3: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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

Page 4: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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 ...

Page 5: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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.

Page 6: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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”

Page 7: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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

Page 8: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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 ...

Page 9: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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 .

Page 10: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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

Page 11: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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)

Page 12: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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)

Page 13: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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)

Page 14: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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

Page 15: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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

Page 16: L3 - Embedded Real Time Systems - Chalmerssvenk/IT_university/embedded_systems... · 2006-09-10 · Embedded Real time systems - an Introduction - Lecture slides 2006 15 Roger Johansson..and

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