CS 204: Scheduling Jiasi Chen Lectures: MWF 12:10-1pm in WCH 139 http://www.cs.ucr.edu/~jiasi/teaching/cs204_spring16/ 1
Overview • What is scheduling? • Round robin Q: How should a • Weighted round robin common resource be • Generalized processor sharing (GPS) shared between • Implementations of GPS multiple users? • Deficit round robin • Weighted fair queuing • Rate control with GPS: Leaky bucket • Paper discussion 2
What is scheduling? • Send packets from multiple hosts • Required features H1 Whose data gets • Fair transmitted? • Easy to implement • Scalable • Work-conserving H2 • Desirable features • Admission control H3 • QoS for different types of traffic 3
What is NOT scheduling? H1 centralized scheduling H2 random access H3 Uplink? Downlink? 4
Toy example Sender A: 5-bit packets Total bandwidth = 12 bits/s Sender B: 7-bit packets Sender C: 2-bit packets 5
Fairness • How much of the link does each user get? • One measure of fairness: max-min fair • Maximize the minimum rate across all users NOT max-min fair Max-min fair Sender A: 5-bit packets 4 5 6 5 Sender B: 7-bit packets 2 2 Sender C: 2-bit packets 6
Round robin • Choose 1 packet from each subqueue After two rounds After one round 10 5 5 7 2 0 7
Weighted round robin • Choose certain # packets from each subqueue • # of packets sent = weight / packet size Weights # packets sent Number of bits sent 7 packets * 5 bits/packet 5 5/5 = 1 à 7 = 35 bits 5 packets * 7 bits/packet 5 5/7 à 5 = 35 bits 7 packets * 2 bits/packet 2 2/2 = 1 à 7 = 14 bits 8
Overview • What is scheduling? • Round robin Q: How should a • Weighted round robin common resource be • Generalized processor sharing (GPS) shared between • Implementations of GPS multiple users? • Deficit round robin • Weighted fair queuing • Rate control with GPS: Leaky bucket • Paper discussion 9
Bit-by-bit Round Robin • Not implementable After two rounds After one round 10 5 10 5 4 2 10
Generalized processor sharing • Send infinitesimal amount of bits each round • Idealized version of bit-by-bit round robin • Not implementable, but achieves perfect fairness 5/12 5/12 2/12 How to implement this? 11
Overview • What is scheduling? • FIFO Q: How should a • Round robin • Weighted round robin common resource be • Generalized processor sharing (GPS) shared between • Implementations of GPS multiple users? • Deficit round robin • Weighted fair queuing • Rate control with GPS: Leaky bucket • Paper discussion 12
Weighted fair queuing • See which packets would finish first under GPS P3,P3 P2 P2,P2 P1 P1, P1 time • Send packets in that order O(log(n)) complexity Need to sort the list of finishing times After two rounds After one round 10 5 10 5 13 4 2
Weighted fair queuing (2) • Problem: what if new user enters the system? P2 P3,P3 P2,P2 P1 P1, P1 time Finishing times are different, need to be updated! P1, P1 P2, P3 P2 P1, P2 P1 time 14
Weighted fair queuing (3) • Solution: use “virtual time” = # of bit-by-bit round robin rounds GPS: P2 P3,P3 P2,P2 P1 P1, P1 time P1 = 5 Bit-by-bit RR: P1 = 2 P1 = 7 P2 = 10 P2 = 6 virtual time 10 9 8 7 6 5 4 3 2 1 15
Weighted fair queuing (4) • Let’s calculate the virtual finishing time with the new user GPS: P1, P1 P3 P2, P3 P2 P1, P2 P1 time P1 = 5 P1 = 2 Bit-by-bit RR: P1 = 7 P2 = 10 virtual time P2 = 6 1 9 8 6 4 3 11 10 7 5 2 16
Weighted fair queuing (5) • Even if new user joins, the “virtual time” stays the same P1 = 5 Bit-by-bit RR: P1 = 2 P1 = 7 P2 = 10 The virtual virtual time P2 = 6 finishing times 10 9 8 7 6 5 4 3 2 1 stayed the same! P1 = 5 P1 = 2 Bit-by-bit RR: P1 = 7 P2 = 10 virtual time P2 = 6 11 10 9 8 7 6 5 4 3 2 1 17 Note: BBRR virtual time is shown here for ease of exposition; WFQ virtual time is slightly different. See Parekh-Gallager for details.
Deficit round robin • That seems confusing… is there a simpler way? Q = 5 Define a quantum Q for each subqueue • Define a counter C for each subqueue • How many bits allowed to be sent each • Q = 5 turn Q = 2 18
Deficit round robin D = Q = 2 D = D + Q = 10 D = Q = 5 D = Q = 5 Send Send Send Send D = 0 D = 3 D = 0 D = 0 D = Q = 2 D = Q = 5 D = Q = 5 Send Cannot Send D = 0 send D = 0 D = 5 Q = 5 Q = 5 After two rounds After one round 13 10 7 0 Q = 2 4 2 O(1), but less accurate 19
Overview • What is scheduling? • FIFO Q: How should a • Round robin • Weighted round robin common resource be • Generalized processor sharing (GPS) shared between • Implementations of GPS multiple users? • Deficit round robin • Weighted fair queuing • Rate control with GPS: Leaky bucket • Paper discussion 20
Performance guarantees with GPS • GPS implementations give us an average throughput • What about delay guarantee? 21
Leaky Bucket Tokens arrive with rate a k Bucket can hold B k tokens Packets can only leave if accompanied by a token If the buffer is full, how many packets can leave during time interval T? 22
GPS + Leaky Bucket K leaky buckets GPS scheduler • Max delay experienced by a bit: • Why? 1. At most B k packets waiting in GPS scheduler 2. Delay = (B k pkts) / (ρ k pkts/s) 23
Sources • An Introduction to Computer Networks , Peter Dordal http://intronetworks.cs.luc.edu/current/html/queuing.html • A. Parekh and R. Gallager, “A Generalized Processor Sharing Approach to Flow Control in Integrated Services Networks: The Single-Node Case”, ToN 1993. 24
Recommend
More recommend