CS4514 Real Time Scheduling

Similar documents
Real-time operating systems and scheduling

Schedulability with resource sharing. Priority inheritance protocol Priority ceiling protocol Stack resource policy

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

What s an Operating System? Real-Time Operating Systems. Cyclic Executive. Do I Need One? Handling an Interrupt. Interrupts

Introduction to Embedded Systems

1.1 CPU I/O Burst Cycle

Microkernel/OS and Real-Time Scheduling

Concurrent activities in daily life. Real world exposed programs. Scheduling of programs. Tasks in engine system. Engine system

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

Overview of Scheduling a Mix of Periodic and Aperiodic Tasks

Event-Driven Scheduling. (closely following Jane Liu s Book)

Computer Systems Assignment 4: Scheduling and I/O

Fault tolerant scheduling in real time systems

Overview. Sporadic tasks. Recall. Aperiodic tasks. Real-time Systems D0003E 2/26/2009. Loosening D = T. Aperiodic tasks. Response-time analysis

Multiprocessor and Real-Time Scheduling. Chapter 10

Aperiodic Task Scheduling

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

Reference Model and Scheduling Policies for Real-Time Systems

Real-Time Architectures 2004/2005

Operating Systems and Networks Assignment 9

CSE 4/521 Introduction to Operating Systems

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Furious activity is no substitute for understanding. -- H. H. Williams. Chapter 4. Scheduling P1 T4 T5

1.1 Explain the difference between fast computing and real-time computing.

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

CEC 450 Real-Time Systems

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones

Practice Exercises 305

Comparison of scheduling in RTLinux and RT-Mach Fredrik Löfgren frelo305 Dan Persson danpe454

Embedded Systems: OS

Operating system concepts. Task scheduling

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

CEC 450 Real-Time Systems

Chapter 19: Real-Time Systems. Operating System Concepts 8 th Edition,

Multimedia Systems 2011/2012

Multiprocessor and Real- Time Scheduling. Chapter 10

Chapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on

4/6/2011. Informally, scheduling is. Informally, scheduling is. More precisely, Periodic and Aperiodic. Periodic Task. Periodic Task (Contd.

Embedded Systems: OS. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

6.1 Motivation. Fixed Priorities. 6.2 Context Switch. Real-time is about predictability, i.e. guarantees. Real-Time Systems

Operating Systems: Quiz2 December 15, Class: No. Name:

Scheduling. CSC400 - Operating Systems. 7: Scheduling. J. Sumey. one of the main tasks of an OS. the scheduler / dispatcher

Chapter 5: CPU Scheduling

Last Class: Processes

Chapter -5 QUALITY OF SERVICE (QOS) PLATFORM DESIGN FOR REAL TIME MULTIMEDIA APPLICATIONS

Operating System Concepts Ch. 5: Scheduling

Analyzing Real-Time Systems

CS 318 Principles of Operating Systems

The University of Missouri - Columbia Electrical & Computer Engineering Department ECE4220 Real-Time Embedded Computing

Introduction to Embedded Systems

Real-Time and Concurrent Programming Lecture 6 (F6): Scheduling and bounded response times

Simulation of Priority Driven Algorithms to Schedule Real-Time Systems T.S.M.Priyanka a*, S.M.K.Chaitanya b

International Journal of Advanced Research in Computer Science and Software Engineering

Learning Outcomes. Scheduling. Is scheduling important? What is Scheduling? Application Behaviour. Is scheduling important?

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #10: More on Scheduling and Introduction of Real-Time OS

Operating System Study Notes Department of Computer science and Engineering Prepared by TKG, SM and MS

Course Syllabus. Operating Systems

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

CS 537: Intro to Operating Systems (Fall 2017) Worksheet 3 - Scheduling & Process API Due: Sep 27 th 2017 (Wed) in-class OR Simmi before 5:30 pm

Operating Systems. Process scheduling. Thomas Ropars.

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

The Priority Ceiling Protocol: A Method for Minimizing the Blocking of High-Priority Ada Tasks

8: Scheduling. Scheduling. Mark Handley

Uniprocessor Scheduling. Chapter 9

Exam Review TexPoint fonts used in EMF.

Scheduling of processes

Verification of Real-Time Systems Resource Sharing

REAL-TIME DATABASES (RTDB)

Operating Systems ECE344. Ding Yuan

cfl 2001 Thomas Hedemand Nielsen and Jens Christian Schwarzer This document was created with the L A T

Scheduling Algorithm and Analysis

CPU Scheduling Algorithms

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total

7. Multimedia Operating System. Contents. 7.3 Resource Management. 7.4 Process Management. 7.2 Real Time Systems. 7.5 Prototype Systems. 7.

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

Implementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9

UNIT:2. Process Management

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Implementation and Evaluation of the Synchronization Protocol Immediate Priority Ceiling in PREEMPT-RT Linux

Resource Reservation & Resource Servers

CEC 450 Real-Time Systems

PROCESS SCHEDULING Operating Systems Design Euiseong Seo

Ch 4 : CPU scheduling

Comparison of scheduling in RTLinux and QNX. Andreas Lindqvist, Tommy Persson,

A comparison between the scheduling algorithms used in RTLinux and in VxWorks - both from a theoretical and a contextual view

CS370 Operating Systems

Fixed-Priority Multiprocessor Scheduling

OPERATING SYSTEM CONCEPTS UNDERSTAND!!! IMPLEMENT!!! ANALYZE!!!

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institution of Technology, IIT Delhi

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

An Improved Priority Ceiling Protocol to Reduce Context Switches in Task Synchronization 1

Authors Abugchem, F. (Fathi); Short, M. (Michael); Xu, D. (Donglai)

CS4514 Real-Time Systems and Modeling

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS

Transcription:

CS4514 Real Time Scheduling Jose M. Garrido Fall 2015 Department of Computer Science 1

Periodic Tasks Typical real-time application has many tasks that need to be executed periodically Reading sensor data Computation Sending data to actuators Communication Standard formulation: Given a set of tasks T 1, T n. Each task T i has Period P i Computation time C i Deadline D i 2

Schedulability Problem Can all the tasks be scheduled so that every task Ti can execute in the CPU for Ci units in every interval of length Pi? If yes, then the schedule is said to be feasible, Assume that these tasks execute on the same processor. 3

Standard (non-rt) Scheduling Policies FCFS SPN RR SRTF PS PPS Others 4

Periodic Tasks Example 1: Task T1 with period 10 and compute time 3 Task T2 with period 10 and compute time 1 Task T3 with period 15 and compute time 8 Possible schedule: repeats every 30 sec T1 from 0 to 3, 12 to 15, 24 to 27 T2 from 3 to 4, 15 to 16, 27 to 28 T3 from 4 to 12, 16 to 24 Simple test: Task T i needs to use CPU for C i /P i fraction per unit Utilization = Sum of C i /P i Task set is schedulable if and only if utilization is 1 or less. 5

RT Scheduling Example2 Pi has (c, p, d) Two processes: P1 (1,2,2) and P2 (2, 5, 5) priority (P1) > priority (P2) No preemption In this schedule, there is 1 unit of idle time Schedule can be repeated at time t = 10 6

RT Scheduling Example3 If the priorities are reversed, prio(p2) > prio(p1) P2 starts at t = 0 P2 will compute for 2 time units, which is the entire first cycle of P1 P1, will therefore, miss its deadline This schedule is not feasible. 7

RR with Preemption Example 4 Two processes: P1 (1, 2, 2) and P2 (2, 5, 5) The time slice = 1 Assume that P2 starts first There is 1 time unit of CPU idle time 8

RR Scheduling Example 5 Two processes: P1 (3, 4, 4) and P2 (2, 8, 8) using RR scheduling with time slice = 1 time units. At time t = 4, P1 has executed only 2 time units, therefore misses its deadline 9

RT Scheduling Example 6 Two processes: P1 (3, 4, 4) and P2 (2, 8, 8) using priority scheduling. P1 has higher priority than P2. P2 is preempted by P1 at t = 4 10

Real-Time Scheduling Fixed Priorities Rate Monotonic Scheduling (RMS) Least Compute Time First (LCT) Dynamic priorities Earliest Deadline First (EDF) Shortest Completion Time (SCT) Least Slack Time (LST) 11

Rate Monotonic Scheduling Based on fixed priorities The shorter the period of the task, the higher the priority assigned Example: P1 = (3, 4, 4) P2 = (2, 8, 8) 12

RM Scheduling Example 7 P1 = (3, 4, 4) higher priority P2 = (2, 8, 8) 13

Least Compute Time (LCT) Also based on fixed priorities The shorter the compute time of the task, the higher the priority assigned Example: P1 = (3, 4, 4) P2 = (2, 8, 8) P2 will have higher priority. P1 will missed its first deadline A LCT schedule is not feasible, for this workload 14

RT Scheduling with Dynamic Priorities Earliest Deadline First (EDF) Shortest Completion Time (SCT) Least Slack Time (LST) These scheduling techniques can change the priorities of processes at period boundaries 15

Earliest Deadline First Scheduling: EDF Based on dynamic priorities. Choose the task with the earliest (current) deadline Preemptive: scheduling decision made when a task finishes as well as when a new task arrives Theorem: If there is a possible schedule, then EDF will find one Example: Two processes: P1 (2, 4, 4) and P2 (5, 10, 10) 16

EDF Example 8 P1 (2, 4, 4) and P2 (5, 10, 10) At times t=4 and t=12, P2 is preempted 17

EDF Example 2 Task T1 with period 10 and CPU time 3 Task T2 with period 10 and CPU time 1 Task T3 with period 15 and CPU time 8 T1 T2 T3 T3 T1 T2 T3 T1 T2 T3 0 3 4 10 12 1516 20 2324 28 18

Scheduling Algorithm: RMS Rate Monotonic Scheduling (Liu and Layland, 1973) Based on static priorities. Preemptive: scheduling decision made when a task finishes as well as when a new task arrives Scheduling algorithm: Choose the task with smallest period (among ready tasks) It may happen that a set of tasks is schedulable by EDF, but not by RMS Theorem: If utilization is smaller than 0.7, then RMS is guaranteed to find one If utilization is between 0.7 to 1, RMS may or may not succeed Example: 19

SCT Scheduling Priority is given to the process with the shortest remaining compute time Example: P1 (1,2,2) and P2 (2, 5, 5) 20

Scheduling Sporadic Processes 21

Priority Inversion Can occur when process interactions are included in the model Process synchronization Direct communication Manipulate shared data Utilize non-preemtable resources A major issue is blocking: suspension to force waiting of a process interacting with another process A low priority process can cause a higher priority process to block for an unbounded time interval 22

The Priority Inversion Problem Priority order: T1 > T2 > T3 failed attempt to lock R lock(r) unlock(r) T1 T2 lock(r) unlock(r) T3 T2 is causing a higher priority task T1 to wait! 23

Priority Inversion 1. T1 has highest priority, T2 next, and T3 lowest 2. T3 comes first, starts executing, and acquires some resource (say, a lock). 3. T1 comes next, interrupts T3 as T1 has higher priority 4. But T1 needs the resource locked by T3, so T1 gets blocked 5. T3 resumes execution (this scenario is still acceptable so far) 6. T2 arrives, and interrupts T3 as T2 has higher priority than T3, and T2 executes till completion 7. In effect, even though T1 has priority than T2, and arrived earlier than T2, T2 delayed execution of T1 8. This is priority inversion!! Not acceptable. 9. Solution T3 should inherit T1 s priority at step 5 24

Priority Inheritance Protocols Temporarily raise the priority of a process only if and when it actually blocks a higher priority process On leaving the critical section, the process priority reverts to its original value 25

Priority Inheritance Protocol lock R fails lock(r) unlock(r) T1 T2 lock(r) T2 arrives unlock(r) T3 T3 blocks T2 T3 has priority of T1 T3 directly blocks T1 26