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

Similar documents
The Temporal Firewall--A Standardized Interface in the Time-Triggered Architecture

Aperiodic Task Scheduling

Embedded Systems. 6. Real-Time Operating Systems

Embedded & Real-time Operating Systems

Real Time Scheduling Basic Concepts. Radek Pelánek

System Software and TinyAUTOSAR

Real- Time Scheduling

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

Real Time Programming: Concepts

Predictable response times in event-driven real-time systems

From Control Loops to Software

Resource Reservation & Resource Servers. Problems to solve

Mixed-Criticality Systems Based on Time- Triggered Ethernet with Multiple Ring Topologies. University of Siegen Mohammed Abuteir, Roman Obermaisser

Operating Systems 4 th Class

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

Real-Time Software. Basic Scheduling and Response-Time Analysis. René Rydhof Hansen. 21. september 2010

Chapter 6, The Operating System Machine Level

Distributed Systems Theory 6. Clock synchronization - logical vs. physical clocks. November 9, 2009

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Real-time Operating Systems. VO Embedded Systems Engineering Armin Wasicek

Tasks Schedule Analysis in RTAI/Linux-GPL

Domains. Seminar on High Availability and Timeliness in Linux. Zhao, Xiaodong March 2003 Department of Computer Science University of Helsinki

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

Resource Utilization of Middleware Components in Embedded Systems

Real-Time Scheduling (Part 1) (Working Draft) Real-Time System Example

A Survey of Fitting Device-Driver Implementations into Real-Time Theoretical Schedulability Analysis

Lecture 3 Theoretical Foundations of RTOS

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

Why Threads Are A Bad Idea (for most purposes)

Tools Page 1 of 13 ON PROGRAM TRANSLATION. A priori, we have two translation mechanisms available:

How to design and implement firmware for embedded systems

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

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005

Replication on Virtual Machines

Mutual Exclusion using Monitors

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Multi-core Programming System Overview

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings

Chapter 11 I/O Management and Disk Scheduling

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

Principles and characteristics of distributed systems and environments

Overview and History of Operating Systems

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

Comparing RTOS to Infinite Loop Designs

Introduction. What is an Operating System?

Multi-core real-time scheduling

COS 318: Operating Systems. Virtual Machine Monitors

Methods and Tools For Embedded Distributed System Scheduling and Schedulability Analysis

BASIC CONCEPTS AND RELATED WORK

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

High Availability Design Patterns

Objectives. Distributed Databases and Client/Server Architecture. Distributed Database. Data Fragmentation

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Operating System Tutorial

Comparison of FlexRay and CAN-bus for Real-Time Communication

GETTING STARTED WITH LABVIEW POINT-BY-POINT VIS

Real-Time Operating Systems for MPSoCs

SYSTEM ecos Embedded Configurable Operating System

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

So#ware Tools and Techniques for HPC, Clouds, and Server- Class SoCs Ron Brightwell

Distributed Systems. Security concepts; Cryptographic algorithms; Digital signatures; Authentication; Secure Sockets

ZooKeeper. Table of contents

SECTION CONTROL SOFTWARE

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

Chapter 13 Embedded Operating Systems

Database Replication with Oracle 11g and MS SQL Server 2008

Hard Real-Time Linux

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

Introduction to Embedded Systems. Software Update Problem

Hadoop Fair Scheduler Design Document

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

WinCC Options. Redundancy. Manual C79000-G8263-C142-01

WA Manager Alarming System Management Software Windows 98, NT, XP, 2000 User Guide

Five Essential Components for Highly Reliable Data Centers

Contents. Chapter 1. Introduction

Load balancing Static Load Balancing

DigiPoints Volume 1. Student Workbook. Module 4 Bandwidth Management

Do AUTOSAR and functional safety rule each other out?

Performance Comparison of RTOS

How To Write A Profibus Dpl (Profibus) Program

Storage. The text highlighted in green in these slides contain external hyperlinks. 1 / 14

IMPORTANT PRODUCT INFORMATION

Linux Process Scheduling Policy

Achieving Nanosecond Latency Between Applications with IPC Shared Memory Messaging

Operating Systems. III. Scheduling.

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

4. Fixed-Priority Scheduling

Priority-Driven Scheduling

System Software Integration: An Expansive View. Overview

W4118 Operating Systems. Instructor: Junfeng Yang

Chapter 18: Database System Architectures. Centralized Systems

Agenda. Context. System Power Management Issues. Power Capping Overview. Power capping participants. Recommendations

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

Trends in Embedded Software Engineering

Clock Synchronization

Transcription:

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

Overview OS services Task Structure Task Interaction Input/Output Error Detection 2

Operating System and Middleware Applica3on So5ware Component API OS and Middleware In Hardware Interface Out 3

OS Services Secure boot of component software Reset, start, exec. control of component SW Task management Task interaction Message communication interface Linking Interface (RTS) Config., control (TII), debug (TDI) I/O Handling Discretization Agreement Time predictability, determinism 4

Assumptions about Software HRT Software Closed world assumption Tasks and task timing parameters known at design time Task communication, precedence known at design time I/O requirements known (values, timing) Pre-runtime preparation/analysis to provide runtime guarantees SRT Software Open world assumption Tasks, task timing and QoS parameters, I/O requirements QoS assessment before runtime; at runtime: best effort Non real-time Software 5

Task Management The software of a component is structured into a set of tasks (execution of a sequential program) that run in parallel. The OS provides the execution environment for each task. Temporal and spatial isolation: HRT Software versus other SW HRT Tasks are cooperative, not competitive. Component = unit of failure No resource-intensive protection between tasks Light-weight OS Stateless versus stateful tasks 6

S-Tasks and C-Tasks Simple task (S-Task) executes from the beginning to the end without any delay, given the CPU has been allocated. Complex task (C-Task) may contain one or more WAIT statements in the task body. 7

Simple Task (S-Task) Can execute from beginning to end without delay, given the CPU has been allocated to it No blocking inside (no synchronization, communication) Independent progress Inputs available in input data structure at the task start Outputs ready in the output data structure at the task end API: input DS, output DS, g-state Input DS g-state S-Task g-state Output DS 8

Complex Task (C-Task) May contain one or more WAIT operations Possible dependencies due to synchronization, communication Progress dependent on other tasks in node or environment C-task timing is a global issue API: input DS, output DS, g-state, shared DS, dependencies Input DS g-state C-Task WAIT g-state Output DS Shared DS 9

ARINC Standard WG 48-1999 HRT systems demands (taken from ARINC standard): The Avionics Computing Resource (ACR) shall include internal hardware and software management methods as necessary to ensure that time, space and I/O allocations are deterministic and static. Deterministic and static means in this context, that time, space and I/O allocations are determined at compilation, assembly or link time, remain identical at each and every initialization of a program or process, and are not dynamically altered during runtime. 10

Time-Triggered Task Control In strictly TT systems, the dispatcher controls the execution of tasks, by interpreting the Task Descriptor List (TADL). TADL Time 10 17 22 38 47 Action Start T1 Send M5 Stop T1 Start T3 Send M3 Dispatcher The TADL tables are generated and checked by a static scheduler, before runtime. 11

TT Resource Management In a TT OS there is hardly any dynamic resource management. Static CPU allocation. Autonomous memory management. It needs little attention from the operating system. Buffer management is minimal. No queues. Implicit, pre-planned synchronization fulfills synchronization needs and precedence constraints S-tasks only No explicit synchronization (e.g., mgmt. of semaphore queues). Operating systems become simple, can be formally analyzed. Examples: TTOS, OSEK time 12

TT Task Structure Basically the task structure in a TT system is static. There are some techniques that make the task structure data dependent, but they are limited: Mode changes navigate dynamically between statically validated operating modes. Sporadic server tasks: Provide a laxity in the schedule that can be consumed by a sporadic server task. Precedence graphs with exclusive or: dynamic selection of one of a number of mutually exclusive alternatives (not very effective!) This limited data dependency of the task structure has both big advantages and disadvantages. 13

TT Task States Non preemptive system Inactive Task Activation Task Termination or Error Active 14

Task Control ET with S-Tasks In an ET system, the task control is performed by a dynamic scheduler that decides which task has to be executed next on the basis of the evolving request scenario. Advantage: Actual (and not maximum) load and task execution times form the basis of the scheduling decisions. Disadvantage: In most realistic cases the scheduling problem that has to be solved on-line is NP hard. 15

ET Task States with S-Tasks Preemptive system Task Activation Ready Active Inactive Preemption Scheduler Decision Running Task Termination 16

ET Task States with C-Tasks Preemptive system Task Activation 1 Running Active Inactive Ready 2 3 4 Blocked Task Termination 1 Scheduler Decision 3 Task executes WAIT for Event 2 Task Preemption 4 Blocking Event occurs 17

ET Resource Management In ET OS the dynamic resource management is extensive: Dynamic CPU allocation. Dynamic memory management. Dynamic Buffer allocation and ET management of communication activities Explicit synchronization between tasks, including semaphore queue management and deadlock detection. Extensive interrupt management. Timeout handling of blocked tasks. A formal timing analysis of ET operating systems is beyond the state of the art (e.g., OSEK). 18

Task Interaction Precedence constraints: restrictions on task sequence (e.g., sequence of actions or outputs) TT: reflected in TT schedule (TADL) ET: WAIT Exchange of data Messages Shared data structure provision of integrity Coordinated task schedules TT schedule guarantees mutex: deterministic solution, min. overhead Non-blocking write protocol Semaphores 19

Non-Blocking Write (NBW) Protocol Assumptions Distributed System Communication via shared memory Exactly one writer on dedicated CPU (no conflicts on CPU) One or more readers (on one or more CPUs) Intervals between write operations an long compared to the duration of a write operation 20

Non-Blocking Write Protocol Demanded Properties Consistency: Read operations must return consistent results. Non-Blocking Property: Readers must not block the writer. Timeliness: The maximum delay of a reader during a read operation must be bounded. 21

Non-Blocking Write Protocol Init: CCF := 0; /* concurrency control flag */ Writer: CCF_old := CCF; CCF := CCF_old + 1; write to shared struct; CCF := CCF_old + 2; Reader: start: CCF_begin := CCF; if CCF_begin mod 2 = 1 then goto start; read from shared struct; CCF_end := CCF; if CCF_end CCF_begin then goto start; CCF arithme3cs in prac3ce: all CCF opera3ons mod (2 * bign) 22

NBW Protocol Correctness The following szenarios have to be checked for correctness: 1. 2. 3. 4. Read Write Read Write Write Read Write Read 5. 6. Read Write 23

Task Interaction Semaphores: high overheads for small critical regions (typical for real-time applications) Replica determinism Simultaneous access to CCF (NBW) or semaphores may cause race conditions unpredictable resolution 24

Time Services Clock Synchronization Time services: Specification of a potentially infinite sequence of events at absolute time-points (off-line and on-line). Specification of a future point in time within a specified temporal distance from "now" (timeout service) Time stamping of events immediately after their occurrence Output of a message (or a control signal) at a precisely defined point in time in the future, either relative to "now" or at an absolute future time point Gregorian calendar function to convert TAI (UTC) to calendar time and vice versa 25

Timing at I/O Interface Value at RT Entity Input Output Value at RT Entity Delay within Computer System t Time Delay at Sensor Time Delay at Actuator Phase-alignment of sampling transmission to control node computation transmission of set point to the actuator to reduce dead time of control loops 26

Dual Role of Time of Event Occurrence A significant event in the environment of a real-time computer can be seen from two different perspectives: Time as data: Point in time of a value change of an RT entity. Precise knowledge of this point in time is important for the analysis of the consequences of the event. Example: timekeeping in downhill skiing Time as control: may demand immediate action by the computer system to react as soon as possible to this event. Example: Emergency stop It is much more demanding to implement time as control than to implement time as data! 27

Sampling Value of an Analog RT Entity Sampling Points t 28

Timing in a Sampled System Sampling of the RT Entity Transport of the Observation WCET of the Processing Task Transport of the Result Output to the Actuator Controlled Object t 29

Sampling States vs. Events Sampling refers to the periodic interrogation of the state of a RT entity by a computer. The duration between two sampling points is called the sampling interval. The length of the sampling interval is determined by the dynamics of the real-time entity. States can be observed by sampling. Events cannot be sampled. They have to be stored in an intermediate memory element (ME). 30

Sampling Position of Memory Element Push Button ME Memory Element in Sensor Control Data Computer 31

Sampling Role of the Memory Element View of Observer without Memory Element at RT Entity View of Observer with Memory Element at RT Entity Sampling Points Value of RT Entity 32 t

Sampling Importance of MINT View of Observer with Memory Element at RT Entity Sampling Points RT Entity MINT minimum inter-arrival time t 33

Interrupt An interrupt is a hardware mechanism that periodically monitors (after the completion of each instruction or CPU clock cycle) the state of a specified signal line (interrupt line). If the line is active and the interrupt is not disabled, control is transferred after completion of the currently executing instruction (from the current task) to an instruction (task) associated with the servicing of the specified interrupt. As soon as an interrupt is recognized, the state of the local interrupt memory is reset. 34

Interrupt Push Button Memory Element in Computer ME Control Data External event forces computer into interrupt service state. 35

Memory Element for an Event Event Occurrence Memory Set Memory Reset Time Sampling: after a fixed period by sensor Polling: by CPU Interrupt: by CPU In the interval between the event occurrence and the resetting of the memory, no further events are recognized MINT 36

Sampling, Polling, Interrupt Failures What happens in the case of failure on transmission line? Sampling: Polling: ME protected message ME Control Data Control Data Interrupt: ME Control Data Computer 37

Interrupt Handling Three tasks to handle an interrupt: Time window is opened by the first dynamic TT task à guarantee MINT. Interrupt may occur in this time window; The third task, the ET interrupt service task, is activated and closes the time window. Time window is closed by the second dynamic TT task if no interrupt has occurred. Real Time 38

Need for Agreement Protocols If an RT entity is observed by two (or more) nodes of the distributed system, the following may happen: The same event can be time-stamped differently by two nodes fundamental limit of time measurement. When reading an analog sensor, a dense quantity is mapped onto a digital values discretization error. Even sensors of highest quality may yield readings differing by a single-bit quantity. Whenever a dense quantity is mapped onto a discrete representation, agreement protocols are needed to get an agreed view on multiple redundant sensor readings 39

Agreement Protocol An agreement protocol provides a consensus on the value of an observation and on the time when the observation occurred among a number of fault-free members of an ensemble: The first phase of an agreement protocol concerns the exchange of the local observations to get a globally consistent view to each of the partners In the second phase, each partner executes the same algorithm on this global data (e.g., averaging) to come to the same conclusion the agreed value and time Agreement always needs an extra round of communication and thus weakens the responsiveness of a real-time system. 40

Agreement of Resource Controllers As long as a number of resource controllers that observe a set of real-time entities has not agreed on the observations, active redundancy is not possible (and therefore no need for replica determinism): The world interface between a sensor and the associated resource controller can be serviced without concern for replica determinism (local interrupts!!) It should be an explicit design goal to eliminate the h-state from the resource controller (stateless protocols) as far as possible. The message interface of the resource controller to the rest of a cluster should provide agreed values only! 41

Byzantine Agreement Byzantine agreement protocols have the following requirements to tolerate the Byzantine failures of f " nodes : There must be at least 3f+1 nodes in a FTU. Each node must be connected to all other nodes of the FTU by f+1 disjoint communication paths. In order to detect the malicious nodes, f+1 rounds of communication must be executed among the nodes. The nodes must be synchronized to within a known precision of each other. 42

Error Detection Mechanisms An RTOS must provide error detection in the temporal domain and in the value domain Consistency checks Monitoring task execution times Monitoring interrupts (MINT) Double execution of tasks (time redundancy) Watchdogs observable heart-beat signal CRC checks 43

Separating Control Flow data-sharing interface HRT Component Safety- Critical Connector Unit HRT Subsystem Symbols Time-Triggered State Message Port Control Signal Port Memory Element for a Single State Message Synchronized Clock Time-Triggered Communication 44

Synchronization with Real-Time Clock Master clock synchronization Programmed clock interrupt from connector unit Planned window of inactivity before expected clock sync. time allows slow CPUs to complete the same workload as fast CPUs (needs bound on clock skew) window of inactivity slow CPU fast CPU clock interrupt 45

A Time-Predictable Component Application Computer Safety- Critical Connector Unit HRT Subsystem Symbols Time-Triggered State Message Port Control Signal Port Memory Element for a Single State Message Synchronized Clock Time-Triggered Communication 46

Time-Predictable Component (2) synchronized representation of global time instruction counter clock, synchronized to the local representation of global time Static schedule (instruction-counter interrupt for preemptions) Data transfer triggered by progression of instruction counter clock Data transfer triggered by progression of global-time representation Programmable clock interrupt to synchronize the instructioncounter clock with the global-time representation 47

Points to Remember Separation HRT SW vs. other SW Pre-planned TT operation keeps SW simple and verifyable Time services and the role of time Sampling I/O Application-dependent timing parameters Protection against failures Input agreement at system borders 48