cs 204: scheduling
TRANSCRIPT
CS204:Scheduling
Jiasi ChenLectures:MWF12:10-1pminWCH139
http://www.cs.ucr.edu/~jiasi/teaching/cs204_spring16/
1
Overview
• Whatisscheduling?• Roundrobin• Weighted roundrobin
• Generalizedprocessorsharing(GPS)• ImplementationsofGPS
• Deficitroundrobin• Weighted fairqueuing
• RatecontrolwithGPS:Leakybucket• Paperdiscussion
2
Q:Howshouldacommonresourcebesharedbetweenmultipleusers?
Whatisscheduling?
• Sendpacketsfrommultiplehosts• Requiredfeatures
• Fair• Easytoimplement• Scalable• Work-conserving
• Desirablefeatures• Admission control• QoS fordifferenttypesoftraffic
3
H1
H2
H3
Whose datagetstransmitted?
Toyexample
5
Sender A:5-bit packets
Sender C:2-bit packets
Sender B:7-bit packets
Totalbandwidth =12bits/s
Fairness
• Howmuchofthelinkdoeseachuserget?• Onemeasureoffairness:max-minfair
• Maximizetheminimum rateacrossallusers
6
Sender A:5-bit packets
Sender C:2-bit packets
Sender B:7-bit packets
5
5
2
4
6
2
Max-min fair NOTmax-minfair
Weightedroundrobin
• Choosecertain#packetsfromeachsubqueue• #ofpackets sent=weight/packetsize
8
5
5
2
Weights5/5=1à 7
5/7à 5
2/2=1à 7
#packets sent7packets *5bits/packet=35bits
5packets *7bits/packet=35bits
7packets *2bits/packet=14bits
Numberofbitssent
Overview
• Whatisscheduling?• Roundrobin• Weighted roundrobin
• Generalizedprocessorsharing(GPS)• ImplementationsofGPS
• Deficitroundrobin• Weighted fairqueuing
• RatecontrolwithGPS:Leakybucket• Paperdiscussion
9
Q:Howshouldacommonresourcebesharedbetweenmultipleusers?
Generalizedprocessorsharing
• Sendinfinitesimalamountofbitseachround• Idealizedversionofbit-by-bitroundrobin• Notimplementable,butachievesperfect fairness
11
2/12
5/125/12
Howtoimplement this?
Overview
• Whatisscheduling?• FIFO• Roundrobin• Weighted roundrobin
• Generalizedprocessorsharing(GPS)• ImplementationsofGPS
• Deficitroundrobin• Weighted fairqueuing
• RatecontrolwithGPS:Leakybucket• Paperdiscussion
12
Q:Howshouldacommonresourcebesharedbetweenmultipleusers?
• SeewhichpacketswouldfinishfirstunderGPS
• Sendpackets inthatorder
Weightedfairqueuing
13
timeP1, P1P1P2 P2,P2P3,P3
Afterone round552
Aftertworounds10104
O(log(n)) complexityNeed tosortthelistof finishing times
• Problem:whatifnewuserentersthesystem?
Weightedfairqueuing(2)
14time
P1, P1P1P2P1,P2
P1 P1, P1P2
time
P2,P2P3,P3
P3P2,
Finishing timesaredifferent,need tobeupdated!
• Solution:use“virtualtime”=#ofbit-by-bitroundrobinrounds
Weightedfairqueuing(3)
15
P1 =5P1 =2P1=7P2=10P2 =6
P1 P1, P1P2
time
P2,P2P3,P3
GPS:
virtual time1
Bit-by-bit RR:
2345678910
• Let’scalculatethevirtualfinishingtimewiththenewuser
Weightedfairqueuing(4)
16
virtual time
P1 =5P1 =2P1=7P2=10P2 =6
P1 P1, P1time
P2P3 P1,P2P3 P2,
GPS:
Bit-by-bit RR:
1234567891011
Weightedfairqueuing(5)
17
P1 =5P1 =2P1=7P2=10P2 =6
• Evenifnewuserjoins,the“virtualtime”staysthesame
virtual time1110987654321
Bit-by-bit RR:
virtual time10987654321
Bit-by-bit RR: P1 =5P1 =2P1=7P2=10P2 =6
Thevirtualfinishing timesstayedthesame!
Note:BBRRvirtualtimeisshownhere forease ofexposition;WFQvirtualtimeisslightlydifferent.See Parekh-Gallager fordetails.
Deficitroundrobin
• Thatseemsconfusing…isthereasimplerway?
18
Q =5
Q =5
Q =2
• DefineaquantumQforeachsubqueue• DefineacounterCforeachsubqueue
• Howmanybitsallowedtobesenteachturn
Deficitroundrobin
19
Afterone round1002
Aftertworounds1374
Q =5
Q =5
Q =2
O(1), butless accurate
D =Q =5SendD =0
D =Q =5CannotsendD =5
D =Q =2SendD =0
D =Q= 5SendD =0
D =D +Q =10SendD =3
D =Q =2SendD =0
D =Q =5SendD =0
Overview
• Whatisscheduling?• FIFO• Roundrobin• Weighted roundrobin
• Generalizedprocessorsharing(GPS)• ImplementationsofGPS
• Deficitroundrobin• Weighted fairqueuing
• RatecontrolwithGPS:Leakybucket• Paperdiscussion
20
Q:Howshouldacommonresourcebesharedbetweenmultipleusers?
PerformanceguaranteeswithGPS
• GPSimplementationsgiveusanaveragethroughput
• Whataboutdelayguarantee?
21
LeakyBucket
22
Tokens arrivewithrateak
Bucketcanhold Bk tokens
Packetscanonly leaveifaccompanied by atoken
Ifthebuffer isfull, howmanypackets canleaveduring timeinterval T?
GPS+LeakyBucket
• Maxdelayexperiencedbyabit:
• Why?1. AtmostBk packetswaiting inGPS
scheduler2. Delay=(Bk pkts)/(ρk pkts/s)
23
GPS scheduler
Kleaky buckets