350 likes | 488 Views
Dynamic Soft Real Time Scheduling (DSRT) System. Klara Nahrstedt cs589kn. Problem Statement. Multimedia applications need guaranteed and continuous processor time allocation. A MPEG decoder running at 10 frames per second. A game animation updating the movements of objects every 50ms.
E N D
Dynamic Soft Real Time Scheduling (DSRT) System Klara Nahrstedt cs589kn
Problem Statement • Multimedia applications need guaranteed and continuous processor time allocation. • A MPEG decoder running at 10 frames per second. • A game animation updating the movements of objects every 50ms. • Applications have Soft Deadlines. • Run on General Purpose OS. • Limitations: I/O Interrupts, Layered memory subsystem, priority inversion, ...
DSRT Solution • Basic Features are insufficient. • Unique/Advanced Features • CPU Service Classes. • Probing Service. • Adaptive Service. • Advanced Reservations*. • Security/Access Model*. • Multiprocessor Support. • Distributed Monitoring Support*. • Middleware Implementation.
DSRT Concepts • CPU Service Classes • Mapping CPU Service Classes into a Multiprocessor Partitioning Design • Execution Flow of a SRT Process
Service Classes Specification Parameters Guaranteed P = Period PPT = Peak Processing Time PPT PCPT (Periodic Constant Processing Time) 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 CPU Service Classes
Periodic Constant Processing Time Class • Example Usage Pattern: Peak Processing Time=10ms Period = 100ms 0 10 110 210 100 200 Time(ms)
0 15 120 210 100 200 Periodic Variable Processing Time Class • Example Usage Pattern: Period = 100ms Peak Processing Time = 30ms Sustainable Processing Time = 15ms Burst Tolerance = 7ms Time(ms)
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
Execution Phase Probing Phase Reservation Phase Scheduling Probe Admission Control Extract Reservation Monitor/ Conformance Test Contract Processor Binding Adaptation SRT Process Adjusted Contract Execution Flow of a SRT Process
Smart 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.
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
Execution Phase Probing Phase Reservation Phase Scheduling Probe Admission Control Extract Reservation Monitor/ Conformance Test Contract Processor Binding Adaptation SRT Process Adjusted Contract Execution Flow of a DSRT Process
Conformance Test (1) Processor Usage Nonconformance Conformance Burst Tolerance Reserved Usage
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
12ms 50ms 62ms 10ms 55ms 40ms 60ms 5ms Smart Probing (3) • Compute average processor usage = 50ms • Compute peak processor usage = 62ms. • Max Burst = 12ms 50ms 40ms 62ms 43ms 55ms 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
Execution Phase Probing Phase Reservation Phase Scheduling Probe Admission Control Extract Reservation Monitor/ Conformance Test Contract Processor Binding Adaptation SRT Process Adjusted Contract Execution Flow of a DSRT Process
Admission Control Test • Given a reservation request, determine • Resource Availability. (1) + (2) • Processor Binding. (2) • Preemptive Earliest Deadline First:
Execution Phase Probing Phase Reservation Phase Scheduling Probe Admission Control Extract Reservation Monitor/ Conformance Test Contract Processor Binding Adaptation SRT Process Execution Flow of a DSRT Process Adjusted Contract
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 Partition Scheduling Top-Level Scheduler
RT Partition Scheduler Processor #1 Waiting Queue: (Sorted with the earliest released time) p (2a) finished one iteration p (3) released for next iteration (1) admitted p Runnable Queue: (Sorted with the earliest deadline) (2b) overrunning Overrun Partition Queues
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 Overrun Partition Scheduler
Execution Phase Probing Phase Reservation Phase Scheduling Probe Admission Control Extract Reservation Monitor/ Conformance Test Contract Processor Binding Adaptation SRT Process Adjusted Contract Execution Flow of a DSRT Process
Adaptation Scene #1 Scene #2 • Adjust Reservation. • 3 Strategies • Exponential Average • Range • Statistical Frame 275
X1 X2 X3 ... Xws-1 Xws Xws+1 ... X2ws ... X3ws Iteration Number Adaptation Points Exponential Average Adaptation Strategy • Specification: • Window Size (ws). • Alpha () • Xi= Guaranteed Parameter in a reservation. • Xi-1 = Actual Usage.
X1 X2 X3 ... Xws-1 Xws Xws+1 ... X2ws ... X3ws Iteration Adaptation Points Statistical Adaptation Strategy • Specification: • Window Size (ws). • Overrun Tolerance Frequency (f). • Example: ws=10, f=20%. Adjust X=40ms.
Implementation Building Blocks • A Real Time Timer. • setiimer() in Solaris and Irix. Lots of Timers in NT. • Fixed Real Time Priority. • priocntl() in Solaris, sched_setscheduler() in Irix, setPriorityClass() in NT. • Processor Affinity. • processor_bind() in Solaris, sysmp(MP_MUSTRUN_PID) in Irix, and setProcessAffinityMask() in NT.
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
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);
Experiment • Dual Processor Sun Ultra 2 Machine. • Solaris 2.6 Operating System. • Dispatch Latency 400us. Includes • Scheduling Algorithm. • Context Switches. • Various system calls.
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).
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).
Experimental Result SRT2: MPEG player with P=50ms. SRT1: MPEG player With P=100ms
Experimental Result (Cont.) SRT3: Sampling program with P=50ms. SRT4: Java game with P=100ms.
Conclusion • Multimedia needs strong support from the OS via scheduling policies, differentiation policies and mechanisms • Soft real-time guarantees can be made using priority mechanisms, but in a careful manner • Changes can be made via middleware systems or directly inside of kernels, but there are trade-offs