Download presentation
Presentation is loading. Please wait.
Published byWhitney Ross Modified over 8 years ago
1
The Greedy Algorithm for Buffer Management: A Personal Perspective Zvi Lotker Some slide contributed by Prof Boaz Patt-Shamir
2
Thanks! Credits: Aiello, Kesselman, Kushilevits, Kimbrel, Lotker, Mansour, Ostrovski, Rosen,Schieber, Sviridenko, van Stee (apologies for the others!)
3
Schematic Switch Structure link buffer input portsoutput ports buffer management incoming packets outgoing stream dropped packets
4
Model Discrete time. Packets: size = 1 Buffer space B In each step: Set of packets arrive: arbitrary! One packet transmitted: Alg. Set of packets dropped: Alg. Restriction: FIFO (a packet cannot be transmitted before an earlier packet ) Two values: >1 Goal: maximize total value transmitted buffer management
5
5 Simple Results Theorem: Any deterministic algorithm has competitive ratio of at least 1.28. Greedy Algorithm: upon overflow, discard cheapest packets Theorem: Competitiveness of Greedy at most 4.
6
6 The Lower Bound: Setup The algorithm is fixed for any input sequence The adversary picks an input sequence. To prove the bound, we consider two sequences If the algorithm does well on one, it does badly on the other We consider packets with one of two values: 1, and >1. We construct the sequences parametrized by ,and then 1. Bound the best response of the algorithm (mininimize CR) 2. Choose to maximize CR
7
7 The Lower Bound: Scenario B packets of value 1 arrive at time 0. In each time step 1..t, a single packet of value >1 arrives. This continues until the algorithm transmits an -value packet (i.e., the algorithm has no more 1-value packets) t “small”: no more packets. t “large”: B -value packets arrive in together at time t+1.
8
8 The Lower Bound: Math Equating the two expressions and solving for t yields Letting t 0 ( ):=t 0 ( ,B)/B we get Which is maximized at 4.01545, for C 1.28197.
9
An optimal off-line algorithm Sort all packets in decreasing value Resolve ties in favor of earlier packets (to get a unique schedule) Construct schedule: Start with an empty schedule Scan packets in order: add packet to schedule if resulting schedule is feasible
10
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
11
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
12
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
13
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
14
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
15
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
16
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
17
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
18
An optimal off-line algorithm phase 1: overflow resolution Sort all packets by decreasing value and within each value class, by increasing index.
19
An optimal off-line algorithm phase 2: re-order the packets in Fifo order.
20
20 Simple Upper Bound: Argument Consider a time interval [t,t+B]. Let A be the set of packets arriving in that interval. OPT can accept at most the 2B top packets of A B transmitted, B stored GREEDY sends in [t,t+2B] at least the B top packets of A. No packet can push them out in [t,t+B] If a value V is stored at time t+B, at least value V is sent in [t+B,t+2B]
21
21 Simple Upper Bound: Math OPT can accept at most the 2B top packets of A GREEDY sends in [t,t+2B] at least the B top packets of
22
22 Is It Really 4? Answer: competitive ratio can’t be better than 2 Bad scenario: is “cheap”, “valuable” GREEDY loses B out of 2B valuable packets B
23
23 Why 2? OPT discards all cheap packets immediately, sends only valuable ones. lose B cheap packets
24
24 Intermediate Summary Greedy Algorithm: Annoying gap in the analysis Buffer overflows: A hint of a much more general model Context: Adversarial Queuing Theory Basic question, rephrased: When are we guaranteed to avoid overflows Our viewpoint: overflows happen. Deal with them… These motivated the next step [STOC’01]
25
25 FIFO Buffers: Elegant Upper Bound Potential function: Idea: When OPT sends a valuable packet, potential can account for it by an excess packet in Greedy’s buffer. Total value in buffer of OPT Total value in the of ALG Value of first |Q OPT | packets in buffer of ALG
26
26 FIFO Buffers: Elegant Upper Bound Lemma: 2·ALG(t) - OPT(t) . Proof: Wlog, OPT never preempts. Now, case analysis. Delivery: Assume both send together. Greedy sends maximal # packets. Therefore -OPT(t) + 2ALG(t). Arrival: Need to prove that 0. If OPT rejects, result is immediate, because val(Q ALG ) may only increase.
27
27 FIFO Buffers: Elegant Upper Bound Lemma: 2·ALG(t) -OPT(t) . Arrival: Need to prove that 0. If Greedy accepts: net change in first two terms 0, change in last term 0. If Greedy rejects & OPT accepts: increase in first term cannot be larger than decrease in last term: each packet in Q ALG at least as valuable as rejected packet. 2 nd term unchanged. QED
28
28 FIFO Buffers: Elegant Upper Bound Lemma: 2·ALG(t) -OPT(t) . Theorem: ALG ½ OPT. Proof: sum over steps, use Lemma, observe that initial and final value is 0. QED
29
29 Not All Greedys Are Created Equal When an overflow occurs, may have several packets of the same value eligible to be discarded. Does it matter which we throw away? Tail-Drop: drop the newest Head-Drop: drop the oldest Theorem: Head-Drop is the best greedy algorithm (up to 3/2 better than Tail-Drop).
30
30 Head-Drop is the Best Greedy Algorithm The proof is based on two observations 1. All Greedy algorithms have the same buffer occupancy 2. Out of all Greedy algorithms, head-drop always has the least weight in its buffer The competitive viewpoint: A low-value packet sent is a waste of bandwidth
31
31 Head-Drop Beats Tail-Drop 3:2 Tail Drop Head Drop B/2 +B 1 + 3/2B
32
Overflows happen What should be dropped? Simplified model for QoS: each packet has a value, either 1 or >1 Motivation: Each stream has a traffic descriptor Packets not conforming to their descriptors are marked In ATM: Cell Loss Prioirity (CLP) bit Conforming packets are expensive, non-conforming are cheap
33
Previous work GREEDY Algorithm [KLMPSS ’ 01]: Competitive ratio is 2, for any packet values DiffServ [KM ’ 01]: Competitive ratio 1.88 (2 packet values) Algorithm: each expensive packet ejects cheap packets ahead of it Lower bound [KLMPSS ’ 01]: Competitive ratio for DiffServ 1.28
34
The Mark&Flush Algorithm for DiffServ: competitive ratio ~1.30 This work
35
Remainder of the talk Introduction Off-line Algorithm The mark & flush Basic lemma The worst case Open problems
36
phase 1: overflow resolution The mark & flush Algorithm
37
phase 1: overflow resolution Greedy tail-drop phase 2: preemption Each expensive packet marks r cheap packets ahead of it. Marked packets are discarded when they reach the head of the buffer. NOTE: head-drop only! The Mark&Flush Algorithm
38
phase 2: preemption The mark & flush Algorithm
39
phase 2: preemption The mark & flush Algorithm
40
phase 2: preemption The mark & flush Algorithm
41
phase 2: preemption The mark & flush Algorithm
42
phase 2: preemption The mark & flush Algorithm
43
phase 2: preemption The mark & flush Algorithm
44
phase 2: preemption The mark & flush Algorithm If mf preempts a packet then mf send an expansive packet
45
Lemma 1: OPT(1) =mf(1) Let A be an arrival sequence such that v(on(1))=v(opt(1)). Then there exists another input sequence A' such that |A'|<|A| and Cr(A') Cr(A).
46
Example Opt= On= 5 +1 5 +2
47
Example Opt= On= A`(1)=A(1) A(2)-{p} A`(t)=A(t+1) 5 +1 5 +2
48
Example Opt= On= 5 5 +1 A`(1)=A(1) A(2)-{p} A`(t)=A(t+1)
49
Example Opt= On= 7 7
50
Example Opt= On= 6 6 A`(1)=A(1) A(2)-{p} Drop A`(t)=A(t+1)
51
Example Opt= On= 6 6 A`(1)=A(1) A(2)-{p} Drop A`(t)=A(t+1)
52
The Main Lemma: Proof (1) If the common value of the first packet is 1, then both algorithms send the first packet Can omit it from input stream to get A’ Not difficult to see remainder of schedules don’t change Cr(A) = mf A /opt A < (mf A -1)/(opt A -1) = Cr(A')
53
The Main Lemma: Proof (2) If the common value of the first packet is , then both algorithms send the first packet p OPT drops all cheap packets that arrive at t=1. Define: A' (1)=Arrive[1,2]\{p} Dropped mf (1) A' (t)=A(t+1) for t>1 Can show: remainder of OPT, MF don’t change Cr(A) = mf A /opt A < (mf A - ) /(opt A - ) = Cr(A')
54
Lemma 1: OPT starts cheap If the first packet sent by OPT is cheap, then it is the first packet to arrive. Proof: By our tie-breaking rule of OPT.
55
Lemma 2: OPT starts cheap If the first packet sent by OPT is cheap, then opt accepts all expensive packets until the first time the buffer of opt is empty. Proof: If opt dropped an expensive and the buffer is not empty then we can reject the first packet and accept the first expensive packets that opt dropped.
56
Lemma 3: OPT starts cheap Let A be an arrival sequence such that Val(opt(1))=1, Val(on(1))= and opt does not accept some packet that arrives in the time interval [1,t z ]. Then there exists an arrival sequence A' such that |A'|<|A| and Cr(A') Cr(A)
57
mf opt Lemma 3: OPT starts cheap p1p1 p2p2 p3p3 p4p4 p4p4
58
mf opt Lemma 3: OPT starts cheap p1p1 p2p2 p3p3 p4p4 p4p4
59
splitting point Def: Let A be an arrival sequence with duration t e. A time step t is called a splitting point if t<t e, there are no cheap packets in the buffers of on and opt, and and the number of expensive is equal.
60
splitting point Lemma Let A be an arrival sequence with splitting point t 0. Then there exists an arrival sequence A' such that |A'|<|A| and Cr(A') Cr(A).
61
Example Opt= On= 7 6 +1
62
Example Opt= On= 5 4 +1
63
Lemma 4: OPT starts cheap Let A be an arrival sequence with no splitting points such that Val(opt(1))=1, Val(on(1))= , and opt does not drop any packet during steps 1, …,t z. Then Cr(A) (r+ )/ Proof The buffer of mf is empty at time t z Mf don ’ t reject an expansive packets. Cr(A) (n 1 + n )/ (n ’ 1 + n ) n 1 n ’ 1 +r n n ’ 1 =0 Cr(A) (r n + n )/ ( n ) = (r+ )/
64
Lemma 1: OPT starts expensive Suppose that Val(opt(1))= and that Val(on(1))=1.Then there exists a time t e such that: opt sends only expensive packets in steps 1, …,t e. The buffer of opt and mf is full with expansive packets at time t e Prove : The first packet is cheap. If Opt don ’ t send the fist cheap packet then By our tie- breaking rule of OPT the buffer of OPT must be full with expansive The buffer of mf has more expansive packets than opt
65
Lemma 2: OPT starts expensive Suppose that Val(opt(1))= and that Val(on(1))=1. Then for all time steps t t e, Exp(Q opt (t)) Exp(Q on (t)) Exp(Q opt (t))+B/(r+1). Prove : By induction on time
66
Lemma 3: OPT starts expensive Let A be an unsplittable arrival sequence Suppose that Val(opt(1))= and that Val(on(1))=1. Then if there exist t 1 <t e such that Exp(Q on (t 1 ))=B and Exp(Q opt (t e ))=B, then there exists another arrival sequence A' such that |A'|<|A| and Cr(A) Cr(A`). Prove : We add an expansive packet to A at time t 1
67
Lemma 4: OPT starts expensive Let A be an arrival sequence with no splitting points such that Val(opt(1))= , Val(on(1))=1, and Exp(Q on (t))=B iff Exp(Q opt (t))=B then Cr(A) (2+r) /(1+ (1+r)) Proof Both mf and opt send the same nuber of packets Opt send only expansive packets. Cr(A) (n 1 + n )/ (n 1 + n ) B n n 1 B/(1+r) Cr(A) (2+r) /(1+ (1+r))
68
Two worst cases M&f
69
Two worst cases Opt sends only expensive packets Cr (2+r)/(1+ + r)
70
Two worst cases Opt sends all the packets Cr ( +r)/
71
Put the pieces together Cr max{( +r)/ , (2+r)/(1+ + r)} Solving the eq ( +r)/ = (2+r)/(1+ + r) We get that r( )=(-1- + (4( -1) 2 +(1+ ) 2 )/(2 )= +0.5+O(1/ ) Cr=(-1- + 2 2 + (1+2 - 3 2 +4 3 )/(2 2 )=1+ 1/ +O(1/ )
72
Open problems (mandatory?) Close the gap What about more than two values? How about a network of buffers?
73
The Main Lemma: Pruning Let A be an arrival sequence such that OPT and MF send packets of the same value at the first step. Then there exists a shorter arrival sequence A' such that CompRatio(A) CompRatio(A').
74
The Main Lemma: Proof (1) If the common value of the first packet is 1, then both algorithms send the first packet Can omit it from input stream to get A’ Not difficult to see remainder of schedules don’t change Cr(A) = mf A /opt A < (mf A -1)/(opt A -1) = Cr(A')
75
The Main Lemma: Proof (2) If the common value of the first packet is , then both algorithms send the first packet p OPT drops all cheap packets that arrive at t=1. Define: A' (1)=Arrive[1,2]\{p} Dropped mf (1) A' (t)=A(t+1) for t>1 Can show: remainder of OPT, MF don’t change Cr(A) = mf A /opt A < (mf A - ) /(opt A - ) = Cr(A')
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.