Deadline-driven scheduling

Similar documents
Static priority scheduling

There are three priority driven approaches that we will look at

Real-Time Systems. Event-Driven Scheduling

Clock-driven scheduling

Real-Time Systems. Event-Driven Scheduling

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

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

Real-Time and Embedded Systems (M) Lecture 5

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

Task Models and Scheduling

Dynamic-Priority Scheduling. CSCE 990: Real-Time Systems. Steve Goddard. Dynamic-priority Scheduling

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

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

Networked Embedded Systems WS 2016/17

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

Andrew Morton University of Waterloo Canada

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

Schedulability of Periodic and Sporadic Task Sets on Uniprocessor Systems

Embedded Systems Development

Aperiodic Task Scheduling

Real-Time Scheduling and Resource Management

CHAPTER 5 - PROCESS SCHEDULING

CIS 4930/6930: Principles of Cyber-Physical Systems

CPU SCHEDULING RONG ZHENG

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

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

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

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

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

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

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

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

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

Static-Priority Scheduling. CSCE 990: Real-Time Systems. Steve Goddard. Static-priority Scheduling

Real-Time Scheduling

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

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

CSE 380 Computer Operating Systems

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

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

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

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

EDF Feasibility and Hardware Accelerators

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

Embedded Systems 14. Overview of embedded systems design

Scheduling Algorithms for Multiprogramming in a Hard Realtime Environment

Schedulability analysis of global Deadline-Monotonic scheduling

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

Supplement of Improvement of Real-Time Multi-Core Schedulability with Forced Non- Preemption

EDF and RM Multiprocessor Scheduling Algorithms: Survey and Performance Evaluation

Real-time Systems: Scheduling Periodic Tasks

Real-Time Systems. LS 12, TU Dortmund

LSN 15 Processor Scheduling

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

Segment-Fixed Priority Scheduling for Self-Suspending Real-Time Tasks

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

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

Contention-Free Executions for Real-Time Multiprocessor Scheduling

Tardiness Bounds under Global EDF Scheduling on a. Multiprocessor

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

Multiprocessor EDF and Deadline Monotonic Schedulability Analysis

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

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

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

Laxity dynamics and LLF schedulability analysis on multiprocessor platforms

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

The Rate-Based Execution Model

A New Task Model and Utilization Bound for Uniform Multiprocessors

arxiv: v1 [cs.os] 25 May 2011

2.1 Task and Scheduling Model. 2.2 Definitions and Schedulability Guarantees

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

Schedulability Analysis of the Linux Push and Pull Scheduler with Arbitrary Processor Affinities

arxiv: v1 [cs.os] 21 May 2008

Mitra Nasri* Morteza Mohaqeqi Gerhard Fohler

AS computer hardware technology advances, both

Rate-monotonic scheduling on uniform multiprocessors

Embedded Systems - FS 2018

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

2/5/07 CSE 30341: Operating Systems Principles

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

Uniprocessor real-time scheduling

Controlling Preemption for Better Schedulability in Multi-Core Systems

CycleTandem: Energy-Saving Scheduling for Real-Time Systems with Hardware Accelerators

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

On-line scheduling of periodic tasks in RT OS

Resource Sharing in an Enhanced Rate-Based Execution Model

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

Multiprocessor Scheduling of Age Constraint Processes

PASS: Priority Assignment of Real-Time Tasks with Dynamic Suspending Behavior under Fixed-Priority Scheduling

Load Regulating Algorithm for Static-Priority Task Scheduling on Multiprocessors

Task assignment in heterogeneous multiprocessor platforms

Design of Real-Time Software

The Partitioned Dynamic-priority Scheduling of Sporadic Task Systems

Supporting Intra-Task Parallelism in Real- Time Multiprocessor Systems José Fonseca

Multiprocessor Real-Time Scheduling Considering Concurrency and Urgency

Spare CASH: Reclaiming Holes to Minimize Aperiodic Response Times in a Firm Real-Time Environment

Probabilistic Preemption Control using Frequency Scaling for Sporadic Real-time Tasks

Bounding the End-to-End Response Times of Tasks in a Distributed. Real-Time System Using the Direct Synchronization Protocol.

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

FPCL and FPZL Schedulability Analysis

Transcription:

Deadline-driven scheduling Michal Sojka Czech Technical University in Prague, Faculty of Electrical Engineering, Department of Control Engineering November 8, 2017 Some slides are derived from lectures by Steve Goddard and James H. Anderson 1 / 29

Classification of scheduling algorithms (used in real-time systems) Scheduling algorithms Off-line scheduling (static, clock-driven) On-line scheduling (dynamic) Static-priority scheduling (VxWorks, SCHED_FIFO) Deadline-driven scheduling (EDF, ) General purpose OS scheduling (fair, interactive, ) 2 / 29

Note Terminology Deadline-driven scheduling is also referred to as dynamic-priority scheduling. Why dynamic priority? Historical name coming from implementations on top of fixed-priority schedulers. Deadline driven scheduling better reflects the nature of the algorithms. Differences against fixed-priority scheduling: Different jobs of the same tasks can have assigned different priority. Infinite number of priorities 3 / 29

Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 4 / 29

Earliest Deadline First (EDF) and its optimality Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 5 / 29

Earliest Deadline First (EDF) and its optimality Earliest Deadline First (EDF) scheduling Scheduler selects a job with earliest deadline (the job with earliest deadline has the highest priority ) From the programmers point of view (when dealing with CPU scheduling): On task creation, one specifies relative deadline (or period if D = T) rather than the priority. Job completion has to be explicitly announced to the scheduler. Scheduler is able to detect deadline misses and react appropriately (e.g. notify the application). 6 / 29

Earliest Deadline First (EDF) and its optimality EDF optimality Theorem (Liu, Layland) When preemption is allowed and jobs do not contend for resources, the EDF algorithm can produce a feasible schedule of a set T of independent jobs with arbitrary release times and deadlines on a processor if and only if T has feasible schedules. Notes: Applies even if tasks are not periodic. If periodic, a task s relative deadline can be less than its period, equal to its period, or greater than its period. Stronger claim that RM/DM optimality. 7 / 29

Earliest Deadline First (EDF) and its optimality Proof We show that any feasible schedule of jobs T can be systematically transformed to EDF schedule. Assume that parts of two jobs J i a J k are scheduled in non-edf order: J i J k r k Dk D i This can be easily resolved by swapping the jobs: J k J k J i Note that this operation cannot cause deadline miss. 8 / 29

Earliest Deadline First (EDF) and its optimality Proof (continued) By repeating this step, we get rid of all EDF order violations. Resulting schedule may still not be valid EDF schedule, because it can contain gaps even when some jobs were ready: J k J k J i These gaps can be easily eliminated by shifting the schedule ahead of time: J k J k J i 9 / 29

LRT, LLF and optimality Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 10 / 29

LRT, LLF and optimality Latest Release Time (LRT) algorithm It is sufficient when jobs finish right at the deadline. We will run them at the latest time possible to not miss deadline. EDF with time going backward the same optimality claim holds. 11 / 29

LRT, LLF and optimality Least Laxity First (LLF) scheduling Sometimes called least slack time first or minimum laxity first (Liu). Definition (slack, laxity) At any time t the slack (or laxity) of a job with deadline at D is equal D t x, where x is the remaining portion of the job. termín dokončení rezerva: 4 4 4 3 3 3 3 2 2 1 0 LLF scheduling: The job with the smallest laxity has highest priority at all times. 12 / 29

LRT, LLF and optimality LLF optimality Theorem When preemption is allowed and jobs do not contend for resources, the LLF algorithm can produce a feasible schedule of a set J of independent jobs with arbitrary release time times and deadlines on a processor if and only if J has feasible schedules. The proof is similar to that of EDF. Question: Which of EDF and LLF would be preferable in practice? 13 / 29

Utilization-based schedulability test Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 14 / 29

Utilization-based schedulability test Utilization-based schedulability test for (preemptive) EDF CZ: Test rozvrhnutelnosti pro EDF založený na zatížení Theorem (Liu, Layland) A system T of independent, preemptable, periodic tasks with relative deadlines equal to their periods can be feasibly scheduled (under EDF) on one processor if and only if its total utilization U is at most one. Proof: Implication in one direction is trivial: If U > 1, then it is obvious that some task has to miss its deadline. Let s focus on the opposite direction. 15 / 29

Utilization-based schedulability test Proof We want to show that U 1 T is schedulable. We will prove equivalent statement (contrapositive) T is not schedulable U > 1. Assume that T is not schedulable. Let τ i,k is the first job to miss the deadline. 16 / 29

Utilization-based schedulability test Proof (continued) As τ i,k misses the deadline, the demand placed on the processor by jobs with deadline less than r i,k+1 in the interval [t 1, r i,k+1 ) is greater than the available processor time in [t 1, r i,k+1 ]. Thus, r i,k+1 t 1 = available processor time in [t 1, r i,k+1 ] < < demand placed on the processor by jobs with D r i,k+1 = N = (number of jobs τ j s D j,x r i,k+1 and r j,x [t 1, r i,k+1 ])C j j=1 N ri,k+1 t 1 C j j=1 N j=1 T j r i,k+1 t 1 T j C j 17 / 29

Utilization-based schedulability test Proof (continued) So we have r i,k+1 t 1 < Canceling r i,k+1 t 1 yields N j=1 r i,k+1 t 1 T j C j 1 < N j=1 C j T j, i.e. This completes the proof. 1 < U, 18 / 29

EDF variants Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 19 / 29

EDF variants EDF with deadlines < period If deadlines are less than periods then U < 1 is no longer sufficient schedulability condition. This is easy to see. Consider two tasks such that, for both, C i = 1 a T i = 2. If both have deadlines at 1.0, then the system is not schedulable, even though U = 1. For these kinds of systems, we work with densities instead of utilizations. Definition The density of task τ k is defined as δ k = min(d k, T k ). The density of the system is defined as = δ k. C k k=1,...,n 20 / 29

EDF variants EDF with deadlines < period (continued) Theorem System T of independent, preemptible, periodic tasks can be feasibly scheduled on one processor if its density is at most one. Proof is similar to the one for the previous theorem. Note: This gives only sufficient condition. The next expression is called EDF schedulability condition. n k=1 C k min(d k, T k ) 1 21 / 29

EDF variants Proof on non-tightness Next example shows, why > 1 does not imply non-feasibility. Example Consider tasks τ 1 = (2, 0.6, 1) and τ 2 = (5, 2.3). = 0.6/1 + 2.3/5 = 1.06. Yet, the tasks can be feasibly scheduled by EDF: 22 / 29

EDF variants EDF in existing systems Real-Time threads 1 in MAC OS X are reported to use a variant of EDF. SCHED_DEADLINE scheduler in Linux: In mainline kernel since 3.14 (January 2014) Developed at SSSA, Pisa, Italy SCHED_DEADLINE tasks are scheduled before SCHED_FIFO tasks (have higher priority) SCHED_DEADLINE tasks have guaranteed bandwidth (see scheduling servers lecture) 1 http://developer.apple.com/library/mac/#documentation/darwin/ Conceptual/KernelProgramming/scheduler/scheduler.html 23 / 29

EDF variants SCHED_DEADLINE example (in Linux) void run_deadline(void data) { struct sched_attr attr; attr.size = sizeof(attr); attr.sched_flags = attr.sched_nice = attr.sched_priority = 0; / This creates a 10ms/30ms reservation / attr.sched_policy = SCHED_DEADLINE; attr.sched_runtime = 10 1000 1000; attr.sched_period = attr.sched_deadline = 30 1000 1000; sched_setattr(0, &attr, 0); while (!done) {... } } int main (int argc, char argv) { ^^Ipthread_t thread; ^^Ipthread_create(&thread, NULL, run_deadline, NULL); ^^I//... } 24 / 29

Comparison of EDF with FPS Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 25 / 29

Comparison of EDF with FPS Comparison of EDF and FPS (RM) Giorgio C. Buttazzo: Rate Monotonic vs. EDF: Judgment Day https://support.dce.felk.cvut.cz/psr/prednasky/3/rtsj05-rmedf.pdf Implementation: EDF is a bit simpler Overhead: EDF typically exhibits less number of preemptions lower overhead Overrun behavior (U > 1): Permanent: EDF automatic period rescaling, RM complete blocking of lower priority tasks Transient: Task overrun can cause deadline miss of EDF: arbitrary task RM: only lower priority task If we don t know which task will overrun, the result is the same. Jitter and latency: RM has no jitter only for the highest-priority task. In overall comparison, EDF provides better results (smaller release-time jitter a smaller input-output latency) Resource reservation: Simpler in case of EDF (see future lecture) 26 / 29

Multiprocessor Scheduling Outline 1 Earliest Deadline First (EDF) and its optimality 2 LRT, LLF and optimality 3 Utilization-based schedulability test 4 EDF variants 5 Comparison of EDF with FPS 6 Multiprocessor Scheduling 27 / 29

Multiprocessor Scheduling Multiprocessor Scheduling EDF scheduling for multiple processors is not optimal. 28 / 29

Multiprocessor Scheduling Multiprocessor Scheduling EDF scheduling for multiple processors is not optimal. So far we have talked about uni-processor scheduling. Nowadays, multi-core CPUs are common. Possible approaches to real-time multiprocessor scheduling: Partitioned scheduling each CPU is scheduled independently of the others (Linux, most RTOSes) Global scheduling single scheduler for all CPUs Clustered scheduling mixture of the above 29 / 29