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

Similar documents
Real-time Systems: Scheduling Periodic Tasks

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

Real-Time Systems. Event-Driven Scheduling

There are three priority driven approaches that we will look at

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

Real-Time Systems. Event-Driven Scheduling

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

Embedded Systems Development

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

Andrew Morton University of Waterloo Canada

Real-Time Scheduling

Task Models and Scheduling

CIS 4930/6930: Principles of Cyber-Physical Systems

Clock-driven scheduling

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

Static priority scheduling

Aperiodic Task Scheduling

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

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

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

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

Real-Time Scheduling and Resource Management

Schedulability analysis of global Deadline-Monotonic scheduling

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

Networked Embedded Systems WS 2016/17

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

EDF Feasibility and Hardware Accelerators

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

Scheduling Algorithms for Multiprogramming in a Hard Realtime Environment

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

Multiprocessor EDF and Deadline Monotonic Schedulability Analysis

Embedded Systems 14. Overview of embedded systems design

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

Cyclic Schedules: General Structure. Frame Size Constraints

On-line scheduling of periodic tasks in RT OS

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

CPU SCHEDULING RONG ZHENG

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

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

CEC 450 Real-Time Systems

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #7: More on Uniprocessor Scheduling

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

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

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

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

Scheduling Slack Time in Fixed Priority Pre-emptive Systems

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

Schedulability of Periodic and Sporadic Task Sets on Uniprocessor Systems

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

Selected solutions for. TDDD07 Real-time Systems

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

A Utilization Bound for Aperiodic Tasks and Priority Driven Scheduling

Rate-monotonic scheduling on uniform multiprocessors

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

CSE 380 Computer Operating Systems

Multiprocessor Scheduling of Age Constraint Processes

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

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

Exam Spring Embedded Systems. Prof. L. Thiele

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

Deadline-driven scheduling

Task assignment in heterogeneous multiprocessor platforms

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

Lecture: Workload Models (Advanced Topic)

Real-Time Systems. LS 12, TU Dortmund

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

CEC 450 Real-Time Systems

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

A Dynamic Real-time Scheduling Algorithm for Reduced Energy Consumption

Multi-core Real-Time Scheduling for Generalized Parallel Task Models

The Partitioned Dynamic-priority Scheduling of Sporadic Task Systems

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

LSN 15 Processor Scheduling

Rate Monotonic Analysis (RMA)

Resource Sharing Protocols for Real-Time Task Graph Systems

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

Tardiness Bounds under Global EDF Scheduling on a Multiprocessor

A Framework for Automated Competitive Analysis of On-line Scheduling of Firm-Deadline Tasks

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

Semi-Partitioned Fixed-Priority Scheduling on Multiprocessors

An Optimal Real-Time Scheduling Algorithm for Multiprocessors

Uniprocessor real-time scheduling

Design of Real-Time Software

Multiprocessor Real-Time Scheduling Considering Concurrency and Urgency

The preemptive uniprocessor scheduling of mixed-criticality implicit-deadline sporadic task systems

TEMPORAL WORKLOAD ANALYSIS AND ITS APPLICATION TO POWER-AWARE SCHEDULING

Multi-core Real-Time Scheduling for Generalized Parallel Task Models

Scheduling Lecture 1: Scheduling on One Machine

Schedulability Analysis for the Abort-and-Restart Model

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

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017

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

Time and Schedulability Analysis of Stateflow Models

A 2-Approximation Algorithm for Scheduling Parallel and Time-Sensitive Applications to Maximize Total Accrued Utility Value

Scheduling Lecture 1: Scheduling on One Machine

Improved Deadline Monotonic Scheduling With Dynamic and Intelligent Time Slice for Real-time Systems

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

Component-Based Software Design

Transcription:

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

Lecture Outline Scheduling periodic tasks The rate monotonic algorithm Definition Non-optimality Time-demand analysis...!2

Scheduling Periodic Tasks Simplest real-time system: a set of n periodic tasks characterised by Ti = (φi, pi, ei, Di) for i = 1, 2,, n Simplified model: Ti = (pi, ei) when φi = 0 and Di = pi Tasks are independent, with no resource constraints Assume a single processor system There are no aperiodic or sporadic tasks Must schedule system to ensure all deadlines met What type of job scheduler is used? What scheduling algorithm is used? How to prove correctness of the schedule?!3

Job Schedulers Clock driven scheduler Decisions on what job execute made at specific time instants Usually regularly spaced, implemented using a periodic timer interrupt: scheduler awakes after each interrupt, schedules the job to execute for the next period, then sleeps until the next interrupt E.g. the furnace control example, with an interrupt every 100ms Primarily used for static systems, with schedule computed at design time and encoded as a fixed table Behaviour depends on algorithm used to assign jobs to time slots Priority driven scheduler Scheduler chooses what to run at job release or completion time, based on some notion of job priority; will always run a job, if one available Flexible, as scheduling decisions made at runtime, but hard to validate Behaviour depends on algorithm used to assign priorities to jobs!4

Scheduling Algorithms Wide range of scheduling algorithms used: Rate monotonic (RM) Deadline monotonic (DM) Earliest deadline first (EDF) Least slack time (LST)! Trade-off optimality, stability, and ease of validation!5

Proving Correctness of a Schedule A set of periodic tasks repeats after hyper-period, H = lcm(pi) for i = 1, 2,, n If the system can be scheduled for one hyper-period, it can be scheduled for all, given no aperiodic or sporadic tasks, and no resource constraints Can demonstrate correctness of schedule by exhaustive simulation, or using a mathematical proof of correctness! 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!6

The Rate Monotonic Algorithm Assign priorities to jobs in each task based on the period of that task Shorter period higher priority; rate (of job releases) is the inverse of the period, so jobs with higher rate have higher priority Rationale: schedule jobs with most deadlines first, fit others around them All jobs in a task have the same priority fixed priority algorithm! For example, consider a system of 3 tasks: T1 = (4, 1) rate = 1/4 T2 = (5, 2) rate = 1/5 T3 = (20, 5) rate = 1/20 Relative priorities: T1 > T2 > T3!7

Rate Monotonic: Example Time Ready to run Running 0 J 2,1 J 3,1 J 1,1 1 J 3,1 J 2,1 2 J 3,1 J 2,1 3 J 3,1 4 J 3,1 J 1,2 5 J 3,1 J 2,2 6 J 3,1 J 2,2 7 J 3,1 8 J 3,1 J 1,3 9 J 3,1 Time Ready to run Running 10 J 3,1 J 2,3 11 J 3,1 J 2,3 12 J 3,1 J 1,4 13 J 3,1 14 J 3,1 15 J 2,4 16 J 2,4 J 1,5 17 J 2,4 18 19 All tasks meet deadlines: proof by exhaustive simulation Low priority tasks (e.g., T 3 ) frequently preempted Released J 1,1 J 1,2 J 1,3 J 1,4 J 1,5 J 2,1 J 2,2 J 2,3 J 2,4 J 3,1 J 1,1 J 2,1 J 3,1 J 1,2 J 2,2 J 3,1 J 1,3 J 3,1 J 2,3 J 1,4 J 3,1 J 2,4 J 1,5 J 2,4 T 1 = (4, 1) T 2 = (5, 2) T 3 = (20, 5) 0 4 8 12 16 20!8

Rate Monotonic is Not Optimal Proof by counter-example: A system of two independent periodic tasks, T1 = (2, 1) and T2 = (5, 2.5), scheduled preemptively on a single processor: H = 10, U = 1.0 there is no slack time Rate monotonic fails to meet deadlines, EDF (discussed later) succeeds J2,1 misses deadline Deadlines J 1,1 J 1,2 J 1,3 J 1,4 J 1,5 J 2,1 J 2,2 RM J 1,1 J 2,1 J 1,2 J 2,1 J 1,3 J 2,1 J 2,2 J 1,4 J 2,2 J 1,5 J 2,2 EDF J 1,1 J 2,1 J 1,2 J 2,1 J 1,3 J 2,2 J 1,4 J 2,2 J 1,5 J 2,2 0 2 4 6 8 10!9

Time Demand Analysis Exhaustive simulation error prone and tedious an alternative is time demand analysis Fixed priority algorithms predictable; do not suffer scheduling anomalies The worst case execution time of the system occurs with the worst case execution time of the jobs, unlike dynamic priority algorithms which can exhibit anomalous behaviour Basis of general proof that system can be scheduled to meet all deadlines Find critical instants when system is most loaded, and has its worst response time Use time demand analysis to check if system can be scheduled at those instants In absence of scheduling anomalies, system will meet all deadlines if it can be scheduled at critical instants!10

Finding Critical Instants Critical instant of a job is the worst-case release time for that job, taking into account all jobs that have higher priority i.e., job is released at the same instant as all jobs with higher priority are released, and must wait for all those jobs to complete before it executes Response time, wi,k, of a job released at a critical instant is the maximum possible response time of that job Definition of a critical instant: if wi,k Di,k for every Ji,k in Ti then The job released at that instant has maximum response time of all jobs in Ti and Wi = wi,k All jobs meet deadlines, but this is when job with the slowest response is started else if Ji,k : wi,k > Di,k then The job released at that instant has response time > D where wi,k is the response time of the job If some jobs don t meet deadlines, this is one of those jobs!11

Finding Critical Instants: Example T 1 = (2.0, 0.6) T 2 = (2.5, 0.2) T 3 = (3.0, 1.2) 0 1 2 3 4 5 6 7 8 9 10 11 12 3 tasks scheduled using the rate-monotonic algorithm Response times of jobs in T 2 are: r 2,1 = 0.8, r 2,2 = 0.2, r 2,3 = 0.2, r 2,4 = 0.2, r 2,5 = 0.8, Therefore critical instants of T 2 are t = 0 and t = 10!12

Time-demand Analysis Simulate system behaviour at the critical instants For each job Ji,c released at a critical instant, if Ji,c and all higher priority tasks complete executing before their relative deadlines the system can be scheduled Compute the total demand for processor time by a job released at a critical instant of a task, and by all the higher-priority tasks, as a function of time from the critical instant; check if this demand can be met before the deadline of the job: Consider one task, Ti, at a time, starting highest priority and working down to lowest priority Focus on a job, Ji, in Ti, where the release time, t0, of that job is a critical instant of Ti At time t0 + t for t 0, the processor time demand wi(t) for Xi 1 t this job and all higher-priority jobs released in [t0, t] is: w i (t) is the time-demand function w i (t) =e i + k=1 p k e k Execution time of job J i Execution time of higher priority jobs started during this interval!13

Using the Time-demand Function Compare time-demand function, wi(t), and available time, t: If wi(t) t at some t Di, the job, Ji, meets its deadline, t0 + Di If wi(t) > t for all 0 < t Di then the task probably cannot complete by its deadline; and the system likely cannot be scheduled using a fixed priority algorithm Note that this is a sufficient condition, but not a necessary condition. Simulation may show that the critical instant never occurs in practice, so the system could be feasible! Use this method to check that all tasks are can be scheduled if released at their critical instants; if so conclude the entire system can be scheduled!14

Time-demand Analysis: Example w 3 (t) The time-demand, wi(t), is a staircase function with steps at multiples of higher priority task periods! 10 J 3,1 starts with a time demand of 5 units: 2 for itself, 2 for J 2,1, 1 for J 1,1 t w 2 (t) Plot the time-demand versus available time graphically, to get intuition into approach Example: a rate monotonic system T 1 = (3, 1), T 2 = (5, 2), T 3 = (10, 2) U = 0.933 Time-demand functions w 1 (t), w 2 (t) and w 3 (t) are below t at deadlines, so the system can be scheduled simulate the system to check this! Time-demand function, w i (t) 8 6 4 2 0 Deadline for J 2,1 Deadline for J 1,1 0 2 4 6 8 10 J 3,1 deadline w 1 (t) Time, t!15

Time-demand Analysis Works for any fixed-priority scheduling algorithm with periodic tasks where Di < pi for all tasks! Only a sufficient test: System can be scheduled if time demand less than time available before critical instants But, might be possible to schedule if time demand exceeds available time further validation (i.e., exhaustive simulation) needed in this case!16

Summary The real-time scheduling problem for periodic tasks The rate monotonic algorithm Simple, fixed-priority, algorithm Non-optimal Proofs of correctness of a schedule using exhaustive simulation and timedemand analysis! Next lecture: Alternative proofs of correctness for rate monotonic schedules Other algorithms: deadline monotonic, earliest deadline first, least slack time!17