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



Similar documents
Commonly Used Approaches to Real-Time Scheduling

Common Approaches to Real-Time Scheduling

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

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

Priority-Driven Scheduling

Aperiodic Task Scheduling

Scheduling Aperiodic and Sporadic Jobs in Priority- Driven Systems

Lecture 3 Theoretical Foundations of RTOS

ICS Principles of Operating Systems

Real Time Scheduling Basic Concepts. Radek Pelánek

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

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

Real-Time Scheduling 1 / 39

Operating Systems. III. Scheduling.

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

4. Fixed-Priority Scheduling

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

CPU Scheduling. CPU Scheduling

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

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

CPU Scheduling Outline

Operating Systems, 6 th ed. Test Bank Chapter 7

Operating Systems Concepts: Chapter 7: Scheduling Strategies

OPERATING SYSTEMS SCHEDULING

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

Processor Scheduling. Queues Recall OS maintains various queues

Periodic Task Scheduling

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

W4118 Operating Systems. Instructor: Junfeng Yang

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

Today. Intro to real-time scheduling Cyclic executives. Scheduling tables Frames Frame size constraints. Non-independent tasks Pros and cons

Scheduling Sporadic Tasks with Shared Resources in Hard-Real-Time Systems

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

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

Chapter 5 Process Scheduling

REAL TIME OPERATING SYSTEMS. Lesson-10:

Predictable response times in event-driven real-time systems

Real-time scheduling algorithms, task visualization

CPU Scheduling. Core Definitions

Today s topic: So far, we have talked about. Question. Task models

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

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

Time Management II. June 5, Copyright 2008, Jason Paul Kazarian. All rights reserved.

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Job Scheduling Model

REAL TIME OPERATING SYSTEMS. Lesson-18:

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

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

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

Comparison between scheduling algorithms in RTLinux and VxWorks

Introduction. Scheduling. Types of scheduling. The basics

Overview of Presentation. (Greek to English dictionary) Different systems have different goals. What should CPU scheduling optimize?

Aperiodic Task Scheduling

Operating System: Scheduling

OS OBJECTIVE QUESTIONS

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

Scheduling. Monday, November 22, 2004

Exercises : Real-time Scheduling analysis

Operating Systems Lecture #6: Process Management

Classification - Examples

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

Operating System Tutorial

The simple case: Cyclic execution

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

Task Attribute-Based Scheduling - Extending Ada s Support for Scheduling

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

PROCESS SCHEDULING ALGORITHMS: A REVIEW

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Scheduling Real-time Tasks: Algorithms and Complexity

Earliest Due Date (EDD) [Ferrari] Delay EDD. Jitter EDD

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of Real-Time Systems

Real- Time Scheduling

Linux Process Scheduling Policy

International Journal of Computer Science Trends and Technology (IJCST) Volume 2 Issue 4, July-Aug 2014

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

Threads Scheduling on Linux Operating Systems

Master thesis. Title: Real-Time Scheduling methods for High Performance Signal Processing Applications on Multicore platform

Resource Reservation & Resource Servers. Problems to solve

Performance Comparison of RTOS

Integrating job parallelism in real-time scheduling theory

CPU Scheduling 101. The CPU scheduler makes a sequence of moves that determines the interleaving of threads.

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

W4118 Operating Systems. Instructor: Junfeng Yang

LAB 5: Scheduling Algorithms for Embedded Systems

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

Multi-core real-time scheduling

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

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

6.6 Scheduling and Policing Mechanisms

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

Real-Time Scheduling Strategy for Wireless Sensor Networks O.S

Partition Scheduling in APEX Runtime Environment for Embedded Avionics Software

EECS 750: Advanced Operating Systems. 01/28 /2015 Heechul Yun

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

Transcription:

Overview of Real-Time Scheduling Embedded Real-Time Software Lecture 3

Lecture Outline Overview of real-time scheduling algorithms Clock-driven Weighted round-robin Priority-driven Dynamic vs. static Deadline scheduling: EDF and LST Validation Outline relative strengths, weaknesses Material corresponds to chapter 4 of Liu s book 2

Approaches to Real-Time Scheduling Different classes of scheduling algorithm used in real-time systems: Clock-driven Primarily used for hard real-time systems where all properties of all jobs are known at design time, such that offline scheduling techniques can be used Weighted round-robin Primarily used for scheduling real-time traffic in high-speed, switched networks Priority-driven Primarily used for more dynamic real-time systems with a mix of timebased and event-based activities, where the system must adapt to changing conditions and events Look at the properties of each in turn 3

Clock-Driven Scheduling Decisions about what jobs execute when are made at specific time instants These instants are chosen before the system begins execution Usually regularly spaced, implemented using a periodic timer interrupt Scheduler awakes after each interrupt, schedules the job to execute for the next period, then blocks itself until the next interrupt E.g. the helicopter example with an interrupt every 1/180 th of a second E.g. the furnace control example, with an interrupt every 100ms Typically in clock-driven systems: All parameters of the real-time jobs are fixed and known A schedule of the jobs is computed off-line and is stored for use at runtime; as a result, scheduling overhead at run-time can be minimized Simple and straight-forward, not flexible [Will discuss in more detail in lecture 4] 4

Weighted Round-Robin Scheduling Regular round-robin scheduling is commonly used for scheduling time-shared applications Every job joins a FIFO queue when it is ready for execution When the scheduler runs, it schedules the job at the head of the queue to execute for at most one time slice Sometimes called a quantum typically O(tens of ms) If the job has not completed by the end of its quantum, it is preempted and placed at the end of the queue When there are n ready jobs in the queue, each job gets one slice every n time slices (n time slices is called a round) Only limited use in real-time systems 5

Weighted Round-Robin Scheduling In weighted round robin each job J i is assigned a weight w i; the job will receive w i consecutive time slices each round, and the n duration of a round is wi å i = 1 Equivalent to regular round robin if all weights equal 1 Simple to implement, since it doesn t require a sorted priority queue Partitions capacity between jobs according to some ratio Offers throughput guarantees Each job makes a certain amount of progress each round 6

Weighted Round-Robin Scheduling By giving each job a fixed fraction of the processor time, a roundrobin scheduler may delay the completion of every job A precedence constrained job may be assigned processor time, even while it waits for its predecessor to complete; a job can t take the time assigned to its successor to finish earlier Not an issue for jobs that can incrementally consume output from their predecessor, since they execute concurrently in a pipelined fashion E.g. Jobs communicating using Unix pipes E.g. Wormhole switching networks, where message transmission is carried out in a pipeline fashion and a downstream switch can begin to transmit an earlier portion of a message, without having to wait for the arrival of the later portion Weighted round-robin is primarily used for real-time networking; will discuss more in lecture 17 7

Priority-Driven Scheduling Assign priorities to jobs, based on some algorithm Make scheduling decisions based on the priorities, when events such as releases and job completions occur Priority scheduling algorithms are event-driven Jobs are placed in one or more queues; at each event, the ready job with the highest priority is executed The assignment of jobs to priority queues, along with rules such a whether preemption is allowed, completely defines a priority scheduling algorithm Priority-driven algorithms make locally optimal decisions about which job to run Locally optimal scheduling decisions are often not globally optimal Priority-driven algorithms never intentionally leave any resource idle Leaving a resource idle is not locally optimal 8

Example: Priority-Driven Scheduling Consider the following task: Jobs J 1, J 2,, J 8, where J i had higher priority than J k if i < k Jobs are scheduled on two processors P 1 and P 2 Jobs communicate via shared memory, so communication cost is negligible The schedulers keep one common priority queue of ready jobs Schedulers Preemptable scheduling decisions are made whenever some job becomes ready for execution or a job completes Non-preemptable scheduling decision are delayed until a running job completes. 9

Example: Priority-Driven Scheduling Time Not yet released Released but not yet ready to run Ready to run P1 P2 Completed 0 J5 J3, J4, J6, J8 J7 J1 J2 1 J5 J4, J6, J8 J7 J1 J3 J2 2 J5 J4, J6, J8 J7 J1 J3 J2, J1, J3 3 J5 J6, J8 J4 J7 J2, J1, J3 4 J6, J8 J7 J4 J5 J2, J1, J3 5 J6, J8 J7 J5 J2, J1, J3, J4 6 J7 J2, J1, J3, J4, J5 7 J7 J2, J1, J3, J4, J5 8 J6 J8 J2, J1, J3, J4, J5, J7 9 J6 J2, J1, J3, J4, J5, J7, J8 10 J6 J2, J1, J3, J4, J5, J7, J8 11 J6 J2, J1, J3, J4, J5, J7, J8 12 J2, J1, J3, J4, J5, J7, J8, J6 10

Example: Priority-Driven Scheduling Note: The ability to preempt lower priority jobs slowed down the overall completion of the task This is not a general rule, but shows that priority scheduling results can be nonintuitive Different priority scheduling algorithms can have very different properties Tracing execution of jobs using tables is an effective way to demonstrate correctness for systems with periodic tasks and fixed timing constraints, execution times, resource usage Show that the system enters a repeating pattern of execution, and each hyperperiod of that pattern meets all deadlines Proof by exhaustive simulation Provided the system has a manageably small number of jobs 11

Priority-Driven Scheduling Most scheduling algorithms used in non real-time systems are priority-driven First-In-First-Out Last-In-First-Out Shortest-Execution-Time-First Longest-Execution-Time-First Real-time priority scheduling assigns priorities based on deadline or some other timing constraint: Earliest deadline first Least slack time first Etc. Assign priority based on release time Assign priority based on execution time 12

Priority Scheduling Based on Deadlines Earliest deadline first (EDF) Assign priority to jobs based on deadline Earlier the deadline, higher the priority Simple, just requires knowledge of deadlines Least Slack Time first (LST) A job J i has deadline d i, execution time e i, and was released at time r i At time t < d i: Remaining execution time t rem = e i - (t r i) e i t REM Slack time t slack = d i t t rem Assign priority to jobs based on slack time, t slack The smaller the slack time, the higher the priority More complex, requires knowledge of execution times and deadlines Knowing the actual execution time is often difficult a priori, since it depends on the data, need to use worst case estimates ( poor performance) r i t d i 13

Optimality of EDF and LST These algorithms are optimal i.e. they will always produce a feasible schedule if one exists Constraints: on a single processor, as long as preemption is allowed and jobs do not contend for resources 14

Optimality of EDF and LST: Proof 1. Any feasible schedule can be transformed into an EDF schedule If J i is scheduled to execute before J k, but J i s deadline is later than J k s either: The release time of J k is after the J i completes they re already in EDF order The release time of J k is before the end of the interval in which J i executes: Swap J i and J k (this is always possible, since J i s deadline is later than J k s) Move any jobs following idle periods forward into the idle period the result is an EDF schedule 2. So, if EDF fails to produce a feasible schedule, no feasible schedule exists If a feasible schedule existed it could be transformed into an EDF schedule, contradicting the statement that EDF failed to produce a feasible schedule [Proof for LST is similar] 15

Non-Optimality of EDF and LST Neither algorithm is optimal if jobs are non-preemptable or if there is more than one processor The book has examples which demonstrate EDF and LST producing infeasible schedules in these cases This includes non-strict LST scheduling (scheduling decisions made only when jobs release or complete) Proof-by-counterexample Non-preemptible: J 1 (0,3,10) J 2 (2,6,14) J 3 (4,4,12) 0 2 4 6 8 10 12 14 0 2 4 6 8 10 12 14 J 1 J 1 J 2 J 2 Missed deadline by non-preemptible EDF J3 J 3 No missed deadline by preemptible non-edf Multi-processor: J 1 (0,1,1), J 2 (0,1,2), J 3 (0,5,5) on two processors Show the EDF generates a non-optimal scheduling on multi-processors 16

EDF and LST EDF and LST are simple priority-driven scheduling algorithms; introduced to show how we can reason about such algorithms Lectures 5-8 discuss other priority-driven scheduling algorithms 17

Dynamic vs. Static Systems If jobs are scheduled on multiple processors, and a job can be dispatched from the priority run queue to any of the processors, the system is dynamic A job migrates if it starts execution on one processor and is resumed on a different processor If jobs are partitioned into subsystems, and each subsystem is bound statically to a processor, we have a static system Expect static systems to have inferior performance (in terms of overall response time of the jobs) relative to dynamic systems But it is possible to validate static systems, whereas this is not always true for dynamic systems For this reason, most hard real time systems are static 18

Effective Release Times and Deadlines Sometimes the release time of a job may be later than that of its successors, or its deadline may be earlier than that specified for its predecessors This makes no sense: derive an effective release time or effective deadline consistent with all precedence constraints, and schedule using that Effective release time If a job has no predecessors, its effective release time is its release time If it has predecessors, its effective release time is the maximum of its release time and the effective release times of its predecessors Effective deadline If a job has no successors, its effective deadline is its deadline It if has successors, its effective deadline is the minimum of its deadline and the effective deadline of its successors 19

Effective Release Times and Deadlines Note: definition of effective deadline does not take into account execution time of successor jobs Would be more accurate, and needs to be done on multiprocessor systems But: unnecessary on single processor with preemptable jobs Feasible to schedule any set of jobs according to their actual release times and deadline, iff feasible to schedule according to effective release times and deadlines Ignore precedence constraints, schedule using effective release times and deadlines as if all jobs independent Resulting schedule might meet deadlines but not precedence constraints If so, always possible to swap order of jobs within the schedule to meet deadlines and precedence constraints 20

Validating Priority-Driven Scheduling Priority-driven scheduling has many advantages over clock-driven scheduling Better suited to applications with varying time and resource requirements, since needs less a priori information Run-time overheads are small But not widely used until recently, since difficult to validate Scheduling anomalies can occur for multiprocessor or non-preemptable systems, or those which share resources Reducing the execution time of a job in a task can increase the total response time of the task (see book for example) Not sufficient to show correctness with worse-case execution times, need to simulate with all possible execution times for all jobs comprising a task Can be proved that anomalies do not occur for independent, preemptable, jobs with fixed release times executed using any priority-driven scheduler on a single processor Various stronger results exist for particular priority-driven algorithms 21

Summary Have outlined different approaches to scheduling: Clock-driven Weighted round-robin Priority-driven and some of their constraints 22