310 likes | 427 Views
CS 414 – Multimedia Systems Design Lecture 32 – Process Management (Part 2). Klara Nahrstedt Spring 2009. Outline. MP4 is out , Start early Competition on May 1, 2009, 5-6:30pm in 216 SC Deadline April 30 (pre-competition to decide on the finalists)
E N D
CS 414 – Multimedia Systems DesignLecture 32 – Process Management (Part 2) Klara Nahrstedt Spring 2009 CS 414 - Spring 2009
Outline • MP4 is out, Start early • Competition on May 1, 2009, 5-6:30pm in 216 SC • Deadline April 30 (pre-competition to decide on the finalists) • Exact rules, scenarios of the competition will be posted next Monday, April 20. • All should come, pizza and 1,2,3rd prices of the competition will be provided between 6:30-7pm on May 1 in 0216 SC CS 414 - Spring 2009
Overprovisioning Approach • Current Approach: • To achieve throughput - overprovision of resources (fast processors, large disks, fast I/O bus, high-speed networks), and exclusive usage of resources • To achieve timing - overprovision CPU, exclusive usage of resources, application-dependent scheduling With over-provisioning we get Quality of Service !! CS 414 - Spring 2009
Problems with Overprovisioning • Very High Cost (due to unused resources) • Exclusive Networks and Special Purpose Machines • Violation of Timing Guarantees in Exclusive Case (head-of-line blocking) • Sensory and Video Data Processing/Transmission • Violation of Timing/Throughput Guarantees in Shared Case (greedy applications, flows) • UDP flows versus TCP Flows • Last Mile Problem (not everywhere is over-provisioning possible) • Telescopes, University Campus CS 414 - Spring 2009
DSRT Concepts • CPU Service Classes • Mapping CPU Service Classes into a Multiprocessor Partitioning Design • Execution Flow of a SRT Process CS 414 - Spring 2009
CPU Service Classes Service Classes Specification Parameters Guaranteed PCPT (Periodic Constant Processing Time) P = Period PPT = Peak Processing Time PPT SPT PVPT (Periodic Variable Processing Time) P = Period SPT = Sustainable Processing Time PPT = Peak Processing Time BT = Burst Tolerance ACPU (Aperiodic Constant Processor Utilization) PPU PPU = Peak Processor Utilization Relative Deadline PPT = Peak Processing Time Event PPT CS 414 - Spring 2009
Periodic Constant Processing Time Class • Example Usage Pattern: Peak Processing Time=10ms Period = 100ms 0 10 110 210 100 200 Time(ms) CS 414 - Spring 2009
Periodic Variable Processing Time Class • Example Usage Pattern: Period = 100ms Peak Processing Time = 30ms Sustainable Processing Time = 15ms Burst Tolerance = 7ms 0 15 120 210 100 200 Time(ms) CS 414 - Spring 2009
Execution Flow of a SRT Process Execution Phase Probing Phase Reservation Phase Scheduling Probe Admission Control Extract Reservation Monitor/ Conformance Test Contract Processor Binding Adaptation SRT Process Adjusted Contract CS 414 - Spring 2009
Smart Offline Probing (1) • Goal: Extract a reservation. • Determine the most suitable Service Class and Parameters. • Avoid over/under reserve resources. • Needed because: • Processor usage is hardware platform dependent. • Processor usage is input dependent. CS 414 - Spring 2009
Smart Probing (2) • DSRT runs a few iterations of SRT applications without reservation. • DSRT monitors the usage iteration by iteration. • DSRT analyzes the usage history. Estimate a Reservation Processor Usage Conformance Test ? Iteration Number CS 414 - Spring 2009
Conformance Test (1) Processor Usage Nonconformance Conformance Burst Tolerance Reserved Usage CS 414 - Spring 2009
Conformance Test (2) • SSBTR = System Specific Burst Tolerance Rate. PVPT Class PCPT Class Processor Usage Processor Usage SPT(1+SSBTR)+BT PPT(1+SSBTR) PPT(1+SSBTR) SPT Leak every P PPT Leak every P PPT Leak every P CS 414 - Spring 2009
Smart Probing (3) • Compute average processor usage = 50ms • Compute peak processor usage = 62ms. • Max Burst = 12ms 62ms 55ms 40ms 50ms 43ms 12ms 50ms 62ms 10ms 55ms 40ms 60ms 5ms CS 414 - Spring 2009 50ms 50ms 50ms 50ms 50ms
Smart Probing (4) • SSBTR = 10% • Average Processor Usage * SSBTR = 5ms • If Max Burst < 5ms • Constant Processing Time Class • else if Max Burst (12ms) > 5ms, • Variable Processing Time Class • Sustainable Processing Time =50ms • Peak Processing Time = 62ms • Burst Tolerance = 12ms - 5ms = 7ms CS 414 - Spring 2009
Admission Control Test • Given a reservation request, determine • Resource Availability. (1) + (2) • Processor Binding. (2) • Preemptive Earliest Deadline First: CS 414 - Spring 2009
Multiprocessor Partitioning Design Guaranteed Part Non-guaranteed Part PCPT Processes Reserved Run Overrun Reserved Run Burst Overrun PVPT Processes TS Processes RT Scheduler Overrun Scheduler TS Scheduler Processor #1 RT Partition Overrun Partition TS Partition Processor #2 RT Partition Overrun Partition TS Partition CS 414 - Spring 2009
Partition Scheduling Top-Level Scheduler Proportional Sharing RT Scheduler Overrun Scheduler TS Scheduler Multi-Level Round Robin Priority Queues Kernel Scheduler Preemptive EDF Processor #1 RT Partition Overrun Partition TS Partition Processor #2 RT Partition Overrun Partition TS Partition CS 414 - Spring 2009
RT Partition Scheduler Processor #1 Waiting Queue: (Sorted with the earliest released time) p (2a) finished one iteration (3) released for next iteration p (1) admitted p Runnable Queue: (Sorted with the earliest deadline) (2b) overrunning Overrun Partition Queues CS 414 - Spring 2009
Overrun Partition Scheduler Highest Priority Burst Queue (FIFO) (2) Miss Deadline p (1a) Conformed? Overrun Queue (FIFO) (1b) Nonconformed? p Permanent Non-conforming Queue (FIFO) (1c) Nonconformed frequently? Lowest Priority CS 414 - Spring 2009
Adaptation Scene #2 Scene #1 • Adjust Reservation. • 3 Strategies • Exponential Average • Range • Statistical Frame 275 CS 414 - Spring 2009
Exponential Average Adaptation Strategy X1 X2 X3 ... Xws-1 Xws Xws+1 ... X2ws ... X3ws • Specification: • Window Size (ws). • Alpha () • Xi= Guaranteed Parameter in a reservation. • Xi-1 = Actual Usage. Iteration Number Adaptation Points CS 414 - Spring 2009
Statistical Adaptation Strategy X1 X2 X3 ... Xws-1 Xws Xws+1 ... X2ws ... X3ws • Specification: • Window Size (ws). • Overrun Tolerance Frequency (f). • Example: ws=10, f=20%. Adjust X=40ms. Iteration Adaptation Points CS 414 - Spring 2009
User-level Priority Dispatch Highest Priority (5) Dispatched Process runs for T ms. (4) Scheduler sleeps. Fixed RT Priority (3) Scheduler sets Timer for T ms. DSRT Scheduler Process N (6) Timer interrupts Scheduler Dispatched Process N-1 . ....... (2) Set Processor Affinity. ....... . Time Sharing Processes (5) Decrease Priority . (1) Increase Priority. ....... Dynamic TS Priority ....... RT Process Pool 0 Lowest Priority CS 414 - Spring 2009
C++ APIs // Reservation Phase cpu.reserve(reservation); cpu.setAdaptStrategy(strategy); // Execution Phase cpu.start(); for (;;) { doJob(); cpu.yield(); } cpu.stop(); cpu.free(); CpuApi cpu; CpuReservation reservation; // Probing Phase; cpu.probe(); cpu.start(); for (int i=0; i<numProbeIterations; i++) { doJob(); cpu.yield(); } cpu.stop(); cpu.probeEnd(); cpu.probeMatch(&reservation); CS 414 - Spring 2009
Experiment • Dual Processor Sun Ultra 2 Machine. • Solaris 2.6 Operating System. • Dispatch Latency 400us. Includes • Scheduling Algorithm. • Context Switches. • Various system calls. CS 414 - Spring 2009
Experiment Setup • Run 8 TS processes and 5 SRT processes concurrently. • TS1-6: Computational intensive programs. • TS7-8: Compilation programs. • SRT1: A MPEG player at 10 FPS. • Probing (PVPT class, P=100ms, • SPT=28ms, PPT=40ms, BT=11ms). • Adaptation Strategy: (Statistical, f = 20%, ws = 20). CS 414 - Spring 2009
Experimental Setup (Cont.) • SRT2: A MPEG player at 20 FPS. • Probing (PVPT class, P=50ms, SPT=14ms, PPT=21ms, BT=6ms) • SRT3: A sampling program. • Probing(PCPT class, P=50ms, PPT=10ms) • SRT4: A Java RocksInSpace game. • (PCPT class, P=100ms, PPT=30ms). • SRT5: Misbehaving greedy program. • (PCPT class, P=500ms, PPT=10ms). CS 414 - Spring 2009
Experimental Result SRT2: MPEG player with P=50ms. SRT1: MPEG player With P=100ms CS 414 - Spring 2009
Experimental Result (Cont.) SRT3: Sampling program with P=50ms. SRT4: Java game with P=100ms. CS 414 - Spring 2009
Conclusion • Careful planning of CPU resources works for multimedia applications and other applications that share the CPU CS 414 - Spring 2009