2. Overview
• Context
&
MoCvaCons
• Logical
Time
Formalism
• ClockSystem:
Logical
Time
in
Smalltalk
• Example
• Conclusion
&
PerspecCves
3. Context
&
MoCvaCon
• Parallel
plaGorms
available
(mulC-‐core,
GPU,
www)
• More
and
more
Parallel
&
Distributed
apps
• General-‐purpose
languages
have
constructs
for
expressing
concurrency
and
exploi+ng
parallelism
• DifficulCes
for
reasoning
about
concurrency:
– Low-‐level,
implementaCon
specific
– Lack
of
formal
semanCcs
4. Logical
Time
and
Synchronous
languages
• Logical
Time
(Leslie
Lamport
‘78)
– Abstracts
“physical”
Cme
as
a
par1al
order
of
events
– Mul1-‐form,
the
event
need
not
be
Cme
related
• Enables
to
describe,
manipulate
and
analyze
interacCons,
communicaCons,
synchronizaCons
between
processes.
• Used
in
hardware,
embedded
and
distributed
systems
– Signal,
Lustre,
Esterel,
CCSL
7. ClockSystem
Figure 3: Automaton encoding the SDF execution policy
• Logical
Time
embedded
in
Smalltalk
• Automata
interpretaCon
of
CCSL
primiCves
Figure 4: CLOCKSystem model (abstract syntax)
8. for
primiCves:
StrictPrecedence
(<)
Figure 5: The infinite automaton of the a b relation
ClockSystem Metamodel. At its core, the CLOCKSystem
toolkit relies on the Smalltalk implementation of the meta-model
presented in Fig. 4. In this meta-model, the two cen-tral
concepts are the Clocks and the ClockRelations. The
Clocks are instantiated and linked to problem-space ob-jects
representing the different events of interests. Each
ClockRelations contains an automaton specification en-coding
its operational semantics. Conceptually, this automa-ton
variable is in transitions value: a set {a}} in should the period clock2 a transition while correct automata-based
(such
are con-strained
CCSL,
prece-dence.
CLOCKSystem, infi-nite
relation-definition
In this
explicitly
the out-going
example, the
shown
by the
num-ber
state-
not passed as arguments when these blocks are evaluated.
They can, however, be used in a read-only manner since
they will be free variables in the action block and capture
their value from the enclosing scope, the automaton block where they are block arguments which are not assignable Smalltalk.
Listing 8: The CLOCKSystem definition of the infinite a relation
1 Kernel L ibrar y # s t r i c t P r e c e d e n c e
ˆ [ :s :a :b | ” unbounded s t r i c t precedence ”
s = 0
i f T r u e : [ {
6 s - ( s + 1) when: {a} } ]
i f F a l s e : [ { s - s when: {a . b }.
s - ( s + 1) when: {a }.
s - ( s - 1) when: {b} } ] ]
9. the clock b, which corresponds to our forth synonym Constraints
instanCaCon
Listing 12: Declaring syntactic synonyms for a b 1 Clock#precedes: ano the rCl ock
s e l f system
r e l a t i o n : #s t r i c tPr e c edenc e
4 c l o c k s : { s e l f . anotherClock }
Clock # ano therClock
7 s e l f precedes: anot h e rCl ock
Clock # ano therClock
ano therClock precedes: s e l f
10 Clock #follows: ano the rCl ock
s e l f ano therClock
With these mechanisms in place we consider that has rather succeeded. However, one detail
11. syntactic overhead, again compared to the TimeSquare spec-ification
which amounts for almost 100 not included SDF
for obvious Constraints:
reasons.
CCSL
lines of code and Listing 4: CCSL specification of the SDF semantics
def edge ( clock source , clock t a r g e t ,
i n t out , i n t i n i t i a l T o k e n s , i n t i n )
clock read
clock wr i t e
source = (write ▼.(1.0out−1)!)
∧ write read $ initialTokens
∧ (read ▼.(0in−1.1)!) target
Listing 5: CLOCKSystem specification of the SDF semantics
edgeFrom: sour c e t o : t a r g e t
12. source = (write ▼.(1.0out−1)!)
∧ write read $ initialTokens
∧ (read ▼.(0in−1.1)!) target
SDF
Constraints:
ClockSystem
Listing 5: CLOCKSystem specification of the SDF semantics
edgeFrom: sour c e t o : t a r g e t
o u t R a t e : out i n i t i a l : i n i t i a lTo k e n s inRa t e : in
|r w| r := self localClock: #read.
w := self localClock: #write .
sou rce===(w p e r i o d : ({1}, (0 for: (out- 1 ) ) ) ) .
w ( r wai tFor : ini t i a lTokens ) .
( r per iod: (0 for : ( in- 1 ) ) , {1}) t a r g e t
13. SimulaCon
(a) Periodic Trace Automaton
A
B
C
(b) Periodic Waveform
A
B
C
(c) Trace interpretation (21 steps)
16. Conclusion
• Embedding
of
Logical
Time
in
Pharo
Smalltalk
• Extensible
automaton-‐based
formal
kernel
• Flexible
DSL
through
message-‐synonyms
• Usage
Scenarios
– Trace
interpretaCon
– model-‐checking
– DSE
– tesCng
monitoring
17. Future
Work
tesCng
monitoring
concurrent
Smalltalk
apps
by
intercepCng
reflecCvely
generated
events
(like
var
access,
method
• Support
ac+va+ons,
etc)
for
dense-‐Cme
representaCon
• Mechanisms
for
dynamically
evolving
systems
• Study
the
connecCon
between
ClockSystem
constraints
and
state-‐space
decomposiCon
in
model-‐checking
context