NUS.SOC.CS5248 Ooi Wei Tsang 1 CPU Scheduling. NUS.SOC.CS5248 Ooi Wei Tsang 2 Scheduling Task vs I/O Request Task computation time unpredictable Task.

Slides:



Advertisements
Similar presentations
CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia.
Advertisements

CPE555A: Real-Time Embedded Systems
1 Augmented CPU Reservations John Regehr John A. Stankovic University of Virginia May 31, 2001.
Real-time concepts Lin Zhong ELEC424, Fall Real time Correctness – Logical correctness – Timing Hard vs. Soft – Hard: lateness is intolerable Pass/Fail.
Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by.
CPU Reservations and Time Constraints: Implementation Experience on Windows NT John Regehr – University of Virginia Michael B. Jones – Microsoft Research.
CS-3013 & CS-502, Summer 2006 Multimedia topics (continued)1 Multimedia Topics (continued) CS-3013 & CS-502 Operating Systems.
Process Scheduling Chapter 4.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
1 Predictable Scheduling for a Soft Modem Michael B. Jones – Microsoft Research Stefan Saroiu – University of Washington.
Towards Resource Aware Applications and Systems Michael B. Jones Microsoft Research.
Building Resource-Aware Applications and Systems Michael B. Jones Microsoft Research.
Embedded Systems Exercise 3: Scheduling Real-Time Periodic and Mixed Task Sets 18. May 2005 Alexander Maxiaguine.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Chapter 19: Real-Time Systems Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 19: Real-Time Systems System Characteristics Features of Real-Time.
Dreams in a Nutshell Steven Sommer Microsoft Research Institute Department of Computing Macquarie University.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Fair Resource Access & Allocation  OS Scheduling
1 Multimedia Storage Issues. NUS.SOC.CS5248 OOI WEI TSANG 2 Media vs. Documents large file size write once, read many deadlines!
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
Page 110/9/2015 CSE 40373/60373: Multimedia Systems So far…  RMS - task with highest rate has highest priority  EDF – earliest deadline first  Tasks.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
Real-Time Systems Mark Stanovich. Introduction System with timing constraints (e.g., deadlines) What makes a real-time system different? – Meeting timing.
Welcome!. PhD Dissertation Defense PhD Candidate: Wenming Li Advisor: Dr. Krishna M. Kavi Committee: Dr. Krishna M. Kavi Dr. Robert Akl Dr. Phil Sweany.
Ernest Cachia University of Malta “Real-Time System Development” Slide No. 1 of part 3 n What about jitter? To calculate jitter one should have data regarding.
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 31 – Multimedia OS (Part 1) Klara Nahrstedt Spring 2011.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
Operating System Requirements for Embedded Systems Rabi Mahapatra.
RTOS task scheduling models
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
1 Course Matters. NUS.SOC.CS5248 OOI WEI TSANG 2 Paper Review October 2003 MonTueWedThuFriSatSun Paper Reviews Due 20% off for each.
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
19.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 19: Real-Time Systems.
Chapter 19: Real-Time Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 19: Real-Time Systems System Characteristics.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
Real-Time Operating System Design
CS333 Intro to Operating Systems Jonathan Walpole.
For a good summary, visit:
NUS.SOC.CS5248 Ooi Wei Tsang 1 Course Matters. NUS.SOC.CS5248 Ooi Wei Tsang 2 Make-Up Lecture This Saturday, 23 October TR7, 1-3pm Topic: “CPU scheduling”
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 32 – Multimedia OS Klara Nahrstedt Spring 2010.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
Scheduling.
Lecture 6: Real-Time Scheduling
Real-Time Operating Systems RTOS For Embedded systems.
1 OPERATING SYSTEMS. 2 CONTENTS 1.What is an Operating System? 2.OS Functions 3.OS Services 4.Structure of OS 5.Evolution of OS.
REAL-TIME OPERATING SYSTEMS
Chapter 6: CPU Scheduling (Cont’d)
Operating Systems Design (CS 423)
Networks and Operating Systems: Exercise Session 2
Unit OS9: Real-Time and Embedded Systems
Chapter 2 Scheduling.
Lecture 21: Introduction to Process Scheduling
Real Time Scheduling Mrs. K.M. Sanghavi.
Jason Neih and Monica.S.Lam
TDC 311 Process Scheduling.
Limited-Preemption Scheduling of Sporadic Tasks Systems
Chapter 6: CPU Scheduling
Processes and operating systems
Lecture 21: Introduction to Process Scheduling
Presentation transcript:

NUS.SOC.CS5248 Ooi Wei Tsang 1 CPU Scheduling

NUS.SOC.CS5248 Ooi Wei Tsang 2 Scheduling Task vs I/O Request Task computation time unpredictable Task can be preemptive

NUS.SOC.CS5248 Ooi Wei Tsang 3 CPU Scheduling Algorithm FCFS Priority-based Proportional fair-share EDF Rate monotonic

NUS.SOC.CS5248 Ooi Wei Tsang 4 Rate Monotonic

NUS.SOC.CS5248 Ooi Wei Tsang 5 EDF

NUS.SOC.CS5248 Ooi Wei Tsang 6 Problem How can multimedia applications co-exists with normal applications?

NUS.SOC.CS5248 Ooi Wei Tsang 7 Same Idea as Cello P. Goyal, X. Guo, and H. M. Vin. “A hierarchical CPU scheduler for multimedia operating systems.” OSDI’96

NUS.SOC.CS5248 Ooi Wei Tsang 8 Guarantee? So far: Best-Effort Real-Time Scheduling What about: Guaranteed service?

NUS.SOC.CS5248 Ooi Wei Tsang 9 How to Guarantee Services?

NUS.SOC.CS5248 Ooi Wei Tsang 10 Resource Reservation: CPU

NUS.SOC.CS5248 Ooi Wei Tsang 11 Resource Reservations How to reserve? Overbook? Overuse?

NUS.SOC.CS5248 Ooi Wei Tsang 12 Example: Memory How to reserve? malloc Overbook? return NULL Overuse? crash, throw exception

NUS.SOC.CS5248 Ooi Wei Tsang 13 Example: CPU How to reserve? Overbook? Overuse? Memory is discrete. CPU time is continuous.

NUS.SOC.CS5248 Ooi Wei Tsang 14 How to Reserve?

NUS.SOC.CS5248 Ooi Wei Tsang 15 CPU Reservation “I need C units of time.. out of every T units.”

NUS.SOC.CS5248 Ooi Wei Tsang 16 Some Issues “I need C units of time, out of every T units.”

NUS.SOC.CS5248 Ooi Wei Tsang 17 Effects of T and C

NUS.SOC.CS5248 Ooi Wei Tsang 18 Effects of T and C

NUS.SOC.CS5248 Ooi Wei Tsang 19 Schedulability Theorems Rate Monotonic Scheduler Earliest Deadline First

NUS.SOC.CS5248 Ooi Wei Tsang 20 Assumptions programs are periodic computation time is constant zero context switch time programs are independent

NUS.SOC.CS5248 Ooi Wei Tsang 21 Rialto Scheduler CPU Reservations and Time Contraints: Efficient and Predictable Scheduling of Independent Activities, M. Jones, D. Rosu and M. Rosu

NUS.SOC.CS5248 Ooi Wei Tsang 22 Why Rialto? Provide CPU reservation Enable deadlines Co-exists with best-effort apps

NUS.SOC.CS5248 Ooi Wei Tsang 23 Overview input: a set of tasks and their reservation pre-compute a scheduling graph schedule tasks based on scheduling graph

TaskABCDEF Amount C Period T EBCA EBFD EBA EBD

TaskABCDEF Amount Period C F A D EB

NUS.SOC.CS5248 Ooi Wei Tsang 26 Advantages Only need to make new scheduling decisions when new task is added

NUS.SOC.CS5248 Ooi Wei Tsang 27 Computing Scheduling Graph Input: A set of tasks with their reservations Output: A scheduling graph if feasible

NUS.SOC.CS5248 Ooi Wei Tsang 28 Many Possible Solutions C F A D EB F C A D EB

TaskABCDEF Amount Period C F F A D EB

NUS.SOC.CS5248 Ooi Wei Tsang 30 Computing Scheduling Graph Input: A set of tasks with their reservations Output: A scheduling graph if feasible Goals: (a) Minimize context switches (b) Distribute free time evenly

NUS.SOC.CS5248 Ooi Wei Tsang 31 Life is Tough.. NP-Hard

NUS.SOC.CS5248 Ooi Wei Tsang 32 Heuristic 10

5 5 5 F TaskABCDEF Amount Period

F B+E TaskABCDEF Amount Period

F B+E A+D C TaskABCDEF Amount Period

NUS.SOC.CS5248 Ooi Wei Tsang 36 Time Constraint “I need to run the following code, that takes 30ms, 100ms from now, and the deadline is (now+180ms).”

NUS.SOC.CS5248 Ooi Wei Tsang 37 Pseudocode can = begin_constraint(start_time, deadline, estimate) if can schedule then do work else adapt time_taken = end_constraint()

NUS.SOC.CS5248 Ooi Wei Tsang 38 Scheduling Constraints C F F A D EB

NUS.SOC.CS5248 Ooi Wei Tsang 39 Advantages Only need to make new scheduling decisions when new task is added Feasibility of time constraint can be predicted accurately

NUS.SOC.CS5248 Ooi Wei Tsang 40 Running Unreserved Task C F F A D EB

NUS.SOC.CS5248 Ooi Wei Tsang 41 Media Player on Rialto/NT

NUS.SOC.CS5248 Ooi Wei Tsang 42 Look inside NT Scheduler Scheduling unit : Thread Priority level: 1-15, rt 24 high 13 normal 8 idle 4

NUS.SOC.CS5248 Ooi Wei Tsang 43 Priority Boosting Example: Priority +6 after awaken by keyboard input

NUS.SOC.CS5248 Ooi Wei Tsang 44 Anti-Starvation If hasn’t run for 3 seconds Boost priority to 14 Avoid “Priority Inversion”

NUS.SOC.CS5248 Ooi Wei Tsang 45 Mars Pathfinder

NUS.SOC.CS5248 Ooi Wei Tsang 46 Rialto/NT NT Scheduler Rialto C F F A D EB Boost Priority to 30

NUS.SOC.CS5248 Ooi Wei Tsang 47 Win Media Player 6.4 PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 48 Experiment 1 WMP running alone PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 49 Experiment 2 WMP running with priority 8 competitor PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 50 Experiment 3 WMP running with priority 10 competitor PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 51 Experiment 5 WMP running with priority 10 competitor PeriodPriorityReservationThread 1024Kernel Mixer 458GUI 10015Timer /1024 MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 52 Experiment 6 WMP running with priority 10 competitor PeriodPriorityReservationThread /16 Kernel Mixer 458GUI 10015Timer /1024 MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 53 Experiment 7 WMP running with priority 10 competitor PeriodPriorityReservationThread 1024Kernel Mixer 458GUI 10015Timer /512 MP3 Decoder 5008Unknown 20008Disk Reader

NUS.SOC.CS5248 Ooi Wei Tsang 54 Summary

NUS.SOC.CS5248 Ooi Wei Tsang 55 CPU Scheduling With guarantee percentage of CPU time task with deadline Algorithms Rate-monotonic EDF Rialto