Architectural design: the coordination perspective Jos Proena & - - PowerPoint PPT Presentation

architectural design the coordination perspective
SMART_READER_LITE
LIVE PREVIEW

Architectural design: the coordination perspective Jos Proena & - - PowerPoint PPT Presentation

Architectural design: the coordination perspective Jos Proena & Lus Soares Barbosa HASLab - INESC TEC & UM Arquitectura e Clculo 2017-18 W N B Reo eclipse toolset PNLTR[N ]MJN[RN0


slide-1
SLIDE 1

Architectural design: the coordination perspective

José Proença & Luís Soares Barbosa HASLab - INESC TEC & UM Arquitectura e Cálculo 2017-18

B N W

slide-2
SLIDE 2

Reo eclipse toolset

]MJN[RN0

PNLTR[N

http://reo.project.cwi.nl/update

slide-3
SLIDE 3

Reo Live

<JJCLR0

https://reolanguage.github.io/ReoLive/snapshot/

slide-4
SLIDE 4

Reo semantics

Jongmans and Arbab 2012 Overview of Thirty Semantic Formalisms for Reo

slide-5
SLIDE 5

Reo semantics

  • Coalgebraic models
  • Timed data streams
  • Record streams
  • Coloring models
  • Two colors
  • Three colors
  • Tile models
  • Other models
  • Process algebra
  • Constraints
  • Petri nets & intuitionistic logic
  • Unifying theories of programming
  • Structural operational semantics
  • Operational models
  • Constraint automata
  • Variants of constraint automata
  • Port automata
  • Timed
  • Probabilistic
  • Continuous-time
  • Quantitative
  • Resource-sensitive timed
  • Transactional
  • Context-sensitive automata
  • Büchi automata
  • Reo automata
  • Intentional automata
  • Action constraint automata
  • Behavioral automata
  • Structural operational semantics
slide-6
SLIDE 6

CA PA LCA CASM TCA SPCA PCA CCA QCA RSTCA TNCA ACA Constr. mC mCRL2 RL2 2CM 3CM Tiles GA BA TDS RS BAR ABAR IA QIA SGA SOS ZSN ITLL UTP

2cm

: Coloring models with two colors [28, 29, 33] pa : Port automata [45]

3cm

: Coloring models with three colors [28, 29, 33] pca : Probabilistic ca [15] abar : Augmented bar [39, 40] qca : Quantitative ca [12, 53] aca : Action ca [46] qia : Quantitative ia [13] ba : Behavioral automata [61] rs : Record streams [38, 40] bar : B¨ uchi automata of records [38, 40] rstca : Resource-sensitive timed ca [51] ca : Constraint automata [10, 17] sga : Stochastic ga [56, 57] casm : ca with state memory [60] sos : Structural operational semantics [58] cca : Continuous-time ca [18] spca : Simple pca [15]

  • Constr. : Propositional constraints [30, 31, 32]

tca : Timed ca [8, 9] ga : Guarded automata [20, 21] tds : Timed data streams [4, 5, 14, 62] ia : Intentional automata [33] Tiles : Tile models [11] itll : Intuitionistic temporal linear logic [27] tnca : Transactional ca [54] lca : Labeled ca [44] utp : Unifying theories of programming [55, 52] mCRL2 : Process algebra [47, 48, 49] zsn : Zero-safe nets [27]

slide-7
SLIDE 7

Outline

Formalism Synchr. Data Time Context Partial Connector Colouring CC2

  • CC3
  • Automata

Port Automata Constraint Automata Time CA

  • Constraints

✓ ✓ ✗ ✓ ✓

slide-8
SLIDE 8

Formalism Synchr. Data Time Context Partial Connector Colouring CC2

  • CC3
  • Automata

Port Automata Constraint Automata Time CA

  • Constraints

✓ ✓ ✗ ✓ ✓

Outline

Intuitive & visual Compilation & verification Runtime / scalability 1 2 3

slide-9
SLIDE 9

Wr Rd Rd

Reo Connector Colouring

Dave Clarke, David Costa, and Farhad Arbab. Connector colouring I: Synchronisation and context dependency

slide-10
SLIDE 10

Behaviour?

NPN0MJJOTW[OWWVNWON [W]LNNVM[WN[RVSNVM TW[[a[aVL0NRNMJJOTW[OWN [W]LNWN[RVSNVMBRR[TW[ *0MJJOTW[OWN[W]LNNVM WN]OONNLWRVPJ]TT*

  • ]TT*0MJJOTW[OWN]OON

WN[RVS]OONNLWRVPJ*

slide-11
SLIDE 11

Colourings to describe synchronous dataflow

a b c d e

a b c a b c a b c c d c d c d d e d e

slide-12
SLIDE 12

Colouring composition

a b c d e a b c d e a b c d e a b c d e a b c d e

LWTW][JL RVVWMN[

slide-13
SLIDE 13

Possible behaviour

a b c d e

*+,d

  • .d

*-,d *+,d

  • .d

*+,-.d

slide-14
SLIDE 14

Colouring semantics (CC2)

  • Colouring: End → {Flow, NoFlow}
  • Colouring table: Set(Colouring)
  • Composition = matching colours
  • More visual (intuitive)
  • Used for generating animations
slide-15
SLIDE 15

Colouring semantics (CC2)

  • Colouring: End → {Flow, NoFlow}
  • Colouring table: Set(Colouring)
  • Composition = matching colours
  • More visual (intuitive)
  • Used for generating animations

CT1 . / CT2 = {cl1 . / cl2 | cl1 ∈ CT1, cl2 ∈ CT2, cl1 _ cl2} cl1 _ cl2 = ∀e ∈ dom(cl1) ∩ dom(cl2) · cl1(e) = cl2(e) cl1 . / cl2 = cl1 ∪ cl2

slide-16
SLIDE 16

Exercise: compose colouring tables

Wr Rd Rd Wr Rd

slide-17
SLIDE 17

Port Automata

Christian Koehler and Dave Clarke. Decomposing Port Automata. 2009

qM, qL, qe qM, qL, qf acd, bcd ac, bc e, ace, bce ac, bc

slide-18
SLIDE 18

Connector behaviour (statefull)

  • Dataflow behaviour is discrete in time: it can be observed and

snapshots taken at a pace fast enough to obtain (at least) a snapshot as often as the configuration of the connector changes

  • At each time unit the connector performs an evaluation step:

it evaluates its configuration and according to its interaction constraints changes to another (possibly different) configuration

  • A connector can fire multiple ports in the same evaluation step
slide-19
SLIDE 19

Port Automata

qe qf a b

a b

NJTN[0

qL ab a

a b

A = (Q, N, →, Q0) Q set of states N a set of ports N → ⊆ Q × 2N × Q a transition relation Q0 ⊆ Q a set of initial states

JV[RRWV[][JNJVWVNa[NWOW[!

slide-20
SLIDE 20

Composing steps

qM, qL, qe qM, qL, qf acd, bcd ac, bc e, ace, bce ac, bc

qM ac bc

qL cd c

qe qf d e

a b c d e

slide-21
SLIDE 21

Composing steps

ac . / cd . / d = acd ac . / c . / d = ⊥

qM ac bc

qL cd c

qe qf d e

a b c d e

slide-22
SLIDE 22

Composing steps

qM ac bc

qL cd c

qe qf d e

a b c d e

merger ; lossy ; fifo <JJCLR0

https://reolanguage.github.io/ReoLive/snapshot/

slide-23
SLIDE 23

Composition - formally

Definition 2. The product of two port automata A1 = (Q1, N1, →1, Q0,1) and A2 = (Q2, N2, →2, Q0,2) is defined by A1 ◃ ▹ A2 = (Q1 × Q2, N1 ∪ N2, →, Q0,1 × Q0,2) where → is defined by the rule q1

N1

− →1 p1 q2

N2

− →1 p2 N1 ∩ N2 = N2 ∩ N1 ⟨q1, q2⟩

N1∪N2

− → ⟨p1, p2⟩ and the following and its symmetric rule q1

N1

− →1 p1 N1 ∩ N2 = ∅ ⟨q1, q2⟩

N1

− → ⟨p1, q2⟩

slide-24
SLIDE 24

→ q1

N1

− →1 p1 q2

N2

− →1 p2 N1 ∩ N2 = N2 ∩ N1 ⟨q1, q2⟩

N1∪N2

− → ⟨p1, p2⟩

Formalize and compose

q1

N1

− →1 p1 N1 ∩ N2 = ∅ ⟨q1, q2⟩

N1

− → ⟨p1, q2⟩

b c . /

qe qf a b

a b

se sf b c

A = (Q, N, →, Q0)

slide-25
SLIDE 25

Examples I

TWNP]TJW gLhLWVWT[OTW OWgJhWgh

a b c

a b c d

MJJOTW[OWgJh Wgh?RO NRNgLhWgMh JNMJJ

slide-26
SLIDE 26

Examples I

TWNP]TJW ghLWVWT[OTW OWgJhWgLh

a b c

a b c d

MJJOTW[OWgJh Wgh?RO NRNgLhWgMh JNMJJ

dupl*id ; id*drain dupl*merger ; id*drain

slide-27
SLIDE 27

Examples II

CaVLWVR[RVPJRN MJJOTW[gJhe2gh

  • MJJOTW[gLhe2gMh

MJJOTW[OWgJh JVMOWghWgbh JTNVJRVPNJ [aVLLWV[JRV[

a b c d

a z b

4TNVJW

slide-28
SLIDE 28

Examples III

MJJOTW[OWgJhgh gLhJVMgMhWgbh JTNVJRVPNJ [aVLLWV[JRV[ ?4TNVJW

a z b c d

slide-29
SLIDE 29

Examples IV

JJOTW[OWgJhWgMhghWgNh JVMgLhWgOhJTNVJRVP( CNY]NVLN

a b c f e d

slide-30
SLIDE 30

Reo in mCRL2

a b c d e

qL cd c

Lossy = (c|d + c).Lossy

qM ac bc

Merger = (a|c + b|c).Merger

slide-31
SLIDE 31

Reo in mCRL2

a b c d e

qM ac bc . / qL cd c . / qe qf d e

Conn = hide({c,d}, block({c1,c2,d1,d2} , comm({c1|c2 -> c, d1|d2 -> d}, Merger || Lossy || FIFO1 )))

slide-32
SLIDE 32

Reo in mCRL2

a b c d e

qM ac bc . / qL cd c . / qe qf d e

Conn = hide({c,d}, block({c1,c2,d1,d2} , comm({c1|c2 -> c, d1|d2 -> d}, Merger || Lossy || FIFO1 )))

1]N(JcLcMcN2]N H]N(JcLcMcN(NIOJT[N

slide-33
SLIDE 33

Build connectors

JLMNd JLNd JLd MNOd JMNLOd JLMNd [W JLM(

slide-34
SLIDE 34

Can you prove?

6WTW]RVP[JVMWJ]WJJWRMNNY]RJTNV[NJVRL[

CT (C) – colouring table of C col(q

P

− → q0) – colouring associated to a transition

A(C1) = (Q1, N1, →1, q0,1) A(C2) = (Q2, N2, →2, q0,2)

(hq0,1, q0,2i

P

  • ! hq1, q2i) 2 A(C1) .

/ A(C2) ) col(hq0,1, q0,2i

P

  • ! hq1, q2i) 2 CT (C1) .

/ CT (C2)

slide-35
SLIDE 35

Can you prove? (more generically)

6WTW]RVP[JVMWJ]WJJWRMNNY]RJTNV[NJVRL[

A = (Q, N, →, {q0}) (q0

P

− → q) ∈ A(C) ⇒ col(P, N) ∈ CT (C)

slide-36
SLIDE 36

Constraint Automata

qM, qL, qe qM, qL, qf acd, bcd ac, bc e, ace, bce ac, bc

Christel Baier, Marjan Sirjani, Farhad Arbab, Jan Rutten. Modeling Component Connectors in Reo by Constraint Automata. 2004

slide-37
SLIDE 37

Note: other constraints, as dA = dB

abv

= ∨d∈Data(dA = d ∧ dB = d) a

Constraint Automata

Automata labelled by

  • a data constraint which represents a set of data

assignments to port names Note: other constraints, such as are derived.

  • a name set which represents the set of port names at

which IO can occur States represent the configurations of the corresponding connector, while transitions encode its maximally-parallel stepwise behaviour.

g ::= true | dA = v | g1 ∨ g2 | ¬g

NJJJVMAW[

slide-38
SLIDE 38

Constraint Automata

JTN0*

slide-39
SLIDE 39

Constraint Automata - Definition

A = (Q, N, !, Q0) Q set of states N a set of ports N Q0 ✓ Q a set of initial states ! ✓ Q ⇥ 2N ⇥ DC ⇥ Q a transition relation such that

P,g

  • ! iff
  • 1. P 6= ;
  • 2. g 2 DC(P, Data)

(DC(P, Data) is the set of data constraints over Data and P)

slide-40
SLIDE 40

NJRW]MNNVM[WVTaWVW[NNMMJJ VWWVO]]NNWT]RWV JV[RRWV[ORNWVTaROMJJ WLL][JJ[NWOW[A

Constraint Automata - Definition

RVLWVORP]JRWV[W[RVA LJVNOWWNJRWV[RL NNP]JMPJVMTNJMW[f

s

P,g

  • ! s0 iff
  • 1. P 6= ;
  • 2. g 2 DC(P, Data)
slide-41
SLIDE 41

Constraint Automata as a semantics for Reo

  • cannot capture context-awareness [Baier, Sirjani,

Arbab, Rutten 2006], but forms the basis for more elaborated models (eg, Reo automata)

  • captures all behaviour alternatives of a connector;

useful to generate a state-machine implementing the connector’s behaviour

  • basis for several tools, including the model

checker Vereofy [Kluppelholz, Baier 2007]

slide-42
SLIDE 42

Constraint Automata - Reo connectors

A B Sync

{A, B} dA = dB

A B LossySync

{A, B} dA = dB {A}

A B SyncDrain

{A, B}

A B A Filter

{A, B} expr(dA) ∧ dA = dB {A} ¬expr(dA)

C A B Merger

{A, C} dA = dC {B, C} dB = dC

A B C Replicator

{A, B, C} dA = dB = dC

slide-43
SLIDE 43

[Parameterised constraint automata]

States are parametric on data values ... therefore capturing complex constraint automata emerging form data-dependencies

Example: 1 bounded FIFO

q(x) q_0 {A} x := d_A {B} d_B=x

slide-44
SLIDE 44

[Parameterised constraint automata]

L = (L, N, V, !, L0, init) L set of locations N a set of ports V a set of variables L0 ✓ L a set of initial states init an initialisation of variables ! ✓ L ⇥ 2N ⇥ DC ⇥ Assgn ⇥ L a transition relation such that

P,g,h

  • ! iff
  • 1. P 6= ;
  • 2. g 2 DC(P, Data, V)
  • 3. h 2 V ! Expr(P, Data, V)

(DC(P, Data, V) is the set of data constraints ove Data, P, and V) (Expr(P, Data, V) is an expression over Data, P, and V)

slide-45
SLIDE 45

[Parameterised constraint automata]

L = (L, N, V, !, L0, init) L set of locations N a set of ports V a set of variables L0 ✓ L a set of initial states init an initialisation of variables ! ✓ L ⇥ 2N ⇥ DC ⇥ Assgn ⇥ L a transition relation such that

P,g,h

  • ! iff
  • 1. P 6= ;
  • 2. g 2 DC(P, Data, V)
  • 3. h 2 V ! Expr(P, Data, V)

(DC(P, Data, V) is the set of data constraints ove Data, P, and V) (Expr(P, Data, V) is an expression over Data, P, and V)

RSNLTWLSLWV[JRV[ RSNLTWLS[ RSNLTWLS]MJN[

slide-46
SLIDE 46

Composing constraint automata

Definition 4.1 [Product-automaton] The product-automaton of the two constraint automata A1 = (Q1,N ames1, − →1, Q0,1) and A2 = (Q2,N ames2,− →2,Q0,2), is:

A1 ◃

▹ A2 = (Q1 ×Q2,N ames1 ∪N ames2,− →,Q0,1 ×Q0,2) where − → is defined by the following rules: q1

N1,g1

− →1 p1, q2

N2,g2

− →2 p2, N1 ∩N ames2 = N2 ∩N ames1 ⟨q1,q2⟩

N1∪N2,g1∧g2

− − − − − − − → ⟨p1, p2⟩ and q1

N,g

− →1 p1, N ∩N ames2 = / ⟨q1,q2⟩

N,g

− → ⟨p1,q2⟩ and latter’s symmetric rule.

slide-47
SLIDE 47
  • a

b

Formalize and compose

. / b c

q1

N1,g1

− →1 p1, q2

N2,g2

− →2 p2, N1 ∩N ames2 = N2 ∩N ames1 ⟨q1,q2⟩

N1∪N2,g1∧g2

− − − − − − − → ⟨p1, p2⟩ q1

N,g

− →1 p1, N ∩N ames2 = / ⟨q1,q2⟩

N,g

− → ⟨p1,q2⟩ rule.

qL {B, C}, dB = dC {B}

slide-48
SLIDE 48

You are here

Formalism Synchr. Data Time Context Partial Connector Colouring CC2

  • CC3
  • Automata

Port Automata Constraint Automata Time CA

  • Constraint

s ✓ ✓ ✗ ✓ ✓

slide-49
SLIDE 49

Timed Port/Const. Automata

Natallia Kokash, Mohammad Mahdi Jaghoori, Farhad Arbab. From Timed Reo Networks to Networks of Timed Automata. 2013

slide-50
SLIDE 50

Timer (Data) Channel

slide-51
SLIDE 51

Timer (Data) Channel

slide-52
SLIDE 52

Time extension

Sync LossySync FIFO SyncDrain AsyncDrain Filter

slide-53
SLIDE 53

Formally

Definition 2.1 [Constraint automaton (CA)] A constraint automaton A = (S, N, →, s0) consists of a set of states (also called locations) S, a set of port names N, a transition relation → ⊆ S × 2N × DC × S, where DC is the set of data constraints over a finite data domain Data, and an initial state s0 ∈ S. C Definition 2.2 [Timed constraint automaton (TCA) [3]] A TCA is an extended constraint automaton A = (S, N, →, s0, C, ic) with transition relation → ⊆ S × 2N × DC × CC × 2C × S such that C is a finite set of clocks and ic : S → CC is a function that assigns a clock constraint, called an invariance condition ic(s) to each location s of A.

Natallia Kokash, Mohammad Mahdi Jaghoori, Farhad Arbab. From Timed Reo Networks to Networks of Timed Automata. 2013

slide-54
SLIDE 54

MNTJaNMDRNJRNNNV gRVhJVMgJhRVLT][RN(

Build channels (TCA)

MNTJaFJRWNJVgh RNNLT][RN(

RW]MJJ!

RNRgWOOhJVM gN[NhW[(

slide-55
SLIDE 55

You are here

Formalism Synchr. Data Time Context Partial Connector Colouring CC2

  • CC3
  • Automata

Port Automata Constraint Automata Time CA

  • Constraint

s ✓ ✓ ✗ ✓ ✓

slide-56
SLIDE 56

2 reasons for context

a b c a b c a b c

1 - avoid data loss when the context (FIFO) can receive the data.

slide-57
SLIDE 57

2 reasons for context

c 1 B b 1 A

!

1 C d c b

!

d 1 B 1 A 1 C c b

!

d 1 B 1 A 1 C c b

!

d 1 B A 1 C

2 - give priority based on the context (writer)

slide-58
SLIDE 58

Context = 3 colours

  • Colouring:

End → {Flow, GiveReason,GetReason}

  • Composition = matching colours:
slide-59
SLIDE 59

Context = 3 colours

  • Colouring:

End → {Flow, GiveReason,GetReason}

  • Composition = matching colours:

CT1 . / CT2 = {cl1 . / cl2 | cl1 ∈ CT1, cl2 ∈ CT2, cl1 _ cl2}

End = {e1, . . . , en} ∪ {e1, . . . , en}

cl1 _ cl2 = ∀e1 ∈ dom(cl1) · ∀e2dom(cl2)· e1 = e2 ⇒ (cl1(e), cl2(e)) ∈ {( , ), ( , ), ( , ), } cl1 . / cl2 = cl1 ∪ cl2

slide-60
SLIDE 60

Composition

a b c a b c a b c

slide-61
SLIDE 61

Priority with 3 colours

! ! ! !

slide-62
SLIDE 62

Connector colouring 3

  • Compositional – composition operation is

associative, commutative, and does not require post-processing.

  • Reasons for the absence of flow are propagated.
  • Expresses priority.
  • 2 colours ⇔ constraint automata (without data)
  • 3 colours: + expressive (⇔ intentional automata)
slide-63
SLIDE 63

Build a connector

Prod connector

OJ[ [TW NONOJ[