30
Growth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam Leiden Institute of Advanced Computer Science, Leiden University 9 October 2009

Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Embed Size (px)

Citation preview

Page 1: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Growth Through Dynamically Reconfigurable Coordination

Farhad ArbabCenter for Mathematics and Computer Science (CWI), AmsterdamLeiden Institute of Advanced Computer Science, Leiden University

9 October 2009

Page 2: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Complex Systems

Sources of complexityo Algorithm or computation Complex composition of sequential steps

o Interaction among concurrent constituents Multitudes of possible interaction patterns Large system state spaces Complex coordination Complexity increases exponentially with more

components

© F. Arbab 2009 2

Page 3: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Growth and Evolution

Growth is a special form of evolutionTwo intertwined aspects

o Change of structure New components New connections restructuring

o Change of behavior Modification of interaction and coordination

© F. Arbab 2009 3

Page 4: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Formal Models for Growth

Study of growth/evolution in complex systems requires formal models foro Structureo Interaction and coordination protocols

Both aspects subject to transformation rules that express growth/evolutiono Model must include explicit, first class

representation of Structure Coordination and interaction protocols

© F. Arbab 2009 4

Page 5: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Models of Concurrency

Traditional models are action basedo Petri netso Work flow / Data flowo Process algebra / calculio Actor models / Agentso …

A system composed of building blocks that represent actions/processes

Interaction becomes an implicit side-effecto Makes coordination of interaction more difficult to

Specify Verify Manipulate Reuse

© F. Arbab 2009 5

Page 6: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Interaction Based Concurrency

Start with a set of primitive interactions as binary constraints

Define (constraint) composition operators to combine interactions into more complex interactions

As constraints, interaction protocols can be manifested independently of the processes that they engageo Connectors

Imposing an interaction on actors exogenously coordinates their activities

© F. Arbab 2009 6

Page 7: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Reo

Reo is an exogenous coordination language for compositional construction of interaction protocols.

Interaction is the only first-class concept in Reo:o Explicit constructs representing interactiono Composition operators over interaction constructs

A (coordination or interaction) protocol:o manifests as a connectoro gets imposed on its engaged components/services from outsideo remains mutually oblivious to its engaged components/services

Reo offers:o Loose(st) couplingo Arbitrary mix of asynchrony, synchrony, and exclusiono Open-ended user-defined primitive channelso Distribution and mobilityo Dynamically reconfigurable connectors

© F. Arbab 2009 7

http://reo.project.cwi.nl

Page 8: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Concurrency in Reo

Reo embodies a non-conventional model of concurrency:

Reo is more expressive than Petri nets, workflow, and dataflow models.

© F. Arbab 2009 8

Conventionalo action basedo process as primitiveo imperativeo functionalo imperative programmingo protocol implicit in processes

Reoo interaction basedo Protocol as primitiveo declarativeo relationalo constraint programmingo Tangible explicit protocols

Page 9: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Reo Connectors

© F. Arbab 2009 9

=A

B

C

FIFO1 channel synchronous channel

lossy synchronous channel

filter channel≤

P-producer

synchronous drain asynchronous drainsynchronous spout asynchronous spout timer channel

A

B

C

Exclusive choice (deffered XOR)

closeopen

A B

Valve connector: controls flow from A to B

A

CB

Alternator

Page 10: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

© F. Arbab 2009 10

Semantics

Reo allows:o Arbitrary user-defined channels as primitives.o Arbitrary mix of synchrony and asynchrony.o Relational constraints between input and output.

Reo is more expressive than, e.g., dataflow models, Kahn networks, workflow models, stream processing models, Petri nets, and synchronous languages.

Formal semantics:o Coalgebraic semantics based on timed-data streams.o Constraint automata.o SOS semantics (in Maude).o Constraint propagation (connector coloring scheme).o Intuitionistic linear logic

Page 11: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Eclipse Coordination Tools

A set of Eclipse plug-ins provide the ECT visual programming environment.

Protocols can be designed by composing Reo circuits in a graphical editor.

The Reo circuit can be animated in ECT. ECT can automatically generate the CA for a Reo circuit. Model-checkers integrated in ECT can be used to verify the

correctness properties of a protocol using its CA. ECT can generate executable (Java/C) code from a CA as a

single sequential thread.

© F. Arbab 2009 11

http://reo.project.cwi.nl

Page 12: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

© F. Arbab 2009 12

Tool supportTool Description

Reo graphical editor Drag and drop editing of Reo circuits

Reo animation plug-in Flash animation of data-flow in Reo circuits

Extensible Automata editor and tools Graphical editor and other automata tools

Reo to constraint automata converter Conversion of Reo to Constraint Automata

Verification tools•Vereofy model checker (www.vereofy.de)•mCRL model checking•Bounded model checking of Timed Constraint Automata

Java code generation plug-inState machine based coordinator code(Java, C, and CA interpreter for Tomcat servlets)

Distributed Reo middleware Distributed Reo code generated in Scala (Actor-based Java)(UML / BPMN / BPEL) GMT to Reo converter Automatic translation of UML SD / BPMN / BPEL to Reo

Reo Services platform Web service wrappers and Mash-ups

Markov chain generatorCompositional QoS model based on ReoAnalysis using, e.g., probabilistic symbolic model checker Prism (http://www.prismmodelchecker.org)

Algebraic Graph Transformation Dynamic reconfiguration of Reo circuits

Page 13: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

© F. Arbab 2009 13

Tool snapshots

Reo to constraint automata converter

Reo graphical editor

Reo simulation plug-inhttp://reo.project.cwi.nl

Page 14: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Snapshot of Reo Editor

© F. Arbab 2009 14

Page 15: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Model Checking

Constraint automata are used for model checking of Reo circuits

Model checker for Reo built in Dresden:o Symbolic model, LTL, and CTL-like logic for specificationo Can also verify properties such as deadlock-freeness and

behavioral equivalence SAT-based bounded model checking of Timed

Constraint Automata Translation of Reo to mCRL for model checking

© F. Arbab 2009 15

Page 16: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Performance Analysis

Quantitative Intentional Automata (QIA) extend CA with quantitative properties:o arrival rates at portso average delays of data-flows between ports

Quantified Reo circuits are converted to QIAMarkov Chain models are derived from QIA

o Resulting Markov Chains are very compact: efficient model checking

PRISM is used for analysis of MC modelso average response times o meetings of deadlineso worst/best case scenarios

© F. Arbab 2009 16

Page 17: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Reo Primitives with Delays

© F. Arbab 2009 17

Page 18: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Markov Chain for Alternator

© F. Arbab 2009 18

Page 19: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Connector Reconfiguration

Ordinary data-flow can change the state of a connector, but not its topology.

(Dynamic) reconfiguration means to change the topology of a connector at (run-time).

Reconfiguration by graph transformationo Perform complex (global) reconfigurations in an atomic step.o Definition and validation of reconfigurations as graph grammars

using visual tools. Reconfiguration model and engine for Reo accessible in ECT

through a basic reconfiguration view.o Reconfiguration rules used inside the editor for dynamic creation

of connectors from templates.o Self-reconfiguring connectors triggered by data flow.

© F. Arbab 2009 19

Page 20: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Create a Barrier Synchronizer

© F. Arbab 2009 20

Page 21: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Growing an Exclusive Router

© F. Arbab 2009 21

Page 22: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Growing a Discriminator

© F. Arbab 2009 22

Page 23: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Negative Rules and Regions

© F. Arbab 2009 23

Reconfiguration rules can be assigned to disjoint reconfiguration regions (sub-graphs) of

a connector

Page 24: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Analysis and Verification

© F. Arbab 2009 24

Formal analysis and verification of the properties of rules and consequences of their applications

Page 25: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Add/Delete Worker

© F. Arbab 2009 25

DelWorker is defined as the inverse rule

Page 26: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Add/Delete Resource

© F. Arbab 2009 26

DelResource is defined as the inverse rule

Page 27: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Export to AGG

© F. Arbab 2009 27

Page 28: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Analysis in AGG

© F. Arbab 2009 28

Page 29: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

Model Checking in GROOVE

© F. Arbab 2009 29

Page 30: Growth Through Dynamically Reconfigurable Coordination fileGrowth Through Dynamically Reconfigurable Coordination Farhad Arbab Center for Mathematics and Computer Science (CWI), Amsterdam

© F. Arbab 2009 30

Conclusion

Making interaction explicit in concurrency allows its directo Specificationo compositiono Analysiso Verificationo reuse

Reo is a simple, rich, versatile, and surprisingly expressive language for compositional construction of pure (coordination orconcurrency) protocols.o Looser interdependencies and strict separation of concerns.o Unique emphasis on interaction, as (the only) first-class concept.o Free combination of synchrony, exclusion, and asynchrony, as

relational constraints simplifies definition of interaction protocols and atomic transactions.

o Exogenous interaction/coordination

http://reo.project.cwi.nl