Introduction to Real-time Systems. Advanced Operating Systems (M) Lecture 2

Similar documents
Syllabus Instructors:

IN4343 Real-Time Systems

CLOCK DRIVEN SCHEDULING

Event-Driven Scheduling. (closely following Jane Liu s Book)

CS4514 Real-Time Systems and Modeling

Real-Time Systems. Introduction

Time Triggered and Event Triggered; Off-line Scheduling

Introduction to Real-Time Communications. Real-Time and Embedded Systems (M) Lecture 15

Real-Time Systems. Introduction

Overall Structure of RT Systems

Implementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9

Precedence Graphs Revisited (Again)

1. Introduction. Real-Time Systems. Initial intuition /1. Outline. 2016/17 UniPD / T. Vardanega 26/02/2017. Real-Time Systems 1

Simplified design flow for embedded systems

Learning Outcomes. Scheduling. Is scheduling important? What is Scheduling? Application Behaviour. Is scheduling important?

Real Time Operating Systems and Middleware

What are Embedded Systems? Lecture 1 Introduction to Embedded Systems & Software

Introduction to Real-Time Systems ECE 397-1

Real-Time Systems 1. Basic Concepts

4/6/2011. Informally, scheduling is. Informally, scheduling is. More precisely, Periodic and Aperiodic. Periodic Task. Periodic Task (Contd.

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institution of Technology, IIT Delhi

Multiprocessor and Real-Time Scheduling. Chapter 10

Classification of RTS. RTS Definitions. RTS Definitions

Reference Model and Scheduling Policies for Real-Time Systems

6.1 Motivation. Fixed Priorities. 6.2 Context Switch. Real-time is about predictability, i.e. guarantees. Real-Time Systems

Multimedia Systems 2011/2012

Copyright Notice. COMP9242 Advanced Operating Systems S2/2014 Week 9: Real-Time Systems. Real-Time System: Definition

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

DISTRIBUTED REAL-TIME SYSTEMS

CHAPTER 1: REAL TIME COMPUTER CONTROL

Homework index. Processing resource description. Goals for lecture. Communication resource description. Graph extensions. Problem definition

ECE519 Advanced Operating Systems

Fault tolerant scheduling in real time systems

Real-time Support in Operating Systems

Overview. Sporadic tasks. Recall. Aperiodic tasks. Real-time Systems D0003E 2/26/2009. Loosening D = T. Aperiodic tasks. Response-time analysis

2. Introduction to Software for Embedded Systems

CS4514 Real Time Scheduling

Time Handling in Programming Language

Concurrent activities in daily life. Real world exposed programs. Scheduling of programs. Tasks in engine system. Engine system

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

Real-time HOOD. Analysis and Design of Embedded Systems and OO* Object-oriented Programming Jan Bendtsen Automation and Control

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

Multimedia-Systems. Operating Systems. Prof. Dr.-Ing. Ralf Steinmetz Prof. Dr. rer. nat. Max Mühlhäuser Prof. Dr.-Ing. Wolfgang Effelsberg

Environment: dictates timeliness requirements, to which the internal system has to react on time.

Administrative Stuff. We are now in week 11 No class on Thursday About one month to go. Spend your time wisely Make any major decisions w/ Client

Providing Real-Time and Fault Tolerance for CORBA Applications

Scheduling of Parallel Real-time DAG Tasks on Multiprocessor Systems

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

Subject Name:Operating system. Subject Code:10EC35. Prepared By:Remya Ramesan and Kala H.S. Department:ECE. Date:

OPERATING SYSTEM CONCEPTS UNDERSTAND!!! IMPLEMENT!!! ANALYZE!!!

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

3. Quality of Service

In examining performance Interested in several things Exact times if computable Bounded times if exact not computable Can be measured

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

Priya Narasimhan. Assistant Professor of ECE and CS Carnegie Mellon University Pittsburgh, PA

Fault-tolerant techniques

Multiprocessor and Real- Time Scheduling. Chapter 10

Analyzing Real-Time Systems

Computer Hardware Requirements for Real-Time Applications

OVERHEADS ENHANCEMENT IN MUTIPLE PROCESSING SYSTEMS BY ANURAG REDDY GANKAT KARTHIK REDDY AKKATI

Exam Review TexPoint fonts used in EMF.

Real-Time (Paradigms) (47)

FIXED PRIORITY SCHEDULING ANALYSIS OF THE POWERTRAIN MANAGEMENT APPLICATION EXAMPLE USING THE SCHEDULITE TOOL

Design and Analysis of Time-Critical Systems Introduction

2. REAL-TIME CONTROL SYSTEM AND REAL-TIME NETWORKS

A TimeSys Perspective on the Linux Preemptible Kernel Version 1.0. White Paper

Aperiodic Task Scheduling

Constructing and Verifying Cyber Physical Systems

Ensuring Schedulability of Spacecraft Flight Software

The Real-time Specification for Java

THE CPU SPENDS ALMOST ALL of its time fetching instructions from memory

Embedded Real-Time Systems. Facts and figures. Characteristics

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Introduction to Embedded Systems

FROM TIME-TRIGGERED TO TIME-DETERMINISTIC REAL-TIME SYSTEMS

Introduction. Real Time Systems. Flies in a bottle. Real-time kernel

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

即時控制系統設計 Design of Real-Time Control Systems

Scheduling Mar. 19, 2018

Real-Time Scheduling in Distributed Environments

Scheduling Algorithm and Analysis

Response Time Analysis of Asynchronous Real-Time Systems

Predictive Thermal Management for Hard Real-Time Tasks

Global Scheduling in Multiprocessor Real-Time Systems

Embedded Software Programming

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #8: Task Assignment and Scheduling on Multiprocessor Systems

A Framework for Real-Time Utilities for Ada 2005

What s an Operating System? Real-Time Operating Systems. Cyclic Executive. Do I Need One? Handling an Interrupt. Interrupts

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

Real-time operating systems and scheduling

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

SE300 SWE Practices. Lecture 10 Introduction to Event- Driven Architectures. Tuesday, March 17, Sam Siewert

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Aperiodic Servers (Issues)

Lecture Little s Law Flux Queueing Theory Simulation Definition. CMPSCI 691ST Systems Fall 2011

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Multiprocessor scheduling

Source EE 4770 Lecture Transparency. Formatted 16:43, 30 April 1998 from lsli

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

Transcription:

Introduction to Real-time Systems Advanced Operating Systems (M) Lecture 2

Introduction to Real-time Systems Real-time systems deliver services while meeting some timing constraints Not necessarily fast, but must meet some timing deadline Many real-time systems are embedded as part of some larger device or system Washing machine, photocopier, mobile phone, car, aircraft, industrial plant, etc. Representative classes: digital process control; telephony and multimedia Frequent requirement to validate for correctness Many embedded real-time systems are safety critical: if they do not complete in a timely and correct basis, serious consequences result Bugs in embedded real-time systems can often be difficult or expensive to fix: you can t just run software update on a car! 2

Example: Digital Process Control Reference input: r(t) A/D A/D rk yk Control-law computation uk Controller D/A u(t) Controlling some device ( the plant ) using an actuator, based on sampled sensor data Effective control depends on correct control law computation, reference input, and accuracy of measurements y(t) Sensor Plant Actuator Time between measurements of y(t), r(t) is the sampling period, T Small T better approximates analogue control but large T needs less processor time; if T is too large, oscillation will result as the system fails to keep up with changes in the input set timer to interrupt periodically with period T; at each timer interrupt, do do analogue-to-digital conversion of y(t) to get y k ; compute control output u k based on reference r k and y k ; do digital-to-analogue conversion of u k to get u(t); end do; A simple control loop is conceptually simple to implement Complexity comes from multiple control loops running at different rates, and from systems that must switch between different modes of operation 3

Examples: Drive-by-Wire and Telephony Real-time systems are increasingly built as distributed systems The components of the system are connected via some communications network E.g., a sensor that sends data to the controller process over a local area network, perhaps as part of a drive by wire car E.g., a voice-over-ip telephony system, where real-time speech data is transferred over a wide area IP network such as the Internet These systems not only need to run a control law under time constraints, but must also schedule communications according to deadlines Brake actuator Wheel sensors Steering Brake Accelerator Gears Controller area network Control system Engine sensors Example: drive-by-wire controls in a car Packet switched voice network Example: voice-over-ip Engine controls 4

Types of Real-Time System Purely cyclic Every task executes periodically Demands in resources (e.g., computing, communication, or storage) do not vary significantly from period to period Example: most digital controllers and real-time monitors Mostly cyclic Most tasks execute periodically The system must also respond to some external events asynchronously (e.g., fault recovery and external commands) Example: modern avionics and process control systems Asynchronous, mostly predictable Most tasks are not periodic The time between consecutive executions of a task may vary considerably, or the variations in resource utilisation in different periods may be large These variations have either bounded ranges or known statistics Asynchronous, unpredictable Applications that react to external events and/or have tasks with high and variable run-time complexity Example: intelligent real-time control Easier to reason about systems that are more cyclic, synchronous, and predictable 5

Implementation Considerations Some real-time embedded systems are complex, implemented on high-performance hardware E.g., industrial plant control, avionics and flight control systems But, many are implemented on hardware that is low cost, low power, and low performance, but lightweight and robust E.g., consumer goods Often implemented in C or assembler, fitting within a few kilobytes of memory; correctness primary concern, efficiency a close second We are interested in proofs of correctness of the scheduling, and ways of raising the level of abstraction when programming such systems 6

Reference Model for Real-time Systems A reference model and consistent terminology let us reason about real-time systems Reference model is characterised by: A model that describes the applications running on the system A model that describes the resources available to those applications Scheduling algorithms that define how the applications execute and use the resources 7

Jobs, Tasks, Processors, and Resources A job is a unit of work scheduled and executed by the system; A task, T, is a set of related jobs, J1, J2,, Jn that jointly provide some function If jobs occur on a regular cycle, the task is termed periodic if jobs are unpredictable, the task is termed aperiodic (or sporadic, if the jobs have deadlines once released) Jobs execute on a processor and may depend on some resources Processors are active devices on which jobs are scheduled E.g., threads scheduled on a CPU, data scheduled on a transmission link A processor has a speed attribute, that determines the rate of progress of jobs executing on that processor A resource, R, is a passive entity on which jobs may depend E.g., system memory, a hardware device Resources may have different types and sizes, but do not have a speed attribute Resources are not consumed by usage, and can be reused multiple times Jobs compete for access to resources, and may block if the resource is in use by another job A resource is plentiful if there is enough of it that nothing blocks waiting access such resources can t affect correctness, and so are generally ignored 8

Execution Time of Jobs A job Ji will execute for time ei This is the amount of time required to complete execution of Ji when it executes alone on the processor, and has all the resources it needs The value of ei depends on the complexity of the job and the speed of the processor; it may vary on a given processor due to conditional branches in the job, the effects of processor caches, etc. Execution times therefore fall into an interval [ei, ei + ]; assume we know this interval for every real-time job, but not necessarily the actual ei Terminology: (x, y] is an interval starting immediately after x, continuing up to and including y Often, assume ei = ei + and validate using worst-case execution times: inefficient, but safe 9

Deadlines & Timing Constraints Relative deadline, D i Response time r i - r i + Job, J i Time Release time, r i Completion time Absolute deadline, d i 10

Deadlines & Timing Constraints: Example A system to monitor and control a heating furnace The system takes 20ms to initialise when turned on After initialisation, every 100ms, the system: Samples and reads the temperature sensor Computes the control-law for the furnace to process the temperature readings, determine the correct flow rates of fuel, air, and coolant Adjusts the flow rates to match the computed values The system can be modelled as a task, T, comprising jobs J0, J1,, Jk, The release time of Jk is 20 + (k 100)ms The relative deadline of Jk is 100ms; the absolute deadline is 20 + ((k + 1) 100)ms Relative deadline = 100ms Slack time Absolute deadline for J2 = 320ms 0 20 120 220 320 420 J0 J1 J2 J3 11

Effective Release Times and Deadlines Sometimes the release time of a job may be later than that of its successors, or its deadline may be earlier than that specified for its predecessors Makes no sense: derive effective release time or effective deadline consistent with all precedence constraints, and schedule using that Effective release time If a job has no predecessors, its effective release time is its release time If it has predecessors, its effective release time is the maximum of its release time and the effective release times of its predecessors Effective deadline If a job has no successors, its effective deadline is its deadline It if has successors, its effective deadline is the minimum of its deadline and the effective deadline of its successors 12

Hard vs. Soft Real-time Systems The firmness of timing constraints affects how we engineer the system If a job must never miss its deadline, the system is hard real-time A timing constraint is hard is failure to meet it is considered a fatal error A timing constraint is hard if the usefulness of the results falls off abruptly at the deadline A timing constraint is hard if the user requires validation (formal proof or exhaustive simulation, potentially with legal penalties) that the system always meets the constraint If some deadlines can be missed occasionally, with low probability, then the system is described as soft real-time Hard and soft real-time are two ends of a spectrum In many practical systems, the constraints are probabilistic, and depend on the likelihood and consequences of failure No system is guaranteed to always meet its deadlines: there is always some probability of failure 13

Periodic Tasks A set of jobs that are executed at regular time intervals can be modelled as a periodic task many real-world systems fit this model Each periodic task Ti is a sequence of jobs Ji,1, Ji,2,, Ji,n The phase, φi, of task Ti is the release time ri,1 of the first job Ji,1 The period, pi, of task Ti is the minimum length of time between release times of consecutive jobs The execution time, ei, of task Ti is the maximum execution time of all jobs in the task The utilisation of task Ti is ui = ei / pi and measures the fraction of time for which the task executes The total utilisation of a system U = i u i 14

Periodic Tasks: Example! T 1 : p 1 = 3, e 1 = 1! T 2 : p 2 = 5, e 2 = 2 H = lcm(3, 5) = 15 J 1,1 J 1,2 J 1,3 J 1,4 J 1,5 J 2,1 J 2,2 J 2,2 J 2,3 0 5 10 15 20 25 30 Time A system of periodic tasks repeats after the hyper-period, H = lcm(pi) for i = 1, 2,, n 15

Aperiodic and Sporadic Tasks Many real-time systems are required to respond to unpredictable events These are modelled as aperiodic or sporadic jobs An aperiodic job has no deadline; a sporadic job has a deadline once released It is often possible to characterise the inter-arrival times for such jobs according to some probability distribution The presence of aperiodic and sporadic jobs greatly complicates reasoning about a system Sporadic tasks make the design of a hard real-time system impossible, unless some bounds can be placed on their inter-arrival times and relative deadlines 16

Dynamic vs. Static Systems A multiprocessor system is dynamic if the jobs can migrate between processors; it is static if (sets of) jobs are bound to a single processor Expect static systems to have inferior performance (in terms of overall response job time) compared to dynamic systems But it is possible to validate static systems, whereas this is not always true for dynamic systems; hence, most hard real time systems are static Results demonstrated for uniprocessor systems are applicable to each processor of a static multiprocessor system; they are not necessarily applicable to dynamic multiprocessor systems 17

Overview of Real-time Scheduling Jobs are scheduled and allocated access to resources according to a scheduling algorithm and some resource access control protocol A valid schedule satisfies the following conditions: Every processor is assigned at most one job at any time; every job is assigned to at most one processor at once No job is scheduled before its release time The total amount of processor time assigned to each job is equal to its maximum or actual execution time All the precedence and resource usage constraints are satisfied A schedule is feasible if it s valid and every job meets its timing constraints A scheduling algorithm is optimal if it always produces a feasible schedule for a given set of jobs if a feasible schedule exists There are some scheduling algorithms that will find some, but not all, feasible schedules, and so may fail to schedule a set of jobs that some other algorithm could schedule 18

Real-time Scheduling Algorithms Two main classes of algorithm for scheduling realtime tasks: Clock-driven algorithms are used for mostly static systems, where all properties of all jobs are known at design time, such that offline scheduling techniques can be used Priority-driven algorithms are used for more dynamic systems, with a mix of periodic tasks and event-driven (aperiodic and/or sporadic tasks), where the system must adapt to changing events and conditions Lecture 3: clock-driven scheduling Lectures 4-7: priority-driven scheduling 19

Further Reading Will focus on real-time scheduling in the next few lectures Recommended reading: Jane W. S. Liu, "Real-Time Systems", Prentice Hall, 2000, ISBN 0130996513 20