Priority-Driven Scheduling of Periodic Tasks. Why Focus on Uniprocessor Scheduling?

Similar documents
ELC 4438: Embedded System Design Real-Time Scheduling

Lecture 6: Scheduling. Michael O Boyle Embedded Software

Lecture Note #4: Task Scheduling (1) EECS 571 Principles of Real-Time Embedded Systems. Kang G. Shin EECS Department University of Michigan

Clock-Driven Scheduling

Real-Time and Embedded Systems (M) Lecture 4

ENGG4420 CHAPTER 4 LECTURE 3 GENERALIZED TASK SCHEDULER

Lab: Response Time Analysis using FpsCalc Course: Real-Time Systems Period: Autumn 2015

Clock-Driven Scheduling

GENERALIZED TASK SCHEDULER

3. Scheduling issues. Common approaches /2. Common approaches /1. Common approaches / /17 UniPD / T. Vardanega 06/03/2017

2. Scheduling issues. Common approaches /2. Common approaches /1. Common approaches / /18 UniPD - T. Vardanega 14/03/2018

CHAPTER 4 CONTENT October :10 PM

DEADLINE MONOTONIC ALGORITHM (DMA)

Limited-preemptive Earliest Deadline First Scheduling of Real-time Tasks on Multiprocessors

Real Time Scheduling. Real Time Scheduling. Real-Time Scheduling. Scheduling

Tasks or processes attempt to control or react to external events occuring in real time RT processes must be able to keep up events

Scheduling theory, part 1

Periodic task scheduling

Introduction to Real-Time Systems. Note: Slides are adopted from Lui Sha and Marco Caccamo

Mode Change Protocols for Priority-Driven Preemptive Scheduling

ure Outline edulability tests for fixed-priority systems ctical factors nues from material in lecturee 5, with the same assumption

Dual Priority Scheduling: A Means of Providing Flexibility in Hard Real-time Systems.

Scheduling issues in mixedcriticality

Real-Time Scheduling Theory and Ada

Motivation. Types of Scheduling

CS510 Operating System Foundations. Jonathan Walpole

Energy Efficient Fixed-Priority Scheduling for Real-Time Systems on Variable Voltage Processors

Project 2 solution code

Lecture 11: Scheduling

Real-Time Systems. Modeling Real-Time Systems

Exploiting Dynamic Workload Variation in Low Energy Preemptive Task Scheduling

Limited Preemptive Real-time Scheduling on Multiprocessors. Abhilash Thekkilakattil

CPU SCHEDULING. Scheduling Objectives. Outline. Basic Concepts. Enforcement of fairness in allocating resources to processes

CSE 451: Operating Systems Spring Module 8 Scheduling

CPU Scheduling. Chapter 9

Real time scheduling for embedded systems

Intro to O/S Scheduling. Intro to O/S Scheduling (continued)

New Results for Lazy Bureaucrat Scheduling Problem. fa Sharif University of Technology. Oct. 10, 2001.

MAX PLANCK INSTITUTE FOR SOFTWARE SYSTEMS. Max Planck Institute for Software Systems (MPI-SWS) Germany

Preference-Oriented Fixed-Priority Scheduling for Real-Time Systems

Uniprocessor Scheduling

Co-scheduling Real-time Tasks and Non Real-time Tasks Using Empirical Probability Distribution of Execution Time Requirements.

CPU scheduling. CPU Scheduling

EEE499 - Real-Time Embedded System Design. Real-Time Schedulability Part I

CS 143A - Principles of Operating Systems

א א א א א א א א

CSC 553 Operating Systems

SE350: Operating Systems. Lecture 6: Scheduling

Schedulability Test for Soft Real-Time Systems under Multi- processor Environment by using an Earliest Deadline First Scheduling Algorithm Abstract

The Design of SMART: A Scheduler for Multimedia Applications

Adaptive Total Bandwidth Server: Using Predictive Execution Time

Dual Priority Algorithm to Schedule Real-Time Tasks in a Shared Memory Multiprocessor

Preemptive Scheduling of Multi-Criticality Systems with Varying Degrees of Execution Time Assurance

Reference model of real-time systems

Exact Speedup Factors for Linear-Time Schedulability Tests for Fixed-Priority Preemptive and Non-preemptive Scheduling

Author's personal copy

Asymptotic Analysis of Real-Time Queues

An Optimal Service Ordering for a World Wide Web Server

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

CPU Scheduling (Chapters 7-11)

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

Fixed-Priority Preemptive Multiprocessor Scheduling: To Partition or not to Partition

Chapter 6: CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. CPU Scheduler. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Operating System 9 UNIPROCESSOR SCHEDULING

Operating Systems. Scheduling

Energy Efficient Scheduler of Aperiodic Jobs for Real-time Embedded Systems

Chapter 9 Uniprocessor Scheduling

Mwave/OS: A Predictable Real-time DSP Operating System

Real-time System Overheads: a Literature Overview

Bounding Worst-Case Response Time for Tasks With Non-Preemptive Regions

Design and Implementation of LST Based Dynamic Scheduler on Real Time OS

SINGLE MACHINE SEQUENCING. ISE480 Sequencing and Scheduling Fall semestre

SEQUENCING & SCHEDULING

Technical Report CMU/SEI-89-TR-14 ESD-TR-89-; 022. Carnegie-Mellon University. Software Engineering Institute. Real-Time Scheduling Theory

Slack Assessment of the Real Time Scheduling Algorithms

Q1. What is Real time system? Explain the basic model of Real time system. (8)

SCHEDULING AND CONTROLLING PRODUCTION ACTIVITIES

CPU Scheduling. Disclaimer: some slides are adopted from book authors and Dr. Kulkarni s slides with permission

CSC 1600: Chapter 5. CPU Scheduling. Review of Process States

Enhancement in System Schedulability by Controlling Task Releases

This is a repository copy of Exact Speedup Factors for Linear-Time Schedulability Tests for Fixed-Priority Preemptive and Non-preemptive Scheduling.

Announcements. Program #1. Reading. Is on the web Additional info on elf file format is on the web. Chapter 6. CMSC 412 S02 (lect 5)

Network Flows. 7. Multicommodity Flows Problems. Fall 2010 Instructor: Dr. Masoud Yaghini

Advanced Types Of Scheduling

Rate Monotonic Analysis

CPU Scheduling. Jo, Heeseung

Mixed Criteria Packet Scheduling

Course Outline. Embedded Real Time Operating System Chin Fu Kuo National University of Kaohsiung 2009 Fall

CS 111. Operating Systems Peter Reiher

Model Based Design of Super Schedulers Managing Catastrophic Scenario in Hard Real Time Systems

Lecture 11: CPU Scheduling

Energy-Efficient Scheduling of Interactive Services on Heterogeneous Multicore Processors

Today s Papers. Composability is Essential. The Future is Parallel Software. EECS 262a Advanced Topics in Computer Systems Lecture 12

Implementation and Evaluation of Mixed-Criticality Scheduling Approaches for Sporadic Tasks

EDZL Schedulability Analysis in Real-Time Multicore Scheduling

Learning Module II: Real-Time Systems Design

Meeting End-to-End Deadlines Through Distributed Local Deadline Assignments

Preemptive Resource Management for Dynamically Arriving Tasks in an Oversubscribed Heterogeneous Computing System

SimSo: A Simulation Tool to Evaluate Real-Time Multiprocessor Scheduling Algorithms

Process Scheduling I. COMS W4118 Prof. Kaustubh R. Joshi hdp://

Transcription:

Priority-Driven Scheduling of Periodic asks Priority-driven vs. clock-driven scheduling: clock-driven: cyclic schedule executive processor tasks a priori! priority-driven: priority queue processor tasks Assumptions for now: tasks are periodic jobs are ready as soon as they are released preemption is allowed tasks are independent no aperiodic or sporadic tasks We will later: integrate aperiodic and sporadic tasks integrate resources etc. Why Focus on Uniprocessor Scheduling? Dynamic Multiprocessor Scheduling : tasks Static Multiprocessor Scheduling : tasks task assignment priority queue partn partn2 partn3 partn4 processors local priority queues Poor worst-case performance of priority-driven algorithms in dynamic environments. Difficulty in validating timing constraints.

Static-Priority vs. Dynamic Priority Static-Priority: "All jobs in task have same priority. Example: Rate-Monotonic: " " he shorter the period, the higher the priority. 2 5, 3, 3,, 5 3 2 Dynamic-Priority: "May assign different priorities to individual jobs. Example: Earliest-Deadline-First: " he nearer the absolute deadline, the higher the priority. here we break tie 2 is not preempted Example Algorithms Static-Priority: Rate-Monotonic RM: he shorter the period, the higher the priority. [Liu+Layland 73] Deadline-Monotonic DM: he shorter the relative deadline, the higher the priority. [Leung+Whitehead 82] For arbitrary relative deadlines, DM outperforms RM. Dynamic-Priority: EDF: Earliest-Deadline-First. LS: Least-Slack-ime-First. FIFO/LIFO etc. 2

Considerations about Priority Scheduling Question: What makes for a good scheduling algorithm? Def: [Schedulable Utilization] Every set of periodic tasks with total utilization less or equal than the schedulable utilization of an algorithm can be feasibly scheduled by that algorithm. wo observations:. he higher the schedulable utilization, the better the algorithm. 2. Schedulable utilization is always less or equal.0! Schedulable Utilization of FIFO Proof: heorem: U FIFO 0 "Given any utilization level ε > 0, we can find a task set, with utilization ε, that may not be feasibly scheduled according to FIFO. Example task set: p e e 2 p 2 3

Optimality of EDF for Periodic Systems heorem: EDF can feasibly schedule a system of independent preemptable tasks with relative deadlines equal to their periods iff their total utilization is less or equal. Proof: "only-if : "obvious "if : "show that if EDF fails to find feasible " " "schedule, then the total utilization must " " "exceed. Assumptions: At some time t, Job J i,c of ask i misses its deadline. WLOG: if more than one job have deadline t, break tie for J i,c. Optimality of EDF cont Case : "Current period of every task begins at or after r i,c. Case 2: "Current period of some task may start before r i,c. Case : 2 current period i r i,c r i,c +p i Current jobs other than J i,c do not execute before time t. J i,c misses deadline! 4

Optimality of EDF cont 2 Case 2: "Some current periods start before r i,c. Notation: " " : "Set of all tasks. " : "Set of tasks where current period starts before r i,c. "- : "Set of tasks where current period start at or after r i,c. φ 2 i r i,c r i,c +p i t l : "Last point in time before t when some current job in is executed. No current job is executed immediately after time t l. Why? ". All jobs in are done. " "2. Jobs in - not yet ready. t l t Case 2 cont What about assumption that processor never idle? forget this part same proof holds for this part t l Q.E.D. 5

What about Static Priority? Static-Priority is not optimal! Example: 2 2, 5,, 2. 5, 2 5 2 So: Why bother with static-priority? simplicity predictability J,3 must have lower priority than J 2,! Unpredictability of EDF Scheduling Over-running jobs in EDF hold on to their priorities Example,2 2,4 3 2,8 Normal Operation,2 2,4 3 2,8 3 over-runs by a bit more than one time unit 6

Unpredictability of EDF Scheduling II,2 2,4 3 2,8 3 over-runs for a bit longer...,2 2,4 3 2,8 he same situation using Rate-Monotonic Scheduling: high-priority tasks are protected Schedulability Bounds for Static-Priority Definition: A set of tasks is simply periodic if, for every pair of tasks, one period is multiple of another period. heorem: A system of simply periodic, independent, preemptable tasks whose relative deadlines are equal to their periods is schedulable according to RM iff their total utilization does not exceed 00%. Proof: "Assume i misses deadline at time t. "t is integer multiple of p i. "t is also integer multiple of p k, p k < p i. Utilization due to i highest-priority tasks ""> total time to complete jobs with deadline t : "If job of i misses deadline, then U i > U >. Q.E.D. 7

Schedulable Utilization of asks with D i p i with Rate-Monotonic Algorithm heorem: [Liu&Layland 73] A system of n independent, preemptable periodic tasks with D i p i can be feasibly scheduled by the RM algorithm if its total utilization U is less or equal to U RM n n2 /n -. Why not.0? Counterexample: 2 2, 5,, 2.5, 2 5 misses deadline! 2 Proof Outline: First, show that theorem is correct for special case where longest period p n <2p p shortest period. We will remove this restriction later. Proof of Liu&Layland General idea: "Find the most-difficult-to-schedule system of n "tasks among all difficult-to-schedule systems of "n tasks. Difficult-to-schedule : Fully utilizes processor for some time "interval. Any increase in execution time would "make system unschedulable. Most-difficult-to-schedule : system with lowest utilization among "difficult-to-schedule systems. Each of the following 4 steps brings us closer to this system. 8

Proof of Liu&Layland cont Step : Identify phases of tasks in most-difficult-to-schedule system. System must be in-phase. talk about this later Proof of Liu&Layland cont Step 2: Choose relationship between periods and execution times. Hypothesize that parameters of MDS system are thus related. Confine attention to first period of each task. asks keep processor busy until end of period p n. " " p 2 3 n- n p 2 p 3... p n- p n 9

Proof Liu&Layland cont Proof Liu&Layland cont Deviate the other way: " "Reduce execution time of some high-priority "tasks by ε: " " "Must increase execution time of some lower-" "priority task: 0

Proof Liu&Layland cont Define Find least upper bound on utilization: Set first derivative of U with respect to each of g i s to zero: for j,2,3,,n- Q.E.D. What about Period Ratios > 2? We show: ". "Every D--S task system with period ratio > 2 " " "can be transformed into D--S task system " " "with"period ratio < 2. " "2. "he total utilization of the task set decreases " " "during the transformation step. We can therefore confine search to systems with period ratio < 2. ransformation -> : Compare utilizations: Q.E.D.

hat Little Question about the Phasing... Definition: [Critical Instant] [Liu&Layland] If the maximum response time of all jobs in i is less than D, i then the job of i released in the critical instant has the maximum response time. [Baker] If the response time of some jobs in i exceeds D, i then the response time of the job released during the critical instant exceeds D. i heorem: In a fixed-priority system where every job completes before the next job in the same task is released, a critical instant of a task i occurs when one of its jobs J i,c is released at the same time with a job of every higher-priority task. Proof informal Assume: " "heorem holds for k < i. WLOG: " " k < i : φ k 0 ", and we look at J i, : Observation:" "he completion time of higher-priority jobs is " " "independent of the release time of J i,. herefore: " "he sooner J i, is released, the longer it has " " "to wait until it is completed. Q.E.D. 2

Proof 2 less informal WLOG: "min{φ k k,, i} 0 Observation:"Need only consider time processor is busy executing jobs in, 2,, i- before φ i. If processor idle or executes lower-priority jobs, ignore that portion of schedule and redefine the φ k s. " Let R i, be the response time for J i,. During [φ k, φ i +R i, ] a total of R i, + φ i - φ k / p k jobs of k become ready for execution. so time-demand analysis: and: Optimal Static-Priority Scheduling heorem: If a task set can be feasibly scheduled by some static-priority algorithm, it can be feasibly scheduled by DM. [J.Y.-.Leung, J. Whitehead, On the complexity of Fixed-Priority Scheduling of Periodic, Real-ime asks, Performance Evaluation 2, 982.] " Proof: Assume: "A feasible schedule S exists for a task set. he " "priority assignment is, 2,, n. " "For some k, we have D k > D k+. We show that we can swap the priority of k and k+ and the resulting schedule call it Sk remains feasible. 3

Optimality of DM: Proof II So, you want to swap the priority of k and k+?! Observation: Response time for each task other than k and k+ is the same in S and Sk. Observation: Response time of k+ in Sk must be smaller than in S, since k+ is not delayed by k in Sk. hus: Must prove that deadline of first invocation of k is also met in Sk. Critical Instant Let x be the amount of work done in S for all tasks in,..., k- during interval [0, d k+ ]. Note: Amount of work done in S and Sk for tasks in,..., k- is at most x during any interval of length d k+. We must have x + e k + e k+ d k+ Optimality of DM: ProofIII Observation: Number of invocations of k+ in Schedule Sk during interval [0, d k /d k+ *d k+ ] is at most d k /d k+. Observation: Amount of work for all tasks in,..., k- in the interval [0, d k /d k+ *d k+ ] is at most d k/d k+ *x. he following condition is sufficient ot guarantee that the deadline of the first request of k is met in Sk: d k /d k+ * x+e k+ + e k d k /d k+ * d k+ his, however, follows from inequality on previous page. qed 4

Why Utilization-Based ests? If no parameter ever varies, we could use simulation. But: Execution times may be smaller than e i Inter-release times may vary. ests are still robust. Useful as methodology to define execution times or periods. ime-demand Analysis Compute total demand on processor time of job released at a critical instant and by higher-priority tasks as function of time from the critical instant. Check whether demand can be met before deadline. Determine whether i is schedulable: Focus on a job in i, suppose release time is critical instant of i : " "w i t: "Processor-time demand of this job and all higher- " " "priority jobs released in t 0, t: his job in i meets its deadline if, for some " " " "t D i p i : w i t t If this does not hold, job cannot meet its deadline, and system of tasks is not schedulable by given static-priority algorithm. 5

6 Example wt t 2 4 6 8 0 2 4 w t 5. 0, 8 25., 7 5., 5, 3 4 3 2 Example wt t 2 4 6 8 0 2 4 w t w 2 t 5. 0, 8 25., 7 5., 5, 3 4 3 2

Example 2 3 4 3, 5, 7, 8,. 5. 25 0. 5 wt w 3 t w 2 t w t 2 4 6 8 0 2 4 t Example 2 3 4 3, 5, 7, 8,. 5. 25 0. 5 wt w 4 t w 3 t w 2 t w t 2 4 6 8 0 2 4 t 7

Practical Factors Non-Preemptable Portions * Self-Suspension of Jobs * Context Switches * Insufficient Priority Resolutions Limited Number of Distinct Priorities ime-driven Implementation of Scheduler ick Scheduling Varying Priorities in Fixed-Priority Systems Practical Factors I: Non-Preemptability Jobs, or portions thereof, may be non-preemptable. Definition: [non-preemptable portion] Let s denote by ρ I the largest non-preemptable portion of jobs in i. Definition: A job is said to be blocked if it is prevented from executing by lower-priority job. priority-inversion When testing schedulability of a task i, we must consider higher-priority tasks and non-preemptable portions of lower-priority tasks 8

Analysis with Non-Preemptable Portions Definition: he blocking time b i of ask i is the longest time by which any job of i can be blocked by lower-priority jobs: ime-demand function with blocking: Utilization bounds with blocking: " "test one task at a time: Non-Preemptability: Example 2 3 4, 5, 9,. 5 2 wt w 3 t time-demand function w 2 t w t 3 non-preemptible i.e. ρ 3 2 2 4 6 8 0 t 9

Practical Factors II: Self-Suspension Definition: Self-suspension of a job occurs when the job waits for an external operation to complete RPC, I/O operation. Assumption: "We know the maximum length of external "operation; i.e., " "the duration of self-suspension is bounded. Example: φ 0,p 4,e 2.5 self-suspension! 2 φ 2 3,p 2 7,e 2 2.0 Analysis: "b i SS : Blocking time of i due to self-suspension. b SS i max. self-suspension time of i + i k mine k, max. self-suspension time of k Self-Suspension with Non-Preemptable Portions Whenever job self-suspends, it loses the processor. When tries to re-acquire processor, it may be blocked by tasks in non-preemptable portions. Analysis: "b NP : i "Blocking time due to non-preemptable " " " "portions " "K : i "Max. number of self-suspensions " " "b : i "otal blocking time " " "b i b SS i + K i + b NP i 20

Practical Factors III: Context Switches Definition: [Job-level fixed priority assignment] In a job-level fixed priority assignment, each job is given a fixed priority for its entire execution. Case I: No self-suspension In a job-level fixed-priority system, each job preempts at most one other job. Each job therefore causes at most two context switches herefore: Add the context switch time twice to the execution time of job: "e i e i + 2 CS Case II: Self-suspensions can occur Each job suffers two more context switches each time it selfsuspends herefore: Add more context switch times appropriately: " " " "e i e i + 2 K i + CS 2