Real-Time Systems. LS 12, TU Dortmund

Similar documents
Task Models and Scheduling

Scheduling Periodic Real-Time Tasks on Uniprocessor Systems. LS 12, TU Dortmund

Embedded Systems Development

Networked Embedded Systems WS 2016/17

Lecture 13. Real-Time Scheduling. Daniel Kästner AbsInt GmbH 2013

Clock-driven scheduling

Multiprocessor Scheduling I: Partitioned Scheduling. LS 12, TU Dortmund

Aperiodic Task Scheduling

Embedded Systems 14. Overview of embedded systems design

Embedded Systems 15. REVIEW: Aperiodic scheduling. C i J i 0 a i s i f i d i

CIS 4930/6930: Principles of Cyber-Physical Systems

Schedulability of Periodic and Sporadic Task Sets on Uniprocessor Systems

Real-Time and Embedded Systems (M) Lecture 5

Non-Preemptive and Limited Preemptive Scheduling. LS 12, TU Dortmund

Real-time Systems: Scheduling Periodic Tasks

Real-Time Systems. Event-Driven Scheduling

Andrew Morton University of Waterloo Canada

RUN-TIME EFFICIENT FEASIBILITY ANALYSIS OF UNI-PROCESSOR SYSTEMS WITH STATIC PRIORITIES

Real-time operating systems course. 6 Definitions Non real-time scheduling algorithms Real-time scheduling algorithm

Real-Time Scheduling

Real-Time Systems. Event-Driven Scheduling

CSE 380 Computer Operating Systems

System Model. Real-Time systems. Giuseppe Lipari. Scuola Superiore Sant Anna Pisa -Italy

The Concurrent Consideration of Uncertainty in WCETs and Processor Speeds in Mixed Criticality Systems

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

Real-Time Scheduling. Real Time Operating Systems and Middleware. Luca Abeni

Deadline-driven scheduling

Real-time Scheduling of Periodic Tasks (1) Advanced Operating Systems Lecture 2

Real-Time Scheduling and Resource Management

Scheduling. Uwe R. Zimmer & Alistair Rendell The Australian National University

Mixed Criticality in Safety-Critical Systems. LS 12, TU Dortmund

Multiprocessor Scheduling II: Global Scheduling. LS 12, TU Dortmund

There are three priority driven approaches that we will look at

Process Scheduling for RTS. RTS Scheduling Approach. Cyclic Executive Approach

EDF Feasibility and Hardware Accelerators

Real-Time Systems. Lecture #14. Risat Pathan. Department of Computer Science and Engineering Chalmers University of Technology

Dependency Graph Approach for Multiprocessor Real-Time Synchronization. TU Dortmund, Germany

3. Scheduling issues. Common approaches 3. Common approaches 1. Preemption vs. non preemption. Common approaches 2. Further definitions

Real-Time Systems. Lecture 4. Scheduling basics. Task scheduling - basic taxonomy Basic scheduling techniques Static cyclic scheduling

CPU SCHEDULING RONG ZHENG

Real-time Scheduling of Periodic Tasks (2) Advanced Operating Systems Lecture 3

Design of Real-Time Software

Exact speedup factors and sub-optimality for non-preemptive scheduling

Schedulability and Optimization Analysis for Non-Preemptive Static Priority Scheduling Based on Task Utilization and Blocking Factors

Paper Presentation. Amo Guangmo Tong. University of Taxes at Dallas January 24, 2014

Scheduling Lecture 1: Scheduling on One Machine

Optimal Utilization Bounds for the Fixed-priority Scheduling of Periodic Task Systems on Identical Multiprocessors. Sanjoy K.

Non-Work-Conserving Non-Preemptive Scheduling: Motivations, Challenges, and Potential Solutions

Scheduling Lecture 1: Scheduling on One Machine

Predictability of Least Laxity First Scheduling Algorithm on Multiprocessor Real-Time Systems

On the Soft Real-Time Optimality of Global EDF on Multiprocessors: From Identical to Uniform Heterogeneous

Rate-monotonic scheduling on uniform multiprocessors

A Theory of Rate-Based Execution. A Theory of Rate-Based Execution

Schedulability analysis of global Deadline-Monotonic scheduling

Real-time scheduling of sporadic task systems when the number of distinct task types is small

EDF Scheduling. Giuseppe Lipari CRIStAL - Université de Lille 1. October 4, 2015

TDDI04, K. Arvidsson, IDA, Linköpings universitet CPU Scheduling. Overview: CPU Scheduling. [SGG7] Chapter 5. Basic Concepts.

Embedded Systems - FS 2018

EDF Scheduling. Giuseppe Lipari May 11, Scuola Superiore Sant Anna Pisa

arxiv: v1 [cs.os] 21 May 2008

arxiv: v3 [cs.ds] 23 Sep 2016

The Partitioned Dynamic-priority Scheduling of Sporadic Task Systems

Static priority scheduling

Priority-driven Scheduling of Periodic Tasks (1) Advanced Operating Systems (M) Lecture 4

Schedulability Analysis for the Abort-and-Restart Model

TDDB68 Concurrent programming and operating systems. Lecture: CPU Scheduling II

Improved Priority Assignment for the Abort-and-Restart (AR) Model

Tardiness Bounds under Global EDF Scheduling on a. Multiprocessor

Scheduling I. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Advanced topics on scheduling

Scheduling I. Today Introduction to scheduling Classical algorithms. Next Time Advanced topics on scheduling

2.1 Task and Scheduling Model. 2.2 Definitions and Schedulability Guarantees

Online Scheduling Switch for Maintaining Data Freshness in Flexible Real-Time Systems

Contention-Free Executions for Real-Time Multiprocessor Scheduling

Bounding the Maximum Length of Non-Preemptive Regions Under Fixed Priority Scheduling

Module 5: CPU Scheduling

Non-preemptive Fixed Priority Scheduling of Hard Real-Time Periodic Tasks

CPU scheduling. CPU Scheduling

EDF and RM Multiprocessor Scheduling Algorithms: Survey and Performance Evaluation

A Note on Modeling Self-Suspending Time as Blocking Time in Real-Time Systems

Cyclic Schedules: General Structure. Frame Size Constraints

Chapter 6: CPU Scheduling

Paper Presentation. Amo Guangmo Tong. University of Taxes at Dallas February 11, 2014

Evaluation and Validation

The Feasibility Analysis of Multiprocessor Real-Time Systems

A New Sufficient Feasibility Test for Asynchronous Real-Time Periodic Task Sets

Lecture: Workload Models (Advanced Topic)

An Optimal Real-Time Scheduling Algorithm for Multiprocessors

Semi-Partitioned Fixed-Priority Scheduling on Multiprocessors

On Non-Preemptive Scheduling of Periodic and Sporadic Tasks

Uniprocessor real-time scheduling

Exam Spring Embedded Systems. Prof. L. Thiele

arxiv: v1 [cs.os] 28 Feb 2018

IN4343 Real Time Systems April 9th 2014, from 9:00 to 12:00

Uniprocessor Mixed-Criticality Scheduling with Graceful Degradation by Completion Rate

Real-Time Workload Models with Efficient Analysis

Worst-Case Execution Time Analysis. LS 12, TU Dortmund

CS 374: Algorithms & Models of Computation, Spring 2017 Greedy Algorithms Lecture 19 April 4, 2017 Chandra Chekuri (UIUC) CS374 1 Spring / 1

Embedded Systems Design: Optimization Challenges. Paul Pop Embedded Systems Lab (ESLAB) Linköping University, Sweden

CHAPTER 5 - PROCESS SCHEDULING

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Transcription:

Real-Time Systems Prof. Dr. Jian-Jia Chen LS 12, TU Dortmund April 24, 2014 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 1 / 57

Organization Instructor: Jian-Jia Chen, jian-jia.chen@cs.uni-dortmund.de Grading: Oral Exam (100%) Credit: 6 Office hour: Wed., 10:30-11:30 AM. Please make appointments. http://ls12-www.cs.tu-dortmund.de/daes/de/lehre/ english-courses/ss14-real-time-systems.html References Textbooks: Giorgio C. Buttazzo, Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications, Springer, Second Edition, 2004. ISBN: 0-387-23137-4 Jane W.S. Liu, Real-Time Systems, Prentice Hall, First Edition, 2000. ISBN:0130996513 Papers from conferences and journals Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 2 / 57

Course Description Time: Wednesday, 14:30-16:00, 16:15-1745 weekly Place: Room 205 at OH16, TU Dortmund Start: on 23.04.2014 Prerequisite: Computer Operating Systems or equivalent. A basic background in algorithm analysis, data structures, and discrete math will be assumed. Course material: The slides contain material of the above textbooks, paper references, and course lectures from Steve Goddard, Kevin Jeffay, Nathan Fisher, Lothar Thiele, James Anderson, Kai Lampka, Alan Burns, and Sanjoy Baruah. Course Calendar: The course will last for 12weeks (including this week). Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 3 / 57

Embedded Systems Complex best effort systems Mobile telecommunications Consumer products, e.g., digital camera, digital video, etc. Good reactivity and good dependability Critical control systems Automated aircraft landing systems Automotive control for gearing, ABS, airbag, etc. High reactivity and high dependability Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 4 / 57

Characteristics of Embedded Systems (Illustrations) Even though the hardware improvement continues, the computing demand also increases Efficiency Executing should be energy-efficient, code-efficient, and cost-efficient Dependability Reliability, maintainability, and availability after deployment Safety even for failure Timing guarantee Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 5 / 57

Real-Time Systems Dual notations of correctness: Logical correctness ( the results are correct ) Requires functional analysis Temporal correctness ( the results are delivered in/on time ) Requires non-functional analysis High reactivity and high dependability are more important than performance Example: A robot arm picking up objects from a belt: Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 6 / 57

Examples for Real-Time Systems Chemical & Nuclear Power Plants Railway Switching Systems Flight Control Systems Space Mission Control Automotive Systems Robotics Telecommunications Systems Stock Market, Trading System, Information Access Multimedia Systems Virtual Reality...... Hard Real-Time Systems Catastrophic if some deadlines are missed Firmed Real-Time Systems The results are useless if the deadlines are missed Soft Real-Time Systems The results are not very useful if the deadlines are missed Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 7 / 57

Classifications of Real-Time Systems Utility Utility r d time Hard Real-Time Systems Catastrophic if some deadlines are missed Utility r d time Firmed Real-Time Systems The results are useless if the deadlines are missed Soft Real-Time Systems r d time The results are not very useful if the deadlines are missed Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 8 / 57

Characteristics of Real-Time Systems Timeliness High cost of failure. Concurrency/multiprogramming Stand-alone/continuous operation Design for worst cases Reliability/fault-tolerance requirements Predictable behavior Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 9 / 57

Frequent Misconceptions Real time is performance engineering/tuning. Timeliness is more important in real-time systems. Real-time computing is equivalent to fast computing. Real-time computing means predictable and reliable computing. There is no science in real-time system design. Let s discuss this at the end of the semester. Advances in supercomputing hardware will take care of real-time requirements. Buying a faster processor may result in timeliness violation. It is not meaningful to talk about guaranteeing real-time performance when things can fail. Though hardwares may fail, the logic components, such as operating systems, should be solid when hardwares are still well functional. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 10 / 57

Needs of Concurrency Reasons for concurrency Functional allow multiple users perform many operations concurrently Performance take advantage of blocking time parallelism in multi-processor machines Expressive Power many control application are inherently concurrent concurrency support helps in expressing concurrency, making application development simpler Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 11 / 57

Multi-Tasking The execution entities (tasks, processes, threads, etc.) are competing from each other for shared resources Scheduling decision policy is needed When to schedule an entity? Which entity to schedule? How to schedule entities? Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 12 / 57

General-Purpose Systems and Real-Time Systems Real-Time Systems Applications are known a priori Programed by designers Timeliness Worst-case response time guarantee Examples: traffic control systems, robotics, etc. General-Purpose Systems Broad class of applications Programmable by end-users The faster, the better Average-case response time Examples: Desktops, web servers, etc. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 13 / 57

Scarcity of Resources Requirements (Performance, scale, etc.) Interesting Region for Real Time Systems Interactive Video High quality Audtio Network File Access Remote Login Insufficient resources Sufficient but scarce resources Abundant Resources 000000000000000000000000000000000000 111111111111111111111111111111111111 1980 1990 2000 Hardware resources in year X Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 14 / 57

Example: Simple Control System Many embedded systems are control systems Robotics Automotive Systems A simple example: one-sensor and one-actuator control system. Control System A/D y k Control law computation u k D/A y(t) u(t) sensor plant (The system being controlled) actuator Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 15 / 57

Example: Simple Control System (cont.) Pseudo-code for this system set timer to interrupt periodically with period T; at each timer interrupt do do analog-to-digital conversion to get y; compute control output u; output u and do digital-to-analog conversion; od Control System A/D yk Control law computation uk D/A T is called the sampling period, which is a key design choice. y(t) u(t) sensor plant (The system being controlled) actuator Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 16 / 57

Example: Multi-Rate Control System More complicated control systems have multiple sensors and actuators and must support control loops of different rates. Example: Helicopter flight controller. Do the following in each 1/180-sec. cycle: validate sensor data and select data source; if failure, reconfigure the system Every six cycles do:: keyboard input and mode selection; data normalization and coordinate transformation; tracking reference update control laws of the outer pitch-control loop; control laws of the outer roll-control loop; control laws of the outer yaw- and collective-control loop; This leads to periodic execution of each control task. Every other cycle do: control laws of the inner pitch-control loop; control laws of the inner roll- and collective-control loop; Compute the control laws of the inner yaw-control loop; Output commands; Carry out built-in test; Wait until beginning of the next cycle; Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 17 / 57

Example: Hierarchical Control System Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 18 / 57

Course Focus Basic tools and analytical methods for real-time systems Scheduling algorithms for real-time systems earliest-deadline-first scheduling, rate monotonic scheduling, deadline monotonic scheduling, etc. resource sharing and servers multiprocessor scheduling Basic analysis of timing satisfaction in real-time systems Real-time operating systems, communication and programming languages Several advanced topics related to the current research directions, including resource augmentation analysis, mixed criticality, and real-time calculus After the course, you are expected to know fundamental building blocks in real-time systems, and schedulability analysis of scheduling algorithms in real-time systems. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 19 / 57

Schedulability Analysis Task Models and Scheduling Uniprocessor Systems Real-Time Systems Worst- Case Execution Time Analysis Real-Time Calculus Resource Sharing and Servers Partitioned Scheduling Multiprocessor Systems Tools Real-Time Communication Semi- Partitioned Scheduling Global Scheduling Real-Time OS Real-Time Programming Language Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 20 / 57

Course Calendar 23,04,14 Introduction of Real-Time Systems and Task Models 30,04,14 Analysis of RM and EDF Scheduling (I) 07,05,14 Analysis of RM and EDF Scheduling (II) 14,05,14 Worst-Case Execution Time (WCET) 21,05,14 Resource Sharing and Reservation Servers 28,05,14 Real-Time Programming Languages and Time Automata 04,06,14 Real-Time Operating Systems 11,06,14 Real-Time Communications and Real-Time Calculus 18,06,14 Multiprocessor Scheduling (I) 25,06,14 Multiprocessor Scheduling (II) 02,07,14 Soft Real-Time Systems 09,07,14 Break (conference trip) 16,07,14 Mixed Criticality and Advanced Topics Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 21 / 57

Real-Time Systems Community For information on real-time research groups, conferences, journals, books, products, etc., have a look at: http://tcrts.org/ Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 22 / 57

Fundamentals Algorithm: It is the logical procedure to solve a certain problem It is informally specified a sequence of elementary steps that an execution machine must follow to solve the problem It is not necessarily (and usually not) expressed in a formal programming language Program: It is the implementation of an algorithm in a programming language It can be executed several times with different inputs Process/job/task: An instance of a program that given a sequence of inputs produces a set of outputs Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 23 / 57

Operating System An operating system is a program that acts as an intermediary between a user of a computer and the computer hardware by providing interfaces provides an abstraction of the physical machine (for example, a file, a virtual page in memory, etc.) manages the access to the physical resources of a computing machine makes the computer system convenient to use executes user programs and makes solving user problems easier and more...... Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 24 / 57

Timing parameters of a job J j Arrival time (a j ) or release time (r j ) is the time at which the job becomes ready for execution Computation (execution) time (C j ) is the time necessary to the processor for executing the job without interruption (= WCET). Absolute deadline (d j ) is the time at which the job should be completed. Relative deadline (D j ) is the time length between the arrival time and the absolute deadline. Start time (s j ) is the time at which the job starts its execution. Finishing time (f j ) is the time at which the job finishes its execution. Response time (R j ) is the time length at which the job finishes its execution after its arrival, which is f j a j. C j a j s j f j d j R j D j time Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 25 / 57

Multi-Tasking (Recap) The execution entities (tasks, processes, threads, etc.) are competing from each other for shared resources Scheduling policy is needed When to schedule an entity? Which entity to schedule? How to schedule entities? Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 26 / 57

Scheduling Concepts Scheduling Algorithm: determines the order that jobs execute on the processor Jobs (a simplified version) may be in one of three states: activate schedule completion ready executing terminated preempt Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 27 / 57

Schedules for a set of jobs {J 1, J 2,..., J N } A schedule is an assignment of jobs to the processor, such that each job is executed until completion. A schedule can be defined as an integer step function σ : R N, where σ(t) = j denotes job J j is executed at time t, and σ(t) = 0 denotes the system is idle at time t. If σ(t) changes its value at some time t, then the processor performs a context switch at time t. Non-preemptive scheduling: there is only one interval with σ(t) = j for every J j, where t is covered by the interval. Preemptive scheduling: there could be more than one interval with σ(t) = j. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 28 / 57

Scheduling Concept: Non-preemptive Schedule: σ : R N function of processor time to jobs σ(t) 3 J 1 J 2 J 3 2 1 Context Switches 0 1 2 3 4 5 6 7 8 9 10 s 1 s 2 = f 1 f 2 s 3 f 3 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 29 / 57

Scheduling Concept: Preemptive Schedule: σ : R N function of processor time to jobs σ(t) 3 J 1 J 2 J 1 J 3 2 1 Context Switches 0 1 2 3 4 5 6 7 8 9 10 s 1 s 2 f 2 f 1 s 3 f 3 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 30 / 57

Feasibility of Schedules and Schedulability A schedule is feasible if all jobs can be completed according to a set of specified constraints. A set of jobs is schedulable if there exists a feasible schedule for the set of jobs. A scheduling algorithm is optimal if it always produces a feasible schedule when one exists (under any scheduling algorithm). Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 31 / 57

Scheduling Algorithms Scheduling Algorithms Static Scheduling (offline, or clock-driven) Dynamic Scheduling (online, or priority-driven) Static-Priority Scheduling Dynamic-Priority Scheduling Preemptive vs. Non-preemptive Guarantee-Based vs. Best-Effort Optimal vs. Non-optimal Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 32 / 57

Evaluating A Schedule For a job J j : Lateness L j : delay of job completion with respect to its deadline. L j = f j d j Tardiness E j : the time that a job stays active after its deadline. E j = max{0, L j } Laxity (or Slack Time)(X j ): The maximum time that a job can be delayed and still meet its deadline. X j = d j a j C j Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 33 / 57

Metrics of Scheduling Algorithms (for Jobs) Given a set J of n jobs, common metrics are to minimize Average response time: J j J f j a j J Makespan (total completion time): max f j min a j J j J J j J Total weighted response time: w j (f j a j ) J j J Maximum latency: L max = max J j J (f j d j ) Number of late jobs: N late = J j J miss(j j ), where miss(j j ) = 0 if f j d j, and miss(j j ) = 1 otherwise. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 34 / 57

Hard/Soft Real-Time Systems Hard Real-Time Systems If any hard deadline is ever missed, then the system is incorrect The tardiness for any job must be 0 Examples: Nuclear power plant control, flight control Soft Real-Time Systems A soft deadline may occasionally be missed Various definitions for occasionally minimize the number of tardy jobs, minimize the maximum lateness, etc. Examples: Telephone switches, multimedia applications We mostly consider hard real-time systems in this course. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 35 / 57

An Example: Shortest-Job-First (SJF) At any moment, the system executes the job with the shortest remaining time among the jobs in the ready queue. J 1 J 2 J 3 J 4 J 5 a j 0 2 8 10 15 C j 5 2 6 3 4 d j 6 8 20 14 22 Exercise What is the average response time of the above schedule? C 1 = 3C 2 = 0 C 1 = 0 C 3 = 4 C 4 = 0C 3 = 2C 3 = 0 C 5 = 0 J 1 J 2 J 1 J 3 J 4 J 3 J 3 J 5 0 2 4 6 8 10 12 14 16 18 20 22 24 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 36 / 57

An Example: Earliest-Deadline-First (EDF) At any moment, the system executes the job with the earliest absolute deadline among the jobs in the ready queue. J 1 J 2 J 3 J 4 J 5 a j 0 2 8 10 15 C j 5 2 6 3 4 d j 6 8 20 14 22 Exercise What is the average response time of the above schedule? C 1 = 0C 2 = 0 C 3 = 4 C 4 = 0C 3 = 2C 3 = 0 C 5 = 0 J 1 J 2 J 3 J 4 J 3 J 3 J 5 0 2 4 6 8 10 12 14 16 18 20 22 24 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 37 / 57

Recurrent Task Models When jobs (usually with the same computation requirement) are released recurrently, these jobs can be modeled by a recurrent task Periodic Task τ i : A job is released exactly and periodically by a period T i A phase φ i indicates when the first job is released A relative deadline D i for each job from task τ i (φ i, C i, T i, D i ) is the specification of periodic task τ i, where C i is the worst-case execution time. Sporadic Task τ i : T i is the minimal time between any two consecutive job releases A relative deadline D i for each job from task τ i (C i, T i, D i ) is the specification of sporadic task τ i, where C i is the worst-case execution time. Aperiodic Task: Identical jobs released arbitrarily (we will revisit this part in Real-Time Calculus). Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 38 / 57

Examples of Recurrent Task Models Periodic task: (φ i, C i, T i, D i ) = (2, 2, 6, 6) release deadline J 1 J 1 J 1 J 1 J 1 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Sporadic task: (C i, T i, D i ) = (2, 6, 6) J 1 J 1 J 1 J 1 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 39 / 57

Example: Sporadic Control System Pseudo-code for this system Control System while (true) start := get the system tick; A/D yk Control law computation uk D/A perform analog-to-digital conversion to get y; y(t) u(t) compute control output u; output u and do digital-to-analog conversion; sensor plant (The system being controlled) actuator end := get the system tick; timetosleep := T (end start); sleep timetosleep; end while Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 40 / 57

Example: Periodic Control System Pseudo-code for this system Control System set timer to interrupt periodically with period T; A/D yk Control law computation uk D/A y(t) u(t) at each timer interrupt do perform analog-to-digital conversion to get y; sensor plant (The system being controlled) actuator compute control output u; output u and do digital-to-analog conversion; od Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 41 / 57

Evaluating A Schedule for Tasks For a job J j : Lateness L j : delay of job completion with respect to its deadline. L j = f j d j Tardiness E j : the time that a job stays active after its deadline. E j = max{0, L j } Laxity (or Slack Time)(X j ): The maximum time that a job can be delayed and still meet its deadline. For a task τ i : X j = d j a j C j Lateness L i : maximum latency of jobs released by task τ i Tardiness E i : maximum tardiness of jobs released by task τ i Laxity X i : D i C i ; Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 42 / 57

Relative Deadline <=> Period For a task set, we say that the task set is with implicit deadline when the relative deadline D i is equal to the period T i, i.e., D i = T i, for every task τ i, constrained deadline when the relative deadline D i is no more than the period T i, i.e., D i T i, for every task τ i, or arbitrary deadline when the relative deadline D i could be larger than the period T i for some task τ i. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 43 / 57

Some Definitions for Periodic Tasks The jobs of task τ i are denoted J i,1, J i,2,....... Synchronous system: Each task has a phase of 0. Asynchronous system: Phases are arbitrary. Hyperperiod: Least common multiple (LCM) of T i. Task utilization of task τ i : u i = C i T i. System utilization: τ i u i. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 44 / 57

Feasibility and Schedulability for Recurrent Tasks A schedule is feasible if all the jobs of all tasks can be completed according to a set of specified constraints. A set of tasks is schedulable if there exists a feasible schedule for the set of tasks. A scheduling algorithm is optimal if it always produces a feasible schedule when one exists (under any scheduling algorithm). Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 45 / 57

Graham s Scheduling Algorithm Classification Classification: a b c a: machine environment (e.g., uniprocessor, multiprocessor, distributed,...) b: task and resource characteristics (e.g., preemptive, independent, synchronous,...) c: performance metric and objectives (e.g., L max, sum of finish times,...) Examples: 1 non-prem L max M C max Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 46 / 57

Earliest Due Date Algorithm Theorem 1 sync L max : Given a set of n independent jobs that arrive synchronously (release time is 0), any algorithm that executes tasks in order of non-decreasing deadlines is optimal with respect to minimizing the maximum lateness. Denoted as Earliest Due Date (EDD) Algorithm [Jackson, 1955] Proof Let σ be the schedule for J produced by scheduling algorithm A. We can transform A to EDD schedule A without increasing L max. Details are in the textbook by Buttazzo [Theorem 3.1]. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 47 / 57

Optimality of EDF Theorem Given a set of n independent aperiodic tasks (jobs) with arbitrary arrival times, if the aperiodic task set is feasible on a single processor then any algorithm that executes tasks with earliest deadline (among the set of active tasks) is guaranteed to meet all tasks deadlines. Several proofs of optimality exist: Liu and Layland (1973), Horn (1974), and Dertouzos (1974). Similar to Jackson Algorithm proof of optimality, but need to account for preemption. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 48 / 57

Monotonicity of Scheduling Algorithms A good scheduling algorithm should be monotonic If a scheduling algorithm derives a feasible schedule, it should also guarantee the feasibility with less execution time of a task/job, less number of tasks/jobs, or more number of processors/machines. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 49 / 57

Why is Real-Time Scheduling Hard? Single-processor (Eisenbrand and Rothvoß, in RTSS 2008) Fixed-Priority Real-Time Scheduling: Response Time Computation Is N P-Hard Multiprocessor (Graham 1976) Changing the priority order, increasing the number of processors, reducing execution times, or weakening precedence constraints can result in a deadline miss. Many Cases Scheduling problems in multiprocessor systems are usually N P-Hard. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 50 / 57

Fundamentals: Computational Complexity N P-Complete for a problem Π: If Π can be solved in polynomial time by using a non-deterministic Turning machine, the problem is said in the computational complexity class N P. Π is N P-Complete if Π is in N P and any problem in the N P class can reduce to Π in polynomial time (or log space). Π is N P-hard if any problem in the N P class can reduce to Π in polynomial time (or log space). More intuitively (informally) The computing machines we have developed so far are deterministic Turning machines. If Π can be solved in polynomial time by using a deterministic Turning machine, the problem is said in the computational complexity class P. If a problem is N P-Complete or N P-hard, there is no efficient (polynomial-time) algorithm to derive optimal/feasible solutions unless P = N P. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 51 / 57

Multiprocessor Anomalies Partitioned scheduling (Each task/job is on a processor) As most partitioning algorithms are not optimal, a system might become infeasible with Less execution time of a task/job Less number of tasks/jobs More number of processors/machines Global scheduling As most priority-assignment algorithms are not optimal, a system might become infeasible with Less execution time of a task/job Less number of tasks/jobs More number of processors/machines Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 52 / 57

Precedence Constraints Jobs (and tasks) may have to execute in a pre-specified order. J 9 J 1 J 8 J 2 J 7 J 3 J 6 J 4 J 5 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 53 / 57

Multiprocessor Anomaly: Case 1 J 1 J 9 J 1 (3) J 2 (2) J 3 (2) J 4 (2) J 9 (9) J 8 (4) J 7 (4) J 6 (4) J 5 (4) J 2 J 4 J 5 J 7 J 3 J 6 J 8 0 2 4 6 8 10 12 14 16 Removing the precedence constraints on J 4... J 1 J 6 J 9 J 2 J 4 J 7 On 3 processors J 3 J 5 J 8 0 2 4 6 8 10 12 14 16 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 54 / 57

Multiprocessor Anomaly: Case 2 J 9 (8) J 1 (2) J 2 (1) J 3 (1) J 4 (1) J 8 (3) J 7 (3) J 6 (3) J 5 (3) J 1 J 5 J 9 J 2 J 4 J 7 J 3 J 6 J 8 0 2 4 6 8 10 12 14 16 Reduce the execution time by 1, and schedule on 3 processors Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 55 / 57

Multiprocessor Anomaly: Case 3 J 1 (3) J 2 (2) J 3 (2) J 4 (2) J 9 (9) J 8 (4) J 7 (4) J 6 (4) J 5 (4) J 1 J 9 J 2 J 4 J 5 J 7 J 3 J 6 J 8 0 2 4 6 8 10 12 14 16 Use 4 processors J 1 J 7 On 4 processors J 2 J 6 J 3 J 5 J 4 J 8 J 9 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 56 / 57

Note about the Material in the Course For the rest of the course, we will not cover systems with the following characteristics non-preemptive scheduling or tasks (jobs) with precedence constraints (namely, one job has to wait until another job finishes). This means that we will cover the design and analysis for scheduling algorithms with preemptive scheduling and independent tasks/jobs The material this week has covered the corresponding contents in Chapters 2 and 3 in Buttazzo s textbook. Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 57 / 57