Professional Documents
Culture Documents
Lecture - Specifications & Modeling of Embedded Systems
Lecture - Specifications & Modeling of Embedded Systems
Embedded Systems
3: ES-hardware 8. Test *
6: Application mapping
Hierarchy
Humans not capable to understand systems
containing more than ~5 objects.
Most actual systems require more objects
Hierarchy (+ abstraction)
proc
Behavioral hierarchy proc
proc
Examples: states, processes, procedures.
Structural hierarchy
Examples: processors, racks,
printed circuit boards
Concurrency
Synchronization and communication
Timing behavior
Essential for embedded and cy-physical systems!
• Additional information (periods, dependences,
scenarios, use cases) welcome
• Also, the speed of the underlying platform must be
known
• Far-reaching consequences for design processes!
“The lack of timing in the core abstraction (of computer science) is a flaw, from the
perspective of embedded software” [Lee, 2005]
? execute
t
execute
t
State-oriented behavior
Required for reactive systems;
classical automata insufficient.
Event-handling
(external or internal events)
Exception-oriented behavior We will see, how all the
Not acceptable to describe arrows labeled k can be
replaced by a single one.
exceptions for every state
Sequence
constraint
Nodes
Nodescould
couldbe
beprograms
programsororsimple
simple
operations
operations
Shared memory
thread a { thread b {
u = 1; .. ..
P(S) //obtain mutex P(S) //obtain mutex
if u<5 {u = u + 1; ..} u=5
// critical section // critical section
V(S) //release mutex V(S) //release mutex
} }
… …
send () receive ()
… …
… …
send () receive ()
… …
queue
a 56 time
5 10 13 15 19
b 7 action
c 8 a:=5 b:=7 c:=8 a:=6 a:=9
Differential equations
2x
b
t 2
Data flow
(models the flow of data in a distributed system)
Petri nets
(models synchronization in a distributed system)
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides: Design Patterns, Addision-
Wesley, 1995
3/15/19 Md. Firoj Ali, Assistant Professor © Edward Lee, Berkeley, Artemis 36
Conference, Graz, 2007
Example: Observer Pattern in Java
3/15/19 Md. Firoj Ali, Assistant Professor © Edward Lee, Berkeley, Artemis 38
Conference, Graz, 2007
Mutexes using monitors are minefields
val uests
req
ueC
x
myListeners[i].valueChanged(newvalue)
han
by
ge
ld
}
he
lock
}
valueChanged() may attempt to acquire a lock on
some other object and stall. If the holder of that lock
calls addListener(): deadlock!
3/15/19 Md. Firoj Ali, Assistant Professor © Edward Lee, Berkeley, Artemis 39
Conference, Graz, 2007
Simple Observer Pattern: Becomes not so simple
3/15/19 Md. Firoj Ali, Assistant Professor © Edward Lee, Berkeley, Artemis 41
Conference, Graz, 2007
Why are deadlocks possible?
Mutual exclusion
No preemption
Circular wait
using compromises
© Springer, 2010
3/15/19 Md. Firoj Ali, Assistant Professor These slides use Microsoft clip arts.
Microsoft copyright restrictions apply.
Capturing the requirements as text
MMI
Communication
NAV RAD
DB
< 200 ms
MMI
<
50
m
Communication
s
NAV RAD
DB
Communication
Resource
Demand
< 200 ms
MMI
Communication
NAV RAD
DB
MMI
<
10
00
m
s
Communication
NAV RAD
DB
Can be
used to
show the Other duty
change of
Professor preparation
the state
of an teaching
object
over time. recording
Recording
assistant editing
Other duty
* W. Damm, D. Harel: LSCs: Breathing Life into Message Sequence Charts, Formal Methods in System Design, 19, 45–80, 2001
Extension 1: har t
r e- c
P
Introduction of pre- Prof Mic Cam TA Recorder
charts:
Pre-charts describe test
conditions that must
hold for the main confirms
press
chart to apply.
Example:
Extension
Extension2:
2:Mandatory
Mandatoryvs.
vs.provisional
provisionalbehavior
behavior
Level Mandatory (solid lines) Provisional (dashed
lines)
Chart All runs of the system At least one run of the
satisfy the chart system satisfies the
chart
Location Instance must move Instance run need not
beyond location/time move beyond loc/time
Message If message is sent, it will Receipt of message is
be received not guaranteed
Condition Condition must be met; If condition is not met,
otherwise abort exit subchart
3/15/19 Md. Firoj Ali, Assistant Professor 63
(Message) Sequence Charts
PROs:
Appropriate for visualizing schedules,
Proven method for representing schedules in transportation.
Standard defined: ITU-TS Recommendation Z.120:
Message Sequence Chart (MSC), ITU-TS, Geneva,
1996.
Semantics also defined: ITU-TS Recommendation
Z.120: Message Sequence Chart (MSC)—Annex B:
Algebraic Semantics of Message Sequence Charts,
ITU-TS, Geneva.
CONS:
describes just one case, no timing tolerances: "What does
an MSC specification mean: does it describe all
behaviors of a system, or does it describe a set of
sample behaviors of
3/15/19 a Ali,
Md. Firoj system?”
Assistant Professor * 64
Communicating finite state machines
© Springer, 2010
3/15/19 Md. Firoj Ali, Assistant Professor These slides use Microsoft clip arts.
Microsoft copyright restrictions apply.
Models of computation considered in this course
Classical automata:
Z0 e=1 Z1
Moore-automata: 0 1
Y = (Z); Z+ = (X, Z) e=1 e=1
Mealy-automata
Z3 Z2
Y = (X, Z); Z+ = (X, Z) 3 e=1 2