Scheduling Aperiodic and Sporadic Jobs in Priority- Driven Systems



Similar documents
4. Fixed-Priority Scheduling

Periodic Task Scheduling

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

Priority-Driven Scheduling

Aperiodic Task Scheduling

3. Scheduling issues. Common approaches /1. Common approaches /2. Common approaches / /13 UniPD / T. Vardanega 23/01/2013. Real-Time Systems 1

Resource Reservation & Resource Servers. Problems to solve

Module 6. Embedded System Software. Version 2 EE IIT, Kharagpur 1

Aperiodic Task Scheduling

Common Approaches to Real-Time Scheduling

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

Real-Time Scheduling (Part 1) (Working Draft) Real-Time System Example

Predictable response times in event-driven real-time systems

Commonly Used Approaches to Real-Time Scheduling

Real- Time Scheduling

Real-Time Scheduling 1 / 39

Real Time Scheduling Basic Concepts. Radek Pelánek

174: Scheduling Systems. Emil Michta University of Zielona Gora, Zielona Gora, Poland 1 TIMING ANALYSIS IN NETWORKED MEASUREMENT CONTROL SYSTEMS

Modular Real-Time Linux

Aperiodic Task Scheduling for Real-Time Systems. Brinkley Sprunt

Performance of Algorithms for Scheduling Real-Time Systems with Overrun and Overload

A Survey of Fitting Device-Driver Implementations into Real-Time Theoretical Schedulability Analysis

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings

Lecture 3 Theoretical Foundations of RTOS

The simple case: Cyclic execution

HARD REAL-TIME SCHEDULING: THE DEADLINE-MONOTONIC APPROACH 1. Department of Computer Science, University of York, York, YO1 5DD, England.

Operating System Aspects. Real-Time Systems. Resource Management Tasks

Implementing a General Real-Time Scheduling Framework in the RED-Linux Real-Time Kernel

Efficient Scheduling Of On-line Services in Cloud Computing Based on Task Migration

Improved Handling of Soft Aperiodic Tasks in Offline Scheduled Real-Time Systems using Total Bandwidth Server

Scheduling Real-time Tasks: Algorithms and Complexity

REAL TIME OPERATING SYSTEMS. Lesson-18:

CHAPTER 4: SOFTWARE PART OF RTOS, THE SCHEDULER

Partition Scheduling in APEX Runtime Environment for Embedded Avionics Software

6.6 Scheduling and Policing Mechanisms

The Design and Implementation of Real-Time Schedulers in RED-Linux

Scheduling of the Distributed Thread Abstraction with Timing Constraints using RTSJ

Load Balancing. Load Balancing 1 / 24

Real- Time Mul,- Core Virtual Machine Scheduling in Xen

Design and Implementation of Distributed Process Execution Environment

Efficient Scheduling of Sporadic, Aperiodic, and Periodic Tasks with Complex Constraints

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Online Scheduling for Cloud Computing and Different Service Levels

Quality of Service su Linux: Passato Presente e Futuro

Advanced Operating Systems (M) Dr Colin Perkins School of Computing Science University of Glasgow

Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H. Yarmand and Douglas G.

Enhancing the Monitoring of Real-Time Performance in Linux

Scheduling Single Machine Scheduling. Tim Nieberg

SOFTWARE VERIFICATION RESEARCH CENTRE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT. No Real-Time Scheduling Theory

Load Balancing and Switch Scheduling

Overview of the Linux Scheduler Framework

Analysis of a Production/Inventory System with Multiple Retailers

RT-Xen: Towards Real-time Hypervisor Scheduling in Xen

Real-Time Software. Basic Scheduling and Response-Time Analysis. René Rydhof Hansen. 21. september 2010

LAB 5: Scheduling Algorithms for Embedded Systems

Real-time scheduling algorithms, task visualization

Keywords: Dynamic Load Balancing, Process Migration, Load Indices, Threshold Level, Response Time, Process Age.

Exercises : Real-time Scheduling analysis

Real-Time Multi-Core Virtual Machine Scheduling in Xen

Discrete-Event Simulation

Quality of Service versus Fairness. Inelastic Applications. QoS Analogy: Surface Mail. How to Provide QoS?

CPU Scheduling. Multitasking operating systems come in two flavours: cooperative multitasking and preemptive multitasking.

Cloud Storage and Online Bin Packing

Real-Time Multi-Core Virtual Machine Scheduling in Xen

SOS: Software-Based Out-of-Order Scheduling for High-Performance NAND Flash-Based SSDs

How To Balance In A Distributed System

Profit Maximization and Power Management of Green Data Centers Supporting Multiple SLAs

Worst Case Analysis - Network Calculus

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

ECE 333: Introduction to Communication Networks Fall 2002

A Study on the Application of Existing Load Balancing Algorithms for Large, Dynamic, Heterogeneous Distributed Systems

Dimensioning an inbound call center using constraint programming

4.2: Multimedia File Systems Traditional File Systems. Multimedia File Systems. Multimedia File Systems. Disk Scheduling

Final Report. Cluster Scheduling. Submitted by: Priti Lohani

The Trip Scheduling Problem

Pull versus Push Mechanism in Large Distributed Networks: Closed Form Results

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Class constrained bin covering

Transcription:

Scheduling Aperiodic and Sporadic Jobs in Priority- Driven Systems Ingo Sander ingo@kth.se Liu: Chapter 7 IL2212 Embedded Software 1 Outline l System Model and Assumptions l Scheduling Aperiodic Jobs l Scheduling Sporadic Jobs IL2212 Embedded Software 2 1

Assumptions l Single Processor l Independent preemptable periodic tasks l Parameters of all periodic tasks are known l Periodic tasks meet their deadlines l Aperiodic and sporadic jobs are independent of each other l Parameters of sporadic jobs become known after release IL2212 Embedded Software 3 System Model Rejected Jobs In each queue jobs are sorted based on priority Sporadic Jobs Acceptance Test Aperiodic Jobs Processor Periodic Jobs IL2212 Embedded Software 4 2

Scheduling Algorithms l Aperiodic jobs l are always accepted l Scheduler tries to complete aperiodic jobs as soon as possible IL2212 Embedded Software 5 Scheduling Algorithms l Sporadic jobs l Scheduler decides, if job can be accepted or must be rejected l Job is accepted and scheduled, if all other scheduled jobs still meet their deadlines l Otherwise job is rejected IL2212 Embedded Software 6 3

Scheduling Algorithm l A scheduling algorithm is correct, if it only produces correct schedules of the system l A correct schedule is a schedule where periodic tasks and accepted sporadic tasks always meet their deadlines IL2212 Embedded Software 7 Optimality of Algorithms l An aperiodic job scheduling algorithm is optimal if it minimizes either l the response time of the aperiodic job at the head of the aperiodic job queue, or l the average response time of all the aperiodic jobs for the given queueing discipline IL2212 Embedded Software 8 4

Optimality of Algorithms l A sporadic job scheduling algorithm is optimal, if it l accepts each sporadic job newly offered to the system and schedules the job to complete in time if and only if the new job can be correctly scheduled in time by some means IL2212 Embedded Software 9 Scheduling Aperiodic Jobs l In the following several different algorithms to schedule aperiodic jobs are discussed l Assumption here: l No sporadic jobs IL2212 Embedded Software 10 5

Background Execution l Aperiodic jobs are only scheduled and executed at times, when there is no periodic or sporadic job ready for execution IL2212 Embedded Software 11 Background Execution T 1 = (3,1), T 2 = (10,4) T 1 0 3 6 9 T 2 0 3 6 9 Background A A 0.1 0.8 IL2212 Embedded Software 12 6

Background Execution l Advantage: simple algorithm l Disadvantage: aperiodic jobs are often executed very late l Possible improvement: slack stealing (as shown in chapter 5 for clock-driven systems) l slack stealing can greatly improve the performance, but is much more complex in priority-driven systems IL2212 Embedded Software 13 Periodic Server l A task that behaves more or less like a periodic task and is created to execute aperiodic jobs is called a periodic server l A periodic server is defined partially by execution time e S and period p S l The parameter e S is the execution budget of the server l The ratio u S = e S / p S is the size of the server IL2212 Embedded Software 14 7

Periodic Server l When the server is scheduled and executes aperiodic jobs, it consumes its budget at the rate of 1 per time unit l The budget is exhausted, when it reaches 0 l A time instant when the budget is replenished (reloaded) is called replenishment time IL2212 Embedded Software 15 Periodic Server l A periodic server is backlogged whenever the aperiodic job queue is non-empty l It is idle when the queue is empty l The server is eligible for execution only when it is backlogged and has non-zero budget IL2212 Embedded Software 16 8

Polling Server l A polling server (p s, e s ) is a periodic server l When executed, it executes an aperiodic job, if the aperiodic job queue is non-empty l Poller suspends execution or is suspended by the scheduler either l when it has executed for e s, or l when the aperiodic job queue becomes empty IL2212 Embedded Software 17 Polling Server l Consumption Rules l The budget is immediately consumed when the server is not scheduled l Replenishment Rules l The budget is replenished to e s at the beginning of each period l Example: Liu, Figure 7.2b, p.193 IL2212 Embedded Software 18 9

Polling Server T 1 = (3,1), T 2 = (10,4), Poller =(2.5, 0.5) Poller 0 2.5 5.3 9 T 1 0 3 6 9 T 2 0 3 6 9 0.8 A 0.1 IL2212 Embedded Software 19 Polling Server l Aperiodic jobs that arrive after the release time of the poller must wait until next polling period l Execution budget is not preserved l Simple to prove correctness IL2212 Embedded Software 20 10

Bandwidth-Preserving Servers l A bandwidth-preserving server is a periodic server l Compared to polling server bandwidth preserving servers try to preserve their budget when they are not executed l Additional rules for consumption and replenishment IL2212 Embedded Software 21 Bandwidth-Preserving Servers l A backlogged bandwidth-preserving server is ready for execution when it has budget l Scheduler keeps track of the consumption of the server budget l If budget is exhausted server becomes idle IL2212 Embedded Software 22 11

Bandwidth-Preserving Servers l Scheduler moves server back to ready queue, when budget is replenished and server is backlogged l If a new aperiodic job arrives an idle server becomes backlogged and is put into the ready queue when it has budget IL2212 Embedded Software 23 Deferrable Server l Simplest bandwidth preserving server l Consumption rule l The execution budget of the server is consumed at the rate of one unit per time whenever the server executes l Replenishment rule l The execution budget of the server is set to e s at multiples of its period l Server is not allowed to cumulate budget from period to period IL2212 Embedded Software 24 12

Deferrable Server (RMS) T DS = (3,1), T 1 = (2,3.5,1.5), T 2 =(6.5, 0.5) T DS 0 2.8 5.3 9 T 1 T 2 2 3 6 9 0 3 6 9 1.7 A Budget 2.8 1.0 0.5 IL2212 Embedded Software 25 Schedulability of Deferrable Servers l Time Demand Analysis can be used to determine whether all jobs remain schedulable in the presence of a deferrable server l Time Demand Function (if deferred server has highest priority) Blocking Server IL2212 Embedded Software 26 13

Deferrable Server Time Demand Analysis T DS = (3,1), T 1 = (2,3.5,1.5), T 2 =(6.5, 0.5) w 2 (t) 6 Time Demand 5 4 3 w 1 (t) y(t) = t Deferrable Server 2 1 0 1 2 3 4 5 6 7 8 Time IL2212 Embedded Software 27 Schedulability of Deferrable Servers l There is no known schedulability utilization that ensures the schedulability of a fixedpriority system in which a deferrable server is scheduled at an arbitrary priority l Some special cases are discussed in the book (Liu p.201) IL2212 Embedded Software 28 14

Limitations of Deferrable Servers l Deferrable servers may be scheduled longer than its execution time in a time interval as long as its period l Lower priority task may be delayed longer by a deferrable server than by a periodic task with same period and execution time Deferrable server does not behave as a periodic task IL2212 Embedded Software 29 Sporadic Server l Bandwidth preserving server l More complex consumption and replenishment rules ensure that each sporadic server with period p s and budget e s never demands more processor time than the periodic task (p s, e s ) in any time interval IL2212 Embedded Software 30 15

A simple Fixed-Priority Sporadic Server l Definitions (Liu p.205) l t r denotes the latest actual replenishment time l t f denotes the first instant after t r at which the server begins to execute l t e denotes the latest effective replenishment time IL2212 Embedded Software 31 A simple Fixed-Priority Sporadic Server l Definitions (Liu p.205) l At any time t, BEGIN is the beginning instant of the earliest busy interval among the latest contiguous sequence of busy intervals of the higher priority subsystem T H that started before t l END is the end of the latest busy interval in the above defined sequence if this interval ends before t and equal to its infinity if the interval ends after t l Server Busy Interval: Begins when an aperiodic job arrives at an empty aperiodic job queue and ends when the queue becomes empty again IL2212 Embedded Software 32 16

Fixed-Priority Simple Sporadic Server l Consumption Rules (Liu p.206) l At any time t after t r, the server s execution budget is consumed at the rate of 1 per unit time until the budget is exhausted when either one of the following to conditions are true. When these conditions are not true, the server holds its budget l C1 The server is executing l C2 The server has executed since t r and END < t IL2212 Embedded Software 33 Fixed-Priority Simple Sporadic Server l l l Replenishment Rules (Liu p.206) R1 Initially when the system begins execution and each time when the budget is replenished, the execution budget = e s, and t r = the current time R2 At time t f, if END = t f, t e = max(t r, BEGIN). If END < t f, t e = t f. The next replenishment time is set at t e + p s IL2212 Embedded Software 34 17

Fixed-Priority Simple Sporadic Server l l Replenishment Rules (Liu p.206) R3 The next replenishment occurs at the next replenishment time, except under the following conditions. Under these conditions, replenishment is done at times stated below a) If the next replenishment time t e + p s is earlier than t f, the budget is replenished as soon as it is exhausted b) If the system T becomes idle before the next replenishment time t e + p s and becomes busy again at t b, the budget is replenished at min(t e + p s, t b ) IL2212 Embedded Software 35 Simple Fixed-Priority Sporadic Server l Example: Liu, Figure 7-8, p.207 IL2212 Embedded Software 36 18

Simple Fixed-Priority Sporadic Server - Example T 1 = (3,0.5), T 2 = (4,1), T 3 = (19,4.5) T S =(5, 1.5) T 1 T 2 T S T 3 0 3 6 9 12 15 18 21 24 1.0 2.0 2.0 A1 A2 A3 Budget 3 7 15.5 1.5 1.0 0.5 C1 C1 C2 C1 C1 C2 C1 C1 C1 C2 C2 0 3 6 9 12 15 18 21 24 IL2212 Embedded Software 37 Simple Fixed-Priority Sporadic Server - Example t t r t f t e BEGIN END 3.5 0 3.5 3 3 3.5 R2: t e = max(0,3.0) => t + r = t e + t s = 8.0 3.5 5.0 C1: Server executes C2: Queue Empty, higher priority jobs idle 8 R3: Replenishment 9.5 8 9.5 3 8 9.5 R2: t e = max(8,8) => t + r = t e + t s = 13.0 IL2212 Embedded Software 38 19

Simple Fixed-Priority Sporadic Server - Example t t r t f t e BEGIN END 13.5 13 13.5 13 12 13.5 R2: t e = max(13,12) => t + r = t e + t s = 18.0 13.5 System T idle! R3b: t r + = min(t e + p s, t b )= 15.0, since system (T 1 ) becomes busy at 15 15.5 15 15.5 15 15.5 R2: t e = max(15,15) => t + r = t e + t s = 20.0 18.5 System T idle! R3b: t r + = min(t e + p s, t b )= 19.0, since system (T 3 ) becomes busy at 19 IL2212 Embedded Software 39 Fixed-Priority Sporadic Server l Sporadic server is more complex than polling or deferrable servers due to more complex consumption and replenishment rules l Main advantage: schedulability easy to demonstrate l A sporadic server can be treated like a periodic task when we check for schedulability l System with sporadic server may be schedulable while the corresponding deferrable server is not l More complex sporadic servers exist (Liu: 7.3.2) IL2212 Embedded Software 40 20

Sporadic Dynamic-Priority Servers l Sporadic servers can also be used for dynamic-priority (deadline-driven) systems l Rules have to be adapted to EDF or LST l Also here sporadic server can be treated as normal task for schedulability analysis IL2212 Embedded Software 41 Other Bandwidth Preserving Servers l Other bandwidth preserver algorithms are based on general processor sharing (GPS) algorithms (deadline-driven algorithms) l Examples: l Constant utilization server l Total bandwidth server l Weighted round-robin server l Exact functionality not discussed in course, instead see Liu: 7.4 IL2212 Embedded Software 42 21

Scheduling Sporadic Jobs l Sporadic jobs l Scheduler decides, if job can be accepted or must be rejected l Job is accepted and scheduled, if all other scheduled jobs still meet their deadlines l Otherwise job is rejected l Sporadic job is denoted by S i (r i, d i, e i ) IL2212 Embedded Software 43 Acceptance Test in Fixed- Priority System l Sporadic server can be used to execute sporadic jobs in a fixed-priority system l The sporadic server (p s, e s ) has e s units of processor time every p s units of time IL2212 Embedded Software 44 22

Acceptance Test in Fixed- Priority Systems l For each new sporadic job S (r, d, e) it must be checked, if l new job can be scheduled together with the sporadic jobs that have deadline before d l sporadic jobs with deadline larger or equal to d can still be scheduled l Acceptance test is quite complex, but may still be feasible for many systems IL2212 Embedded Software 45 Acceptance Test in Fixed- Priority Systems l Accepted sporadic jobs are ordered among themselves on EDF basis l For the first sporadic job S 1 (t, d s,1,e s.1 ) the server has at least floor((d s,1 t)/p s ) e s units of processor time available l Thus first job is accepted, if the slack of the job σ s,1 (t) = floor((d s,1 t)/p s ) e s e s,1 is larger than or equal to 0. IL2212 Embedded Software 46 23

Acceptance Test in Fixed- Priority Systems l When there are already n accepted sporadic jobs in the system, the scheduler computes the slack σ s,i of S i according to where ξ s,k is the execution time of the completed portion of the sporadic job S k IL2212 Embedded Software 47 Acceptance Test in Fixed- Priority Systems l If the slack σ s,i for the new sporadic job is not less than 0, we have to check, if all accepted jobs can still meet their deadline l For each sporadic job S k which has an equal or later deadline the S i we have to check, if the slack σ s,k is larger than the execution time of the new sporadic job e s,i l The new sporadic job is only accepted, if this is the case for all accepted sporadic jobs IL2212 Embedded Software 48 24

Summary l Servers can be used for the efficient scheduling of aperiodic and sporadic jobs l Servers have consumption and replenishment rules, which can be arbitrarily complex l Implementation overhead can be significant IL2212 Embedded Software 49 25