RT Language Classes. Real-Time Programming Languages (ADA and Esterel as Examples) Implementation. Synchroneous Systems Synchronous Languages



Similar documents
Real Time Programming: Concepts

Dispatching Domains for Multiprocessor Platforms and their Representation in Ada

Monitors and Semaphores

Outline of this lecture G52CON: Concepts of Concurrency

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I)

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

Kepware Technologies Optimizing KEPServerEX V5 Projects

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

(Refer Slide Time: 01:52)

Sources: On the Web: Slides will be available on:

point to point and point to multi point calls over IP

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

Chapter 6 Concurrent Programming

Lecture 6: Semaphores and Monitors

4. Fixed-Priority Scheduling

Mutual Exclusion using Monitors

STORM. Simulation TOol for Real-time Multiprocessor scheduling. Designer Guide V3.3.1 September 2009

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

VHDL GUIDELINES FOR SYNTHESIS

Specification and Analysis of Contracts Lecture 1 Introduction

Predictable response times in event-driven real-time systems

ARINC-653 Inter-partition Communications and the Ravenscar Profile

Linux Block I/O Scheduling. Aaron Carroll December 22, 2007

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Section 29. Real-Time Clock and Calendar (RTCC)

Attaining EDF Task Scheduling with O(1) Time Complexity

Arena Tutorial 1. Installation STUDENT 2. Overall Features of Arena

LADDER LOGIC/ FLOWCHART PROGRAMMING DIFFERENCES AND EXAMPLES

Memory Database Application in the Processing of Huge Amounts of Data Daqiang Xiao 1, Qi Qian 2, Jianhua Yang 3, Guang Chen 4

IP Office - Job Aid Voic Pro Example Exercises

Design Patterns in C++

GETTING STARTED WITH LABVIEW POINT-BY-POINT VIS

Tasks Schedule Analysis in RTAI/Linux-GPL

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

Introduction to LabVIEW Design Patterns

Operating System Tutorial

National CR16C Family On-Chip Emulation. Contents. Technical Notes V

The Designer's Guide to VHDL

Chapter 8 Detailed Modeling

mguard Device Manager Release Notes Version 1.6.1

Operating Systems 4 th Class

Monitors, Java, Threads and Processes

Operating Systems Concepts: Chapter 7: Scheduling Strategies

PostgreSQL Concurrency Issues

Chapter 3 General Principles in Simulation

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Linux Process Scheduling Policy

Implementing and Using Execution Time Clocks in Ada Hard Real-Time Applications

AN601 I2C 2.8 Communication Protocol. SM130 SM130 - Mini APPLICATION NOTE

Embedded Systems. 6. Real-Time Operating Systems

Synchronization. Todd C. Mowry CS 740 November 24, Topics. Locks Barriers

Configuration Notes 0217

Software Engineering Reference Framework

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Time Management in the High Level Architecture"

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

Simple Cooperative Scheduler for Arduino ARM & AVR. Aka «SCoop»

High-Stability Time Adjustment with Real-Time Clock Module

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

SEER PROBABILISTIC SCHEDULING FOR COMMODITY HARDWARE TRANSACTIONAL MEMORY. 27 th Symposium on Parallel Architectures and Algorithms

FIRST ALERT INSTRUCTION MANUAL FOR FA 270 KEYPADS SECURITY SYSTEM

Concurrent programming in Java

Monitoring DoubleTake Availability

Glossary of Object Oriented Terms

Programma della seconda parte del corso

Programming real-time systems with C/C++ and POSIX

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

How To Understand And Understand An Operating System In C Programming

Open Source Implementation of Hierarchical Scheduling for Integrated Modular Avionics

How to build agent based models. Field service example

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Quality of Service versus Fairness. Inelastic Applications. QoS Analogy: Surface Mail. How to Provide QoS?

Handling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total

APR-PRT3 Printer Module: C-Bus Programming Instructions

Oracle 11g PL/SQL training

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

How to Obtain an OPC License--5. Creating a System Code 5 Entering an Authorization Code 6. Getting Started with SNMP Editor--7

CS11 Java. Fall Lecture 7

SNMP Web card. User s Manual. Management Software for Uninterruptible Power Supply Systems

Last Class: Semaphores

Bigdata High Availability (HA) Architecture

User s Manual. Version January EVS SNMP Monitoring

INF5140: Specification and Verification of Parallel Systems

Middleware. Peter Marwedel TU Dortmund, Informatik 12 Germany. technische universität dortmund. fakultät für informatik informatik 12

CPU Scheduling. CPU Scheduling

Automatic Telephone Dialer TD-101(W)

Have both hardware and software. Want to hide the details from the programmer (user).

Module 6. Embedded System Software. Version 2 EE IIT, Kharagpur 1

Contact Center Administrator Guide

Rigorous Software Development CSCI-GA

Overview of Luna High Availability and Load Balancing

Transcription:

RT Language Classes Real-Time Programming Languages (ADA and Esterel as Examples) HLL suitable for RT-Analysis (e.g., rms or time-driven) Synchronous HLL (clock driven) Esterel Lustre (State Charts) RT-Euclid Normal HLL with some rt-extensions ADA RT-Java PEARL CHILL Real-Time Systems, WS 2006 RT Languages, 1 Real-Time Systems, WS 2006 RT Languages, 2 Synchroneous Systems Synchronous Languages Gerard Berry: Our approach is based on the standard principle of separation of concerns. First, write the program at the logical level and make use of all the mathematics available there. Then, implement the program using the best available automatic synthesis tools, and check that the result is practically OK. Ideal Systems produce their outputs synchronously with their inputs. Implementation Gerard Berry: For example, assume we want to trigger a reaction with two inputs A and B present. We execute the following [compiler generated] C code: M_I_A(); M_I_B(); M(); If X is emitted by the reaction, the function M() will call an output function M O X() we have to supply. The reaction is subject to an essential atomicity condition: during the execution of the main reaction function M(), it is forbidden to call any input function. This is the software counterpart to the hardware requirement that input voltages must be kept stable during a clock cycle. Real-Time Systems, WS 2006 RT Languages, 3 Real-Time Systems, WS 2006 RT Languages, 4 Esterel Most statements are instantaneous (starts and terminates at the same instant of time) Stepwise execution, everything completes in each step/cycle Time consumption explicit (e.g., Pause ) Variable: Value Esterel Data : Variables and Signals Signal: Value vs Status Value of any type Status: Present/non present Newly evaluated at every step present when emitted Real-Time Systems, WS 2006 RT Languages, 5 Real-Time Systems, WS 2006 RT Languages, 6

Signals vs Variables Emit Count(pre(?Count) + 1) vs V:= V+1; Beware: writing emit COUNT(?COUNT+1) is tempting but incorrect. Since?COUNT is the current value of COUNT, it cannot be incremented and reemitted right away as itself. It is necessary to use the previous value pre(?count). Esterel: Statements Consume no time (unless explicitly said otherwise) Await A: consumes one A Pause: consumes one time step (tick) X:= Y: assigns values to variables S1;S2 S1 S2 Loop S end starts S, repeats if not terminated (S must consume time) Loop S each R restarts S at each occurance of R Real-Time Systems, WS 2006 RT Languages, 7 Real-Time Systems, WS 2006 RT Languages, 8 Signals More Statements Emit x(y): sets signal x present, assigns value y?s current value: value just emitted (if so) or value of previous instant (otherwise) pre(?s): previous value Present then s1 else s2 end (conditional) Abort S when do R end abort; starts S, terminates when becomes active, does R Suspend S when suspends S when active no emission when suspended Trap in S end trap starts S, aborts when present halt: loop pause end await : abort halt when end abort sustain x(t): loop emit x(t); pause end every do S end every: await ; loop S each Real-Time Systems, WS 2006 RT Languages, 9 Real-Time Systems, WS 2006 RT Languages, 10 Examples (all by Berry): ABRO Specification ABRO: Emit an output O as soon as two inputs A and B have occurred. Reset this behavior each time the input R occurs. module ABRO: input A, B, R; output O; loop [ await A await B ]; emit O each R end module Counting Specification COUNT: Count the number of occurrences of the input I seen so far, and broadcast it as the value of a COUNT signal at each new I. module COUNT: input I; output COUNT := 0 : integer; every I do emit COUNT(pre(?COUNT) + 1) end every end module Beware: emit COUNT(?COUNT+1) is tempting but incorrect. Real-Time Systems, WS 2006 RT Languages, 11 Real-Time Systems, WS 2006 RT Languages, 12

Speed Specification SPEED: Count the number of centimeters run per second, and broadcast that number as the value of a Speed signal every second. module SPEED: input Centimeter, Second; relation Centimeter # Second; output Speed : integer; loop var Distance := 0 : integer in abort every Centimeter do Distance := Distance+1 end every when Second do emit Speed(Distance) end abort end var end loop end module Real-Time Systems, WS 2006 RT Languages, 13 Real-Time Systems, WS 2006 RT Languages, 14 RT-Extensions for Standard HLL: Requirements ADA as an Example standard goodies + exception handling tasks + communication priorities a notion of time access to low level hardware portability efficiency predictability Real-Time Systems, WS 2006 RT Languages, 15 Used intensively, e.g. Military, Aircraft (B777), Space most commonly used language in US weapons modernization Ada 83 - result of a competition... Ada 95 - major redesign (ISO/IEC 8652: 1995) Ravenscar: subset new standard expected in 2007 (called Ada 2006 ) Annex: Real-Time Systems (here: very limited excerpts... Especially, not covered at all: packages OO, Generics separate compilation ) Real-Time Systems, WS 2006 RT Languages, 16 Exception Handling Exceptions are declared and may be raised. Buffer_Full: exception;... if BufferSize > Limit then raise Buffer_Full end if;... exception when Buffer_Full => reset; when others => bla ; end; Tasks Tasks are entities whose execution may proceed in parallel. A task has a thread of control. Different tasks proceed independently, except at points where they synchronize.... declared by an object declaration or created dynamically.... Every task has a master : block, subprogram etc. containing the declaration of the task object (or access object). Before leaving the master, the parent task waits for all dependent tasks. Real-Time Systems, WS 2006 RT Languages, 17 Real-Time Systems, WS 2006 RT Languages, 18

Example task type Babbler is entry Start(Message : Unbounded_String; Count : Natural); end Babbler; task body Babbler is Babble : Unbounded_String; Maximum_Count : Natural; Communication Activation and termination (see previous slide) protected objects for synchronized access to shared data rendezvous for synchronous communication unprotected access to shared data (global variables) -- We're done, exit task. end Babbler; Real-Time Systems, WS 2006 RT Languages, 19 Real-Time Systems, WS 2006 RT Languages, 20 The Rendezvous Rendezvous, example One task calls an entry (Client) Other task accepts a call (Server) calling task placed on a queue task body Babbler is Babble : Unbounded_String; Maximum_Count : Natural; accept Start(Message : Unbounded_String; Count : Natural) do Babble := Message; -- Copy the rendezvous data to Maximum_Count := Count; -- local variables. end Start; -- babble... end Babbler; Real-Time Systems, WS 2006 RT Languages, 21 Real-Time Systems, WS 2006 RT Languages, 22 Entries and Exceptions procedure Noise is Babble_1 : Babbler; -- Create a task. Babble_2 : Babbler; -- Create another task. -- At this point we have two active tasks, but both of them -- are waiting for a "Start" message. So, send them a Start. Babble_1.Start(U("Hi, I'm Babble_1"), 10); Babble_2.Start(U("And I'm Babble_2"), 6); end Noise; What happens if an exception is raised within an accept statement? Exception is raised twice, at caller and callee tasks Real-Time Systems, WS 2006 RT Languages, 23 Real-Time Systems, WS 2006 RT Languages, 24

select when (expression) => accept E1 do bla end E1; or when (expression) => accept E2 do bla end E2; or... end select; Select Statement Arbitrary entry, whose expression is evaluated to true, is called. Exception if no expression evaluates to true. Access to time: Calendar object. delay duration point in time Time delay 5.0; -- delay for 5 seconds delay until A_Time; -- delay until it is... Real-Time Systems, WS 2006 RT Languages, 25 Real-Time Systems, WS 2006 RT Languages, 26 Delay and Select Protected Objects select accept An_Entry do bla end An_Entry; or delay 5.0; Put("An_Entry: timeout"); end select; export functions read-only access to shared data functions can be executed concurrently procedures read/write access to shared data Procedures: executed under mutual exclusion entries procedures with barriers (boolean expressions) synchronization operations automatic evaluate barriers at each call to and at each return from an entry Real-Time Systems, WS 2006 RT Languages, 27 Real-Time Systems, WS 2006 RT Languages, 28 protected type Resource is entry Seize; -- Acquire this resource exclusively. procedure Release; -- Release the resource. private Busy : Boolean := False; end Resource; protected body Resource is entry Seize when not Busy is Busy := True; end Seize; procedure Release is Busy := False end Release; end Resource; Reordering Requests: Requeue Flexible, explicit treatment of request orders example: An request enters entry or barrier Parameters inspected Decision: wait for another chance Action: Requeue a request of a caller to some entry or barrier Not easy to use!!! Real-Time Systems, WS 2006 RT Languages, 29 Real-Time Systems, WS 2006 RT Languages, 30

Example: Requeue Statement protected body AirportGate is entry EnterGateBusiness(Ticket) if Ticket.Economy then requeue EnterGateEconomy; end if; CountBusinessPassengers end EnterGate; entry EnterGateEconomy(Ticket) when AllBusinessPassengersHaveEntered... end end Event; Timeouts on Actions select delay 5.0; -- triggering alternative CalculationComplete:= false; then abort Invert_Giant_Matrix(M); -- abortable part CalculationComplete:= true; end select; also possible: an entry call instead of delay (intricate sematics) Real-Time Systems, WS 2006 RT Languages, 31 Real-Time Systems, WS 2006 RT Languages, 32 Real-Time Annex Time Priorities Priority Scheduling Ceiling Queuing Policies Dynamic priorities Access to Real-Time: Real_Time.Time finer grained monotonically non-decreasing (time zone, correction, summertime) loop delay until Poll_Time; --- poll Poll_Time:= Poll_Time + Period; end loop; Real-Time Systems, WS 2006 RT Languages, 33 Real-Time Systems, WS 2006 RT Languages, 34 Priorities Dynamic Priorities Task/protected type T is pragma Priority(P); pragma task_dispatching_policy( fifo within priorities ); evaluated at init time task gets priority of creator if no pragma is present procedure Set_Priority(Priority: Any_Priority; T: Task_ID := Current_Task); function Get_Priority(T: Task_ID := Current_Task) return Any_Priority; Real-Time Systems, WS 2006 RT Languages, 35 Real-Time Systems, WS 2006 RT Languages, 36

Priority Ceiling Pragma Locking_Policy(Ceiling_Locking); the task executing a protected operation inherits the priority of the protected object dynamic priorities higher than ceiling Entry Queuing Policies Standard: FIFO pragma Queuing_Policy(Priority_Queuing); the user can override the default FIFO policy with the pragma Queuing_Policy per partition (not per entries or tasks) passing of dynamic priorities as implicit parameters Real-Time Systems, WS 2006 RT Languages, 37 Real-Time Systems, WS 2006 RT Languages, 38 ADA Material No support for explicit specification of periodic processes!!! for static analysis for feasible schedules!!! Esterel: Gerard Berry, Esterel Language Primer http://www.esterel-technologies.com/files/primer.zip ADA: lots... Used for this lecture: Burns/Wellings: RT systems and Programming Languages http://www.adahome.com/ammo/cplpl2ada.html (Ada for C programmers) http://www.adahome.com/tutorials/lovelace http://atlas.otago.ac.nz:800/staff/paulg/ Ada-Information/Ada95/Rationale ADA 2005 and Ravenscar: http://www.adacore.com/home/ada_answers/ada_2005 Real-Time Systems, WS 2006 RT Languages, 39 Real-Time Systems, WS 2006 RT Languages, 40