Surplus Fair Scheduling: A Proportional

advertisement
Surplus Fair Scheduling:
A Proportional-Share Scheduling
Algorithm for Symmetric Multiprocessors
Abhishek Chandra
Micah Adler
Pawan Goyal †
Prashant Shenoy
UMASS Amherst and †Ensim Corporation
http://lass.cs.umass.edu/software/gms
Computer Science
Motivation
Server
Web
Streaming
Network
End-stations
E-commerce
 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

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
Wt=2
Wt=1
2/3
1/3
Applications
CPU bandwidth
 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?
Computer Science
Starvation Problem
 SFQ : Start tag of a thread ( Service / weight )
 Schedules the thread with minimum start tag
S1=0
S1=1
S2=0
S2=100
CPU 1
0
100
...
B starves
1000
C arrives
Computer Science
S1=11
S2=1000
S3=10
CPU 2
Time
...
...
CPU 2
S1=10
S3=110
1100
...
A
(Wt=100)
B
(Wt=1)
C
(Wt=1)
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:

wi
1

p
 wj
j
Computer Science
Weight Readjustment (contd.)
 Goal: Convert given weights to feasible weights
Decreasing Order of weights
...
CPU 1
CPU 2
CPU 3
...
CPU p
 Efficient: Algorithm is O(p)
 Can be combined with existing algorithms
Computer Science
Effect of Readjustment
SFQ with Readjustment
SFQ without Readjustment
Number of iterations (105)
30
25
A (wt=10)
A (wt=10)
20
B (wt=1)
15
B (wt=1)
10
C (wt=1)
5
0
C (wt=1)
0
10
20
30
Time (s)
40
50
0
10
20
30
Time (s)
 Weight Readjustment gets rid of starvation problem
Computer Science
40
50
Short Jobs Problem
 Frequent arrivals and departures of short jobs
Ideal
SFQ
Number of iterations (105)
20
J1, wt=20
J2-J21, wt=1x20
J_short, wt=5
15
J1, wt=20
J2-J21, wt=1x20
J_short, wt=5
10
5
0
0
5
10
15
20
25
Time (s)
30
35
40
0
5
10
15
20
25
30
35
40
Time (s)
SFQ does unfair allocation!
Computer Science
Surplus Fair Scheduling
Surplus = ServiceActual - ServiceIdeal
Service
received
by thread i
Actual
Ideal
Surplus
Time
t
 Scheduler picks the threads with least surplus values
Lagging threads get closer to their due
 Threads that are ahead are restrained

Computer Science
Surplus Fair Scheduling (contd.)
 Start tag (Si) : Weighted Service of thread i
Si = Servicei / wi
 Virtual time (v) : Minimum start tag of all runnable
threads
 Surplus (α i ) : α i = Servicei - Servicelagging
= wi Si - wi v
 Scheduler selects threads in increasing order of surplus
Computer Science
Surplus Fair Sched with Short Jobs
Number of iterations (105)
Ideal
Surplus Fair Sched
20
J1, wt=20
J2-J21, wt=1x20
J_short, wt=5
15
J1, wt=20
J2-J21, wt=1x20
J_short, wt=5
10
5
0
0
5
10
15
20
25
Time (s)
30
35
40
0
5
10
15
20
25
30
35
Time (s)
 Surplus Fair Scheduling does proportionate allocation
Computer Science
40
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
Processor Shares received by two web servers
7
6
5
Processor
Allocation 4
(Normalized)
3
2
1
0
1:1
1:2
1:4
Weight Assignment
Computer Science
1:7
Application Isolation
MPEG decoder with background compilations
50
Surplus Fair
Time-sharing
40
Frame Rate 30
(frames/sec)
20
10
0
0
2
4
6
8
Number of background compilations
Computer Science
10
Scheduling Overhead
10
Surplus Fair
Time-sharing
8
Context switch 6
time
(microsec)
4
2
0
0
10
20
30
40
Number of processes
50
 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:
http://lass.cs.umass.edu/software/gms
Computer Science
Download