CSE 237A Scheduling of Communication
Total Page:16
File Type:pdf, Size:1020Kb
CSE 237A Scheduling of communication Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego. 1 RlReal-time commun ica tion sc hdliheduling Value of comm unication depends on the time at which the message is delivered to the recipient Metrics Throughput Delay Delay jitter Loss rate Fairness Deadlines can be hard or soft Deterministic vs. statistical guarantees 2 Key Problem Allocation/ sched uling of comm unication Point-to-point link e.g. wire (scheduling at transmitter) Distributed link e. g. wireless (MAC) or bus (arbiter) Entire network (routing) Anywhere there is a shared resource! Different from scheduling to CPUs Often no pppreemption or coarse pre-emption Channels of time-varying quality/capacity 3 Type of Traffic So urces Cons tan t bit rat e: peri odi c t raffi c Fixed-size packets at periodic intervals Analogous to periodic tasks with constant computation time in RM model Variable bit rate: bursty traffic Fixed-size packets at irregular intervals Variable-size packets at regular intervals 4 Key Iss u es Scheduling Admission control PliiPolicing Goals: meet performance and fairness metrics high resource utilization easy to implement small work per data item , scale slowly with # of flows or tasks easy admission control decisions 5 ShdliScheduling for commun ica tion Determine who sends data when: FIFO Priority queuing: preemptive, non-preemptive Round robin Weighted fair queuing EDF Discard mechanism when buffer is f ull Distributed implementation Need multiple access mechanism 6 Problems du e to FIFO qu eu es 1. In order to maximize its chances of ss ee success, a source has an incentive to maximize the rate at which it transmits. Fairn 2. FIFO queue is “unfair” since it favors the most greedy flow. es 3.ee It i s har d to con tro l the de lay o f pac ke ts Delay through a network of FIFO queues. Guarant 7 Fairness 10 Mb/s 0.55 A Mb/s 1.1 Mb/s 100 R C Mb/s 1 e.g. an http flow with a given B 0.55 (IP SA, IP DA, TCP SP, TCP DP) Mb/s What is the “fair” allocation: (0.55Mb/s, 0.55Mb/s) or (0.1Mb/s, 1Mb/s)? 8 Fairness 10 Mb/s A 1.1 Mb/s 100 R1 D Mb/s B 0.2 C Mb/s What is the “fair” allocation? 9 Fairness Intuitively each connection gets no more than what it wants the excess, if any, is equally shared Fairness is intuitively a good idea Fairness also provides protection traffic hogs cannot overrun others automatically builds firewalls around heavy users reverse is not true: protection may not lead to fairness Transfer half of excess Unsatisfied demand ABC ABC 10 Max-min Fairness Maximize the minimum share of task or flow whose demand is not fully satisfied Resources are allocated in order of increasing demand, normalized by weight No task or flow gets a share larger than its demand Task or flows with unsatisfied demands get resource shared in ppproportion to their wei ghts 11 Max-Min Fairness A common way to allocate flows N flows share a link of rate C. Flow f wishes to send at rate W(f), and is allocated rate R(f). 1. Pick the flow, f, with the smallest requested rate. 2. If W(f)<C/N, then set R(f) = W(f). 3. If W(f)>) > C/N, then set R(f)=) = C/N. 4. Set N = N – 1. C = C –R(f). 5. If N > 0 got1to 1. 12 Max-Min Fairness An example W(f1) = 0.1 W(f ) = 0.5 1 2 C R1 W(f3) = 10 W(f4) = 5 Round 1: Set R(f1) = 0.1 Round 2: Set R(f2) = 0.9/3 = 0.3 Round 3: Set R(f4) = 0.6/2 = 0.3 Round 4: Set R(f3) = 0.3/1 = 0.3 13 Round Robin Scan class queues serving one from each class that has a non-empty queue Figure from: Kurose14 & Ross Weighted Round Robin Round-robin unfair if packets are of different length or weihtights are no t equa l Different weights, fixed packet size serv e m or e th an on e pack et per vi si t, af ter n orm alizin g to obtain integer weights Different weights, variable size packets normalize weights by mean packet size Problems with variable size packets and different weights, need to know mean packtket s ize in a dvance fair only over time scales > round time round time can be large can lead to long periods of unfairness 15 Priority Que u ing Flows classified according to priorities Preemptive and non-preemptive versions Figure from: Kurose16 & Ross Fair Que u eing 1. Packets belonging to a flow are placed in a FIFO. This is called “per-flow queuing”. 2. FIFOs are scheduled one bit at a time, in a round-robin fashion. 3. This is called Bit-by-Bit Fair Queuing. Flow 1 Bit-by-bit round robin Classification Flow N Scheduling 17 Weighted Bit-by-Bit Fair Queueing Likew ise, flows can be a lloca te d differen t rates by servicing a different number of bits f or each fl ow dur ing eac h roun d. R(f1) = 0.1 R(f ) = 0.3 1 2 C R1 R(f3) = 0.3 R(f4)03) = 0.3 OdOrder of service for the four queues: … f1, f2, f2, f2, f3, f3, f3, f4, f4, f4, f1,… Also called “Generalized Processor Sharing (GPS)” 18 Generalized Processor Sharing Generalized Round Robin In any time interval, allocates resource in proportion to the weig h t a m on g th e set of all backl ogged co nn ecti on s Serves infinitesimal resource to each Achieves max-min fairness But is non-implementable Figure from: S. Keshav,19 Cornell Weighted Fair Queueing (WFQ) Problem: We need to serve a whole packet at a time. Solution: 1. Determine what time a packet, p, would complete if we served flows bit- by-bit. Call this the packet’s finishing time, Fp. 2. Serve packets in the order of increasing finishing time. Theorem: PktPacket p will depar t be fore Fp+ TRANSPmax Also called “Packetized Generalized Processor Sharing (PGPS)” 20 Understanding bit by bit WFQ 4 queues, sharing 4 bits/sec of bandwidth, Equal Weights 6 5 4 3 2 1 0 Time A1 = 4 1 B1 = 3 1 C2 = 1 C1 = 1 1 D2 = 2 D1 = 1 1 Weights : 1:1:1:1 6 5 4 3 2 1 0 Time D1, C1 Depart at R=1 A2, C3 arrive A2 = 2 A1 = 4 1 B1 = 3 D1 C1 B1 A1 1 C3 = 2 C2 = 1 C1 = 1 1 Round 1 D2 = 2 D1 = 1 1 Weights : 1:1:1:1 6 5 4 3 2 1 0 Time C2 Departs at R=2 A2 = 2 A1 = 4 1 B1 = 3 D2 C2 B1 A1 D1 C1 B1 A1 1 C3 = 2 C2 = 1 C1 = 1 1 Round 2 Round 1 D2 = 2 D1 = 1 1 Weights : 1:1:1:1 21 Understandinggy bit by bit WFQ 4 queues, sharing 4 bits/sec of bandwidth, Equal Weights 6 5 4 3 2 1 0 Time D2, B1 Depart at R=3 A2 = 2 A1 = 4 1 B1 = 3 D2 C3 B1 A1 D2 C2 B1 A1 D1 C1 B1 A1 1 C3 = 2 C2 = 1 C1 = 1 1 Round 3 Round 2 Round 1 D2 = 2 D1 = 1 1 Weights : 1:1:1:1 6 5 4 3 2 1 0 A2 C3, A1 Depart at R=4 Time Departs at R=6 A2 = 2 A1 = 4 1 B1 = 3 A2 A2 C3 A1 D2 C3 B1 A1 D2 C2 B1 A1 D1 C1 B1 A1 1 C3 = 2 C2 = 1 C1 = 1 1 6 5 Round 4 Round 3 Round 2 Round 1 D2 = 2 D1 = 1 1 Weights : 1:1:1:1 Sort packets 6 5 4 3 2 1 0 Time Departure order for packet by packet WFQ: Sort by finish round of packets A2 = 2 A1 = 4 1 B1 = 3 A2 A2 C3 C3 A 1 A 1 A1 A 1 D2 D2 B1 B1 B1 C2 D1 C1 1 C3 = 2 C2 = 1 C1 = 1 1 D2 = 2 D1 = 1 1 Weights : 1:1:1:1 22 WFQ implementation ov erv iew Assuming we know the current round number R Finish number of packet of length p if arriving to active connection = previous finish number + p if arriving to an inactive connection = R + p Dealing with weights replace p by p/w Computing the current round number Define round number (R) as a real-valued variable R increases at a rate inversely proportional to # of active connections replace # of connections by sum of connection weights WFQ emulates GPS instead of bit-by-bit RR with this definition from: S. Keshav,23 Cornell WFQ wi Serves traffi c at rat e R (t) = i w ∑k∈ACTIVE(t) k 1 If w =1 then the rate is: R(t) = i’s | ACTIVE(t) | Finish number computation: Pi (k,t) Fi (k,t) = max{Fi (k −1,t), R(t)}+ wi 1 Round rate: RR(t) ~ w TSR ∑k∈ACTIVE (t) k 24 WFQ E xample Pi (k,t) Fi (k,t) = max{Fi (k −1,t), R(t)}+ wi =1 link rate 1 unit/sec Queue A Queue B Queue C time # conn RR R F P F P F P ΔR(t) = RR(t)⋅Δtime⋅ LinkRate 0 3 0.33 0 1 1 2 2 2 2 320.51102121 4 3 0.33 1.5 3.5 2 2 0.5 2 0.5 555.5 1 1 2 353.5 151.5 2 0 2 0 7003.53.502020 TSR 25 WFQ E xample Pi (k,t) Fi (k,t) = max{Fi (k −1,t), R(t)}+ wi link rate 100 bits/s Q A wa=2 Q B wb=5 time (s) # conn RR R F P F P ΔR(t) = RR(t)⋅Δtime⋅ LinkRate 0 2 0 x=100 y=200 1.5 When do packets complete service? 2 What round number? 282.8 What is packet ZZs’s finish number if it arrives at time 1.5s and is 10 bits? 3 TSR 26 Ev alu ation Pros like GPS, it provides protection can obtain worst-case end-to-end delay bound gives users incentive to use intelligent flow control Cons needs per-connection state comppplex to implement requires a priority queue 27 Problems du e to FIFO qu eu es 1.