Embedded Tutorial CPS Foundations

Similar documents
Temporal Semantics in Concurrent and Distributed Software

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

Computing Needs Time

Concurrency Demands New Foundations for Computing

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

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

Making Concurrency Mainstream

Precision Timed (PRET) Machines

Concurrent Semantics without the Notions of State or State Transitions

Component Architectures for Time-Sensitive Systems Part 1

Disciplined Concurrent Models of Computation for Parallel Software

Actor-Oriented Design: Concurrent Models as Programs

The Case for the Precision Timed (PRET) Machine

Understandable Concurrency

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

Synthesis of Distributed Real- Time Embedded Software

The Problem With Threads

Introduction to Embedded Systems

Concurrent Component Patterns, Models of Computation, and Types

The Problem with Treads

Predictable Timing of Cyber-Physical Systems Future Research Challenges

The Future of the Ptolemy Project

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

Embedded Software from Concurrent Component Models

Model-Based Design for Signal Processing Systems

Actor-Oriented Design and The Ptolemy II framework

fakultät für informatik informatik 12 technische universität dortmund Specifications Peter Marwedel TU Dortmund, Informatik /11/15

Specifications and Modeling

PREcision Timed (PRET) Architecture

Programming Languages for Real-Time Systems. LS 12, TU Dortmund

Component-Based Design of Embedded Control Systems

Concurrent Models of Computation

Compositionality in system design: interfaces everywhere! UC Berkeley

Precision-Timed (PRET) Machines

Imperative model of computation

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.

Concurrent Models of Computation

Specifications Part 1

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

Programming Embedded Systems

An Introduction to Lustre

Modular code generation from synchronous models:

Simulink/Stateflow. June 2008

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

Ptolemy II The automotive challenge problems version 4.1

Modal Models in Ptolemy

Portable Real-Time Code from PTIDES Models

An Extension to the Foundation Fieldbus Model for Specifying Process Control Strategies

Distributed Systems Principles and Paradigms

Hybrid System Modeling: Operational Semantics Issues

Hardware Description Languages & System Description Languages Properties

Concurrent Models of Computation for Embedded Software

Concurrent ML. John Reppy January 21, University of Chicago

The Internet of Important Things

Introducing Embedded Systems: A Cyber- Physical Systems Approach

Embedded Real-Time Systems

The Problem with Threads

Specifications and Modeling

System Design and Methodology/ Embedded Systems Design (Modeling and Design of Embedded Systems)

Multi-threaded, discrete event simulation of distributed computing systems

Introduction to Embedded Systems

殷亚凤. Processes. Distributed Systems [3]

Classes and Inheritance in Actor- Oriented Models

Predictable multithreading of embedded applications using PRET-C

Reconciling Repeatable Timing with Pipelining and Memory Hierarchy

Ptolemy Seamlessly Supports Heterogeneous Design 5 of 5

Foundations of the C++ Concurrency Memory Model

Interface Automata and Actif Actors

Timing Analysis of Embedded Software for Families of Microarchitectures

Hardware Description Languages & System Description Languages Properties

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Systems I: Programming Abstractions

Parallel Discrete Event Simulation

Hardware/Software Co-design

Achieving Predictable Multicore Execution of Automotive Applications Using the LET Paradigm

DISTRIBUTED FILE SYSTEMS & NFS

Department of Computer Science Institute for System Architecture, Operating Systems Group REAL-TIME MICHAEL ROITZSCH OVERVIEW

Timing Definition Language (TDL) Concepts, Code Generation and Tools

Multiprocessor and Real- Time Scheduling. Chapter 10

The Strategy Pattern Design Principle: Design Principle: Design Principle:

From synchronous models to distributed, asynchronous architectures

Parallel Programming Multicore systems

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

High Performance Computing on GPUs using NVIDIA CUDA

Grassroots ASPLOS. can we still rethink the hardware/software interface in processors? Raphael kena Poss University of Amsterdam, the Netherlands

TDDD07 Real-time Systems Lecture 10: Wrapping up & Real-time operating systems

Parallelism. Parallel Hardware. Introduction to Computer Systems

Flight Systems are Cyber-Physical Systems

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

ECE519 Advanced Operating Systems

Predictable Programming on a Precision Timed Architecture

SWE 760 Lecture 1: Introduction to Analysis & Design of Real-Time Embedded Systems

Going With the (Data) Flow

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

CHAPTER - 4 REMOTE COMMUNICATION

Outline. Exploiting Program Parallelism. The Hydra Approach. Data Speculation Support for a Chip Multiprocessor (Hydra CMP) HYDRA

An Overview of the Ptolemy Project and Actor-Oriented Design

Dr Markus Hagenbuchner CSCI319 SIM. Distributed Systems Chapter 4 - Communication

Overview. Distributed Computing with Oz/Mozart (VRH 11) Mozart research at a glance. Basic principles. Language design.

Model-Based Design in the Ptolemy Project

Transcription:

Embedded Tutorial CPS Foundations Edward A. Lee Robert S. Pepper Distinguished Professor UC Berkeley Special Session: Cyber-Physical Systems Demystified Design Automation Conference (DAC 2010) Annaheim, CA, Thursday, June 17, 2010

Abstract This talk argues that cyber-physical systems present a substantial intellectual challenge that requires changes in both theories of computation and dynamical systems theory. The CPS problem is not the union of cyber and physical problems, but rather their intersection, and as such it demands models that embrace both. Two complementary approaches are identified: cyberizing the physical (CtP) means to endow physical subsystems with cyber-like abstractions and interfaces; and physicalizing the cyber (PtC) means to endow software and network components with abstractions and interfaces that represent their dynamics in time. 2

Cyber-Physical Systems (CPS): Orchestrating networked computational resources with physical systems Automotive Building Systems Avionics Telecommunications Transportation (Air traffic control at SFO) E-Corner, Siemens Power generation and distribution Factory automation Instrumentation (Soleil Synchrotron) Military systems: Daimler-Chrysler Courtesy of General Electric Courtesy of Kuka Robotics Corp. 3

CPS Example Printing Press 4

Where CPS Differs from the traditional embedded software problem: The traditional embedded software problem: Embedded software is software on small computers. The technical problem is one of optimization (coping with limited resources). The CPS problem: Computation and networking integrated with physical processes. The technical problem is managing dynamics, time, and concurrency in networked computational + physical systems. 5

CPS is Multidisciplinary Computer Science: Carefully abstracts the physical world System Theory: Deals directly with physical quantities Cyber Physical Systems: Computational + Physical 6

A Key Challenge Models for the physical world and for computation diverge. physical: time continuum, ODEs, DAEs, PDEs, dynamics computational: a procedural epistemology, logic There is a huge cultural gap. Physical system models must be viewed as semantic frameworks (cyberizing the physical), and theories of computation must be viewed as alternative ways of talking about dynamics (physicalizing the cyber) 7

First Challenge on the Cyber Side: Real-Time Software Correct execution of a program in C, C#, Java, Haskell, etc. has nothing to do with how long it takes to do anything. All our computation and networking abstractions are built on this premise. Programmers have to step outside the programming abstractions to specify timing behavior. 8

Techniques that Exploit this Fact Programming languages Virtual memory Caches Dynamic dispatch Speculative execution Power management (voltage scaling) Memory management (garbage collection) Just-in-time (JIT) compilation Multitasking (threads and processes) Component technologies (OO design) Networking (TCP) 9

A Story In fly by wire aircraft, certification of the software is extremely expensive. Regrettably, it is not the software that is certified but the entire system. If a manufacturer expects to produce a plane for 50 years, it needs a 50-year stockpile of fly-by-wire components that are all made from the same mask set on the same production line. Even a slight change or improvement might affect timing and require the software to be recertified. 10

Consequences Stockpiling for a product run Some systems vendors have to purchase up front the entire expected part requirements for an entire product run. Frozen designs Once certified, errors cannot be fixed and improvements cannot be made. Product families Difficult to maintain and evolve families of products together. It is difficult to adapt existing designs because small changes have big consequences Forced redesign A part becomes unavailable, forcing a redesign of the system. Lock in Cannot take advantage of cheaper or better parts. Risky in-field updates In the field updates can cause expensive failures. 11

Abstraction Layers in Common Use The purpose for an abstraction is to hide details of the implementation below and provide a platform for design from above. 12

Abstraction Layers in Common Use Every abstraction layer has failed in the fly-by-wire scenario. The design is the implementation. 13

Abstraction Layers How about raising the level of abstraction to solve these problems? 14

But these higher abstractions rely on an increasingly problematic fiction: WCET Example war story: Analysis of: Motorola ColdFire Two coupled pipelines (7-stage) Shared instruction & data cache Artificial example from Airbus Twelve independent tasks Simple control structures Cache/Pipeline interaction leads to large integer linear programming problem And the result is valid only for that exact Hardware and software! Fundamentally, the ISA of the processor has failed to provide an adequate abstraction. C. Ferdinand et al., Reliable and precise WCET determination for a real-life processor. EMSOFT 2001. 15

The Key Problem Electronics technology delivers highly reliable and precise timing 20.000 MHz (± 100 ppm) and the overlaying software abstractions discard it. 16

Second Challenge on the Cyber Side: Concurrency (Needed for real time and multicore) Threads dominate concurrent software. Threads: Sequential computation with shared memory. Interrupts: Threads started by the hardware. Incomprehensible interactions between threads are the sources of many problems: Deadlock Priority inversion Scheduling anomalies Timing variability Nondeterminism Buffer overruns System crashes Even distributed software commonly goes to considerable lengths to emulate this rather poor abstraction using middleware that supports RPC, proxies, and data replication. 17

My Claim Nontrivial software written with threads is incomprehensible to humans, and it cannot deliver repeatable or predictable behavior, except in trivial cases. 18

Perhaps Concurrency is Just Hard Sutter and Larus observe: humans are quickly overwhelmed by concurrency and find it much more difficult to reason about concurrent than sequential code. Even careful people miss possible interleavings among even simple collections of partially ordered operations. H. Sutter and J. Larus. Software and the concurrency revolution. ACM Queue, 3(7), 2005. 19

Is Concurrency Hard? It is not concurrency that is hard 20

It is Threads that are Hard! Threads are sequential processes that share memory. From the perspective of any thread, the entire state of the universe can change between any two atomic actions (itself an ill-defined concept). Imagine if the physical world did that 21

Concurrent programs using shared memory are incomprehensible because concurrency in the physical world does not work that way. We have no experience! 22

Concurrent Programs with Threads and Interrupts are Brittle Small changes can have big consequences. Consider a multithreaded program on multicore: Theorem (Richard Graham, 1976): If a task set with fixed priorities, execution times, and precedence constraints is optimally scheduled on a fixed number of processors, then increasing the number of processors, reducing execution times, or weakening precedence constraints can increase the schedule length. 23

The Current State of Affairs We build embedded software on abstractions where time is irrelevant using concurrency models that are incomprehensible. Just think what we could do with the right abstractions! 24

Approaching the CPS Challenge Physicalizing the cyber (PtC): to endow software and network components with abstractions and interfaces that represent their dynamics in time. Cyberizing the Physical (CtP): to endow physical subsystems with cyber-like abstractions and interfaces 25

Projects at Berkeley focused on Physicalizing the Cyber Time and concurrency in the core abstractions: Foundations: Timed computational semantics. Bottom up: Make timing repeatable. Top down: Timed, concurrent components. Holistic: Model engineering. 26

Bottom Up: Make Timing Repeatable Precision-Timed (PRET) Machines Make temporal behavior as important as logical function. Timing precision with performance: Challenges: Memory hierarchy (scratchpads?) Deep pipelines (interleaving?) ISAs with timing (deadline instructions?) Predictable memory management (Metronome?) Languages with timing (discrete events? Giotto?) Predictable concurrency (synchronous languages?) Composable timed components (actor-oriented?) Precision networks (TTA? Time synchronization?) See S. Edwards and E. A. Lee, "The Case for the Precision Timed (PRET) Machine," in the Wild and Crazy Ideas Track of the Design Automation Conference (DAC), June 2007. 27

Projects at Berkeley focused on Physicalizing the Cyber Time and concurrency in the core abstractions: Foundations: Timed computational semantics. Bottom up: Make timing repeatable. Top down: Timed, concurrent components. Holistic: Model engineering. 28

Rethinking Software Components: Object Oriented vs. Actor Oriented The established: Object-oriented: class name data methods What flows through an object is sequential control call return Things happen to objects The alternative: Actor oriented: actor name data (state) parameters ports Actors make things happen What flows through an object is evolving data Input data Output data 29

Examples of Actor-Oriented Systems UML 2 and SysML (activity diagrams) ASCET (time periods, interrupts, priorities, preemption, shared variables ) Autosar (software components w/ sender/receiver interfaces) Simulink (continuous time, The MathWorks) The semantics of LabVIEW (structured dataflow, National Instruments) these differ SCADE (synchronous, based on Lustre and Esterel) considerably in their CORBA event service (distributed push-pull) approaches to ROOM and UML-2 (dataflow, Rational, IBM) concurrency and time. Some are loose VHDL, Verilog (discrete events, Cadence, Synopsys,...) (ambiguous) and Modelica (continuous time, constraint-based, Linkoping) some rigorous. Some OPNET (discrete events, Opnet Technologies) are strongly actororiented, while some SDL (process networks) Occam (rendezvous) retain much of the flavor (and flaws) of SPW (synchronous dataflow, Cadence, CoWare) threads. 30

Ptolemy II: Our Laboratory for Experiments with Actor- Oriented Design Concurrency management supporting dynamic model structure. Director from a library defines component interaction semantics Large, behaviorallypolymorphic component library. Type system for transported data Visual editor supporting an abstract syntax 31

Conclusion The core intellectual challenge in CPS is in developing abstractions that embrace computation, networking, and physical dynamics in a coherent way. 32