The execution architecture determines largely the realtime and performance
behavior of a system. Hard real time is characterized as ”missing a deadline” will
...
Execution architecture concepts by Gerrit Muller Buskerud University College e-mail:
[email protected] www.gaudisite.nl
Abstract The execution architecture determines largely the realtime and performance behavior of a system. Hard real time is characterized as ”missing a deadline” will result in system failure, while soft real time will result ”only” in dissatisfaction. An incremental design approach is described. Concepts such as latency, response time and throughput are illustrated. Design considerations and recommendations are given such as separation of concerns, understandability and granularity. The use of budgets for design and feedback is discussed.
hard real time systems should be explainable with a few A4 diagrams
Distribution This article or presentation is written as part of the Gaudí project. The Gaudí project philosophy is to improve by obtaining frequent feedback. Frequent feedback is pursued by an open creation process. This document is published as intermediate or nearly mature version to get feedback. Further distribution is allowed as long as the document remains complete and unchanged.
to combine or not to combine?
reasoning must be possible
limited use of tasks, threads, priorities
October 20, 2017 status: preliminary draft version: 1.1
overview is based on understanding many (critical) details
complex reality; many details, many relations
simulation: additional means if declared indispensable this is often a symptom of poor models
simulation
simple is better
Execution Architecture other architecture views
dead lines timing, throughput requirements ut
receive
execution architecture
inp
functional model demux display
Map
process
thread
store
p in
hardware CPU
DSP
RAM
ut
p in
interrupt handlers
ut
repository structure Applications play
tuner
txt
drive UI toolkit menu
foundation classes
Execution architecture concepts 2 Gerrit Muller
zap
process process process task task task thread thread thread thread thread thread
processing DCT
hardware abstraction
queue
tuner
list
DVD drive
execution architecture issues: concurrency scheduling synchronisation mutual exclusion priorities granularity
version: 1.1
October 20, 2017 CVexecutionArchitecture
Fuzzy customer view on real time
hard real time
soft real time
disastrous failure
dissatisfaction
human device safety safety
loss of functionality
loss of information
Execution architecture concepts 3 Gerrit Muller
limited throughput
loss of eye hand coordination
version: 1.1
October 20, 2017 EAChardVsSoft
waiting time
Smartening requirements Limited set of hard real time cases freq
Precise form of the distribution is not important. Be aware of systematic effects No exception allowed Worst case must fit
time 20 ms Well defined set of performance critical cases freq
Typical within desired time, limited exceptions allowed. Exceptions may not result in functional failure
90% 200 ms
Execution architecture concepts 4 Gerrit Muller
time 500 ms
version: 1.1
October 20, 2017 EACsmarteningRequirements
Latency long distance connection telephone
telephone
bla bla bla reaction
perceived delay connection latency speak listen
connection latency
bla bla bla
speak listen
reaction reaction bla bla bla time
Execution architecture concepts 5 Gerrit Muller
version: 1.1
October 20, 2017 EAClatency
Response Time
new channel
zap
total response time
P+
zap repetition
Premote control
zap
visual feedback
open for next new respons channel time
visual feedback time Execution architecture concepts 6 Gerrit Muller
version: 1.1
October 20, 2017 EACresponseTime
Throughput
speakers
tuner pip
tuner processing
screen TV
throughput: + processing steps/frame + frames/second + concurrent streams Execution architecture concepts 7 Gerrit Muller
version: 1.1
October 20, 2017 EACthroughput
Gross versus Nett bus bandwidth, processor load [memory usage] useful macroscopic views, be aware of microscopic behavior margin loss = not schedulable overhead
gross
bus, OS, scheduling
depends on design depends strongly on granularity
nett
function 4 function 3
application overhead is still in this "nett" number
function 2 function 1
Execution architecture concepts 8 Gerrit Muller
version: 1.1
October 20, 2017 EACbrutoVsNetto
Design recommendations separation of concerns
soft Real Time
process as unit of execution clear single demarcation between hard and soft
decoupling
minimize influence
queues or buffers
performance HW
HW
HW hard Real Time
minimal shared resources
Execution architecture concepts 9 Gerrit Muller
separation
manage tension explicit cost
version: 1.1
October 20, 2017 EACseparation
Design recommendations understandability hard real time systems should be explainable with a few A4 diagrams
to combine or not to combine?
reasoning must be possible
limited use of tasks, threads, priorities overview is based on understanding many (critical) details
complex reality; many details, many relations
simulation: additional means if declared indispensable this is often a symptom of poor models
simulation
simple is better Execution architecture concepts 10 Gerrit Muller
version: 1.1
October 20, 2017 EACunderstandability
Granularity considerations == == unit of or or synchronization
unit of buffering
unit of processing
video frame
video line pixel
fine grain: flexible high overhead
Execution architecture concepts 11 Gerrit Muller
coarse grain: rigid low overhead
version: 1.1
October 20, 2017 EACgranularity
== or
unit of I/O
Design patterns
synchronous
thread based
safety critical, reliable, subsystems
Asynchronous applications and services
very low overhead predictable understandable
separation of timing concerns sharing of resources (no wait)
works best in total separation does not work for multiple rhythms
poor understanding of concurrency danger of high overhead
timer based
interrupt based I/O and HW events
regular rhythm;
c n yfrm ,sp e tvilb a d
ly d ,p u sa W itrH n o m .g e
separation of timing concerns low "tunable" overhead understandable
definition of interrupts determines: overhead, understandability
fast rhythms significant overhead
Execution architecture concepts 12 Gerrit Muller
version: 1.1
October 20, 2017 EACdesignPatterns
Synchronous design
HW
SW
HW
input for tn
input for tn+1
calculate tn
calculate tn-1
execute tn-2
execute tn-1
setting tn+1 clk
input for tn+2
calculate tn+1
execute tn
calculate tn+2
execute tn+1
double buffer: full decoupling of calculation and execution
setting tn HW
Execution architecture concepts 13 Gerrit Muller
input for tn+3
version: 1.1
October 20, 2017 EACsynchronousDesign
Execution architecture concepts 14 Gerrit Muller m
la
e
ze ro
pl
h
pl
le r e ve sp l f on un se ctio
ap
n
ge
fe r
itc
ns
w
tra
ts
PU
ay
le e x ve l ch m an es g e sa
ap
ge
nt ex
sa
co
es
re
m
pu
C
el
(s) 10-6
es pl le D sa ve is k ge l n se ex etw ek ch o an rk ge ap pl le re ve sp l f on un se ctio n
cy
tim
z
rd
G H
rte
(ns) 10-9
ap
e
te n
cl
2
ve
light travels 1 cm
0H
z
de
10
vi
o
lin
e
0 f ra H z m m TV ey an e ee h y hu e an m d an co -o re rd hu ac in m tio at an n io tim n 1 st hu e i rr m ita an tio th 2 nd n re th sh i r r i re t ol at sh d io ol n d hu
10
10 0 pi Hz xe v l t id im eo e
application needs
pa fa cka st g e et t he ra rn ns et fer
1
AM
cy
1 b fa yte st et tran he s rn fer et
R
AM
e
in
(ps) 10-12
D
R
from low to high level storage/network
D
cl
4
cy
FO
Actual timing on logarithmic scale
(ms) 10-3 (s) 1
October 20, 2017 RVtimeAxis
version: 1.1
from low level to high level processing times
Typical micro benchmarks for timing aspects infrequent operations, often time-intensive
often repeated operations
database
start session finish session
perform transaction query
network, I/O
open connection close connection
transfer data
high level construction
component creation component destruction
low level construction
object creation object destruction
basic programming
memory allocation memory free
function call loop overhead basic operations (add, mul, load, store)
OS
task, thread creation
task switch interrupt response
HW
power up, power down boot
cache flush low level data transfer
Execution architecture concepts 15 Gerrit Muller
method invocation same scope other context
method invocation
version: 1.1
October 20, 2017 RVuTimingBenchmarks
time
The transfer time as function of blocksize
wo
toverhead
Execution architecture concepts 16 Gerrit Muller
se a c rst
ze i s k c o l b l a optim
version: 1.1
October 20, 2017 RVparametrizedTransferRate
rate-1
block size
Example of a memory budget memory budget in Mbytes
code obj data bulk data
total
shared code User Interface process database server print server optical storage server communication server UNIX commands compute server system monitor
11.0 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
3.0 3.2 1.2 2.0 2.0 0.2 0.5 0.5
12.0 3.0 9.0 1.0 4.0 0 6.0 0
11.0 15.3 6.5 10.5 3.3 6.3 0.5 6.8 0.8
application SW total
13.4
12.6
35.0
61.0
UNIX Solaris 2.x file cache
10.0 3.0
total
74.0
Execution architecture concepts 17 Gerrit Muller
version: 1.1
October 20, 2017 RVmemoryBudgetTable
Complicating factors and measures
complications
measures
cache
considered margin
bus allocation
explicit behavior
memory management
architecture rules
garbage collection
monitoring, logging
memory (buffer, storage) fragmentation
pool management
non preemptable OS activities
feedback to architect
"hidden" dependencies (ie [dead]locks)
flipover simulation
systematic "coincidences", avalanche triggers instable response, performance
Execution architecture concepts 18 Gerrit Muller
version: 1.1
October 20, 2017 EACcomplicationsMeasures