Algorithms for Scheduling Weighted Packets with Deadlines in a Bounded Queue
Motivated by the Quality-of-Service (QoS) buffer management problem, we consider online scheduling of packets with hard deadlines in a finite capacity queue. At any time, a queue can store at most $b \in \mathbb Z^+$ packets. Packets arrive over time…
Authors: ** Fei Li (George Mason University) **
Algorithms for Sc heduling W eigh ted P ac k ets with Deadlines in a Bounded Queue F ei Li ∗ No v ember 2, 2018 Abstract Motiv ated by the Quality-of-Service (QoS) buffer management pr oblem, we consider online scheduling of pack ets with hard deadlines in a finite capacity q ueue. A t any time, a queue can store at mo st b ∈ Z + pack ets. Pac kets ar r ive ov er time. E ach pack et is asso ciated with a non- negative v alue a nd an in teger deadline. In ea ch time step, only one pa c ket is allow ed to be sent. Our ob jective is to ma x imize the total v alue gained by the pack ets sen t b y their deadlines in an online manner. Due to the Internet traffic’s chaotic characteris tics, no sto chastic assumptions are made on the pack et input sequences. This mo del is ca lled a finite-queu e mo del . W e us e competitive ana lysis to mea sure an online algor ithm’s p erformance versus an unrealizable optimal offline algorithm who constructs the w orst pos sible input based on t he knowledge of the online algorithm. F or the finite-queue mo del, w e fir s t present a deterministic 3-comp etitive memory less online alg orithm. Then, we give a randomized ( φ 2 = ((1 + √ 5) / 2) 2 ≈ 2 . 618 )-comp etitive memoryless online alg orithm. The a lgorithmic fr amework and its theor etical ana lysis include several interesting features. First, our algor ithms use (pos sibly) mo dified characteristics of pack e ts ; these characteristics may not b e same as thos e sp e c ified in the input sequence. Second, our ana lysis metho d is different from the classical p otential function appr oach. W e use a simple charging scheme, which dep ends on a clever mo dification (during the course of the a lgorithm) o n the packets in the queue of the optimal offline algorithm. W e then pr ov e that a set o f inv aria n ts holds at the end of each time step. Finally , we analyze the tw o propos ed a lgorithm in a r elaxed mo del, in which pack ets have no hard deadlines but an order . W e conclude that b oth alg orithms hav e the sa me comp etitive r atios in the rela x ed model. 1 In tro duction In the la st three decades, routers in the In ternet con tin ue su pp orting more and more applications. Currently , most r outers f orw ard pac ke ts in a First-In -First-Ou t ( FIFO ) mann er and treat all pac k ets equally . Ho wev er, th e d iversit y of applications h as r esulted in heterogeneit y and un predictable n et w ork traffic. Th u s, it is more reasonable to consider differen tiation among pac k ets from d ifferent t yp es of applications (see [23, 1, 17, 2] and th e references therein). F or instance, we could sp ecify v alues for pac k ets to r epresen t their priorities. Also, w e may lik e to assign hard d eadlines to p ac k ets in time- critical applications. These concerns h av e made buffer managemen t at r ou ters significan t in provi d ing effectiv e qualit y of service (QoS) to v arious applications. ∗ Departmen t of Computer Scien ce, George Mason Univ ersity . lifei@cs.gmu.e du. Part of this w ork appears in the Proceedings of the 28th IEEE Inte r national Confer ence on Computer C ommunications (INF OCOM 2009) [19]. One kind theoretical researc h on QoS buffer management starts from three p ap er b y Aie llo et al. [1], b y K esselman et al. [17] an d by Ha jak [15], where a mo d el called a b ounde d-delay mo del is prop osed. In this mo del, time is discrete. Pac k ets arrive ov er time, and they are buffered u p on arriv als. The queue capacit y is unlimited. An arrivin g pac k et p has a non -n egativ e value w p ∈ R + and an inte ger de ad line d p ∈ Z + b y which it should b e transmitted; after d p , p expires. In eac h time step, at most one pac ket can b e s ent. T he ob jectiv e is to maximize th e weighte d thr oughput , whic h is defin ed as the total v alue of the trans mitted pack ets b y their d eadlines. Fig. 1 illustrates the fun ctionalities of the online buffer managemen t algorithms, whic h pro cess newly arriving pac kets and s end one pac ke t out of the buffer in eac h time step. The buffer size and deadlines of pac k ets limit the num b er of p ending p ackets 1 in the queue. Figure 1: Buffer man agement is in c h arge of pro cessing arriving pac k ets from the input streams and deliv ering pac kets out of the buffer as outgoing streams. Realizing th at the capacit y of a queue bu ffering p ac k ets is limited and su c h queue is a shared resource for multiplexing pac k ets inside routers, Azar and Levy extend the single bu ffer b ounded-dela y mo del to m ultiple buffers. They consider scheduling pac k ets with deadlines in multiple finite capacit y buffers, all of which hav e the same finite capacities [5]. In this pap er, w e study the single queue sc h eduling problem, in which the capacit y of the qu eue is finite. In the ideal case, if the release time, v alue, and deadline of eac h pac ket are kno wn ahead of time, an optimal schedule can b e found efficien tly; w e call this the optimal offline algorithm . F or instance, give n no constrain t ov er the queue capacit y , the the optimal schedule can b e found b y computing a maximum w eight ed m atc hing on a conv ex bipartite graph. Ho w ev er, we do not kno w all suc h information ahead of time. Rather, pac ke ts arrive online , and w e only learn ab out a p ac k et and its asso ciated charact eristics when it actually arriv es. F ur thermore, w ithout a realistic m o del of th e net work traffic [23, 14], w e cannot ac hiev e go o d sto c hastic p erformance guaran tee. Hence, we study the worst-ca se analysis for algorithms in queueing pac ke ts, without an y assump tions ov er the in put sequence. Comp etitiv eness has b een wid ely accepted as the metric to measure an online algorithm’s w orst- case p erforman ce in theoretical compu ter science [9]. In this pap er, w e d esign and analyze b etter deterministic and randomized online algo r ithms, in terms of co m p etitiv e ratio, for sc h ed uling pac k ets in a finite capacit y queue. A deterministic (rand omized) online algorithm ON d ( ON r ) is called k -c omp etitive if its (exp ected) weigh ted throughpu t on any instance is at least 1 /k of the w eighte d throughp ut of an 1 A pending pack et i s a pac k et in the buffer whose deadline has not expired y et. F or a giv en time step, every pending pac ket is eligible for sending. 2 optimal offline algorithm on this instance: k = m ax I OPT ( I ) − α ON d ( I ) , ON d is a deterministic algorithm k = m ax I OPT ( I ) − α E [ ON r ( I , r )] , ON r is a randomized algorithm where α is a constan t, OPT ( I ) is the optimal solution of an input I , and r is the set of ran d om v ariables flipp ed b y a randomized online alg orithm ON r . The parameter k is known as the online algo r ithm’s c omp etitive r atio [9] 2 . If k is not a constant , such an algorithm w ith comp etitiv e ratio k is called non-c omp etitive . If the additive constan t α ≤ 0, the algorithm ON d ( ON r ) is called strictly k -c omp etitiv e . Note that for a r andomized algorithm, the role of randomization is pu rely internal to th e randomized algorithm. No sto chastic assumption is made on the input. Also n ote that the optimal offline alg orithm is called the adversary of the online algorithm since the inp ut sequen ce constructed b y the offline optimal algorithm is allo we d to maximize the comp etitiv e r atio k . 1.1 Problem setting. Th e mo del we stud y here is called the finite queue mo del , in w hic h we consider sc hedu ling p ac k ets with d eadlines in a finite capacit y queue. In ou r mod el, time is discrete. P ac k ets arriv e o ver time and eac h p ac k et p is asso ciated with a non-n egativ e w eigh t w p ∈ R + and an intege r deadline d p ∈ Z + . d p sp ecifies the time by which p should b e sen t. If p is transm itted by its deadline d p , p con tr ibutes our ob jectiv e b y a v alue w p . (W e use “v alue” and “weig ht”, “queue” and “buffer” in terc h angeably .) T his mo del is p reemptiv e, which means that pack ets already existing in the queues can b e dropp ed at any time b efore they are served. If a pac k et is dropp ed, this pack et cannot b e deliv ered any more. There is only one queue with a limited capacit y of b ∈ Z + . A t an y time, the qu eu e can store n o more than b pac k ets. P ac kets that expire are drop p ed immediately . A t most one pac ket can b e sen t in ea ch time step. Our targe t is to maximize the total v alue of the pac k ets sent by their deadlines. Remem b er that in a b ounded dela y mo del [17, 15], th e queue capacit y is infinite. The finite queue mo del generalizes the b ounded dela y mo d el: if the queue capacit y is larger than any pac k ets slack time , whic h is defined as th e difference b etw een the pac k ets deadline and its release time, the finite q u eue mo del is the b ounded-dela y mo del. 1.2 Related w ork. S ince the fir st QoS buffer managemen t mo del (the b ounded-dela y mo d el) w as in tro d uced in [1, 2], man y researc hers h av e considered this mo del as w ell as its v arian ts [17, 15, 11, 10, 12, 20, 21, 13 ]. Most of th ese studies consider the single queue case, whic h do es not h a v e an explicit limit o v er the queue capacit y . The b est kn o wn lo wer b ound of comp etitiv e ratio of deterministic algorithms is φ = (1 + √ 5) / 2 ≈ 1 . 618 [15, 11, 4]; this lo wer-b ound also applies to instances in wh ic h the d eadlines of the pac ke ts (w eakly) increase with their release dates. F or an arbitrary deadline instance, a simp le greedy algorithm that alw ays schedules a maximum- v alue pac ket in the queue is 2-c omp etitiv e [15, 17]. A generalizat ion of the greedy algorithm, called EDF α , whic h sc hedules the earliest pac k et with a v alue at least 1 /α ( α ≥ 1) of the maxim u m-v alue of a pac ket [10], has a co mp etitiv e r atio of (asymptotic ally) 2. Ch robak et al. [1 2 ] discuss a cleve r 2 In real-tim e sch eduling terminologies, 1 /k , the recipro cal of the comp etitiv e ratio, is called c omp etiti ve factor . W e use the term c omp etitive r atio , which is wi dely recognized in the area of onli ne computation. 3 mo dification that results in an algorithm with a comp etitiv e ratio of 64 / 33 ≈ 1 . 939. This algorithm emplo ys a status bit to h elp sc h edule pac kets and hence, it is not m emoryless 3 . F or instances in w hic h the d eadlines of the pac kets (wea kly) increase with their release dates, Li et al. [20 ] p rop ose an optimal deterministic online algorithm M G w h ose comp etitiv e ratio is φ . Unfortunately , this impro ve d comp etitiv e ratio is ac hieve d by exploiting th e d eadline assumption; on general instances, MG , lik e the greedy algorithm and ED F α , is also 2-comp etitiv e. Applying similar analysis approac h , but in a more complicated w ay , Li et al. pr ovide a 3 /φ ≈ 1 . 8 54-comp etitiv e deterministic algorithm [20] f or the general mo d el. Ind ep endently , Englert and W estermann present a 1 . 894-comp etitiv e deterministic memoryless algorithm and a (2 √ 2 − 1 ≈ 1 . 828)-c omp etitiv e deterministic algorithm [13], w hic h is not memoryless. Closing th e gap of [1 . 618 , 1 . 828] b et ween the lo w er b ounds and the upp er b oun ds of comp etitiv e ratio of determin istic online algorithms is still a difficult op en pr oblem. Randomization on the b ounded-dela y mo del is considered in [10]. A r andomized online algorithm with a comp etitiv e ratio of e/ ( e − 1) ≈ 1 . 582 is p rop osed. The lo w er b ound of comp etitiv e ratio of randomized algorithms is 1 . 25. Ho w to tigh ten the gap of [1 . 25 , 1 . 582] in the randomized m o del still r emains op en. Azar and Levy consider the multi-buffer mo del in w hic h multiple queues are b ounded in their capacitie s and pack ets can h a v e arbitrary deadlines. Noti ce that if the qu eu es are unlimited in capacities, this mo del is the same as the b ounded-dela y single queue mo del. The lo wer b ound 1 . 618 for the b ound ed-dela y mo del directly applies on the m u lti-queue mo d el. In [5], the authors giv e a d eterministic memoryless 9 . 82-comp etitiv e algorithm. In this p ap er, we impr o v e the lo w er b ound to 2 f or a family of d eterministic on lin e alg orithms (this lo wer b ound also applies to the finite qu eue mo d el). T o our kno wledge, there is no pu blished w ork of rand omized alg orithms on the multi-buffer mo del. Also, our pr op osed single fi nite qu eue mo del, whic h is more realistic for buffer managemen t, h as not been addressed in recen t literature. F or the single queue case, the comp etitiv e ratio of the algorithm in [5] 9 . 82 still applies. There h as also b een wo r k on another m o del in whic h the queue capacit y is b ounded. In this mo d el, pac k ets ha v e no deadlines but we ights, and the FIF O d iscipline is enf orced in deliv erin g pac k ets [22, 18, 8] — pack ets should b e sen t in the same order as they arriv e. Some researc hers also consider pac k et sc hedu ling in multi p le FIFO input queu es connecting one output queue [6, 7 , 3, 16]: Every qu eue ob eys the FIFO constraint in deliv ering weig hted p ac k ets and eac h arriving pack et has only one destined queue. 1.3 Our co ntributions. This pap er provides theoretical b oun ds for algorithms on the finite queue mo del, whic h considers the fin ite capacit y constraint for buffer managemen t u nder a more practical mo deling. Ou r main cont r ibutions include 1. A strictly 3-comp etitiv e deterministic memoryless online algorithm ME f or the fin ite queue mo d el (in S ection 2). 2. A strictly ( φ 2 = (( 1 + √ 5) / 2) 2 ≈ 2 . 618)-comp etitiv e r andomized memoryless online algo r ithm RME for the finite qu eue mo del (in S ection 3). 3. A new analysis metho d including a charging sc heme and a set of inv ariant s. T ab le 1 sum maries the comp etitiv e ratios of those kn own algorithms for the b ound ed-dela y mo d el, its v arian ts, and our r esults on th e fin ite queue mo d el. 3 An algorithm is called memoryless if this algorithm makes its sche duli ng decision only based on the pack ets in the curr ent queue but not on the historical infor mation. 4 Mo dels Upp er b ound of comp etitiv e ratio Lo we r b ound of comp etitiv e ratio General b ounded -d ela y mo del Deterministic algorithms: 1 . 854 [21] 1 . 828 [13] Deterministic alg orithm s: 1 . 618 [17, 15] Randomized algorithms: e/ ( e − 1) ≈ 1 . 582 [10] Randomized algorithms: 1.2 5 [10] Agreeable deadline b ound ed-dela y mo del Deterministic algorithms: 1 . 618 [20] Deterministic alg orithm s: 1 . 618 [17, 15] General fi nite qu eue mo del Deterministic algorithms: 3 (in th is pap er) A broad family of deterministic al- gorithms: 2 (in this pap er) Randomized algorithms: 2 . 618 (in this pap er) - T ab le 1: Summary of comp etitiv e ratios for the b ounded-dela y mo del and the fin ite qu eue mo del. Upp er b ound s are ac hieved by some kno w n alg orithm s . Any online algorithm ca n not ac hieve a comp etitiv e ratio less than the lo wer b ound. T o su p plemen t our work on the finite queue m o del, we also p ro vide an optimal offline algorithm (in Section 4). 2 Algorithm ME a nd Its Analysis In this section, we introdu ce a d eterministic memoryless online algorithm ME to sc hedu le pac kets w ith deadlines in a single fi n ite capacit y qu eue. ME stand s for “Mod ified ED F ”. W e first discuss the intuitio n s b ehind the algorithm M E . Then, w e pr esent M E and its analysis. 2.1 In tuitions of designing ME . W e commence our study at a well-kno wn real-time sc hedu ling algorithm called EDF (“Earliest-Deadline-F ir st”). EDF is one of the most imp ortan t (and ever analyzed) dynamic priority algorithm, and the pr iorit y of a job (or a pac ket ) is inv ersely p rop ortional to its ab s olute deadline. In eac h time step, EDF sc hedu les the pac ket w ith the earliest deadline [10]. T he f ollo wing example sh ows that eve n E DF calculates the b est sc h edule sequence among all p ending pac ket s, it do es not h a v e a constan t comp etitiv e ratio for the finite qu eue mo del 4 . In this example, the queue capacit y is b ∈ Z + and w e use ( w, d ) to represent a pac k et with v alue w and deadline d . W e use d = ∞ to d enote a pack et with a v ery large d eadline. Example 1. Initially , the algorithm’s queue is empt y . In the first time step, b − 1 p ac k ets of ( ǫ, i ), i = 1 , 2 , . . . , b − 1 and one pac k et (1 , ∞ ) arriv e. In eac h of the follo wing b − 2 time steps 2 , . . . , b − 1, only one pac ke t (1 , ∞ ) is released to the queue. When a new p ack et arrives, EDF tries to accept it and drops th e minim u m-v alue p ack et only if th e queue is o verflo w. EDF sends the earliest-deadline pac ke t in eac h time step. In our instance, EDF s ends the pac ket ( ǫ, i ) in eac h time step i = 1 , 2 , . . . , b − 1 and all released pack ets (1 , ∞ ) are s tored in its queue till the end of step b − 1. On the con trary , the optimal offline algorithm s en ds one pack et (1 , ∞ ) in eac h of the firs t b − 1 time steps, and only one pac k et (1 , ∞ ) r emains in its q u eue at the en d of step b − 1. 4 Suc h an algorithm is called non-c omp etitive . 5 A t the b eginnin g of step b , EDF ’s queue is full and has b p ac k ets (1 , ∞ ). No w b pac k ets of (1 − ǫ, 2 · b ) arriv e but since they hav e weigh ts smaller than the pac kets already in the buffer, they are d ropp ed. Notice th at EDF has lost b − 1 pac ket s of (1 − ǫ, 2 · b ) due to the o ve r flo w happ ening in step b . A t the b eginning of eac h step b + 1 , b + 2 , . . . , 2 · b , one p ac k et ( ǫ, b + i ) ( i = 1 , 2 , . . . , b ) arriv es. Giv en that all pac kets already in the queue keep their deadlines ∞ , EDF sends p ac k et ( ǫ, b + i ) in eac h time step. On th e cont r ary , the offline optimal algorithm sends (1 − ǫ, 2 · b ) in eac h step. A t the b eginning of step 2 · b + 1, b pac kets of (1 − ǫ, 3 · b ) arriv e and EDF ’s qu eue has a pac ket (1 − ǫ, 3 · b ) an d b − 1 p ac k ets (1 , ∞ ). EDF sends a pac k et (1 − ǫ, 3 · b ) in step b . Notic e that EDF has lost b − 1 pac ket s of (1 − ǫ, 3 · b ) du e to the o verflo w happ ening in step 2 · b + 1. A t the b eginnin g of eac h time step 2 · b + 2 , 2 · b + 3 , . . . , 3 · b , one pack et ( ǫ, 2 · b + i ) ( i = 2 , 3 , . . . , b ) arr iv es. Giv en that all pack ets already in the queu e ha ve deadline ∞ , EDF sends the pack et ( ǫ, 2 · b + i ) and kee p s those in th e queue without worrying ab out them b eing expir ed, hoping to send them in the fu ture. On th e con trary , the offline optimal algorithm sends (1 , ∞ ) in eac h time step. W e rep eat this pattern. In the interv al b et w een 2 o ve r flo ws (a p er io d of b time steps), the optimal offline algorithm s ends b large-v alue pac kets with v alue 1 − ǫ an d EDF sends only one large-v alue pac k et and b − 1 small v alue pac kets with v alue ǫ . W e find th at EDF cannot ac hieve a total v alue more than 1 /b of w hat an offlin e optimal algorithm d o es. Assume we run n r ounds of the same pattern of r eleased pac k ets. ED F sends all pac k ets (1 , ∞ ) afte r n r ou n ds. Th e comp etitiv e ratio c of EDF is (assume n · ǫ = 1) c = 1 · b + (1 − ǫ ) · b · n + ǫ · b [ ǫ · ( b − 1) + 1] · n + 1 · b ≥ b 1 + (2 · b − 1) /n ≥ b − 1 1 + n/ (2 · b − 1) . Giv en b is large and if w e rep eat ab o v e pattern for at least 1 /ǫ times, EDF is not comp etitiv e in sc hedu ling pac k ets w ith deadlines in th e fi nite capacit y queue b ecause the comp etitiv e c is n ot b oun ded b y a constant. Example 1 r ev eals th at e v en EDF ke eps the set of p ending p ackets with the maximum total value in e ach time step, it is not c omp etitive . Th e underlying id ea of using EDF is that w e d o not drop an y pac k et p un less p is going to expire at time d p or in the qu eue, there are more pack ets with n o less v alue than w p ha ving to b e sent b efore d p . The non-comp etitiv eness of EDF o ver the ab o v e instance implies that w e need a b etter metho d to iden tify wh ether a more v aluable pac ket should b e sen t eve n w ell b efore its “real deadline”. F or example, pac ket (1 − ǫ, ∞ ) released in step b + 1 in E x amp le 1 should be sent early instead of b eing o ve r flo wed by late r pac kets. Thus, it is critical for us to defin e and asso ciate a “virtu al deadline” with eac h pac k et, instead of the real d eadline assigned, to denote th e “b est latest time” by whic h a pac ket should b e sent. In spired b y the EDF instance in E x amp le 1, we prop ose an algo r ithm ME , whic h ke eps trac k of a pac ke t’s imp ortance with resp ectiv e to the others by using its “virtual deadline”. 2.2 Algorithm ME . At first, w e in tro d uce some notation. A p ac k et p arrive s at an in teger time r p ∈ Z + . p h as a non-n egativ e v alue w p ∈ R + and an in teger d eadline d p ∈ Z + . Giv en a time t , w e denote the buffer of an algorithm A to b e Q A t . All buffer slots in Q A t are indexed as 0 , 1 , . . . , b − 1. W e use Q A t ( i ) to denote the p ac k et in the bu ffer slot indexed as i . If there is no pac ket in a buffer slot i , Q A t ( i ) is a nul l p acket . W e asso ciate eac h pac ket p a virtual de ad line t p . A t p ’s arriv al, t p is initialized as its real deadline sp ecified by the adversary in the in put sequence. Giv en a set of p ending p ac k ets, a pr ovisional sche dule sp ecifies whic h pac k et should b e s ent in whic h time step no later than its virtual de ad line , assuming n o futur e arriv als. Giv en a s et of p ending pac k ets 6 with virtual deadlines, an optimal pr ovisional sche dule is the one that ac hiev es the maxim um total v alue of pac ket s among all pro visional sc hed u les on p endin g pac ke ts. The optimal p ro visional sc h edule giv es a greedily optimal sc hedule of all the p ending p ac k ets at time t : I f there is n o future arr iv als, sendin g the p ac k ets eac h in one time step follo wing the op timal p ro visional schedule is optimal for maximizing the total gain. W e d ev elop our algorithm ME from our considerations on the EDF instance in Example 1. ME consists of 3 parts: 1. Based on th e vir tual d eadlines of p ac k ets, calculate the optimal p ro visional schedule of sending the p end ing pac kets in the qu eue (includ ing the new arriv al in this time step), assuming there is no futur e arriv als (see Algorithm 1). 2. Up date the virtu al deadlines of p ac k ets, if needed (see Algorithm 2). 3. S en d the pac ket with the earliest v ir tual deadline or the m axim um-v alue pac k et, based on the ratio of these t wo pac ket s (see Algorithm 2). Assume for eac h pac ke t p , we ha ve known its v ir tual deadline t p . The follo win g pro cedur e OPS ( OPS stands for “Optimal Pro visional Sc hedule”) greedily calculates the optimal p r o visional s c hedule from the set of p end in g pac ket s S at time t . In O PS , we first sort pac k ets in non-increasing weig ht ord er. Then we pic k up a pac ket p and pu t it into an empt y queue as later as w e could. If we cannot find suc h an empt y buffer slot f or p , this p ac k et is discarded. All pac k ets selected to b e put into the queue are claimed to b e in the optimal p r o visional s chedule. OPS is describ ed in Algorithm 1. Algorithm 1 OPS ( S , t) 1: Sort all pac ket s in S in non-increasing we ight order, with ties b rok en in fa vo r of the larger virtual deadlines. 2: while S 6 = ∅ do 3: Pic k up a p ac k et p from S . 4: for eac h b uffer slot i in dexed from min { t p − t , b − 1 } do wn to 0 do 5: if there is no pac ket in th e bu ffer slot ind exed as i then 6: Put p in to the i -th b uffer slot. 7: Remo v e p from S . 8: Break . 9: end if 10: end for 11: if p is not added into the queu e then 12: Discard p . 13: end if 14: end while 15: Sort all pac ke ts in the q u eue in non-decreasing virtual deadline order, with ties brok en in fa v or of the larger v alue p ack ets. Using an int erchange argument, w e prov e the optimalit y of OPS . Lemma 2.1. OPS ( S ) c alculates the optimal pr ovisional sche dule f or a se t of p e nding p ackets S . 7 Pr o of. I n the algorithm OPS , for eac h pac ket p , w e either mo v e p in to the qu eue or we p erm an ently discard it. W e finalize the pro visional sc hedu le ˜ S in a greedy manner. T o prov e Lemma 2.1, it is sufficien t to pr o v e that for e ach pac k et p in the optimal pr o visional sc hedu le S ∗ , ˜ S and S ∗ c ho ose the same set of pac ket s to p ut in to buffer slots [ ˜ S ( p ) − t, b − 1], wher e ˜ S ( p ) denotes the time step in whic h p is p ut in to ˜ S ( p ), giv en the s et of p end in g p ac k ets and the assump tion of no futur e arriv als. Without loss of generalit y , w e assume all pac ke ts in S ∗ are sorted in n on-decreasing deadline order, with ties brok en in f av or of the larger v alue pac ket s . W e assume there exists an optimal pr o visional sc hedule S ∗ . If ˜ S = S ∗ , Lemma 2.1 holds imm ed iately . Let us assume ˜ S 6 = S ∗ . W e then compare the p ac k ets sc h eduled in ˜ S and S ∗ from the bu ffer slot indexed as b − 1 in reve r se order. q is th e fi rst pac ke t app earing in the schedule S ∗ that is different from its coun terpart in ˜ S (in the b ac kw ard m anner) and the corresp onding time slot in ˜ S conta ins p . A pac ket p 6 = q m u st b e found. W e apply the in terchange argument to prov e ˜ S = S ∗ . F rom ou r pro cedur e of selecting p ac k ets in OPS , we kn o w th at any pack et in a queue fr om ˜ S ( p ) to its virtual deadline t p has a v alue larger than or equal to w p . 1. If w q > w p , then, q should b e c hosen b efore p wh en we create ˜ S and q should b e put in the p osition ˜ S ( p ) instead of th e p osition of p . 2. If w q ≤ w p , th e optimal provisio n al sc hedu le S ∗ should con tain p since it includes q ( t p and t q are not b efore the time slot S ∗ sc hedu les q ). Without losing any v alue, S ∗ can swa p p and q since p is n ot in any buffer slot from S ∗ ( p ) to t p . Th u s, in th is step, b oth S ∗ (after sw app ing p and q ) and ˜ S schedule the same pac ke t p . Lemma 2.1 is pro ved. No w, we present the algorithm ME . M E consists of mainta in ing pac ke ts in the queue (including selecting pac k ets and up dating their virtual d eadlines) and d eliv ering a pac ket at the end of eac h time step. F or eac h new arriv al p , its v ir tual deadline t p is initialized as its real deadline d p . If there are more than one pac k et arriving, we consider them one b y one. The d eadline d p is sp ecified by the adv ersary at its arriv al. Then w e calculate all existing p ac k ets in th e queue and p to fin d the optimal pr o visional sc h edule from time t . After we obtain th e optimal pro visional s c hedule, we up date some pack ets’ virtual deadlines, if necessary . Eac h pac k et u p dates its virtual deadline to the tentat ive time step sp ecified in the optimal pro visional schedule. A t last, we send either th e p ac k et with the earliest virtual deadline (if it has a sufficien t large v alue), or th e maximum-v alue pac ket (otherwise). M E is d escrib ed in Algorithm 2. Directly from the algorithm ME , for eac h p ∈ Q ME t , we conclude the follo wing p rop erties of its virtual deadline t p : Remark 1. Al l p ackets p ∈ Q ME t have their t p sorte d in strictly incr e asing or der as t, t + 1 , . . . , t + | Q ME t | − 1 , wher e | Q ME t | is the numb er of p ackets in the queue. So, unless a new arrival p c omes with its virtual de ad line t p = d p > t + | Q ME t | − 1 , ac c epting p wil l le ad to dr opp ing exactly one p acket in Q ME t . Remark 2. Every time when t p is up date d (if any), t p is de c r e ase d strictly. F or any p acket p ∈ Q ME t , r p ≤ t p ≤ d p . Remark 3. Al l p ackets in the buffer have distinct virtual de ad lines, which may not b e the same as their de ad lines sp e c ifie d in the input se quenc e. 8 Algorithm 2 ME ( S , t) 1: F or eac h new arriv al p , set t p = d p . 2: Calculate the optimal pr o visional sc h edule S ∗ b y runn ing OPS ( Q ME t ∪ p , t ). 3: Drop all pac ke ts not in S ∗ . 4: Up date the virtual deadline t j of a p ac k et j ∈ S ∗ as t + i ( ≤ d j ), wh ere i is the index of the b uffer slot that j is r esiding in th e optimal provi s ional sc h edule queue. { Notice that Q ME t ( i ) = j . } { Let the pac k et w ith the earliest virtual deadline b e e , let the maxim u m-v alue pac ket b e h , with ties brok en in f a v or of the earliest virtual deadline. } 5: if w e ≥ w h /α then 6: Send e . 7: else 8: Send h . 9: end if { Lines 5 to 9 are as in EDF α [12]. } 2.3 Analysis of ME . Theorem 2.1. ME is a deterministic 3 -c omp etitive algo rithm for sche duling p ackets with de ad lines in the finite q u eue mo del, wher e the p ar ameter α in the algorithm is set 2 . Fix an input sequence of arriving pac k ets. The actions of the alg orithm can b e regarded as a sequence of p acket arrival events and p acket delivery events τ := τ 1 τ 2 . . . . Then, in our algorithm ME and its analysis, if not men tioning, we use the su b script t to d en ote the ev en t τ t , instead of the time step t . A single time step may in volv e m ore than one arr iv al even ts and only one d eliv ery ev ent. In analyzing online algorithms, p oten tial fun ction approac h and charging sc heme are t wo commonly used metho ds [9]. The p oten tial fu nction metho d assigns some v alues as the p otent ials to the online algorithm and th e adv ersary’s confi gurations resp ectiv ely , and then compares the c han ge of the p oten tials in eac h time step to b oun d the comp etitiv e ratio. In our analysis, we use a mo dified p otenti al f unction to pr ov e Theorem 2.1. W e let ADV denote th e adversary of ME and O denote th e set of pac kets sen t b y ADV , i.e., the pac ke ts in the optimal solution. Without loss of generalit y , we assume AD V sen ds the earliest d eadline pack et in eac h time step. Let the pac kets sen t by A DV b e p 1 , p 2 , . . . , p i , . . . in ord er . A pac ke t p i ∈ O is deliv ered in step i . If there is no pac k et to send in step t , p t is a nul l pac ket . Our analysis (esp ecially for p ac k et arr iv als) dep ends on a critical observ ation on the adversary and a prop erty of ME : Remark 4. Assume in step s 1 , 2 , . . . , i, n , ADV send s p ackets p 1 , p 2 , . . . , p i , . . . , p n in or der. Cle arly, r p i ≤ i ≤ d p i . F urthermor e, in ADV ’s queue, we ar e fr e e to mo dify the p acke ts’ de ad lines d p i to t ′ p i as long as r p i ≤ i ≤ t ′ p i . Remark 5. F or any p acket j i n ME ’s qu eue, the minimum value of a p acket i with t i ≤ t j do es not de c r e ase over time. W e use Φ ME t (resp ectiv ely , Φ ADV t ) to denote the p otentia l of the queue of ME (resp ectiv ely , ADV ) at time t . Φ ME t (resp ectiv ely , Φ ADV t ) is the su m of the (mapp ed) O -pac k ets (resp ectiv ely , O -pac kets) in the queue. 9 Define S A t as the pac ke t sen t by an algorithm A . Our goal is to prov e that at the end of eac h ev en t, the follo wing inequalit y 3 · X j ∈ S ME t w j + Φ ME t ≥ X k ∈ S ADV t w k + Φ ADV t , (2.1) holds. As a consequence, this y ields Theorem 2.1. Let ∆ ME t (resp ectiv ely , ∆ ADV t ) denote the d ifference of the left (resp ectiv ely , righ t) side of In equ alit y 2.1 from time t − 1 to time t , i.e., ∆ ME t := 3 · X i ∈ ( S ME t \ S ME t − 1 ) w i + Φ ME t − Φ ME t − 1 , (2.2) ∆ ADV t := X k ∈ ( S ADV t \ S ADV t − 1 ) w k + Φ ADV t − Φ ADV t − 1 . (2.3) Ob v ious ly , Inequ alit y 2.1 holds b efore the fi rst ev ent sin ce pac kets hav e not b een sent so far. In order to prov e Theorem 1, it is suffi cien t to pr o v e that for eac h ev en t, the follo win g inequalit y holds since it leads to Inequalit y 2.1. ∆ ME t ≥ ∆ ADV t . (2.4) In ord er to prov e Inequ alit y 2.4, w e present a set of in v arian ts wh ic h hold at the end of eac h ev en t. I 1 . ∆ ME t ≥ ∆ ADV t . I 2 . A DV ’s queue contai n s only th e set of pac k ets it will send . F or eac h p ack et j ∈ ( Q ME t ∩ Q ADV t ), ADV has the virtual d eadline t j as its real deadline. F or eac h pack et j ∈ Q ME t , j maps to at most one pac k et j ′ ∈ ( Q ADV t \ Q ME t ). F or eac h pac k et p ′ ∈ ( Q ADV t \ Q ME t ), p ′ m us t b e m app ed un iquely by a pac ket p ∈ Q ME t . I 3 . I f j ∈ Q ME t maps to j ′ ∈ ( Q ADV t \ Q ME t ), for any pac ke t i ∈ Q ME t with t i ≤ t j , the f ollo w ing in equ alities are tru e: t i ≤ d j ′ and w i ≥ w j ′ . W e prov e that th e set of inv ariants hold separately for b oth the ev ents of pack et arriv als and pack et deliv eries. Summing these in equalities o ver the arriv als and deliv eries happ ened in one s in gle time step yields the claim for a single time step; summing ov er all time steps prov es Theorem 2.1. T o pro ve the existence of the ab o ve s et of inv arian ts, we app ly case study in the follo wing. Pr o of. W e sho w th e set of inv ariants hold at the end of eac h time step. F or eac h time s tep, we consider pac k et arriv als and pac ket d eliv ery separately . In the follo wing case analysis, we up date the pack ets in ADV ’s queue as well as their mapp ings to the pac kets in ME ’s bu ffer. If not men tioned otherwise, everything else remains un c hanged at the end of this ev ent. F or ease of present ation, w e assume buffer slots are indexed as 1 , 2 , . . . , b . W e use O to denote the set of pac kets sen t by the adv ersary . Let e and h denote the p ac k ets with the earliest virtual deadline an d the pac ke t with the maximum v alue, with ties b rok en in fav or of the earliest virtual deadline one. Remem b er all pac k ets in the queue h a ve d istinct virtual deadlines (see Algorithm 1 and Remark 3). W e are going to show that in eac h time step, the ratio of ADV ’s gain o ve r ME ’s gain is b ound ed by 1 + α , or 1 + 3 /α , or 2 + 2 /α . The comp etitiv e ratio 3 is optimized at α = 2 for min max { 1 + α, 1 + 3 /α, 2 + 2 /α } . (2.5) 10 2.3.1 P ac k et delivery In eac h time step, ME either sends e or h . If ME sends e , w e ≥ w h /α ; otherwise, ME send s h . W e assu m e ADV sends j . A t the end of this deliv ery ev en t, e is out of ME ’s queue b ecause of its virtu al deadline. W e su m marize all the p ossible consequences into the follo win g 5 cases, based on the pac ket M E sends and the p ac k et ADV sends in eac h step. 1. Assu me ME and ADV send the same p ac k et j . W e c harge ME w j . W e c harge ADV w j initially . If j 6 = e , i.e., j = h and w e kn o w w h > α · w e . W e c harge ADV more w e + w e ′ + w j ′ , where e ′ is the pac k et mapp ed by e and j ′ is the pac k et mapp ed by j , if any . F rom the in v arian t I 3 , max { w e ′ , w j ′ } ≤ w e . Thus, the ratio of the mo d ified gain for ADV and ME is b oun ded b y max { ( w e + w e ′ ) /w e , ( w e + w e ′ + w j + w j ′ ) /w j } = max { 2 , 1 + 3 /α } = 1 + 3 /α , where α = 2. 2. Assu me ME sends e and A DV sends j / ∈ Q ME t . F rom the in v arian t I 2 , we assume j = p ′ , and j is mapp ed by a pac ke t p ∈ Q ME t . Since M E sends e , w e ≥ w h /α . (a) Assume e = p . W e c harge ME w e and charge ADV w j ≤ w p = w e . Th en the r atio of the mo dified gains is w j /w e ≤ 1. (b) Assume e 6 = p and e is not in any mapping. W e c harge ME w e and w e ADV w e + w j (giv en e p ossibly b eing an O -p ack et). Th en the r atio of the mo dified gains is ( w e + w j ) /w e ≤ ( w e + w h ) /w e ≤ 1 + α . (c) Assum e e 6 = p and e maps e ′ ∈ Q ADV t . W e ha ve d e ′ > d j , otherwise, ADV will select e ′ to s end (b ecause w e assume ADV sele cts pack ets to send in the earliest deadline ord er ). T h us , d e ′ ≥ d j = d p ′ ≥ t p (the third inequalit y holds b ecause of the in v arian t I 2 ). Also, p / ∈ Q ADV , otherwise, since t p = d p ≤ d j , ADV will send p instead of j . W e c harge ME w e and w e c harge ADV w e ′ + w j . Then the ratio of th e mo dified gains is ( w e ′ + w j ) /w e ≤ ( w e + w h ) /w e = 1 + α . 3. Assu me ME sends e and A DV sends j ∈ Q ME t , e 6 = j . w e ≥ w h /α ≥ w j /α . e / ∈ Q ADV t , otherwise, ADV w ill send e instead of j in this step. W e c harge ME w e . W e charge A DV w e ′ + w j , assuming e maps e ′ . Then the ratio of the mo d ified gains is ( w e ′ + w j ) /w e ≤ 1 + α . If j maps a pac ket in AD V ’s queue only , this m apping still holds at the end of this d eliv ery ev ent. 4. Assu me ME sends h 6 = e and AD V sends j / ∈ Q ME t . Note w e < w h /α . F rom the in v ariant I 2 , w e can assume p ∈ Q ME t maps p ′ = j ∈ ( Q ADV t \ Q ME t ). Since A DV sends p ′ and d p ′ ≥ t p (from the inv arian t I 2 ), we kno w p / ∈ Q ADV t . Thus, w j = w p ′ ≤ w e . h should b e in Q ADV t , otherwise, ADV can send h instead of j to gain more v alue in this time step. Also, w h ′ ≤ w e . 11 (a) Assume e = p . e is out of ME ’s queu e at the end of this ev ent b ecause of its vir tual deadline expires. Then w e c harge ME w h . W e c harge ADV w e + w e ′ + w h + w h ′ , assu ming e maps e ′ = j and h maps h ′ . Note max { w e ′ , w h ′ } ≤ w e < w h /α . Then the ratio of the mo difi ed gains is ( w e + w e ′ + w h + w h ′ ) /w h ≤ (3 + α ) /α = 1 + 3 /α . (b) Assume e 6 = p . Assume e 6 = p and e maps e ′ ∈ Q ADV t . W e ha ve d e ′ > d j , otherw ise, ADV will select e ′ to send (b ecause we assume ADV selects pac k ets to send in earliest d eadline order). Thus, d e ′ ≥ d j = d p ′ ≥ t p . W e map p to e ′ . W e c harge ME w h and we c harge ADV w h + w h ′ + w e + w e ′ . Then the ratio of the mo dified gains is ( w e + w e ′ + w h + w h ′ ) /w h ≤ 1 + 3 /α . 5. Assu me ME sends h 6 = e and AD V sends j ∈ Q ME t , j 6 = h . Clearly , t j = d j < t h = d h , otherwise, ADV can alwa ys swa p th e sendin g sequences of j and h . h should b e in Q ADV t , otherwise, ADV can send h instead of j to gain more v alue in this time step. Also, w h ′ ≤ w e . (a) Assume j = e . W e c harge ME w h and c h arge ADV w h + w h ′ + w e + w e ′ , assum in g e ma p s e ′ and h maps h ′ . max { w e ′ , w h ′ } ≤ w e ≤ w h /α . Then the rati o of the modified g ains is ( w h + w h ′ + w e + w e ′ ) /w h ≤ 1 + 3 /α . (b) Assume j 6 = e . e is not an O -p ac k et. Assu me e maps e ′ in AD V ’s qu eue; if e ′ do es not exist, w e let e ′ b e a n u ll pack et. w e ′ ≤ w e . Note w j ′ ≤ w e . A t the end of this d eliv ery , j is s till in ME ’s qu eue b ut j is not in ADV ’s queue. W e c harge ME w h . Then , we charge ADV w h + w h ′ + w j + w e ′ . Then the r atio of the mo difi ed gains is ( w h + w h ′ + w j + w e ′ ) /w h ≤ ( w h + w e + w h + w e ) /w h = 2 + 2 /α . 2.3.2 P ac k et arriv als Remem b er that f r om the prop erties of algorithm M E (see Remark 1 and Remark 2), for eac h new arriv al p , if admitting p results in a pac k et i lea ving Q ME t , the total v alue of the queue is not decrea sin g. p can alw a ys b e a candidate pac k et to map the pac ke t which wa s mapp ed by the p ac k et evicted du e to accepting p (since w p ≥ w i ). Also, the slac k time of p , defin ed as d p − t , is no larger than the total num b er of p ac k ets in the queue | Q ME t | , otherwise, p will b e accepted b y ME w ithout evicting a pack et (see Algorithm 1). F or eac h arriving even t at time t , S ME t +1 \ S ME t = Q ADV t +1 \ Q ADV t = ∅ . Thus, f or eac h new arriv al ev ent , w e only n eed to consider the c hange of mappings, if an y . F rom the prop erty of the adv ersary , we k n o w that all pac ke ts in A DV ’s queue (supp osed to b e sent b y ADV ) will not b e evicted when we put new O -pac kets in ADV ’s queue. Let us consider the case when in tro d ucing an O -pack et p results in a pack et i lea vin g ME ’s queue. If i is not in AD V ’s queue, we are fine with all mappings and p oten tials b ecause there is no loss to Φ ME t . W e only consider the case when i is in ADV ’s qu eue. Assuming i is an O -pac k et in ADV ’s queue, we first claim that w e can alw a ys find a pac ket q , which is n ot in ADV ’s queue with w q ≥ w i . Other w ise, ADV does not accept p as well. Then w e coll ect a ll 12 O -pac ke ts in M E ’s queu e but w ith deadlines ≤ | Q ME t | , as they are need to b e d eliv ered by A DV by time t + | Q ME t | , it d o es not hurt to assign them deadlines in strictly decreasing order from t + | Q ME t | . Therefore, the evicted O -pac ke t i can b e assigned a deadline as the virtual deadline of the la test non- O -pac k et in a b u ffer s lot no later than d i − t in ME ’s queue. Let this p ac k et b e j . W e can r emo v e i from ADV ’s queue and put j with t j as its d eadline and w j as its v alue in ADV ’s queue. These op erations do not h u rt A DV b ecause of Remark 5. Ab o v e r easoning can also b e applied to th e case when a new O -pack et p is r ejected by ME . Based on our case study at pac ket arriv al ev ents and p ac k et deliv ery ev en ts discussed ab o v e, Theorem 2.1 is p ro ve d . Some sid e research results on the fin ite queue mo del are sh o wn as f ollo ws; they giv e the upp er and lo w er b ounds that (some) online algorithms can ac h iev e. W e use S t to denote b oth the pro visional sc hedule for time steps [ t, + ∞ ) and the set of p ack ets sp ecified b y the sc hedu le. All known onlin e algorithms for the b ounded-dela y mo del [17], [1 5 ], [11], [20], [21], [13] calculate their optimal provisio n al sc h edules at the b eginning of eac h time step. These algorithms only differ by the pac kets they select to send. The deterministic onlin e algorithms in suc h a broad family are d efi ned as th e b est-effort admission algorithms . Definition 1. Best-effort admission algorithm . Consider an online algorithm ON and a set of p ending p ackets P t at time t . If ON c alculates the optimal pr ovisional sche dule S t on P t and sele cts one p acket fr om S t to se nd in the step t , we c al l ON a b est-effort admission algorithm . Theorem 2.2. The lower b ound of c omp etitive r atio for the b est-effort admission algorithms is 2 . Pr o of. I n the follo wing in s tance, we will sho w: If the buff er size is b ounde d, the p ackets that the optimal offline algorithm c ho oses to send may not b e fr om the optima l pr ovisional sche dule c alculate d by th e online algorithm, even i f b oth algorithms have the same set of p ending p ackets . This prop erty d o es not hold in the b ound ed-dela y mo del; and it leads that an y deterministic b est-effort admission algorithm cannot ac h iev e a comp etitiv e r atio b etter than 2. Assume the bu ffer size is b . Let a b est-effort admission online algorithm b e ON . W e use ( w p , d p ) to represent a pac ke t p w ith a v alue w p and a deadline d p . Initially , the b uffer is empt y . A set of pac kets, from whic h the optimal offline algorithm will accept b − 1 pack ets from th em and ev entually send, are released: (1 , b + 1) , (1 , b + 2) , . . . , (1 , b + b ). Based on its d efinition, u p on these p ack ets’ arriv al, ON will select all of them to p ut into its bu ffer . Notice that all pack ets released h a v e deadlines larger than the b uffer size b . T he optimal offline algorithm dr op s (1 , b + 1), and ke eps (1 , b + 2) , . . . , (1 , b + b ) in its b u ffer. In the same time s tep, b p ac k ets (1 + ǫ, 1) , (1 + ǫ, 2) , . . . , (1 + ǫ, b ) are released afterwa r ds. There are no more new pac kets arrivin g in this step. The optimal offline algorithm only accepts (1 + ǫ, 1). Th u s, after pr o cessing arriv als in step 1, th e optimal offline algorithm send the pac k et (1 + ǫ , 1). Instead, ON calculates the optimal pro visional schedule in step 1 wh ic h in cludes all these newly arr iving p ac k ets with v alue 1 + ǫ . All such pac kets will b e accepted by ON , b ut the p ac k ets (1 , b + i ), ∀ i = 1 , 2 , . . . , b , will b e dr opp ed du e to the buffer size constraint. ON sends a pac ket w ith v alue 1 + ǫ in the first step. A t the b eginning of eac h step i = 2 , 3 , . . . , b , only on e pac ket (1 + ǫ, i ) is released. At the end of step b , no n ew p ac k ets will b e r eleased in the future. Since the time after the fi rst step, all pac kets 13 a v ailable to O N h a v e their deadlines ≤ b . Thus, ON cannot sc hedu le sending pack ets with a total v alue ≥ (1 + ǫ ) · ( b − 1) in the time steps 2 , 3 , . . . , b . Of course, since there is one empt y buffer slot at the beginnin g of eac h time step i = 2 , 3 , . . . , b , the optimal offline algorithm can accept and send all newly released pac kets (1 + ǫ, i ) in steps i = 2 , 3 , . . . , b . A t the end of step b , the pac kets (1 , b + 2) , (1 , b + 3) , . . . , (1 , b + b ) are still remained in the optimal offline algorithm’s buffer (they are n ot in ON ’s bu ffer thou gh ). Since there is no futu re arriv als, these b − 1 pac k ets will b e transm itted eve ntually by the optimal algorithm in the f ollo wing b − 1 steps. Th e total v alue of ON ac hieve s is (1 + ǫ ) · b while the optimal offline alg orithm gets a total v alue (1 + ǫ ) · b + 1 · ( b − 1). The comp etitiv e ratio f or this in stance is c = (1 + ǫ ) · b + 1 · ( b − 1) (1 + ǫ ) · b = 2 − 1 + b · ǫ b + b · ǫ ≥ 2 − 2 b , if ǫ · b = 1 and b ≥ 2 . If b is la r ge, ON cann ot p erform asymptotically b etter than 2-comp etitiv e. This lose is d ue to ON calculating op timal p ro visional schedule to fi nd out the pac ket to send in eac h time step. Theorem 2.2 is prov ed. Lemma 2.2. The simple gr e e dy algorithm, which sele cts p ackets in the optimal pr ovisional sche dule and sends the maximum-value p acket in e ach time step, is no b etter than 4 -c omp etitive. Pr o of. I n the follo wing instance, we will show that the greedy algorithm Greedy , whic h calculates the optimal pro visional sc hedule an d sc hedules the m axim um-v alue p ac k et, cannot b e b ette r than 4- comp etitiv e. Let th e bu ffer size b e b . Without loss of generalit y , we assume b is ev en. W e use ( w p , d p ) to repr esen t a pac ket p with a v alue w p and a deadline d p . Supp ose at the en d of step 0, the buffer is emp t y . A s et of pack ets, w hic h the optimal offline algorithm will ev entually send, are released: (1 , b + 1) , (1 , b + 2) , . . . , (1 , b + b ). Notice that all pac k ets in the buffer h a v e deadlines larger than the buffer s ize b . A t the b eginning of step 1, b pac k ets (1 + 1 · ǫ, 1) , (1 + 2 · ǫ, 2) , . . . , (1 + b · ǫ, b ) are released. Greedy accepts all these newly arriving pac ket s. The optimal offline algorithm only accepts (1 + ǫ, 1), drops (1 , b + 1) , and k eeps (1 , b + 2) , . . . , (1 , b + b ) in its buffer. In step 1, the optimal offline alg orithm send (1 + ǫ, 1). Instead, Gr eedy w ill accept all newly released p ack ets in step 1, th u s, all pack ets (1 , b + i ) for any i = 1 , 2 , . . . , b are d ropp ed. Greed y sen ds the pac ket (1 + b · ǫ, b ). At the end of th is step, the pac ket (1 + 1 · ǫ, 1) in Gree dy ’s bu ffer expires. A t the b eginning of eac h step i = 2 , 3 , . . . , b , only one pack et (1 + ǫ, i ) is r eleased. A t the end of step b , no futur e p ack ets will b e released. Gre edy rejects all these n ewly released pac kets. Greedy will send the pac kets (1 + ( b − 1) · ǫ, b − 1) , (1 + ( b − 2) · ǫ, b − 2) , . . . , (1 + ( b/ 2 + 1) · ǫ, b/ 2 + 1) in the follo wing b/ 2 − 1 time steps . All the pac k ets (1 + 2 · ǫ, 2) , (1 + 3 · ǫ, 3) , . . . , (1 + ( b/ 2) · ǫ, b/ 2) will b e dropp ed due to their deadlines. Of course, the optimal offlin e algorithm can sen d all newly released pac k ets in steps 2 , 3 , . . . , b . A t the end of step b , the pac kets (1 , b + 2) , (1 , b + 3) , . . . , (1 , b + b ) are still remained in the optimal offline algorithm’s bu ffer , but not in Greedy ’s buffer. Since there is no fu ture arriv als, these b − 1 pac k ets w ill b e transmitted ev en tually by the optimal algorithm in the follo wing b − 1 steps. If b is large, Gree dy cannot p erform b etter than 4-comp etitiv e. The lose is due to G reedy ’s first step in which optimal p ro visional sc hedu le is used in selecting pac kets in the buffer and its greedy mann er in s ending pack ets in the fir st b/ 2 time steps. Lemma 2.2 is prov ed. 14 3 Algorithm RME and Its Analysis In this section, w e present a r an d omized algorithm for the fin ite capacit y queue mo del. Our algorithm is n amed R ME , which stands for “Randomized ME ”. Similar to ME , RME consists of t wo parts in h andling pac k et arr iv als and pac ket delive r ies resp ectiv ely in eac h time step. The differen ce is that RME employs a rand om v ariable to decide whether to send the earliest p ack et or the most v aluable pac k et. W e w ould lik e to p oin t out that eve n R ME mak es a random c hoice durin g its execution, this randomization is executed by the algorithm internally and has n othing to d o with the c h aracteristics of the input s equence. Th e adv ersary is allo w ed to generate the inpu t sequence to maximize the comp etitiv e ratio. No sto c hastic assump tion is made on th e input sequence. 3.1 Algorithm RME . F or eac h pack et arr iv al ev ent, RME w orks the same as w hat ME do es. That is, RME calls OPS ( S , t ) to id en tify the p ac k ets in its b uffer deterministically , where S is th e set of p ending pac k ets and t is the cur ren t time. In pac k et deliv ery , a ran d om v ariable β is used to facilitate sc heduling. W e use e to denote the p ac k et with the earliest-virtual deadline pac ket and h to denote the earliest maxim um v alue pac ke t in the b uffer. The algorithm w orks as follo ws. If e has a sufficien tly large v alue with w e ≥ w h /α , we send e deterministically . O therwise (i.e., w e < w h /α ), we c h o ose β uniformly on [0 , 1]. If β ∈ [0 , γ ] (we will decide γ later. The parameter γ infl uences the comp etitiv e ratio of the algorithm), we deliver e , otherwise (i.e., if β ∈ ( γ , 1] and w e < w h /α ), we d eliver h . T he pseud o co de of RME is describ ed in Algorithm 3, where the set of p ending p ac k ets at time t is S . Algorithm 3 RME ( S , t) 1: F or eac h new arriv al p , set t p = d p . 2: Calculate the optimal pr o visional sc h edule S ∗ b y runn ing OPS ( Q ME t ∪ p , t ). 3: Drop all pac ke ts not in S ∗ . 4: Up date the virtual deadline t j of a pac ket j ∈ S ∗ as t + i , wh ere i is the index of the buffer slot that j is in. 5: if w e ≥ w h /α then 6: Send e . 7: else 8: Cho ose β uniform ly on [0 , 1]. 9: if β ∈ [0 , γ ] then 10: Send e . 11: else 12: Send h . 13: end if 14: end if 3.2 Analysis of RME . Theorem 3.1. RME is a r andomize d ( φ 2 ≈ 2 . 618 )-c omp etitive algorithm for sche duling p acke ts with de ad lines in the finite queue mo del, wher e α = φ ≈ 1 . 6 18 and γ = 1 / φ 2 ≈ 0 . 382 . Some f ormulas are u sed in our analysis: 1 /φ + 1 = φ, φ + 1 = φ 2 , 2 + 1 /φ = φ 2 , φ + 1 /φ 2 = 2 . 15 Pr o of. At first, w e examine the exp ected gain that the algorithm RME can gain in a time s tep. F rom the algorithm itself, we kno w that RM E gains, w e , if w e ≥ w h /α, w e , if w e < w h /α and β ∈ [0 , 1 /φ 2 ] , w h , if w e < w h /α and β ∈ (1 /φ 2 , 1] . In either wa y ( w e ≥ w h /φ or w e < w h /φ ), the algorithm gains an exp ected v alue of E ( W t ) ≥ m in { w h /φ, w e · (1 /φ 2 ) + w h · (1 − 1 /φ 2 ) } = w h /φ. Remem b er S A t is the pac ke t sent b y an algorithm A . W e observe the follo w ing set of inv ariant s ab out ADV and RME ’s b uffers: V 1 . φ 2 · E ( X j ∈ S RME t w j ) + Φ RME t = φ 2 · X j ∈ S RME t E ( w j ) ≥ X k ∈ S ADV t w k + Φ ADV t , where linearit y of exp ectations is used in the first equalit y . V 2 . A DV ’s queu e cont ains only the set of pac ket s it sends. F or eac h pac k et j ∈ ( Q RME t ∩ Q ADV t ), ADV h as the vir tu al deadline t j as this p ac k et’s mo dified real deadline d j . F or eac h pac k et j ∈ Q RME t , j maps to at most one pac k et j ′ ∈ ( Q ADV t \ Q RME t ). F or eac h pac ket p ′ ∈ ( Q ADV t \ Q RME t ), p ′ m us t b e mapp ed u niquely by a pack et p ∈ Q RME t . V 3 . I f j ∈ Q RME t maps j ′ ∈ ( Q ADV t \ Q RME t ), for an y pack et i ∈ Q RME t with t i ≤ t j , t i ≤ d j ′ and w i ≥ w j ′ . Similar to the analysis of ME , pac ke t arriv al and deliv ery eve nts are analyzed separated from case studies. W e omit the analysis on p ac k et arriv al, whic h h as b een p resen ted in the pr o of of Th eorem 2.1. In the follo wing, we discuss th e in v arian ts in the randomized p ac k et deliv ery ev ents. In eac h time step, RME either sends e or h . If R ME send s h , we must ha ve w h ≥ α · w e = φ · w e (from the algorithm). W e assume ADV sends j . A t the end of this delivery ev en t, e is out of RME ’s q u eue b ecause of its virtu al deadline. W e study the follo wing cases w hic h are categorized based on th e pac ket RME sends and th e pac ket ADV sends in eac h time step. 1. Assu me RME send s e and w e ≥ w h /φ . As what we ha ve seen in the pro of of Theorem 2.1, the ratio of the mo d ified gain is b ounded b y 1 + α = 1 + φ = φ 2 . 2. Assu me RME send s e with w e < w h /φ . This case h ap p ens with a p r obabilit y of 1 /φ 2 when w e < w h /φ . W e combine this case w ith the next case to get the exp ected comp etitiv e r atio. 3. Assu me RME send s h 6 = e and AD V sends j 6 = h . This case happ ens with a probabilit y of 1 /φ when w e < w h /φ . e leav es the b uffer at the en d of this delive r y due to its vir tu al deadline. W e assume j 6 = e . 16 (If j = e , w e j ust ignore all w j and w j ′ in ou r follo wing calculation and all inequalities still hold with simpler representati ons . If j = h , we simply use h to replace j in the follo w ing calculation and all inequalities hold also.) W e categorize the cases with e is in a mappin g and e is not in a mapp ing. If e is in a mapping, e is sen t with a p robabilit y of 1 /φ 2 and h is sen t with a p robabilit y of 1 /φ . In the first case, w e c harge ADV w e + w e ′ where e maps e ′ . In the second case, w e c harge ADV w e + w e ′ + w j + w h ′ . Thus, the exp ected comp etitiv e ratio is c = ADV t E ( RME t ) = (1 /φ 2 ) · (2 · w e ) + (1 /φ ) · ( w e + w e ′ + w j + w h ′ ) (1 /φ 2 ) · w e + (1 /φ ) · w h ≤ 2 w e + φ · 2 w e + φ · 2 w h w e + φ · w h ≤ (2 φ + 2)( w h /φ ) + 2 φ · h w h /φ + φ · w h = 2 + 2 /φ + 2 φ 1 /φ + φ ≤ φ 2 . If e is not in a m apping, e is sent with a pr obabilit y of 1 /φ 2 and h is sent with a p robabilit y of 1 /φ . I n the fi rst case, we c harge AD V w j ≤ w h . In the second case, we charge ADV w j + w h + w h ′ . Remem b er w e ≥ w h ′ (see the inv arian t V 3 ). Thus, the exp ected comp etitiv e ratio is c = ADV t E ( RME t ) = (1 /φ 2 ) · w j + (1 /φ ) · ( w j + w h + w h ′ ) (1 /φ 2 ) · w e + (1 /φ ) · w h ≤ w h /φ 2 + ( w h + w h + w e ) /φ w e /φ 2 + w h /φ ≤ w h + 2 · φ · w h + φ · w e w e + φ · w h ≤ 2 · φ + 1 φ = φ 2 . Based on the ab o v e analysis, Theorem 3.1 is prov ed. 4 The Optimal O ffline Algorithm and It s Analysis Let O denote the set of p ac k ets sen t by an optimal offline algorithm. Our algo r ith m is simple. Fix an input sequence I . W e start from a set of pac kets S 0 ⊆ I suc h that all pac kets in S 0 = S can b e deliv ered successfully if we send them in increasing ord er of d eadlines. Giv en a set of pac k ets S , w e get the total gain of W ( S ). If S 0 = I , the algorithm is optimal. If S 0 6 = I , then w e study the set of pac k ets I \ S 0 . W e sort all pack ets in I \ S 0 in increasing order of deadlines. F or eac h p ac k et j , add in g j into S 0 generates a new set S ; this results at most one pac ket i not b eing sent successfully (still u n der the earliest deadline p olicy). Then we run in to a lo op to pic k up a pac k et i ∈ S with w i < w j and see w h ether W ( S ∪ { j } \ { i } ) > W ( S ). ( i can b e a nul l p acket suc h that S ∪ { j } \ { i } = S ∪ { j } . If W ( S ∪ { j } ) > W ( S ∪ { j } \ { i } ) > W ( S ), w e add j in to S . If W ( S ∪ { j } ) < W ( S ∪ { j } \ { i } ), w e drop i . W e iterativ ely mo ve j out of I \ S 0 in to S until I \ S 0 is emp t y . W e claim that the sc h ed ule we finally ha ve is optimal. It d ep ends on the follo win g t wo theorems. Theorem 4.1. Given a set of p ackets S , if al l p ackets c an b e sent by their de ad lines with the buffer size c onstr aint, we c an always sche dule them in incr e asing or der of de ad lines among al l p ending p ackets in the buffe r. 17 Pr o of. T his is a standard result. Lemma 4.1. S 0 is e asy to b e c onstruct. We simply pick up the e arliest de ad line p acket to send and in e ach time step, gr e e dily ac c ept p ackets. Theorem 4.2. If a set of p ackets S c an b e deliver e d suc c essful ly, S ∪ { j } r esults at most one p acket unsuc c e ssful ly sent. We c an pick up any p acket i with w i < w j as th e c andidate and sche dule S ∪ { j } \ { i } . If W ( S ∪ { j } \ { i } ) > W ( S ) but W ( S ∪ { j } ) ≤ W ( S ) , i / ∈ O . Pr o of. T his is due to th e pr op ert y of matrio d. Theorem 4.3. The optimal offline algorithm runs in p olynomial-time O ( n 3 ) , wher e n is the size of the input se quenc e. Pr o of. Given a set of m pack ets S , sorting all pack ets in S (in order of increasing deadlines) tak es time O ( m · log m ). F or eac h p ac k et n ot in S bu t not discarded ye t, w e take time O ( m ) to lo cate a pack et i with v alue w i < w j and then we sc hedu le S ∪ { j } \ { i } (note that i can b e a nul l p ackets su c h that S ∪ { j } \ { i } = S ∪ { j } ). It take s time O ( m ) to get the total gain of a s chedule. T h us , identifying whether to accept j or to d iscard j tak es time O ( m 2 ). Let th e set of pac kets in the in put sequence b e n with n > m . Th e total ru nning time of our algorithm is b ounded by O ( n · n 2 ) = O ( n 3 ). 5 Conclusions and Op en Problems In this pap er, w e presen t t w o online algorithms for sc h ed uling weigh ted pac k ets with hard deadlines in a fi n ite capacit y queue an d w e provide th eir theoretical comp etitiv e analysis. Th e mo del w e study generalizes the extensively studied b ounded-dela y mo d el f or QoS b uffer managemen t. Our mo d el has significan t imp ortance in real system design since it tak es in to accoun t of the r ealistic bou n d on the size of th e router queues. The deterministic m emoryless algorithm we p resen t is 3-comp etitiv e and the randomized memoryless algorithm w e presen t is ( φ 2 ≈ 2 . 618)-comp etitiv e. Both algorithms pro vid e the w orst-case guarantees to robu stly op timize our ob jectiv e (maximizing the w eigh ted throughp u t) without applying any sto c hastic assum ptions o ver the pac ket traffic. W e pr op ose a n o v el analysis app roac h b y up d ating pac ke ts’ parameters in an online manner. Instead of using the real d eadlines, w e introd uce virtual deadlines, whic h are u p dated o ver time to help us m ake the b est decision on when to send the pac k ets. The virtual deadlines are strictly d ecreased ov er time and they guarantee the hard deadlines are alwa y s satisfied. This idea can b e applied in many other online and real-time p roblems. Closing or shrinkin g the gap of [1 . 61 8 , 2 . 618] b etw een the lo w er b ound and u pp er b ound of comp etitiv e ratios for this mo del is an op en problem. F or a broad family of online algorithms, includin g all pr eviously kno wn resea r c h for the b ounded-dela y model, the lo wer b ound is 2. Our algorithmic framew ork can b e applied to th e multi-buffer mo del [5]. Getting an algorithm b etter than 9 . 82- comp etitiv e for th e the multi- b uffer mo d el is still an in teresting op en p r oblem. References [1] W. Aiello , Y. Ma nsour, S. Ra jagop olan, and A. Rosen. Comp etitive queue polic ies for differentiated ser vices. In Pr o c e e dings of the 19th Annual Joint Confer enc e of t he IEEE Computer and Commun ic ations S o cieties (INFOCOM) , pages 431–4 40, 2 000. 18 [2] W. Aiello , Y. Ma nsour, S. Ra jagop olan, and A. Rosen. Comp etitive queue polic ies for differentiated ser vices. Journal of Algorithms , 55(2):113 –141, 2005. [3] S. Alb ers and M. Sc hmidt. On the perfo r mance of g reedy a lg orithms in pa ck et buffer ing . SIAM Journ al on Computing , 35(2):2 78–30 4, 20 0 5. [4] N. Andelman, Y. Manso ur, and A. Z hu. Comp etitiv e que uing p olices for QoS switches. In Pr o c e e dings of the 14th Annual ACM-SIAM Symp osium on Discr ete Algo rithms (SO DA) , pag es 761– 770, 2003. [5] Y. Azar a nd N. Levy . Multiplexing packets with ar bitrary deadlines in b ounded buffers. L e ctu r e N otes in Computer Scienc e (SW A T) , pag e s 5–16, 2006 . [6] Y. Azar and Y. Rich ter. Mana gement of m ulti-queue switches in Qo S netw or ks. In Pr o c e e dings of the 35th Annual ACM Symp osium on The ory of Computing (STOC) , pages 82–8 9, 2003. [7] Y. Azar and Y. Rich ter. The zero-o ne principle for switching netw o rks. In Pr o c e e dings of the 36th Annual ACM Symp osium on The ory of Computing (S TOC) , pages 64 –71, 2004 . [8] N. Bans al, L. K. Fleischer, T. Kim brel, M. Mahdia n, B. Schieber, a nd M. Sviridenko. F ur ther improv ements in comp etitive guara nt ee s for QoS buffering . In Pr o c e e dings of the 31st Intern ational Col lo quium on Automata, L anguages and Pr o gr amming ( ICALP) , pages 1 96–20 7, 20 04. [9] A. Bor o din and R. El-Y aniv. Online Computation and Comp etitive Analysis . Cam bridge Univ er sity Press, 1998. [10] F. Y. L. Chin, M. Chrobak , S. P . Y. F ung, W. Jaw or, J. Sgall, and T. Tich y . Online compe titive a lgorithms for maximizing weighted thr oughput of unit jobs. Journ al of Discr ete Algorithms , 4(2):255– 276, 2006. [11] F. Y. L. Chin a nd S. P . Y. F ung . Online scheduling with par tia l job v alues: Do es timesharing or randomizatio n help? Algorithmi c a , 37(3):14 9–164 , 2003. [12] M. Chrobak, W. Jaw or , J. Sga ll, a nd T. Tichy . Improv ed online algor ithms for buffer ma nagement in Qo S switches. ACM T r ansactions on Algori t hms , 3 (4), Article num b er 50 , 2007 . [13] M. Englert and M. W ester mann. Co nsidering suppressed pack ets improv es buffer mana g ement in QoS switches. In Pr o c e e dings of the 18th Annual ACM-SIAM Symp osium on Discr ete Algorithms (SODA) , pages 209–2 18, 2 007. [14] S. Floyd and V. Paxson. Difficulties in simulating the Internet. IEEE/A CM T r ansactions on Networking , (4):392–4 03, 2 001. [15] B. Ha jek. On the comp etitiveness of online scheduling o f unit-length pa ckets with hard deadlines in slotted time. In Pr o c e e dings of 2001 Confe re n c e on Information Scienc es and Systems (CISS) , pages 434 –438, 20 01. [16] T. Ito h a nd N. T ak ahashi. Competitive analy sis of m ulti-queue preemptive QoS algorithms for genera l priorities. IEICE T r ansactions on F undamentals of Ele ctr onics, Communic ations and Computer Scienc es , E89-A(5):1 1 86–1 1 97, 2006. [17] A. Kess elman, Z. Lotker, Y. Manso ur, B. Patt-Shamir, B. Schieber, and M. Sviridenko. Buffer overflo w management in QoS switches. SIAM Journ al of Computing (S ICO MP) , 33(3):56 3–583 , 2004. [18] A. Kesselman, Y. Mansour, and R. v a n Stee. Improv ed comp etitive guarantees fo r QoS buffering. In Pr o c e e dings of 13th Annual Eur op e an S ymp osium on Algorithms (ESA) , page s 36 1–372 , 2 003. [19] F. Li. Comp etitive scheduling o f pack ets with hard dea dlines in a finite ca pacity queue. In Pr o c e e dings of the 28th IEEE In t ernational Confer enc e on Computer Communic ations (INFOCOM) , 2009 . [20] F. Li, J. Sethuraman, and C. Stein. An optimal online algorithm for pack et s c heduling with agreeable deadlines. In Pr o c e e dings of the 16th Annual ACM-SIAM Symp osium on Discr ete Alg orithms (S O DA) , pages 801– 802, 2005. [21] F. Li, J. Sethuraman, and C. Stein. Better o nline buffer mana gement. In Pr o c e e dings of the 18th Annual ACM -S IAM S ymp osium on Discr ete Algorithms (SO DA) , pag es 199–20 8, 2007. [22] Z. Lotker and B. Patt-Shamir. Near ly optimal FIFO buffer management for DiffServ. In Pr o c e e dings of the 21st Annual ACM Symp osium on Principles of Distribute d Computing (PODC) , pa g es 134–14 2, 20 02. [23] W. Willinger and V. Paxso n. Where mathematics meets the Internet. Notic es of the Americ an Mathematic al So ciety , pages 9 61–97 0, 19 98. 19
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment