Imperative model of computation

Similar documents
Imperative model of computation

Imperative model of computation

Specifications and Modeling

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

Embedded Systems CS - ES

Specifications and Modeling

Discrete Event Models

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

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

Discrete Event Models

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

Models of computation

Specifications Part 1

FSMs & message passing: SDL

Overview of Java 2 Platform, Micro Edition (J2ME )

Specifications Part 3

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

EC-821 Advanced Embedded Systems (3+0)

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

Embedded & Real-time Operating Systems Communication Libraries

CM0256 Pervasive Computing

Requirements and Issues of V**s for Mobile Terminals

Discrete Event Models

Who am I? Wireless Online Game Development for Mobile Device. What games can you make after this course? Are you take the right course?

Java 2 Platform, Micro Edition

Specifications Part 2

Embedded Systems 7. Models of computation for embedded systems

Model-based Embedded Systems Design - Introduction, Motivation

Concept of a process

PennBench: A Benchmark Suite for Embedded Java

POSIX Threads: a first step toward parallel programming. George Bosilca

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

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

DAY 3 J2ME Aalborg University, Mobile Device Group. Mobile. Mobile Phone Programming

DAY 3 J2ME March 2007 Aalborg University, Mobile Device Group Mobile Phone Programming

J2ME ARCHITECTURE AND RELATED EMBEDDED TECHNOLOGIES

ProvideX On Handhelds

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio

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

Mobile Application Design and Development With the use of J2ME Technology & UML m.khlaif Computer Science Dept Garyounis University

Parallel Computing Introduction

1/16/17. Computer Programs and Processes. PHYSICAL: damage from either tampering, misuse, theft of equipment, or any combination of these

Mobile Application Development. Introduction. Dr. Christelle Scharff Pace University, USA

Parallelism Marco Serafini

Hardware/ Software Partitioning

Mobile Station Execution Environment (MExE( MExE) Developing web applications for PDAs and Cellphones. WAP (Wireless Application Protocol)

Hardware Description Languages & System Description Languages Properties

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

Hardware Description Languages & System Description Languages Properties

Hardware/Software Co-design

Device Technologies I J2ME & WinCE

Hardware Software Codesign

Virtual Machine Design

Review: Easy Piece 1

Dealing with Issues for Interprocess Communication

Chapter 5 Concurrency: Mutual Exclusion. and. Synchronization. Operating Systems: Internals. and. Design Principles

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

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction

Parallel and High Performance Computing CSE 745

Exam TI2720-C/TI2725-C Embedded Software

Improved Mechanism for Efficient object Pooling in J2ME Based Mobile Phone

CSC 4320 Test 1 Spring 2017

Concurrency: a crash course

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

CMSC 714 Lecture 14 Lamport Clocks and Eraser

Recommendations for a CORBA Language Mapping for RTSJ

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation

StackVsHeap SPL/2010 SPL/20

Synchronization Principles I

ZiLOG Real-Time Kernel Version 1.2.0

Last Class: Monitors. Real-world Examples

Applying Componentbased. Engineering in On-board Software

Programming Languages

Introduction to Multicore Programming

A High Integrity Distributed Deterministic Java Environment. WORDS 2002 January 7, San Diego CA

Fiji VM Safety Critical Java

Real-Time Java. Martin Schöberl

Multithreading and Interactive Programs

Building Robust Embedded Software

Compiler Construction

INSTITUTE OF AERONAUTICAL ENGINEERING

Midterm Exam. October 20th, Thursday NSC

Java ME Directions. JCP F2F - Austin. Florian Tournier - Oracle May 9, Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Bluetooth Scatternet Application. Sun Code for Freedom

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control

A Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria

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

IT 540 Operating Systems ECE519 Advanced Operating Systems

CSC 533: Organization of Programming Languages. Spring 2005

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

Deadlock and Monitors. CS439: Principles of Computer Systems September 24, 2018

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies

Deduplication File System & Course Review

main read Identical static threads Dynamic threads with Concurrent and

Threads. Threads The Thread Model (1) CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5

Resource management. Real-Time Systems. Resource management. Resource management

Curriculum 2013 Knowledge Units Pertaining to PDC

Transcription:

12 Imperative model of computation Peter Marwedel TU Dortmund, Informatik 12 Graphics: Alexandra Nolte, Gesine Marwedel, 2003 2010/10/28 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 Shared memory StateCharts (Not useful) Message passing Synchronous Asynchronous Plain text, use cases (Message) sequence charts SDL Kahn networks, SDF C/E nets, P/T nets, Discrete event (DE) model Imperative (Von Neumann) model VHDL*, Verilog*, SystemC*, C, C++, Java * Classification based on the implementation of HDLs Only experimental systems, e.g. distributed DE in Ptolemy C, C++, Java with libraries CSP, ADA - 2 -

Imperative (von-neumann) model The von-neumann model reflects the principles of operation of standard computers: Sequential execution of instructions (sequential control flow, fixed sequence of operations) Possible branches Partitioning of applications into threads In most cases: Context switching between threads, frequently based on pre-emption (cooperative multi-tasking or time-triggered context switch less common) Access to shared memory - 3 -

From implementation concepts to programming models Example languages Machine languages (binary) Assembly languages (mnemonics) Imperative languages providing a limited abstraction of machine languages (C, C++, Java,.) Threads/processes Initially available only as entities managed by the operating system Made available to the programmer as well Languages initially not designed for communication, availability of threads made synchronization and communication a must. Bottom up process - 4 -

Communication via shared memory Several threads access the same memory Very fast communication technique (no extra copying) Potential race conditions: thread a { u = 1; if u<5 {u = u + 1;..} } thread b {.. u = 5 } Context switch after the test could result in u == 6. inconsistent results possible Critical sections = sections at which exclusive access to resource r (e.g. shared memory) must be guaranteed - 5 -

Shared memory thread a { u = 1;.. P(S) //obtain mutex if u<5 {u = u + 1;..} // critical section V(S) //release mutex } thread b {.. P(S) //obtain mutex u = 5 // critical section V(S) //release mutex } S: semaphore P(S) grants up to n concurrent accesses to resource n=1 in this case (mutex/lock) V(S) increases number of allowed accesses to resource Imperative model should be supported by: mutual exclusion for critical sections cache coherency protocols - 6 -

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

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 Definition of requirements Selection of a language from a set of competing designs (selected design based on PASCAL) ADA 95 is object-oriented extension of original ADA. Salient: task concept - 8 -

Synchronous message passing: Using of tasks in ADA - 9 -

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 Sending a message: accept call_ch... do.. begin end call_ch; screen_out.call_ch('z',10,20); or exception accept call_int... do.. when tasking_error => => end call_int; (exception handling) end select; end; - 10 -

Java (1) 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 - 11 -

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 - 12 -

Software stack for J2ME Java Virtual Machine: implementation of a Java VM, customized for a particular device s host OS and supports a particular J2ME configuration. Configuration: defines the minimum set of Java VM features and Java class libraries available on a particular category of devices representing a particular horizontal market segment. In a way, a configuration defines the lowest common denominator of the Java platform features and libraries that the developers can assume to be available on all devices. Profile: defines the minimum set of Application Programming Interfaces (APIs) available on a particular family of devices representing a particular vertical market segment. Profiles are implemented upon a particular configuration. Applications are written for a particular profile and are thus portable to any device that supports that profile. A device can support multiple profiles. Based upon http://java.sun.com/products/cldc/wp/kvmwp.pdf - 13 -

KVM and CLDC The K Virtual Machine: Highly portable Java VM designed for small memory, limited-resource, network-connected devices, e.g.: cell phones, pagers, & personal organizers. Devices typically contain 16- or 32-bit processors and a minimum total memory footprint of ~128 kilobytes. Connected, Limited Device Configuration (CLDC) Designed for devices with intermittent network connections, slow processors and limited memory devices such as mobile phones, two way pagers and PDAs. These devices typically have either 16- or 32-bit CPUs, and a minimum of 128 KB to 512 KB of memory. - 14 -

CDC Configuration and MIDP 1.0 + 2.0 Profiles CDC: Designed for devices that have more memory, faster processors, and greater network bandwidth, such as TV settop boxes, residential gateways, in-vehicle telematics systems, and high-end PDAs. Includes a full-featured Java VM, & a larger subset of the J2SE platform. Most CDCtargeted devices have 32- bit CPUs & 2MB of memory. Mobile Information Device Profile (MIDP): Designed for mobile phones & entry-level PDAs. Offers core application functionality for mobile applications, including UI, network connectivity, local data storage, & application management. With CLDC, MIDP provides Java runtime environment leveraging capabilities of handheld devices & minimizing memory and power consumption. - 15 -

Real-time features of Java J2ME, KVM, CLDC & MIDP not sufficient for real-time behavior. Real-time specification for Java (JSR-1) addresses 7 areas: 1. Thread Scheduling and Dispatching 2. Memory Management: 3. Synchronization and Resource Sharing 4. Asynchronous Event Handling 5. Asynchronous Transfer of Control 6. Asynchronous Thread Termination 7. Physical Memory Access Designed to be used with any edition of Java. [//www.rtj.org] [https://rtsj.dev.java.net/rtsj-v1.0.pdf] - 16 -

Example: different types of memory areas Area of memory may be used for the allocation of objects. There are four basic types of memory areas (partially excluded from garbage collection): 1. Scoped memory provides a mechanism for dealing with a class of objects that have a lifetime defined by syntactic scope. 2. Physical memory allows objects to be created within specific physical memory regions that have particular important characteristics, such as memory that has substantially faster access. 3. Immortal memory represents an area of memory containing objects that, once allocated, exist until the end of the application, i.e., the objects are immortal. 4. Heap memory represents an area of memory that is the heap. The RTSJ does not change the determinant of lifetime of objects on the heap. The lifetime is still determined by visibility. [https://rtsj.dev.java.net/rtsj-v1.0.pdf] - 17 -

Other imperative languages Pearl: Designed in Germany for process control applications. Dating back to the 70s. Used to be popular in Europe. Pearl News still exists (in German, see http://www.real-time.de/) Chill: Designed for telephone exchange stations. Based on PASCAL. - 18 -

Communication/synchronization Communication libraries can add blocking or non-blocking communication to von-neumann languages like C, C++, Java, Examples will be presented in chapter 4-19 -

Summary Imperative languages CSP ADA Java Other languages - 20 -