process-based software components final mobies presentation

47
Process-Based Software Components Final Mobies Presentation Edward A. Lee Professor UC Berkeley PI Meeting, Savannah, GA January 21-23, 2004 PI: Edward A. Lee, 510-642-0455, [email protected] Co-PI: Tom Henzinger, 510-643-2430, [email protected] PM: John Bay Agent: Dale Vancleave, [email protected] Award end date: December, 2003 Contract number: F33615-00-C-1703 AO #: J655

Upload: nam

Post on 25-Feb-2016

49 views

Category:

Documents


2 download

DESCRIPTION

Process-Based Software Components Final Mobies Presentation. PI Meeting, Savannah, GA January 21-23, 2004. Edward A. Lee Professor UC Berkeley. PI: Edward A. Lee, 510-642-0455, [email protected] Co-PI: Tom Henzinger, 510-643-2430, [email protected] PM: John Bay - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Process-Based Software Components Final Mobies Presentation

Process-Based Software ComponentsFinal Mobies Presentation

Edward A. LeeProfessorUC Berkeley

PI Meeting, Savannah, GAJanuary 21-23, 2004

PI: Edward A. Lee, 510-642-0455, [email protected]: Tom Henzinger, 510-643-2430, [email protected]: John BayAgent: Dale Vancleave, [email protected] end date: December, 2003Contract number: F33615-00-C-1703AO #: J655

Page 2: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 2

Ptolemy Project ParticipantsPtolemy Project ParticipantsDirector:Director: Edward A. LeeEdward A. Lee

Staff:Staff: Christopher HylandsChristopher Hylands Susan Gardner (Chess)Susan Gardner (Chess) Nuala MansardNuala Mansard Mary P. StewartMary P. Stewart Neil E. Turner (Chess)Neil E. Turner (Chess) Lea Turpin (Chess)Lea Turpin (Chess)

Postdocs, Etc.:Postdocs, Etc.: Joern Janneck, PostdocJoern Janneck, Postdoc Rowland R. Johnson, Visiting Scholar Rowland R. Johnson, Visiting Scholar Kees Vissers, Visiting Industrial FellowKees Vissers, Visiting Industrial Fellow Daniel Lázaro Cuadrado, Visiting ScholarDaniel Lázaro Cuadrado, Visiting Scholar

Graduate Students:Graduate Students:

J. Adam CataldoJ. Adam Cataldo Chris ChangChris Chang Elaine CheongElaine Cheong Sanjeev KohliSanjeev Kohli Xiaojun LiuXiaojun Liu Eleftherios D. MatsikoudisEleftherios D. Matsikoudis Stephen NeuendorfferStephen Neuendorffer James YehJames Yeh Yang ZhaoYang Zhao Haiyang ZhengHaiyang Zheng Rachel ZhouRachel Zhou

Page 3: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 3

Project Goals and Problem Description

Our focus is on component-based design using principled models of computation and their runtime environments for embedded systems. The emphasis of this project is on the dynamics of the components, including the communication protocols that they use to interface with other components, the modeling of their state, and their flow of control. The purpose of the mechanisms we develop is to improve robustness and safety while promoting component-based design.

Page 4: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 4

Where We Are

Major Accomplishments Actor-oriented design Behavioral types Component specialization (vs. code generation) Hierarchical heterogeneous models Hierarchical modal models Hybrid systems operational semantics Hybrid system modeling and simulation with HSIF import Giotto and timed-multitasking models of computation Network integrated models (P&S, push-pull, discovery) Actor definition language principles

Page 5: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 5

Where We Are Going

Current Efforts Actor-oriented classes, inheritance, interfaces and aspects Security with distributed and mobile models Higher-order components Model-based lifecycle management Behavioral and resource Interfaces for practical verification Modeling of Wireless Sensor nets Construction of Scientific Workflows

Page 6: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 6

Platforms

A platform is a set of designs.

Relations between platforms represent design processes.

big gap

Page 7: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 7

Progress

Many useful technical developments amounted to creation of new platforms.

microarchitectures operating systems virtual machines processor cores configurable ISAs

Page 8: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 8

Desirable Properties

From above: modeling expressiveness

From below: correctness efficiency

Page 9: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 9

Model-Based Design

Model-based design is specification of designs in platforms with “useful modeling properties.”

Page 10: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 10

RecentAction

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)

Page 11: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 11

BetterPlatforms

Platforms with modeling properties that reflect requirements of the application, not accidental properties of the implementation.

Page 12: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 12

How to View This Design

From above: Signal flow graph with linear, time-invariant components.

From below: Synchronous concurrent composition of components

Page 13: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 13

Embedded Platforms

The modeling properties of these platforms are about the application problem, not about the implementation technology.

Page 14: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 14

Embedded Platforms

The modeling properties of these platforms are about the application problem, not about the implementation technology.

Page 15: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 15

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.

Page 16: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 16

Actor-Oriented Design

Actor orientation:

actor name

data (state)

ports

Input data

parameters

Output data

What flows through an object is

streams of data

class name

data

methods

call return

What flows through an object is

sequential control

Object orientation:

Page 17: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 17

Actor Orientationvs. Object Orientation

Identified problems with 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

Actor orientation offers more potential for useful modeling properties, and hence for model-based design.

OO interface definition gives procedures that have to be invoked in an order not specified as part of the interface definition.

TextToSpeech

initialize(): voidnotify(): voidisReady(): booleangetSpeech(): double[]

actor-oriented interface definition says “Give me text and I’ll give you speech”

Actor orientedObject oriented

Page 18: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 18

But… New Design Methods Need to Offer Best-Of-Class Methods

Abstraction procedures/methods classes

Modularity subclasses inheritance interfaces polymorphism aspects

Correctness type systems

Page 19: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 19

Example of an Actor-Oriented Framework: Simulink

basic abstraction mechanism is hierarchy.

Page 20: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 20

Less Conventional Actor-Oriented Framework: VisualSense

Based on Ptolemy II Connectivity is wireless Customized visualization Location-aware models Channel models include:

packets losses power attenuation distance limitations collisions

Component models include: Antenna gains Terrain models Jamming

model of a sensor node

model of a channel

Page 21: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 21

Also Uses Hierarchy for Abstraction

These 49 sensor nodes are actors that are instances of the same class, defined as:

Page 22: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 22

Observation

By itself, hierarchy is a very weak abstraction mechanism.

Page 23: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 23

Tree Structured Hierarchy

Does not represent common class definitions. Only instances.

Multiple instances of the same hierarchical component are copies.

hierarchicalcomponent copy

leaf components: instances of an OO class

container container

Page 24: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 24

Using Copies for Instances is Awkward

Models become unmaintainable. Changes have be performed on all 49 copies of this:

Page 25: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 25

Alternative Hierarchy:Roles and Instances

class

role hierarchy(“design-time” view)

instance hierarchy(“run time” view)

instance instance

one definition,multiple containers

Page 26: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 26

Role Hierarchy

Multiple instances of the same hierarchical component are represented by classes with multiple containers.

This makes hierarchical components are more similar to leaf components.

hierarchicalclass

Page 27: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 27

Example Ptolemy II now supports a role hierarchy.

The definition below is a class and objects at the left are instances, not copies.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.

Page 28: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 28

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?

Page 29: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 29

Actor Interfaces:Ports and Parameters

input portsoutput port

p1

p2

p3

parameters:a1 = valuea2 = value

input/outputport

port

Example:

Page 30: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 30

Subclasses? Inheritance?Interfaces? Subtypes? Aspects?Yes We Can!

Actor-oriented design: subclasses and inheritance

hierarchical models that inherit structure from a base class interfaces and subtypes

ports and parameters of actors form their interface aspects

heterarchical models interweave multiple hierarchies, providing true multi-view modeling.

All of these operate at the abstract syntax level, and are independent of the model of computation, and therefore can be used with any model of computation! Thus, they become available in domain-specific actor-oriented languages.

These are a part of what the Berkeley Center for Hybrid and Embedded Software Systems (Chess) is doing.

Page 31: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 31

ExampleA Simple Resource Interface

out: Double in: Double

out: Double

subtyperelation

power: Double

energy: Double

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: Double

EnergyConsumingFilter composed interface.

in: Event

Page 32: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 32

Ethereal Sting OEP: Lessons onDataflow Design Patterns

Solution to E0 Challenge Problem

E1 Challenge Problem Components

Input data sequence, at samplingFrequency Hz

Output data sequence, at detected baud rate. (not known apriori)

Page 33: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 33

SDF is More Flexible Than We Realized

The Synchronous Dataflow (SDF) model of computation can be easily augmented to make it much more expressive without sacrificing static analyzability.

Model-based lifecycle management can provide systematic ways to construct supervisory structures (resource management, task management).

Page 34: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 34

Dataflow Taxonomy Synchronous dataflow (SDF)

Balance equation formalism Statically schedulable Decidable resource requirements

Heterochronous Dataflow (HDF) Combines state machines with SDF graphs Very expressive, yet decidable Scheduling complexity can be high

Boolean & Integer Dataflow (BDF, IDF) Balance equations are solved symbolically Turing-complete expressiveness Undecidable, yet often statically schedulable

Process Networks (PN) Turing-complete expressiveness Undecidable (schedule and resource requirements) Thread scheduling with interlocks provably executes with bounded resources

when that is possible.

With higher-order components and modal models, SDF is sufficiently expressive for the SW radio OEP.

Page 35: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 35

SDF Principles

Fixed production/consumption rates Balance equations (one for each channel):

Schedulable statically Decidable:

buffer memory requirements deadlock

fire B { … consume M …}

fire A { … produce N …}

channelN M

MfNf BA number of tokens

consumednumber of firings per “iteration”number of tokens produced

Page 36: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 36

Undecidability: What SDF Avoids(Buck ’93)

Sufficient set of actors for undecidability: boolean functions on boolean tokens switch and select initial tokens on arcs

Undecidable: deadlock bounded buffer memory existence of an annotated schedule

booleanfunction se

lect

switc

h

initial token

1

1

1

1

1 1

1

b

1- b

b

1- b

T

F

T

F

Page 37: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 37

Resampling Design Pattern Using Token Routing

This pattern requires the use of a semantically richer dataflow model than SDF because the BooleanSwitch is not an SDF actor.

This has a performance cost and reduces the static analyzability of the model.

Page 38: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 38

Resampling Design Pattern using Modal Models

Uses transition refinements All SDF + FSM Can be captured in a higher-order

component that makes the pattern easy to use.

Page 39: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 39

Scalability of Visual SyntaxesIteration by Replication

naïve approach: 8 tones 8 signal paths

hard to build hardwired scale distributor:

converts an array of dimension 8 to a sequence of 8 tokens.

array in elements out

Page 40: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 40

Scalability of Visual SyntaxesIteration by Dataflow

Although sometimes useful, this design pattern has limitations: array size must be statically fixed actor to iterate must be stateless, or desired semantics must be to carry state across array elements

Page 41: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 41

Structured Programming in SDF

A library of actors that encapsulate common design patterns: IterateOverArray: Serialize an array input and provide it

sequentially to the contained actor. MapOverArray: Provide elements of an array input to distinct

instances of the contained actor. Zip, Scan, Case, …

Like the higher-order functions of functional languages, but unlike functions, actors can have state.

The implementation leverages the abstract semantics of Ptolemy II.

Page 42: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 42

Abstract Semantics – The Key To Hierarchical Heterogeneity

flow of control Initialization Execution Finalization

communication Structure of signals Send/receive protocols

preinitialize() declare static information, like

type constraints, scheduling properties, temporal properties, structural elaboration

initialize() initialize variables

Page 43: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 43

Abstract Semantics – The Key To Hierarchical Heterogeneity

flow of control Initialization Execution Finalization

communication Structure of signals Send/receive protocols

iterate()

Page 44: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 44

Abstract Semantics – The Key To Hierarchical Heterogeneity

flow of control Initialization Execution Finalization

communication Structure of signals Send/receive protocols

iterate()

prefire() fire() postfire()

stopFire()

Page 45: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 45

Lifecycle Management

It is possible to hierarchically compose the Ptolemy II abstract semantics.

Actors providing common patterns: RunCompositeActor is a composite actor that, instead of

firing the contained model, executes a complete lifecycle of the contained model.

ModelReference is an atomic actor whose function is provided by a complete execution of a referenced model in another file or URL.

Provides systematic approach to building systems of systems.

Page 46: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 46

Hierarchical Composition of the Ptolemy II Abstract Semantics

flow of control Initialization Execution Finalization

communication Structure of signals Send/receive protocols

iterate()

prefire() fire() postfire()

stopFire()

initialization Execution Finalization

Page 47: Process-Based Software Components Final Mobies Presentation

Lee, UC Berkeley 47

Conclusion

We aren’t done yet…

Stay tuned…