Computer Science Surplus Fair Scheduling: A Proportional-Share Scheduling Algorithm for Symmetric Multiprocessors Abhishek Chandra Micah Adler Pawan Goyal † Prashant Shenoy UMASS Amherst and † Ensim Corporation
Computer Science Motivation Diverse web and multimedia applications popular HTTP, Streaming, e-commerce, games, etc. Applications hosted on large servers (typically multiprocessors) Key Challenge: Design OS mechanisms for Resource Management End-stations Network Server Streaming E-commerce Web
Computer Science Requirements for OS Resource Management Fair, Proportionate Allocation Eg: 20% for http, 30% for streaming, etc. Application Isolation Misbehaving/overloaded applications should not affect other applications Efficiency OS mechanisms should have low overheads Focus: Achieving these objectives for CPU scheduling on multiprocessor machines
Computer Science Outline Motivation Proportional-Share Scheduling Weight Readjustment Surplus Fair Scheduling Experimental Evaluation Concluding Remarks
Computer Science Proportional-Share Scheduling Associate a weight with each application and allocate CPU bandwidth proportional to weight Existing Algorithms Ideal algorithm: Generalized Processor Sharing E.g.: WFQ, SFQ, SMART, BVT, etc. Question: Are the existing algorithms adequate for multiprocessor systems? Wt=2 Wt=1 2/31/3 CPU bandwidth Applications
Computer Science Starvation Problem SFQ : Start tag of a thread ( Service / weight ) Schedules the thread with minimum start tag CPU 1 CPU C arrives B starves Time A (Wt=100) B (Wt=1) C (Wt=1) S1=10 S1=11 S1=0 S1=1 S2=0 S2=100S2=1000 S3=10S3=110 CPU 2...
Computer Science Weight Readjustment Reason for starvation: Infeasible Weight Assignment (eg: 1:100 for 2 CPUs) Accounting is different from actual allocation Observation: A thread can’t consume more than 1 CPU bandwidth A thread can be assigned at most (1/p) of total CPU bandwidth Feasibility Constraint:
Computer Science Weight Readjustment (contd.)... CPU 1CPU 2CPU 3 CPU p Decreasing Order of weights Efficient: Algorithm is O(p) Can be combined with existing algorithms Goal: Convert given weights to feasible weights
Computer Science Effect of Readjustment SFQ without Readjustment Number of iterations (10 5 ) Time (s) SFQ with Readjustment Time (s) Weight Readjustment gets rid of starvation problem A (wt=10) B (wt=1) C (wt=1) A (wt=10) B (wt=1) C (wt=1)
Computer Science Short Jobs Problem SFQ J1, wt=20 J2-J21, wt=1x20 J_short, wt=5 Time (s) Ideal J1, wt=20 J2-J21, wt=1x20 J_short, wt=5 Time (s) Frequent arrivals and departures of short jobs SFQ does unfair allocation! Number of iterations (10 5 )
Computer Science Surplus Fair Scheduling Service received by thread i Ideal Actual Time Surplus t Scheduler picks the threads with least surplus values Lagging threads get closer to their due Threads that are ahead are restrained Surplus = Service Actual - Service Ideal
Computer Science Surplus Fair Scheduling (contd.) Start tag (S i ) : Weighted Service of thread i S i = Service i / w i Virtual time (v) : Minimum start tag of all runnable threads Surplus (α i ) : α i = Service i - Service lagging = w i S i - w i v Scheduler selects threads in increasing order of surplus
Computer Science Surplus Fair Sched with Short Jobs Surplus Fair Sched Time (s) Ideal Time (s) Number of iterations (10 5 ) Surplus Fair Scheduling does proportionate allocation J1, wt=20 J2-J21, wt=1x20 J_short, wt=5 J1, wt=20 J2-J21, wt=1x20 J_short, wt=5
Computer Science Outline Motivation Proportional-Share Scheduling Weight Readjustment Surplus Fair Scheduling Experimental Evaluation Concluding Remarks
Computer Science Requirements for OS Resource Management Fair, Proportionate Allocation Eg: 20% for web, 30% for streaming, etc. Application Isolation Misbehaving/overloaded applications should not affect other applications Efficiency OS mechanisms should have low overheads
Computer Science Proportionate Allocation :11:21:41:7 Processor Shares received by two web servers Processor Allocation (Normalized) Weight Assignment
Computer Science Application Isolation MPEG decoder with background compilations Frame Rate (frames/sec) Number of background compilations Surplus Fair Time-sharing
Computer Science Scheduling Overhead Surplus Fair Time-sharing Context switch time (microsec) Number of processes Context-switch time(~10μ s) vs. Quantum size (~100ms)
Computer Science Related Work CPU Reservations [Jones99] Uniprocessor proportional-share: Hierarchical Scheduling [Goyal96] BVT [Duda99], SMART [Nieh97] Lottery Scheduling [Waldspurger94]
Computer Science Summary Existing proportional-share algorithms inadequate for multiprocessors Readjustment Algorithm can reduce unfairness Surplus Fair Scheduling practical for multiprocessors Achieves proportional fairness, isolation Has low overhead Heuristics for incorporating processor affinity Source code available at: