Architectural design: the coordination perspective José Proença HASLab - INESC TEC & UM Arquitectura e Cálculo 2015-16 P � �
Reo semantics Jongmans and Arbab 2012 Overview of Thirty Semantic Formalisms for Reo
Reo semantics • Coalgebraic models • Operational models • Timed data streams • Constraint automata • Record streams • Variants of constraint automata • Port automata • Coloring models • Timed Probabilistic • Two colors • Continuous-time • Three colors • Quantitative • Tile models • Resource-sensitive timed • Other models • Transactional • Process algebra • Context-sensitive automata • Constraints • Büchi automata • Petri nets & intuitionistic logic • Reo automata • Unifying theories of programming • Intentional automata • Structural operational semantics • Action constraint automata • Behavioral automata
BAR ZSN PA SOS 2CM 3CM ABAR RS ITLL CA LCA SPCA QCA TNCA Constr. Tiles IA TDS GA CASM TCA CCA RSTCA ACA mCRL2 mC RL2 BA QIA UTP PCA SGA 2 cm : Coloring models with two colors [28, 29, 33] : Port automata [45] pa 3 cm : Coloring models with three colors [28, 29, 33] : Probabilistic ca [15] pca : Augmented bar [39, 40] : Quantitative ca [12, 53] abar qca : Action ca [46] : Quantitative ia [13] aca qia : Behavioral automata [61] : Record streams [38, 40] ba rs : B¨ uchi automata of records [38, 40] rstca : Resource-sensitive timed ca [51] bar : Constraint automata [10, 17] : Stochastic ga [56, 57] ca sga : ca with state memory [60] : Structural operational semantics [58] casm sos : Continuous-time ca [18] : Simple pca [15] cca spca Constr. : Propositional constraints [30, 31, 32] : Timed ca [8, 9] tca : Guarded automata [20, 21] : Timed data streams [4, 5, 14, 62] ga tds : Intentional automata [33] Tiles : Tile models [11] ia : Intuitionistic temporal linear logic [27] tnca : Transactional ca [54] itll : Labeled ca [44] : Unifying theories of programming [55, 52] lca utp : Process algebra [47, 48, 49] : Zero-safe nets [27] zsn mCRL2
Outline Formalism Synchr. Data Context Partial Connector CC2 - CC3 - Colouring Port Constraint Automata - - Automata Automata ✓ ✓ ✓ ✓ Constraints
Outline Intuitive & visual Formalism Synchr. Data Context Partial 1 2 3 4 Connector CC2 - CC3 PCC Colouring Compilation & verification Port Constraint Automata - - Automata Automata ✓ ✓ ✓ ✓ Constraints Runtime / scalability
Rd Wr Rd Reo Connector Colouring Dave Clarke, David Costa, and Farhad Arbab. Connector colouring I: Synchronisation and context dependency
Behaviour? N�SI�S+�FC�C�HMP�T�HSPN�PO��PH����� TPVSE���OFT��P�����T�OL��OF MPTT��T�OE+������S�FC�C�HMP�T�HSPN����� TPVSE���P�����T�OL��OF���������T�MPT� �����)+�FC�C�HMP�T�HSPN�����TPVSE���OF� �P�����DVHH�S��D�EPN�OI�C������VMM�) �����VMM�)+�FC�C�HMP�T�HSPN�����DVHH�S� • �P�����T�OL�DVHH�S��D�EPN�OI�C������)
Colourings to describe synchronous dataflow a c d e b a c c d d e a b c d c d e b a c d c b
Colouring composition a EPMPVST�NC�E�� c d e �O�OPF�T a b c d e a b c d e a b c d e b a c d e b
Colouring semantics (CC2) • Colouring : End → {Flow, NoFlow} • Colouring table : Set(Colouring) • Composition = matching colours • More visual (intuitive) • Used for generating animations
Colouring semantics (CC2) • Colouring : End → {Flow, NoFlow} • Colouring table : Set(Colouring) • Composition = matching colours CT 1 . / CT 2 = { cl 1 . / cl 2 | cl 1 ∈ CT 1 , cl 2 ∈ CT 2 , cl 1 _ cl 2 } • More visual (intuitive) = ∀ e ∈ dom ( cl 1 ) ∩ dom ( cl 2 ) · cl 1 ( e ) = cl 2 ( e ) cl 1 _ cl 2 • Used for generating animations = cl 1 . / cl 2 cl 1 ∪ cl 2
Exercise: compose colouring tables Rd Wr Rd Wr Rd
Rd E S Wr U A P Rd �PO�EPOO�E�PS�EPMPVS�OI� Reo Connector Colouring Dave Clarke, David Costa, and Farhad Arbab. Connector colouring I: Synchronisation and context dependency
ac, bc acd , bcd q M , q L , q f q M , q L , q e ac, bc e, ace, bce Port and Constraint Automata Christel Baier, Marjan Sirjani, Farhad Arbab, Jan Rutten. Modeling Component Connectors in Reo by Constraint Automata. 2004 Christian Koehler and Dave Clarke. Decomposing Port Automata. 2009
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
Port Automata A = ( Q , N , → , Q 0 ) Q set of states N a set of ports N → ⊆ Q × 2 N × Q a transition relation Q 0 ⊆ Q a set of initial states �SCOT���POT�NVT���CW��C�OPO��N����T���PH��PS�T! a ab q f q e �YCN�M�T+ q L a b a a b b
Composing steps a c d e b ac cd d q f q e � ⇥ � ⇥ q M q L c bc e ac, bc acd , bcd q M , q L , q f q M , q L , q e ac, bc e, ace, bce
Composing steps a c d e b ac cd d q f q e � ⇥ � ⇥ q M q L c bc e ac . / cd . / d acd = ac . / c . / d ⊥ =
Composition - formally Definition 2. The product of two port automata A 1 = ( Q 1 , N 1 , → 1 , Q 0 , 1 ) and A 2 = ( Q 2 , N 2 , → 2 , Q 0 , 2 ) is defined by A 1 ◃ ▹ A 2 = ( Q 1 × Q 2 , N 1 ∪ N 2 , → , Q 0 , 1 × Q 0 , 2 ) where → is defined by the rule N 1 N 2 − → 1 p 1 − → 1 p 2 N 1 ∩ N 2 = N 2 ∩ N 1 q 1 q 2 N 1 ∪ N 2 ⟨ q 1 , q 2 ⟩ − → ⟨ p 1 , p 2 ⟩ and the following and its symmetric rule N 1 N 1 ∩ N 2 = ∅ − → 1 p 1 q 1 N 1 ⟨ q 1 , q 2 ⟩ − → ⟨ p 1 , q 2 ⟩
Formalize and compose → N 1 N 2 − → 1 p 1 − → 1 p 2 N 1 ∩ N 2 = N 2 ∩ N 1 q 1 q 2 N 1 ∪ N 2 ⟨ q 1 , q 2 ⟩ − → ⟨ p 1 , p 2 ⟩ N 1 − → 1 p 1 N 1 ∩ N 2 = ∅ q 1 N 1 A = ( Q , N , → , Q 0 ) ⟨ q 1 , q 2 ⟩ − → ⟨ p 1 , q 2 ⟩ a b q f q e s f s e . / c b c a b b
Examples I �MP��S�IVMC�PS a b �D��EPO�SPMT�HMP�� HSPN��C���P��E� c a b FC�C�HMP�T�HSPN��C�� �P��D��������H� �����S��E��PS��F�� �CW��FC�C c d
Examples II ��OE�SPO�T�OI�DCSS��S a FC�C�HMP�T��C��],��D�� b ���� c FC�C�HMP�T��E��],��F�� d .M��SOC�PS a z FC�C�HMP�T�HSPN��C�� COF�HSPN��D���P��[��� CM��SOC��OI�����Y�SC� b T�OE��EPOT�SC�O�T�
Examples III ��.M��SOC�PS a z FC�C�HMP�T�HSPN��C����D��� �E���COF��F���P��[��� CM��SOC��OI�����Y�SC� b T�OE��EPOT�SC�O�T� c d
Examples IV a d e b c f • 1C�C�HMP�T�HSPN��C���P��F����D���P������ ��RV�OE�S COF��E���P��H��CM��SOC��OI�
Reo in mCRL2 a c d e b cd Lossy = ( c|d + c ).Lossy q L c ac q M bc Merger = ( a|c + b|c ).Merger
Reo in mCRL2 a c d e b ac cd d q f q e . / . / q M q L c bc e Conn = hide( { c,d } , block( { c 1 ,c 2 ,d 1 ,d 2 } , comm( { c 1 |c 2 -> c, d 1 |d 2 -> d} , Merger || Lossy || FIFO1 )))
Can you prove? 0PMPVS�OIT�COF��PS��CV�PNC�C��SPW�F���RV�WCM�O��T�NCO��ET CT ( C ) – colouring table of C A ( C 1 ) = ( Q 1 , N 1 , → 1 , q 0 , 1 ) A ( C 2 ) = ( Q 2 , N 2 , → 2 , q 0 , 2 ) P → q 0 ) – colouring associated col ( q − to a transition P ( h q 0 , 1 , q 0 , 2 i � ! h q 1 , q 2 i ) 2 A ( C 1 ) . / A ( C 2 ) ) P col ( h q 0 , 1 , q 0 , 2 i � ! h q 1 , q 2 i ) 2 CT ( C 1 ) . / CT ( C 2 )
Can you prove? (more generically) 0PMPVS�OIT�COF��PS��CV�PNC�C��SPW�F���RV�WCM�O��T�NCO��ET A = ( Q , N , → , { q 0 } ) P → q ) ∈ A ( C ) ( q 0 − ⇒ col ( P, N ) ∈ CT ( C )
Constraint Automata Automata labelled by • a data constraint which represents a set of data assignments to port names ::= true | d A = v | g 1 ∨ g 2 | ¬ g g Note: other constraints, as Note: other constraints, such as abv d A = d B = ∨ d ∈ Data ( d A = d ∧ d B = d ) a 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.
Constraint Automata 2YCN�M�+�����) ��� � ������ � � ��� ������ � � � ��� ������ � ��� ������ � � �
Recommend
More recommend