720 likes | 870 Views
Course Matters. Paper Review. Paper Reviews Due 20% off for each late day. Diwali/Deepavali. No Class. Guest Lecture. CS6212 Guest Lecture “A/V Synchronization” SR1 4-6pm. Books. Project Grading. Previously, on CS5248. Cello. OS disk scheduler Support multiple classes
E N D
Paper Review Paper Reviews Due 20% off for each late day NUS.SOC.CS5248 OOI WEI TSANG
Diwali/Deepavali No Class NUS.SOC.CS5248 OOI WEI TSANG
Guest Lecture CS6212 Guest Lecture “A/V Synchronization” SR1 4-6pm NUS.SOC.CS5248 OOI WEI TSANG
Books NUS.SOC.CS5248 OOI WEI TSANG
Project Grading NUS.SOC.CS5248 OOI WEI TSANG
Cello • OS disk scheduler • Support multiple classes • Protect classes from each other • Work conserving • Use two-level scheduling NUS.SOC.CS5248 OOI WEI TSANG
CPU vs Disk Scheduling • Task computation time unpredictable • Task can be preemptive NUS.SOC.CS5248 OOI WEI TSANG
Problem • How can multimedia applications co-exists with normal applications? NUS.SOC.CS5248 OOI WEI TSANG
Same Old Idea NUS.SOC.CS5248 OOI WEI TSANG
Same Gang P. Goyal, X. Guo, and H. M. Vin. “A hierarchical CPU scheduler for multimedia operating systems.” OSDI’96 NUS.SOC.CS5248 OOI WEI TSANG
So Far Best-Effort Real-Time Scheduling NUS.SOC.CS5248 OOI WEI TSANG
How to Guarantee Services? NUS.SOC.CS5248 OOI WEI TSANG
Resource Reservations • How to reserve? • Overbook? • Overuse? NUS.SOC.CS5248 OOI WEI TSANG
Example: Memory • How to reserve? malloc • Overbook? return NULL • Overuse? crash, throw exception NUS.SOC.CS5248 OOI WEI TSANG
Example: Memory • How to reserve? “I will need 128KB” • Overbook? “Sorry!” • Overuse? malloc returns NULL NUS.SOC.CS5248 OOI WEI TSANG
Example: CPU • How to reserve? • Overbook? • Overuse? Memoryis discrete. CPUtimeis continuous. NUS.SOC.CS5248 OOI WEI TSANG
CPU Reservation • “I need C units of time, out of every T units.” NUS.SOC.CS5248 OOI WEI TSANG
Two Problems • How to determine C? • take measurement and estimate • What if C is not constant? • take the maximum NUS.SOC.CS5248 OOI WEI TSANG
Effects of T and C NUS.SOC.CS5248 OOI WEI TSANG
Rate Scheduling Algorithms • Rate Monotonic • Earliest Deadline First NUS.SOC.CS5248 OOI WEI TSANG
Rate Monotonic NUS.SOC.CS5248 OOI WEI TSANG
EDF NUS.SOC.CS5248 OOI WEI TSANG
Classic Schedulability Theorems • Rate Monotonic Scheduler • Earliest Deadline First NUS.SOC.CS5248 OOI WEI TSANG
Assumptions • programs are periodic • computation time is constant • zero context switch time • programs are independent NUS.SOC.CS5248 OOI WEI TSANG
Why do we care about RM? • Theoretically, RM has lower CPU utilization (70%) but • RM is more efficient than EDF • Can support up to 80-90% CPU utilization in practice • Don’t want to commit 100% CPU anyway (for emergency) NUS.SOC.CS5248 OOI WEI TSANG
Rialto Scheduler From MS Research
Overview • Given a set of task, pre-compute a scheduling graph NUS.SOC.CS5248 OOI WEI TSANG
B E A C B E D F B E A B E D NUS.SOC.CS5248 OOI WEI TSANG
C A B E F D NUS.SOC.CS5248 OOI WEI TSANG
Advantages • Only need to make new scheduling decisions when new task is added NUS.SOC.CS5248 OOI WEI TSANG
Computing Scheduling Graph • Input: A set of tasks with their reservations • Output: A scheduling graph if feasible NUS.SOC.CS5248 OOI WEI TSANG
Many Possible Solutions C A A B E B E F F D D C NUS.SOC.CS5248 OOI WEI TSANG
C A F B E F D NUS.SOC.CS5248 OOI WEI TSANG
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
Life is Tough.. NP-Hard NUS.SOC.CS5248 OOI WEI TSANG
Heuristic 10 10 10 10 10 10 10 NUS.SOC.CS5248 OOI WEI TSANG
10 5 F 5 5 10 10 10 NUS.SOC.CS5248 OOI WEI TSANG
6 1 F 1 B+E 1 6 6 6 NUS.SOC.CS5248 OOI WEI TSANG
C 4 1 F 1 B+E 1 1 1 A+D 1 NUS.SOC.CS5248 OOI WEI TSANG
B E C B E A D B E F B E A D NUS.SOC.CS5248 OOI WEI TSANG
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
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
Scheduling Constraints C A F B E F D NUS.SOC.CS5248 OOI WEI TSANG