Concurrent Component Patterns, Models of Computation, and Types

Similar documents
Actor-Oriented Design and The Ptolemy II framework

Embedded Software from Concurrent Component Models

Component-Based Design of Embedded Control Systems

Model-Based Design in the Ptolemy Project

Extending Ptolemy II

Model-Driven Development From Object-Oriented Design to Actor-Oriented Design

Discrete-Event Modeling and Design of Embedded Software

Advanced Tool Architectures

Building Unreliable Systems out of Reliable Components: The Real Time Story

Concurrent Models of Computation for Embedded Software

Actor-Oriented Design: Concurrent Models as Programs

The Ptolemy II Framework for Visual Languages

An Overview of the Ptolemy Project and Actor-Oriented Design

Actor Package. 2.1 Concurrent Computation. Christopher Hylands Jie Liu Lukito Muliadi Steve Neuendorffer Neil Smyth Yuhong Xiong Haiyang Zheng

UC Berkeley Mobies Technology Project

SDF Domain. 3.1 Purpose of the Domain. 3.2 Using SDF Deadlock. Steve Neuendorffer

System-Level Design Languages: Orthogonalizing the Issues

The Future of the Ptolemy Project

Disciplined Heterogeneous Modeling

Concurrent Models of Computation

Future Directions. Edward A. Lee. Berkeley, CA May 12, A New Computational Platform: Ubiquitous Networked Embedded Systems. actuate.

Component-Based Design of Embedded Control Systems

Hybrid System Modeling: Operational Semantics Issues

The Gigascale Silicon Research Center

Process-Based Software Components Final Mobies Presentation

Interface Automata and Actif Actors

Counting Interface Automata and their Application in Static Analysis of Actor Models

Modeling, Simulation, and Design of Concurrent Real-Time Embedded Systems Using Ptolemy

Modal Models in Ptolemy

Advanced Tool Architectures. Edited and Presented by Edward A. Lee, Co-PI UC Berkeley. Tool Projects. Chess Review May 10, 2004 Berkeley, CA

Giotto Domain. 5.1 Introduction. 5.2 Using Giotto. Edward Lee Christoph Kirsch

Heterogeneous Modeling and Design - Edward A. Lee (PI) -

Overview of the Ptolemy Project

Ptolemy II The automotive challenge problems version 4.1

The Problem With Threads

Static Analysis of Actor Networks

fakultät für informatik informatik 12 technische universität dortmund Data flow models Peter Marwedel TU Dortmund, Informatik /10/08

Concurrent Models of Computation

DESIGN AND SIMULATION OF HETEROGENEOUS CONTROL SYSTEMS USING PTOLEMY II

Temporal Semantics in Concurrent and Distributed Software

System-Level Design Languages: Orthogonalizing the Issues. Kees Vissers

Concurrent Semantics without the Notions of State or State Transitions

Disciplined Concurrent Models of Computation for Parallel Software

Compositionality in system design: interfaces everywhere! UC Berkeley

Concurrent Models of Computation for Embedded Software

Concurrency Demands New Foundations for Computing

Dynamic Dataflow Modeling in Ptolemy II. by Gang Zhou. Research Project

Integration of OpenModelica in Ptolemy II

Embedded Tutorial CPS Foundations

Concurrent Models of Computation

VOLUME 1: INTRODUCTION TO PTOLEMY II. Document Version 3.0 for use with Ptolemy II 3.0 July 16, 2003

Making Concurrency Mainstream

Understandable Concurrency

The Ptolemy Project. Modeling and Design of Reactive Systems. Presenter: Praveen Murthy, PhD Postdoc and Presenter

Integrated Design and Analysis Tools for Software Based Control Systems

SDL. Jian-Jia Chen (slides are based on Peter Marwedel) TU Dortmund, Informatik 年 10 月 18 日. technische universität dortmund

VOLUME 3: PTOLEMY II DOMAINS. Document Version 5.0 for use with Ptolemy II 5.0 July 15, 2005

Embedded Real-Time Systems

Hierarchical FSMs with Multiple CMs

A PRIMITIVE EXECUTION MODEL FOR HETEROGENEOUS MODELING

Automatic Specialization of Actor-oriented Models in Ptolemy II by Stephen Neuendorffer. Research Project

DISCRETE EVENT MODELING IN PTOLEMY II

Embedded Software. Edward A. Lee,

Exploring Models of Computation with Ptolemy II

Process-Based Software Components. Subcontractors and Collaborators

Concurrent Models of Computation

Imperative model of computation

Classes and Inheritance in Actor- Oriented Models

Portable Real-Time Code from PTIDES Models

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

ThreadedComposite: A Mechanism for Building Concurrent and Parallel Ptolemy II Models

EE382N.23: Embedded System Design and Modeling

Fundamental Algorithms for System Modeling, Analysis, and Optimization

PTIDES: A Discrete-Event-Based Programming Model for Distributed Embedded Systems

Building Synchronous DataFlow graphs with UML & MARTE/CCSL

FSMs & message passing: SDL

Simulation of LET Models in Simulink and Ptolemy

By: Chaitanya Settaluri Devendra Kalia

Concurrent Models of Computation

Embedded Systems 8. Identifying, modeling and documenting how data moves around an information system. Dataflow modeling examines

Institutionen för datavetenskap Department of Computer and Information Science

C Code Generation from the Giotto Model of Computation to the PRET Architecture

Embedded Systems CS - ES

A Code Generation Framework for Actor-Oriented Models with Partial Evaluation

San Diego Supercomputer Center, UCSD, U.S.A. The Consortium for Conservation Medicine, Wildlife Trust, U.S.A.

Specifications Part 1

Applying Models of Computation to OpenCL Pipes for FPGA Computing. Nachiket Kapre + Hiren Patel

A Code Generation Framework for Actor-Oriented Models with Partial Evaluation

Designing Actors. 5.1 Overview. Edward A. Lee Jie Liu Xiaojun Liu Steve Neuendorffer Yuhong Xiong Winthrop Williams

LabVIEW Based Embedded Design [First Report]

The Problem with Treads

Finite State Machines and Modal Models in Ptolemy II

VOLUME 1: INTRODUCTION TO PTOLEMY II. Document Version 5.0 for use with Ptolemy II 5.0 July 15, 2005

The Problem with Threads

The Distributed-SDF Domain

The Ptolemy Kernel Supporting Heterogeneous Design

Specifications and Modeling

Embedded Software TI2725 C. 5. Software architectures. Koen Langendoen. Embedded Software Group

EE382V: Embedded System Design and Modeling

A Deterministic Concurrent Language for Embedded Systems

Transcription:

Concurrent Component Patterns, Models of Computation, and Types Edward A. Lee Yuhong Xiong Department of Electrical Engineering and Computer Sciences University of California at Berkeley Presented at Fourth Annual Workshop on New Directions in Software Technology (NDIST 01), St. John, US Virgin Islands, December 2001. Pattern-Related Questions! Are components active? If passive, how are they activated?! event driven! dataflow! time driven! synchronous! How are multiple sources of stimulus merged?! nondeterministic merge! round robin! priorities! time stamps! Are communications synchronous?! synchronous method calls! thread rendezvous! asynchronous with futures! asynchronous with feedback E. A. Lee, UC Berkeley 2 1

View of Concurrent Components: Actors with Ports and Attributes Actor Attributes Port connection Relation Link Link connection Link Port Actor connection Port Actor Attributes Model of Computation: Messaging schema Flow of control Concurrency Attributes Key idea: The model of computation is part of the framework within which components are embedded not part of the components themselves. It enforces patterns. E. A. Lee, UC Berkeley 3 Actor View of Producer/Consumer Components Basic Transport: send(0,t) receiver.put(t) get(0) E1 P1 Actor R1 IOPort P2 IORelation token t E2 Receiver (inside port) Models of Computation: continuous-time dataflow rendezvous discrete events synchronous time-driven publish/subscribe E. A. Lee, UC Berkeley 4 2

Examples of Actor-Oriented Component Frameworks! Simulink (The MathWorks)! Labview (National Instruments)! OCP, open control platform (Boeing)! SPW, signal processing worksystem (Cadence)! System studio (Synopsys)! ROOM, real-time object-oriented modeling (Rational)! Port-based objects (U of Maryland)! I/O automata (MIT)! VHDL, Verilog, SystemC (Various)! Polis & Metropolis (UC Berkeley)! Ptolemy & Ptolemy II (UC Berkeley)! E. A. Lee, UC Berkeley 5 Contrast with Object Orientation! Call/return imperative semantics! Concurrency is realized by ad-hoc calling conventions! Patterns are supported by futures, proxies, monitors «Interface» Executable +fire() +initialize() +postfire() : boolean +prefire() : boolean +preinitialize() +stopfire() +terminate() +wrapup() «Interface» Actor ComponentEntity +getdirector() : Director +getexecutivedirector() : Director +getmanager() : Manager +inputportlist() : List +newreceiver() : Receiver +outputportlist() : List Director AtomicActor 0..n 0..1 CompositeEntity CompositeActor Object orientation emphasizes inheritance and procedural interfaces. Actor orientation emphasizes concurrency and communication abstractions. E. A. Lee, UC Berkeley 6 3

Model by Jie Liu Actor Orientation with a Visual Syntax Ptolemy II is an experimental framework supporting exploration of concurrent component models of computation. E. A. Lee, UC Berkeley 7 Realization of a Model of Computation is a Domain in Ptolemy II! The laws of physics of component interaction! communication semantics! flow of control constraints In astrophysics: a domain is a region of the universe where a certain set of laws of physics applies.! Multiple domains may be combined hierarchically! depends on the concept of domain polymorphism E. A. Lee, UC Berkeley 8 4

Ptolemy II Domains! Define the flow(s) of control! execution model! Realized by a Director class! Define communication between components! interaction model! Realized by a Receiver class Director IOPort producer consumer Receiver E. A. Lee, UC Berkeley 9 Example Domains! Communicating Sequential Processes (CSP): rendezvous-style communication! Process Networks (PN): asynchronous communication, determinism! Synchronous Data Flow (SDF): stream-based communication, statically scheduled! Discrete Event (DE): event-based communication! Synchronous/Reactive (SR): synchronous, fixed point semantics! Time Driven (Giotto): synchronous, time-driven multitasking! Timed Multitasking (TM): priority-driven multitasking, deterministic communication E. A. Lee, UC Berkeley 10 5

IOPort 0..1 0..n Receiver Object Model NoRoomException throws «Interface» Receiver throws NoTokenException +get() : Token +getcontainer() : IOPort +hasroom() : boolean +hastoken() : boolean +put(t : Token) +setcontainer(port : IOPort) Mailbox «Interface» ProcessReceiver QueueReceiver DEReceiver SDFReceiver 1..1 1..1 1..1 CTReceiver CSPReceiver PNReceiver 1..1 FIFOQueue ArrayFIFOQueue E. A. Lee, UC Berkeley 11 Receiver Interface «Interface» Receiver +get() : Token +getcontainer() : IOPort +hasroom() : boolean +hastoken() : boolean +put(t : Token) +setcontainer(port : IOPort) These polymorphic methods implement the communication semantics of a domain in Ptolemy II. The receiver instance used in communication is supplied by the director, not by the component. Director IOPort producer consumer Receiver E. A. Lee, UC Berkeley 12 6

Behavioral Types Codification of Domain Semantics! Capture the dynamic interaction of components in types! Obtain benefits analogous to data typing.! Call the result behavioral types.! Communication has Director IOPort! data types! behavioral types! Components have producer Receiver consumer! data type signatures! domain type signatures! Components are! data polymorphic! domain polymorphic E. A. Lee, UC Berkeley 13 Second Version of a Behavioral Type System! Based on Interface automata! Proposed by de Alfaro and Henzinger! Concise composition (vs. standard automata)! Alternating simulation provides contravariance! Compatibility checking! Done by automata composition! Captures the notion components can work together! Alternating simulation (from Q to P)! All input steps of P can be simulated by Q, and! All output steps of Q can be simulated by P.! Provides the ordering we need for subtyping & polymorphism! Key theorem about compatibility and alternating simulation E. A. Lee, UC Berkeley 14 7

Example: Synchronous Dataflow (SDF) Consumer Actor Type Definition execution interface communication interface Such s are passive, and assume that input is available when they fire. Inputs: f fire t Token htt Return True from hastoken htf Return False from hastoken Outputs: fr Return from fire g get ht hastoken E. A. Lee, UC Berkeley 15 Type Definition Synchronous Dataflow (SDF) Domain receiver interface producer IOPort Director consumer Receiver director interface E. A. Lee, UC Berkeley 16 8

Type Checking Compose SDF Consumer Actor with SDF Domain SDF Domain Compose SDF Consumer Actor E. A. Lee, UC Berkeley 17 Type Definition SDF Consumer Actor in SDF Domain interface to producer 6. internal action: return from fire 5. internal action: get token 1. receives token from producer 2. accept token 3. internal action: fire consumer 4. internal action: call get() E. A. Lee, UC Berkeley 18 9

Type Definition Discrete Event (DE) Domain This domain may fire s without first providing inputs E. A. Lee, UC Berkeley 19 Recall Component Behavior SDF Consumer Actor 1. is fired 2. calls get() 3. gets a token 4. returns E. A. Lee, UC Berkeley 20 10

Type Checking Compose SDF Consumer Actor with DE Domain DE Domain Compose SDF Consumer Actor! Empty automaton indicates incompatibility! Composition type has no behaviors E. A. Lee, UC Berkeley 21 Subtyping Relation Alternating Simulation: SDF DE SDF Domain DE Domain E. A. Lee, UC Berkeley 22 11

System-Level Type Lattice Defined by Alternating Simulation discrete events domain polymorphic DE SDF synchronous dataflow DP PN process networks CSP! Consumer types! Subtyping relation! Shown here for a few Ptolemy II domains communicating sequential processes If an is compatible with a certain type, it is also compatible with the subtypes unknown unknown E. A. Lee, UC Berkeley 23 Type Definition Domain Polymorphic Consumer Actor 6. return 3. false 5. get token 4. return 1. is fired 2. calls hastoken() 3. true 4. call get() This checks for token availability before attempting to get the token. E. A. Lee, UC Berkeley 24 12

Domain Polymorphic Actor Composes with the DE Domain DE Domain Compose Poly Actor E. A. Lee, UC Berkeley 25 Domain Polymorphic Actor Also Composes with the SDF Domain SDF Domain Compose Poly Actor E. A. Lee, UC Berkeley 26 13

Conclusion! We capture patterns of component interaction in a type system framework: behavioral types! We describe interaction types and component behavior using interface automata.! We do type checking through automata composition.! Subtyping order is given by the alternating simulation relation, supporting polymorphism. E. A. Lee, UC Berkeley 27 More Speculative! We can reflect component dynamics in a run-time environment, providing behavioral reflection.! admission control! run-time type checking! fault detection, isolation, and recovery (FDIR)! Timed interface automata may be able to model real-time requirements and constraints.! checking consistency become a type check! generalized schedulability analysis E. A. Lee, UC Berkeley 28 14