1 Course Matters
NUS.SOC.CS5248 OOI WEI TSANG 2 Paper Review October 2003 MonTueWedThuFriSatSun Paper Reviews Due 20% off for each late day
NUS.SOC.CS5248 OOI WEI TSANG 3 Diwali/Deepavali October 2003 MonTueWedThuFriSatSun No Class
NUS.SOC.CS5248 OOI WEI TSANG 4 Guest Lecture October 2003 MonTueWedThuFriSatSun CS6212 Guest Lecture “A/V Synchronization” SR1 4-6pm
NUS.SOC.CS5248 OOI WEI TSANG 5 Books
NUS.SOC.CS5248 OOI WEI TSANG 6 Project Grading
7 Previously, on CS5248
NUS.SOC.CS5248 OOI WEI TSANG 8 Cello OS disk scheduler Support multiple classes Protect classes from each other Work conserving Use two-level scheduling
NUS.SOC.CS5248 OOI WEI TSANG 9 CPU vs Disk Scheduling Task computation time unpredictable Task can be preemptive
NUS.SOC.CS5248 OOI WEI TSANG 10 Problem How can multimedia applications co-exists with normal applications?
NUS.SOC.CS5248 OOI WEI TSANG 11 Same Old Idea
NUS.SOC.CS5248 OOI WEI TSANG 12 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 13 So Far Best-Effort Real-Time Scheduling
NUS.SOC.CS5248 OOI WEI TSANG 14 How to Guarantee Services?
15 Resource Reservation: CPU
NUS.SOC.CS5248 OOI WEI TSANG 16 Resource Reservations How to reserve? Overbook? Overuse?
NUS.SOC.CS5248 OOI WEI TSANG 17 Example: Memory How to reserve? malloc Overbook? return NULL Overuse? crash, throw exception
NUS.SOC.CS5248 OOI WEI TSANG 18 Example: Memory How to reserve? “I will need 128KB” Overbook? “Sorry!” Overuse? malloc returns NULL
NUS.SOC.CS5248 OOI WEI TSANG 19 Example: CPU How to reserve? Overbook? Overuse? Memory is discrete. CPU time is continuous.
20 How to Reserve?
NUS.SOC.CS5248 OOI WEI TSANG 21 CPU Reservation “I need C units of time, out of every T units.”
NUS.SOC.CS5248 OOI WEI TSANG 22 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 23 Effects of T and C
24 CPU Scheduling Algorithm
25 Classic Real-Time Scheduler
NUS.SOC.CS5248 OOI WEI TSANG 26 Rate Scheduling Algorithms Rate Monotonic Earliest Deadline First
NUS.SOC.CS5248 OOI WEI TSANG 27 Rate Monotonic
NUS.SOC.CS5248 OOI WEI TSANG 28 EDF
NUS.SOC.CS5248 OOI WEI TSANG 29 Classic Schedulability Theorems Rate Monotonic Scheduler Earliest Deadline First
NUS.SOC.CS5248 OOI WEI TSANG 30 Assumptions programs are periodic computation time is constant zero context switch time programs are independent
NUS.SOC.CS5248 OOI WEI TSANG 31 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)
32 Rialto Scheduler From MS Research
NUS.SOC.CS5248 OOI WEI TSANG 33 Overview Given a set of task, pre-compute a scheduling graph
NUS.SOC.CS5248 OOI WEI TSANG 34 TaskABCDEF Amount Period EBCA EBFD EBA EBD
NUS.SOC.CS5248 OOI WEI TSANG 35 TaskABCDEF Amount Period C F A D EB
NUS.SOC.CS5248 OOI WEI TSANG 36 Advantages Only need to make new scheduling decisions when new task is added
NUS.SOC.CS5248 OOI WEI TSANG 37 Computing Scheduling Graph Input: A set of tasks with their reservations Output: A scheduling graph if feasible
NUS.SOC.CS5248 OOI WEI TSANG 38 Many Possible Solutions C F A D EB F C A D EB
NUS.SOC.CS5248 OOI WEI TSANG 39 TaskABCDEF Amount Period C F F A D EB
NUS.SOC.CS5248 OOI WEI TSANG 40 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 41 Life is Tough.. NP-Hard
NUS.SOC.CS5248 OOI WEI TSANG 42 Heuristic 10
NUS.SOC.CS5248 OOI WEI TSANG F TaskABCDEF Amount Period
NUS.SOC.CS5248 OOI WEI TSANG F B+E TaskABCDEF Amount Period
NUS.SOC.CS5248 OOI WEI TSANG F B+E A+D C TaskABCDEF Amount Period
NUS.SOC.CS5248 OOI WEI TSANG 46 TaskABCDEF Amount Period EBC EBDA EBF EBAD
47 Time Constraints
NUS.SOC.CS5248 OOI WEI TSANG 48 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 49 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 50 Scheduling Constraints C F F A D EB
NUS.SOC.CS5248 OOI WEI TSANG 51 Scheduling Constraints C F F A D EB C1, C2, C5
NUS.SOC.CS5248 OOI WEI TSANG 52 Advantages of Scheduling Graph Only need to make new scheduling decisions when new task is added Feasibility of time constraint can be predicted accurately
53 Peaceful Coexistence
NUS.SOC.CS5248 OOI WEI TSANG 54 Running Unreserved Task C F F A D EB
55 Media Player on Rialto/NT
NUS.SOC.CS5248 OOI WEI TSANG 56 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 57 Priority Boosting Example: Priority +6 after awaken by keyboard input
NUS.SOC.CS5248 OOI WEI TSANG 58 Anti-Starvation If hasn’t run for 3 seconds Boost priority to 14 Avoid “Priority Inversion”
NUS.SOC.CS5248 OOI WEI TSANG 59 Mars Pathfinder
NUS.SOC.CS5248 OOI WEI TSANG 60 Rialto/NT NT Scheduler Rialto C F F A D EB Boost Priority to 30
NUS.SOC.CS5248 OOI WEI TSANG 61 Win Media Player 6.4 PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader
NUS.SOC.CS5248 OOI WEI TSANG 62 Experiment 1 WMP running alone PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader
NUS.SOC.CS5248 OOI WEI TSANG 63 Experiment 2 WMP running with priority 8 competitor PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader
NUS.SOC.CS5248 OOI WEI TSANG 64 Experiment 3 WMP running with priority 10 competitor PeriodPriorityThread 1024Kernel Mixer 458GUI 10015Timer 1009MP3 Decoder 5008Unknown 20008Disk Reader
NUS.SOC.CS5248 OOI WEI TSANG 65 Experiment 5 WMP running with priority 10 competitor PeriodPriorityReservationThread 1024Kernel Mixer 458GUI 10015Timer /1024MP3 Decoder 5008Unknown 20008Disk Reader
NUS.SOC.CS5248 OOI WEI TSANG 66 Experiment 6 WMP running with priority 10 competitor PeriodPriorityReservationThread 10241/16Kernel Mixer 458GUI 10015Timer /1024MP3 Decoder 5008Unknown 20008Disk Reader
NUS.SOC.CS5248 OOI WEI TSANG 67 Experiment 7 WMP running with priority 10 competitor PeriodPriorityReservationThread 1024Kernel Mixer 458GUI 10015Timer /512MP3 Decoder 5008Unknown 20008Disk Reader
68 Summary
NUS.SOC.CS5248 OOI WEI TSANG 69 CPU Scheduling With guarantee percentage of CPU time task with deadline Algorithms Rate-monotonic EDF Rialto
NUS.SOC.CS5248 OOI WEI TSANG 70 CS5248 Summary Network Encoder Sender Middlebox Receiver Decoder
NUS.SOC.CS5248 OOI WEI TSANG 71 Last Two Lectures October/November 2003 MonTueWedThuFriSatSun
NUS.SOC.CS5248 OOI WEI TSANG 72 Last Two Lectures Papers from recent conferences and journals.