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

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

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

ENGG4420 CHAPTER 4 LECTURE 3 GENERALIZED TASK SCHEDULER

Project 2 solution code

Real-Time and Embedded Systems (M) Lecture 4

GENERALIZED TASK SCHEDULER

CS510 Operating System Foundations. Jonathan Walpole

Clock-Driven Scheduling

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

Scheduling theory, part 1

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

Comp 204: Computer Systems and Their Implementation. Lecture 10: Process Scheduling

DEADLINE MONOTONIC ALGORITHM (DMA)

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

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

CPU Scheduling. Chapter 9

Reference model of real-time systems

Clock-Driven Scheduling

Periodic task scheduling

Motivation. Types of Scheduling

CHAPTER 4 CONTENT October :10 PM

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

CS 111. Operating Systems Peter Reiher

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

Advanced Types Of Scheduling

א א א א א א א א

Real-Time Systems. Modeling Real-Time Systems

CPU scheduling. CPU Scheduling

Operating System 9 UNIPROCESSOR SCHEDULING

CSC 553 Operating Systems

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

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

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

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

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

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

An Analytical Survey of Real Time System Scheduling Techniques

Real time scheduling for embedded systems

Scheduling Processes 11/6/16. Processes (refresher) Scheduling Processes The OS has to decide: Scheduler. Scheduling Policies

Real-Time Scheduler Design For Embedded System Domain

CS 143A - Principles of Operating Systems

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

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

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

Rate Monotonic Analysis

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

Uniprocessor Scheduling

Scheduling. CSE Computer Systems November 19, 2001

Exploiting Dynamic Workload Variation in Low Energy Preemptive Task Scheduling

CPU Scheduling (Chapters 7-11)

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

Chapter 9 Uniprocessor Scheduling

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

LOAD SHARING IN HETEROGENEOUS DISTRIBUTED SYSTEMS

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

Scheduling issues in mixedcriticality

CPU Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Unix Scheduler

Adaptive Total Bandwidth Server: Using Predictive Execution Time

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

The Design of SMART: A Scheduler for Multimedia Applications

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

Implementation and Evaluation of Multi-Mode Real-Time Tasks under Different Scheduling Algorithms

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

Performance Comparison of RTS Scheduling Algorithms

Lecture 11: Scheduling

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

Implementing a Predictable Real-Time. Multiprocessor Kernel { The Spring Kernel.

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - V CPU Scheduling - I. University at Buffalo.

Reading Reference: Textbook: Chapter 7. UNIX PROCESS SCHEDULING Tanzir Ahmed CSCE 313 Fall 2018

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)

DEADLINE SCHEDULING FOR REAL-TIME SYSTEMS. EDF and Related Algorithms

Operating Systems. Scheduling

Learning Module II: Real-Time Systems Design

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

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

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

CPU Scheduling Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University

Mode Change Protocols for Priority-Driven Preemptive Scheduling

A COMPARATIVE ANALYSIS OF SCHEDULING ALGORITHMS

CSE 451: Operating Systems Spring Module 8 Scheduling

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

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

SE350: Operating Systems. Lecture 6: Scheduling

Adaptive Communication Scheduling

Lecture 6: CPU Scheduling. CMPUT 379, Section A1, Winter 2014 February 5

CSE 5343/7343 Fall 2006 PROCESS SCHEDULING

Real-Time Scheduling Theory and Ada

The BEST Desktop Soft Real-Time Scheduler

CS 153 Design of Operating Systems Winter 2016

Principles of Operating Systems

September 30 th, 2015 Prof. John Kubiatowicz

Lecture 11: CPU Scheduling

Chapter 3: Planning and Scheduling Lesson Plan

Real-time System Overheads: a Literature Overview

Introduction to Operating Systems. Process Scheduling. John Franco. Dept. of Electrical Engineering and Computing Systems University of Cincinnati

Author's personal copy

Transcription:

Real Time Scheduling Process control plants, robotics, air traffic control, telecommunications Real Time Computing is defined as:- a type of computing where the correctness of the system depends not only on the logical result of the computation, but also on the time at which the results are produced Real Time Scheduling Scheduling the determination of the policies that decide which tasks execute when multiple tasks are ready to execute. A design concern, it fundamentally involves decisions that optimise the overall system performance according to some criteria. April 05 Real Time Scheduling 1 April 05 Real Time Scheduling 2 System designer decides on the scheduling approach Win 2000 is preemptive, swapping out low priority tasks when a higher priority becomes ready. In many embedded systems, hardware interrupts drive some tasks. Serial communication handled this way in Windows. Commonly Schedulers use a run-to-completion or a preemptive policy to control execution. Most common policies in RTS are preemptive. April 05 Real Time Scheduling 3 April 05 Real Time Scheduling 4 Two keys to good RT design are repeatability and predictability. Fighter aircraft require computers to manage the flight control surfaces. Frequent and timely updates to airfoil position and thrust application. A change that comes too late is no better than one that does not come at all. Pace makers A pulse to the heart just after there is a beat can induce fibrillation. Both these are a BAD THING RTS use one or more scheduling algorithm to control when a task begins and whether or not a task may be suspended during execution and prior to completion. April 05 Real Time Scheduling 5 April 05 Real Time Scheduling 6

Not a trivial thing. High priority tasks can be scheduled in isolation, but may be blocked from execution by lower priority tasks. Blocking is unavoidable in preemptive scheduling with shared resources. It must be bounded to identify worst case blocking. April 05 Real Time Scheduling 7 Key priorities ensuring that hard tasks complete or start by their deadline, and that as many soft tasks also complete or start by their deadline not fairness and minimum average response time most contemporary real-time systems designed to be as responsive as possible to real-time tasks when deadline approaches, the task is scheduled typically require deterministic response times in the range of milliseconds to sub milliseconds. April 05 Real Time Scheduling 8 Various alternatives to Round Robin Using priority driven non preemptive scheduler real-time task is added to head of queue to run after current if current is a slow low priority task, time is unacceptable if it is running at a critical time. There are better approaches:- April 05 Real Time Scheduling 9 Combine priority with clock based interrupts Preemption point occurs at regular intervals, lower priority preempted by higher. delays of milliseconds usually, may not be adequate for more demanding application. For demanding applications, use an immediate preemptive scheduler. OS responds to interrupt almost immediately. Unless system is in critical code lockout section April 05 Real Time Scheduling 10 The approach taken to scheduling depends on 1) does the system perform a schedulability analysis 2) if it does, is it done statically or dynamically 3) does the result of the analysis produce a schedule according to which tasks are dispatched at run time. The classes of algorithm available based on this Static table driven Static priority driven preemtive Dynamic planning Dynamic best effort April 05 Real Time Scheduling 11 April 05 Real Time Scheduling 12

Static Table Driven Applicable mainly to periodic tasks, this performs a static analysis of feasible schedules. Result is a schedule of dispatching. Input for analysis - periodic arrival times, execution time, periodic ending deadline, relative priority of tasks. The scheduler tries to develop schedule to meet all needs. April 05 Real Time Scheduling 13 Static Table Driven Is inflexible - any change to tasks requires schedule to be redone. Earliest Deadline first is an example of this type of scheduling algorithm. A set of tasks is schedulable if the sum of task loading is less than 100%. Not stable, if the load is above 100%, something fails, but can t predict what. April 05 Real Time Scheduling 14 Static Priority Driven Preemptive A static analysis is done, and the result is used to assign priorities to tasks. A traditional priority driven preemptive scheduler can then be used. Usually, in a real-time system, the priority is related to the time constraints on the tasks. Rate Monotonic scheduling assigns priorities based on their periods. Dynamic Planning Based Feasibility is determined at run-time rather than an offline analysis prior to the start of execution. An arriving task is accepted only if it is feasible to meet its time constraints. Requires constant reworking of the schedule to accommodate new tasks and existing ones. April 05 Real Time Scheduling 15 April 05 Real Time Scheduling 16 If a new task can be scheduled in without adverse affects (missed deadlines) to the existing tasks already scheduled, then the schedule is revised. Dynamic Best Effort There is no feasibility analysis. System tries to meet all deadlines and aborts any started process whose deadline is missed. April 05 Real Time Scheduling 17 A new task is assigned a priority based on the characteristics of task. It uses some form of deadline scheduling. Typically, the tasks are aperiodic and static scheduling is not possible. Until a deadline arrives or until a task is complete, do not know whether timing constraint will be met (major disadvantage). It is easier to implement than the others. April 05 Real Time Scheduling 18

Two main approaches:- Deadline & Rate Monotonic scheduling. Contemporary RT systems are designed to start the real-time tasks as rapidly as possible emphasise rapid interrupt handling and task dispatching. Most real-time apps are more concerned with completing/starting tasks at the most valuable times rather than speed. Must take into account dynamic resource demands and conflicts, processing overloads and hardware or software faults. Priorities alone will not be sufficient information for scheduling. April 05 Real Time Scheduling 19 April 05 Real Time Scheduling 20 No matter what approach is taken, some general information will be required:- ready time - when the task becomes ready for execution periodic task - (regular intervals) aperiodic task may know time in advance or become aware only when task becomes ready. Starting or completion deadline Processing time supply/measure Resources required Information about tasks priority - relative importance of the task hard real-time systems may have absolute priority fails if deadline is missed. If the system is to continue operation then the priority is supplied as a guide for the scheduler. subtask structure - task may be composed of mandatory task and optional task April 05 Real Time Scheduling 21 April 05 Real Time Scheduling 22 Deadline Scheduling Several considerations:- Which task to schedule next. What preemption is allowed. Can minimise the missed deadlines using certain preemption policies and scheduling tasks with earliest deadline (either starting or completion). Deadline Scheduling To preempt or not to preempt Makes sense notto preempt with starting deadlines specified. Task must block itself after completing mandatory or critical portion allowing other tasks starting deadlines to be met. Priority Driven Nonpreemptive Scheduler April 05 Real Time Scheduling 23 April 05 Real Time Scheduling 24

Preempt when completion deadlines are specified. May be possible to allow all tasks to meet deadlines in this way. Priority Driven Preemptive Scheduler (on preemption points) or an ImmediatePreemptive Scheduler. Example given below, with two tasks to collect and process data from two sensors A and B. April 05 Real Time Scheduling 25 April 05 Real Time Scheduling 26 By scheduling to give priority at any preemption point to earliest deadline all system requirements are met. The tasks are periodic and predictable can use static table driven scheduling approach. What about aperiodic tasks? April 05 Real Time Scheduling 27 April 05 Real Time Scheduling 28 Example:- Process Arrival Time Execution Time Starting Deadline A 10 20 110 B 20 20 20 C 40 20 50 D 50 20 90 E 60 20 70 April 05 Real Time Scheduling 29 April 05 Real Time Scheduling 30

If, always schedule ready task with EDF and let run to completion straightforward, but using this, B will be missed as A already started. Performance will improve if deadlines can be known in advance of ready time. Known as Earliest Deadline with unforced idle times:- April 05 Real Time Scheduling 31 ED Unforced Idle Time Always schedule eligible task with ED and allow it run to completion. The eligible task may not be ready. The processor will remain idle even though there are other ready processes. The processor may remain idle. The result is that even though maximum utilisation is not achieved, all scheduling requirements are met. April 05 Real Time Scheduling 32 Rate Monotonic Scheduling (RMS) A way to resolve the multitask scheduling conflicts for periodic tasks. Assigns priorities on the basis of a tasks period (shorter the period, higher the priority) Priority is determined at design time and remains fixed. It is a static/fixed scheduling policy. April 05 Real Time Scheduling 33 Can compute schedulability using a single utilisation bound for the entire set of tasks. Will the system meet all hard deadlies? C1 C2 C3 Cn n + + +... n(2 1) T T T T 1 2 3 C = Execution Time T = Period of a task Sum of Utilisations April 05 Real Time Scheduling 34 n 1 RMS assumes that the end of a tasks period is a hard deadline and that all tasks are preemptible at any time. If the condition is not met, a more detailed analysis must be performed. The upper bound converges to 69% as n approaches infinity. Not unusual for a utilisation of 90% to be set for schedulability guarantee. April 05 Real Time Scheduling 35 With known utilisations, requirements can determine if all tasks can be scheduled successfully. Even though it is possible to schedule more periodic tasks with EDF, RMS has been adopted because:- Performance difference is small in practice April 05 Real Time Scheduling 36

Most hard RE systems have soft RT components These can be executed at lower priority to absorb the processor idle time not used with RMS. Stability is easier to achieve with RMS Need to guarantee deadlines of essential tasks if all deadlines cannot be met. Can be done with RMS by structuring essential tasks to have short periods or modifying the RMS priorities to account for essential tasks. April 05 Real Time Scheduling 37