Imperative model of computation

Similar documents
Imperative model of computation

Imperative model of computation

Comparison of models. Peter Marwedel Informatik 12, TU Dortmund, Germany 2010/11/07. technische universität dortmund

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

fakultät für informatik informatik 12 technische universität dortmund Modeling levels Peter Marwedel TU Dortmund, Informatik /11/07

Specifications and Modeling

Specifications and Modeling

FSMs & message passing: SDL

Discrete Event Models

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

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

Discrete Event Models

Models of computation

Embedded Systems CS - ES

Embedded & Real-time Operating Systems Communication Libraries

Specifications Part 1

EC-821 Advanced Embedded Systems (3+0)

Specifications Part 3

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

Specifications Part 2

Early design phases. Peter Marwedel TU Dortmund, Informatik /10/11. technische universität dortmund. fakultät für informatik informatik 12

Embedded Systems 7. Models of computation for embedded systems

Model-based Embedded Systems Design - Introduction, Motivation

Hardware Description Languages & System Description Languages Properties

Hardware Software Codesign

EE382N.23: Embedded System Design and Modeling

The Future of the Ptolemy Project

Discrete Event Models

Modeling Embedded Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

Concurrent Models of Computation

Standard Optimization Techniques

Lecture 2: Models of Computation

EE382V: Embedded System Design and Modeling

Hardware Description Languages & System Description Languages Properties

Modeling Embedded Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

Concurrent Semantics without the Notions of State or State Transitions

Concurrent Models of Computation

Multi-valued logic and standard IEEE 1164

Disciplined Concurrent Models of Computation for Parallel Software

Understandable Concurrency

Concurrency Demands New Foundations for Computing

Hardware/Software Co-design

Introduction to Embedded Systems

Component-Based Design of Embedded Control Systems

EE382V: System-on-a-Chip (SoC) Design

Modeling Embedded Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

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.

Modal Models in Ptolemy

The Problem with Treads

Optimizations - Compilation for Embedded Processors -

SysteMoC. Verification and Refinement of Actor-Based Models of Computation

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

Hardware-Software Codesign. 6. System Simulation

Making Concurrency Mainstream

Fundamental Algorithms for System Modeling, Analysis, and Optimization

Building Synchronous DataFlow graphs with UML & MARTE/CCSL

Middleware. Peter Marwedel TU Dortmund, Informatik 12 Germany. Graphics: Alexandra Nolte, Gesine

By: Chaitanya Settaluri Devendra Kalia

CSE 237A Modeling Embedded Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

The Problem with Threads

Concurrent Component Patterns, Models of Computation, and Types

VHDL Basics. Mehdi Modarressi. Department of Electrical and Computer Engineering, University of Tehran. ECE381(CAD), Lecture 4:

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

Evaluation and Validation

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

Embedded Tutorial CPS Foundations

The Problem With Threads

Functional Programming in Embedded System Design

Petri Nets ee249 Fall 2000

Dataflow Languages. Languages for Embedded Systems. Prof. Stephen A. Edwards. March Columbia University

CS 310 Embedded Computer Systems DESIGN

Hierarchical FSMs with Multiple CMs

The Ptolemy II Framework for Visual Languages

Concurrent Models of Computation

A Survey of Co-Design Ideas and Methodologies

Overview of Dataflow Languages. Waheed Ahmad

Introduction to Embedded Systems

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

Hybrid System Modeling: Operational Semantics Issues

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

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

Actor-Oriented Design: Concurrent Models as Programs

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

Concurrent Models of Computation for Embedded Software

Embedded Real-Time Systems

Embedded Systems 7 BF - ES - 1 -

Implementation of Process Networks in Java

UC Berkeley Mobies Technology Project

CSE 153 Design of Operating Systems

Embedded Software from Concurrent Component Models

Ptolemy Seamlessly Supports Heterogeneous Design 5 of 5

General Overview of Mozart/Oz

Last Time. Introduction to Design Languages. Syntax, Semantics, and Model. This Time. Syntax. Computational Model. Introduction to the class

Hardware/ Software Partitioning

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Mapping of Applications to Multi-Processor Systems

TKT-1527 Digital System Design Issues Tero Arpinen. Introduction to SoC modeling and Models of Computation

Design of Embedded Systems: Formal Models, Validation, and Synthesis

Performance Throughput Utilization of system resources

CSE Traditional Operating Systems deal with typical system software designed to be:

Transcription:

12 Imperative model of computation Jian-Jia Chen (Slides are based on Peter Marwedel) Informatik 12 TU Dortmund Germany Springer, 2010 2016 年 11 月 09 日 These slides use Microsoft clip arts. Microsoft copyright restrictions apply.

Models of computation considered in this course Communication/ local computations Undefined components Communicating finite state machines Data flow Petri nets Discrete event (DE) model Imperative (Von Neumann) model Shared memory StateCharts VHDL*, Verilog*, SystemC*, Message passing Synchronous Asynchronous Plain text, use cases (Message) sequence charts SDL Kahn networks, SDF C/E nets, P/T nets, Only experimental systems, e.g. distributed DE in Ptolemy C, C++, Java C, C++, Java with libraries CSP, ADA * Classification based on semantic model - 2 -

Imperative (von-neumann) model The von-neumann model reflects the principles of operation of standard computers: Sequential execution of instructions (total order of instructions) Possible branches Visibility of memory locations and addresses Example languages Machine languages (binary) Assembly languages (mnemonics) Imperative languages providing limited abstraction of machine languages (C, C++, Java,.) - 3 -

Threads/processes Threads/processes Initially available only as entities managed by OS In most cases: Context switching between threads/processes, frequently based on pre-emption Made available to programmer as well F Partitioning of applications into threads (same address space) Languages initially not designed for communication, but synchronization and communication is needed! - 4 -

Problems with imperative languages and shared memory Access to shared memory leads to anomalies, that have to be pruned away by mutexes, semaphores, monitors Potential deadlocks Access to shared, protected resources leads to priority inversion (F chapter 4) Termination in general undecidable Timing cannot be specified and not guaranteed - 5 -

Synchronous message passing: CSP CSP (communicating sequential processes) [Hoare, 1985], Rendez-vous-based communication: Example: process A.. var a... a:=3; c!a; -- output end process B.. var b...... c?b; -- input end Determinate! - 6 -

Synchronous message passing: Ada After Ada Lovelace (said to be the 1st female programmer). US Department of Defense (DoD) wanted to avoid multitude of programming languages F Definition of requirements F Selection of a language from a set of competing designs (selected design based on PASCAL) Ada 95 is object-oriented extension of original Ada. - 7 -

Synchronous message passing: Ada-rendez-vous task screen_out is entry call_ch(val:character; x, y: integer); entry call_int(z, x, y: integer); end screen_out; task body screen_out is... select accept call_ch... do.. end call_ch; or accept call_int... do.. end call_int; end select; Sending a message: begin screen_out.call_ch('z',10,20); exception when tasking_error => (exception handling) end; - 8 -

Java Potential benefits: Clean and safe language Supports multi-threading (no OS required?) Platform independence (relevant for telecommunications) Problems: Size of Java run-time libraries? Memory requirements. Access to special hardware features Garbage collection time Non-deterministic dispatcher Performance problems Checking of real-time constraints - 9 -

Overview over Java 2 Editions J2ME addresses the large, rapidly growing consumer space, which covers a range of devices from tiny commodities, such as pagers, all the way up to the TV set-top box.. Based on http:// java.sun.com/ products/cldc/wp/ KVMwp.pdf - 10 -

Lee s conclusion Nontrivial software written with threads, semaphores, and mutexes is incomprehensible to humans.. Succinct Problem Statement Threads are wildly nondeterministic. The programmer s job is to prune away the nondeterminism by imposing constraints on execution order (e.g., mutexes). Improve threads? Or replace them? [Edward Lee (UC Berkeley), Artemis Conference, Graz, 2007] - 11 -

Lifting Level of Abstraction - 12 -

12 Comparison of models Jian-Jia Chen (slides are based on Peter Marwedel) Informatik 12, TU Dortmund, Germany 2016 年 11 月 09 日 These slides use Microsoft clip arts. Microsoft copyright restrictions apply. Springer, 2010

Models of computation considered in this course Communication/ local computations Undefined components Communicating finite state machines Data flow Petri nets Discrete event (DE) model Imperative (Von Neumann) model Shared memory StateCharts VHDL*, Verilog*, SystemC*, Message passing Synchronous Asynchronous Plain text, use cases (Message) sequence charts SDL Kahn networks, SDF C/E nets, P/T nets, Only experimental systems, e.g. distributed DE in Ptolemy C, C++, Java C, C++, Java with libraries CSP, ADA * Classification based on semantic model - 14 -

Classification by Stuijk Expressiveness and succinctness indicate, which systems can be modeled and how compact the are. Analyzability relates to the availability of scheduling algorithms and the need for run-time support. Implementation efficiency is influenced by the required scheduling policy and the code size. - 15 -

The expressiveness/analyzability conflict [S. Stuijk, 2007] - 16 -

Properties of processes/threads (1) Number of processes/threads static; dynamic (dynamically changed hardware architecture?) Nesting: Nested declaration of processes process { process { process { }}} or all declared at the same level process { } process { } process { } - 17 -

Properties of processes/threads (2) Different techniques for process creation Elaboration in the source (c.f. ADA) declare process P1 explicit fork and join (c.f. Unix) id = fork(); process creation calls id = create_process(p1); E.g.: StateCharts comprises a static number of processes, nested declaration of processes, and process creation through elaboration in the source. - 18 -

How to cope with MoC and language problems in practice? Mixed approaches: - 19 -

Transformations between models Transformations between models are possible, e.g. Frequent transformation into sequential code Transformations between restricted Petri nets and SDF Transformations between VHDL and C Transformations should be based on the precise description of the semantics (e.g. Chen, Sztipanovits et al., DATE, 2007) - 20 -

Mixing models of computation: Ptolemy Ptolemy (UC Berkeley) is an environment for simulating multiple models of computation. http://ptolemy.berkeley.edu/ (http://ptolemy.berkeley.edu/ptolemyii/ptii8.0/ptii8.0.1/doc/index.htm) Available examples are restricted to a subset of the supported models of computation. - 21 -

Mixing MoCs: Ptolemy (Focus on executable models; mature models only) Communication/ local computations Undefined components Shared memory Message passing Synchronous Asynchronous Communicating finite state machines Data flow Petri nets Discrete event (DE) model DE FSM, synchronous/reactive MoC Kahn networks, SDF, dynamic dataflow, discrete time Experimental distributed DE Von Neumann model CSP Wireless Continuous time Special model for wireless communication Partial differential equations - 22 -

Mixing models of computation: UML (Focus on support of early design phases) Communication/ local computations Undefined components Communicating finite state machines Data flow Petri nets Discrete event (DE) model Shared memory State diagrams Message passing Synchronous Asynchronous use cases sequence charts, timing diagrams Data flow activity charts - - Von Neumann model - - - 23 -

UML for embedded systems? Initially not designed for real-time. Initially lacking features: Partitioning of software into tasks and processes specifying timing specification of hardware components Projects on defining profiles for embedded/real-time systems Schedulability, Performance and Timing Analysis SysML (System Modeling Language) UML Profile for SoC Modeling and Analysis of Real-Time Embedded Systems UML/SystemC, Profiles may be incompatible - 24 -

Modeling levels Levels, at which modeling can be done: System level Algorithmic level: just the algorithm Processor/memory/switch (PMS) level Instruction set architecture (ISA) level: function only Transaction level modeling (TML): memory reads & writes are just transactions (not cycle accurate) Register-transfer level: registers, muxes, adders, (cycle accurate, bit accurate) Gate-level: gates Layout level Tradeoff between accuracy and simulation speed - 25 -

What s the bottom line? The prevailing technique for writing embedded SW has inherent problems; some of the difficulties of writing embedded SW are not resulting from design constraints, but from the modeling. However, there is no ideal modeling technique. The choice of the technique depends on the application. Check code generation from non-imperative models There is a tradeoff between the power of a modeling technique and its analyzability. It may be necessary to combine modeling techniques. In any case, open your eyes & think about the model before you write down your spec! Be aware of pitfalls. You may be forced, to use imperative models, but you can still implement, for example, finite state machines or KPNs in Java. - 26 -