CprE 458/558: Real-Time Systems Real-Time Networks – WAN Packet Scheduling CprE 458/558: Real-Time Systems (G. Manimaran) 1 Scheduler • Ensuring bandwidth (and delay), and buffer guarantees to connections • Determining the service order among packets from different connections • Scheduling algorithm has an associated admission control that is used during channel setup CprE 458/558: Real-Time Systems (G. Manimaran) 2 Scheduler requirements • Fairness – achieving fairness among competing flows • Performance bounds for the guaranteed flows • Efficiency -- schedulability • Protection – guarantees of well-behaving flows are protected from ill-behaving flows • Flexibility – accommodating a diverse mix of traffic class and rates • Ease of implementation – high speed implementation CprE 458/558: Real-Time Systems (G. Manimaran) 3 Fairness and Max-Min Fairness • Fairness – Providing equal share of the resource to all the flows – The notion of fairness is obvious if all the flows demand equal share of the resource – Typically different flows exhibit varying resource demands. The notion of Max-min fairness is employed in such situations CprE 458/558: Real-Time Systems (G. Manimaran) 4 Max-Min Fairness • Basic Idea: A fair share allocates – a source with a small demand what it wants, and evenly distributes unused resources to the big sources • Formally, max-min fair share allocation is defined as: – Resources are allocated in order of increasing demands – No source gets a resource share larger than its demands – Sources with unsatisfied demands get an equal share of the resource CprE 458/558: Real-Time Systems (G. Manimaran) 5 Max-Min Fairness: Example Four incoming flows with their corresponding demands 2 2.6 4 Max-Min Scheduler Output Link 10 5 The max-min fairness allocation proceeds in several rounds CprE 458/558: Real-Time Systems (G. Manimaran) 6 Max-Min Fairness: Example (1) • Round #1: Tentatively divide the resource (output bandwidth) into four equal portions of size 10 / 4 = 2.5 • Allocation = [2.5, 2.5, 2.5, 2.5] • Round #2: Deduct the excess resource allocation and redistribute equally among others CprE 458/558: Real-Time Systems (G. Manimaran) 7 Max-Min Fairness: Example (2) • Source 1’s demand is only 2.0 so deduct (2.5 - 2.0 = 0.5) and distribute the remaining amount of (0.5 / 3 = 0.167) to each of the rest three • Allocation = [2.0, 2.67, 2.67, 2.67] • Source 2’s demand is only 2.6 so deduct (2.67 - 2.6 = 0.07) and distribute the remaining amount of (0.07 / 2) to each of the rest two • Final Allocation = [2.0, 2.6, 2.7, 2.7] CprE 458/558: Real-Time Systems (G. Manimaran) 8 Working of the example [2.5, 2.5, 2.5, 2.5] Flow 1 has excess = 0.5 add (0.5 / 3) to each of the rest [2.0, 2.67, 2.67, 2.67] Flow 2 has excess = 0.07 add (0.07 / 2) to each of the rest [2.0, 2.6, 2.7, 2.7] CprE 458/558: Real-Time Systems (G. Manimaran) 9 Max-Min Fairness: Example Four incoming flows with their max-min resource (bandwidth) allocations / demands 2/2 2.6 / 2.6 2.7 / 4 Max-Min Fairness Resource Allocation Output Link 10 2.7 / 5 CprE 458/558: Real-Time Systems (G. Manimaran) 10 Weighted Max-Min Fairness • A max-min weighted fairness share is as follows – Resources are allocated in order of increasing demand, normalized by the weight – No source gets a resource share larger than its demand – Sources with unsatisfied demands get resource shares in proportion to their weights CprE 458/558: Real-Time Systems (G. Manimaran) 11 Weighted Max-Min Fairness: Example Four incoming flows with their corresponding demands W1 = 2.5 4 W2 = 4 2 W3 = 0.5 10 W4 = 1.0 4 Max-Min Scheduler Output Link 16 The normalized weights are: [5, 8, 1, 2] Now pretend as if the number of flows are (5 + 8 + 1 + 2) = 16 instead of just 4 CprE 458/558: Real-Time Systems (G. Manimaran) 12 Working of the example • Divide the capacity into 16 equal parts – Flow 1’s share (capacity / 16) * 5 = (16 / 16) * 5 = 5 • Assign each flow an amount equal to its corresponding normalized weight • If there is excess allocation deduct it and redistribute it for the rest in a weighted manner CprE 458/558: Real-Time Systems (G. Manimaran) 13 Working of the example [5, 8, 1, 2] Flow 2 has excess = 6 Flow 1 has excess = 1 [4, 2, 3.33, 6.66] •We have to distribute excess “7” units among flows 3 and 4 •Their weights are 1 and 2 respectively •Therefore, flow 3 will get an additional share of (7/3) * 1 and flow 4 will get an additional share of (7/3) * 2 CprE 458/558: Real-Time Systems (G. Manimaran) 14 Working of the example [5, 8, 1, 2] Flow 2 has excess = 6 Flow 1 has excess = 1 [4, 2, 3.33, 6.66] Final Allocation [4, 2, 6, 4] Flow 4 has excess = 2.66 allocate it to flow 3 CprE 458/558: Real-Time Systems (G. Manimaran) 15 General Processor Sharing (GPS) or Fluid Flow Model for achieving Max-min Fairness Two incoming flows with their resource demands 5 5 GPS Resource Allocation (Ideal, but Not practical) Output Link 10 The schedule (ideal, but not realizable in networks) 0 5 CprE 458/558: Real-Time Systems (G. Manimaran) 10 16 Max-Min fairness Approximation Two incoming flows with their resource demands Packetized GPS (Max-Min Fairness Approximation) 5 5 Output Link 10 The schedule 5 units of time 0 5 units of time 5 CprE 458/558: Real-Time Systems (G. Manimaran) 10 17 A Simple Round Robin Scheduler Cannot achieve max-min fairness Four incoming flows •Need to handle weighted flows •Need to handle variable length packets Round Robin Scheduler Output Link The schedule 0 CprE 458/558: Real-Time Systems (G. Manimaran) 18 Weighted Round Robin Scheduler Normalized weights are as follows: [2, 3, 1, 1] Four incoming flows with their corresponding weights 10 15 5 Round Robin Scheduler Output Link 5 Cannot achieve max-min fairness •Need to handle variable length packets 0 CprE 458/558: Real-Time Systems (G. Manimaran) 19