Actor-Oriented Design: Concurrent Models as Programs

Similar documents
Concurrent Models of Computation for Embedded Software

Classes and Inheritance in Actor- Oriented Models

Actor-Oriented Design and The Ptolemy II framework

Process-Based Software Components Final Mobies Presentation

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

Concurrent Component Patterns, Models of Computation, and Types

An Overview of the Ptolemy Project and Actor-Oriented Design

Classes and Subclasses in Actor-Oriented Design

Concurrent Semantics without the Notions of State or State Transitions

Embedded Software from Concurrent Component Models

Concurrency Demands New Foundations for Computing

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

Making Concurrency Mainstream

System-Level Design Languages: Orthogonalizing the Issues

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

UC Berkeley Mobies Technology Project

The Gigascale Silicon Research Center

Temporal Semantics in Concurrent and Distributed Software

The Future of the Ptolemy Project

Concurrent Models of Computation

Component-Based Design of Embedded Control Systems

Modal Models in Ptolemy

Model-Based Design in the Ptolemy Project

Understandable Concurrency

The Problem With Threads

Embedded Tutorial CPS Foundations

Advanced Tool Architectures

Disciplined Concurrent Models of Computation for Parallel Software

Ptolemy II The automotive challenge problems version 4.1

Balance between Formal and Informal Methods, Engineering and Artistry, Evolution and Rebuild

Hybrid System Modeling: Operational Semantics Issues

Beyond Embedded Systems: Integrating Computation, Networking, and Physical Dynamics

Cover Page. The handle holds various files of this Leiden University dissertation

The Ptolemy II Framework for Visual Languages

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

The Problem with Treads

AADL Graphical Editor Design

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

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

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

A PRIMITIVE EXECUTION MODEL FOR HETEROGENEOUS MODELING

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1

Object-Oriented Design

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

New Programming Paradigms

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

Agent-Oriented Software Engineering

Compositional Model Based Software Development

Introduction to Object-Oriented Programming

DESIGN AND SIMULATION OF HETEROGENEOUS CONTROL SYSTEMS USING PTOLEMY II

Object Oriented Issues in VDM++

Compositionality in system design: interfaces everywhere! UC Berkeley

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 2: Review of Object Orientation

Hardware description languages

ICS 252 Introduction to Computer Design

Actor-oriented Metaprogramming. Stephen Andrew Neuendorffer

Course Development. Recall the Goal. Edited and Presented by Edward A. Lee, Co-PI UC Berkeley. Chess Review November 18, 2004 Berkeley, CA

Compositionality in Synchronous Data Flow: Modular Code Generation from Hierarchical SDF Graphs

Transforming Cyber-Physical System Models

Design issues for objectoriented. languages. Objects-only "pure" language vs mixed. Are subclasses subtypes of the superclass?

Object-Oriented Programming

Graphical System Design. David Fuller LabVIEW R&D Section Manager

Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads.

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Component-Based Design of Embedded Control Systems

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Modeling Kernel Language (MKL)

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

FSMs & message passing: SDL

Topics in Object-Oriented Design Patterns

What are the characteristics of Object Oriented programming language?

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

Hardware/Software Co-design

Hardware Description Languages & System Description Languages Properties

Dynamic Object-Oriented Programming with Smalltalk 1. Introduction

The Design and Application of Structured Types in Ptolemy II

Hybrid Agent-Landscape Model Composition

Outline. SLD challenges Platform Based Design (PBD) Leveraging state of the art CAD Metropolis. Case study: Wireless Sensor Network

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

Codesign Framework. Parts of this lecture are borrowed from lectures of Johan Lilius of TUCS and ASV/LL of UC Berkeley available in their web.

Software Synthesis from Dataflow Models for G and LabVIEW

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

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Inheritance (Chapter 7)

OUTLINE RTL DESIGN WITH ARX

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it.

Heterogeneous Concurrent Modeling and Design in Java (Volume 1: Introduction to Ptolemy II)

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

An Introduction to Subtyping

C++ Important Questions with Answers

301AA - Advanced Programming [AP-2017]

Component Design. Systems Engineering BSc Course. Budapest University of Technology and Economics Department of Measurement and Information Systems

Object-Oriented Concepts and Design Principles

Official Survey. Cunning Plan: Focus On Objects. The Need for a Calculus. Object Calculi Summary. Why Not Use λ-calculus for OO?

CSC207 Week 3. Larry Zhang

ECE 3574: Dynamic Polymorphism using Inheritance

Java: Just Another Version of Ada an overview of Ada 2005

Specifications and Modeling

Transcription:

Actor-Oriented Design: Concurrent Models as Programs Edward A. Lee Professor, UC Berkeley Director, Center for Hybrid and Embedded Software Systems (CHESS) Parc Forum Palo Alto, CA May 13, 2004 Abstract Concurrent, domain-specific languages such as Simulink, LabVIEW, Modelica, VHDL, SystemC, and OPNET provide modularization mechanisms that are significantly different from those in prevailing objectoriented languages such as C++ and Java. In these languages, components are concurrent objects that communicate via messaging, rather than abstract data structures that interact via procedure calls. Although the concurrency and communication semantics differ considerably between languages, they share enough common features that we consider them to be a family. We call them actor-oriented languages. Actor-oriented languages, like object-oriented languages, are about modularity of software. I will argue that we can adapt for actor-oriented languages many (if not all) of the innovations of OO design, including concepts such as the separation of interface from implementation, strong typing of interfaces, subtyping, classes, inheritance, and aspects. I will show some preliminary implementations of these mechanisms in a Berkeley system called Ptolemy II. Lee, Berkeley 2

The Questions Is this a good way to do design? How does it relate to prevailing SW engineering? Does it support abstraction and modularity? Will it scale? Can it become mainstream? Lee, Berkeley 3 Platforms big gap A platform is a set of designs. Relations between platforms represent design processes. Lee, Berkeley 4

Progress Many useful technical developments amount to creation of new platforms. microarchitectures operating systems virtual machines processor cores configurable ISAs Lee, Berkeley 5 Recent Action Giving the red platforms useful modeling properties (e.g. verification, SystemC, UML, MDA) Getting from red platforms to blue platforms (e.g. correctness, efficiency, synthesis of tools) Lee, Berkeley 6

Better Platforms Platforms with modeling properties that reflect requirements of the application, not accidental properties of the implementation. Lee, Berkeley 7 How to View This Design From above: Signal flow graph with linear, timeinvariant components. From below: Synchronous concurrent composition of components Lee, Berkeley 8

Actor-Oriented Platforms Actor oriented models compose concurrent components according to a model of computation. Time and concurrency become key parts of the programming model. Lee, Berkeley 9 Actor-Oriented Design Object orientation: class name data methods What flows through an object is sequential control call return Actor orientation: actor name data (state) parameters ports Input data Output data What flows through an object is streams of data Lee, Berkeley 10

Actor Orientation vs. Object Orientation Object oriented Actor oriented TextToSpeech initialize(): void notify(): void isready(): boolean getspeech(): double[] OO interface definition gives procedures that have to be invoked in an order not specified as part of the interface definition. actor-oriented interface definition says Give me text and I ll give you speech Identified limitations of object orientation: Says little or nothing about concurrency and time Concurrency typically expressed with threads, monitors, semaphores Components tend to implement low-level communication protocols Re-use potential is disappointing Lee, Berkeley 11 The First (?) Actor-Oriented Programming Language The On-Line Graphical Specification of Computer Procedures W. R. Sutherland, Ph.D. Thesis, MIT, 1966 MIT Lincoln Labs TX-2 Computer Bert Sutherland with a light pen Bert Sutherland used the first acknowledged objectoriented framework (Sketchpad, created by his brother, Ivan Sutherland) to create the first actor-oriented programming framework. Partially constructed actor-oriented model with a class definition (top) and instance (below). Lee, Berkeley 12

Your Speaker in 1966 Lee, Berkeley 13 Modern Examples of Actor-Oriented Component Frameworks Simulink (The MathWorks) Except Ptolemy, all of Labview (National Instruments) these define a fixed Modelica (Linkoping) model of OPNET (Opnet Technologies) computation. Polis & Metropolis (UC Berkeley) Gabriel, Ptolemy, and Ptolemy II (UC Berkeley) OCP, open control platform (Boeing) GME, actor-oriented meta-modeling (Vanderbilt) SPW, signal processing worksystem (Cadence) System studio (Synopsys) ROOM, real-time object-oriented modeling (Rational) Easy5 (Boeing) Port-based objects (U of Maryland) I/O automata (MIT) VHDL, Verilog, SystemC (Various) Lee, Berkeley 14

Ptolemy II Framework for Experimenting with AO Design Basic Ptolemy II infrastructure: Director from a library defines component interaction semantics Type system Large, domain-polymorphic component library. Hierarchical components Visual editor Lee, Berkeley 15 Actors in 2004: Capsules (UML-RT) and Composite Structures (UML-2) UML-RT borrowed from Selic s ROOM the notion of capsules, which structurally look like actors. UML-2 is introducing the notion of composite structures, which also look like actors. UML capsules and composite structures specify abstract syntax (and a concrete syntax), but no semantics. What this says is that there is huge potential for actororiented design to be done wrong Lee, Berkeley 16

Why Use the Term Actors The term actors was introduced in the 1970 s by Carl Hewitt of MIT to describe autonomous reasoning agents. The term evolved through the work of Gul Agha and others to refer to a family of concurrent models of computation, irrespective of whether they were being used to realize autonomous reasoning agents. The term actor has also been used since 1974 in the dataflow community in the same way, to represent a concurrent model of computation. But UML uses the term actor in its use cases. Lee, Berkeley 17 Does Actor-Oriented Design Offer Best- Of-Class SW Engineering Methods? Abstraction procedures/methods classes Modularity subclasses inheritance interfaces polymorphism aspects Correctness type systems Lee, Berkeley 18

Example of an Actor-Oriented Framework: Simulink basic abstraction mechanism is hierarchy. Lee, Berkeley 19 Observation By itself, hierarchy is a very weak abstraction mechanism. Lee, Berkeley 20

Tree Structured Hierarchy Does not represent common class definitions. Only instances. container hierarchical component container copy Multiple instances of the same hierarchical component are copies. leaf components: instances of an OO class Lee, Berkeley 21 Alternative Hierarchy: Roles and Instances one definition, multiple containers class instance instance role hierarchy ( design-time view) instance hierarchy ( run time view) Lee, Berkeley 22

Role Hierarchy Multiple instances of the same hierarchical component are represented by classes with multiple containers. hierarchical class This makes hierarchical components more like leaf components. Lee, Berkeley 23 A Motivating Application: Modeling Sensor Networks Model of Massimo Franceschetti s small world phenomenon with 49 sensor nodes. Making these objects instances of a class rather than copies reduced the XML representation of the model from 1.1 Mbytes to 87 kbytes, and offered a number of other advantages. These 49 sensor nodes are actors that are instances of the same class, defined as: Lee, Berkeley 24

Subclasses, Inheritance? Interfaces, Subtypes? Aspects? Now that we have classes, can we bring in more of the modern programming world? subclasses? inheritance? interfaces? subtypes? aspects? Lee, Berkeley 25 Example Using AO Classes local class definition execution instance instance inherited actors override actors subclass Lee, Berkeley 26

Inner Classes Local class definitions are important to achieving modularity. Encapsulation implies that local class definitions can exist within class definitions. A key issue is then to define the semantics of inheritance and overrides. Lee, Berkeley 27 Ordering Relations containment relation parent-child relation limited form of multiple inheritance. Mathematically, this structure is a doubly-nested diposet, the formal properties of which help to define a clean inheritance semantics. The principle we follow is that local changes override global changes. Lee, Berkeley 28

Defining Actor Interfaces: Ports and Parameters input ports parameters: a 1 = value a 2 = value output port Example: p 1 p 2 p 3 input/output port port Lee, Berkeley 29 Actor Subtypes a 1 : Int = value Example of a simple type lattice: General p 1 : Int p 3 : Double Boolean String Scalar Contravariant p 1 : Double subtype relation a 1 : Double = value p 3 : Int Covariant Long Int Event Complex Double Lee, Berkeley 30

Actor Subtypes (cont) a 1 : Int = value Subtypes can have: Fewer input ports p 1 : Int p 3 : Double More output ports subtype relation Remove (ignore) input ports Remove (ignore) or add parameters p 3 : Int p 4 : Double Add output ports Of course, the types of these can have co/contravariant relationships with the supertype. Lee, Berkeley 31 Observations Subtypes can remove (or ignore) parameters and also add new parameters because parameters always have a default value (unlike inputs, which a subtype cannot add) Subtypes cannot modify the types of parameters (unlike ports). Co/contravariant at the same time. PortParameters are ports with default values. They can be removed or added just like parameters because they provide default values. Are there similar exceptions to co/contravariance in OO languages? Lee, Berkeley 32

Composing Actors A connection implies a type constraint. Can: check compatibility perform conversions infer types out: Int in: Int out: Int in: Double Source out: Int in: Unknown Sink The Ptolemy II type system does all three. Lee, Berkeley 33 What Happens to Type Constraints When a Subclass Adds Connections? Type resolution results may be different in different subclasses of the same base class (connection with let-bound variables in a Hindley-Milner type system?) DerivedClass τ 3 τ 1 <= τ 3 τ 1 τ τ 1 <= τ 2 2 Source BaseClass Sink Lee, Berkeley 34

Abstract Actors? Suppose one of the contained actors is an interface only. Such a class definition cannot be instantiated (it is abstract). Concrete subclasses would have to provide implementations for the interface. Is this useful? Lee, Berkeley 35 Implementing Multiple Interfaces An Example EnergyConsumer interface has a single output port that produces a Double representing the energy consumed by a firing. Filter interface for a stream transformer component. in: Event Event is a peculiar type that can yield a token of any type. It is the bottom of the type lattice. in: Double energy: Double subtype relation in: Double out: Double out: Double EnergyConsumingFilter composed interface. power: Double Lee, Berkeley 36

A Model Using Such an Actor in: Double in: Double out: Double Sink out: Double power: Double EnergyConsumingFilter Source in: Double EnergyTabulator Lee, Berkeley 37 Heterarchy? Multi-View Modeling? Aspects? Abstract Abstract Filter Sink EnergyConsumer Source FunctionModel EnergyModel EnergyTabulator Source Sink This is multi-view modeling, similar to what GME (Vanderbilt) can do. EnergyConsumingFilter EnergyTabulator Is this an actor-oriented version of aspect-oriented programming? Lee, Berkeley 38

Recursive Containment Can Hierarchical Classes Contain Instances of Themselves? class instance class instance role hierarchy instance Note that in this case, unrolling cannot occur at compile time. instance hierarchy Lee, Berkeley 39 Primitive Realization of this in Ptolemy Classic FFT implementation in Ptolemy Classic (1995) used a partial evaluation strategy on higher-order components. recursive reference Lee, Berkeley 40

Conclusion Actor-oriented design remains a relatively immature area, but one that is progressing rapidly. It has huge potential. Many questions remain Lee, Berkeley 41