1 Introduction
Online Buffer Management is a scheduling problem which arises in network routers. Packets arrive online to be sent on a specific link, the goal is to maximize the total weight of sent packets under various constraints. Different models have been studied in the past, the FIFO model, where the router stores pending packets in a limited capacity buffer, and the bounded delay model where packets can stay only limited time in the buffer.
We are particularly interested in the later model, which can be formalized as the following scheduling problem. Jobs of unit length arrive online on a single machine. Job arrives at a release time , has a deadline and a weight . At every time point , there is a set of pending jobs, which is updated by jobs released at time and by jobs expiring at time . The algorithm can choose to schedule one of the pending jobs, at every time point, and the goal is to maximize the total weight of the scheduled jobs. The usual restriction on the online algorithm is that these decisions need to be made without knowledge of future arriving jobs. Its performance is measured by the competitive ratio, which compares the objective value reached by the algorithm with the objective value of the optimal schedule, maximizing the ratio over all possible instances. The deterministic competitive ratio of the problem is defined as the best competitive ratio among all deterministic online algorithms. As randomization usually helps in these online settings, we also consider the randomized competitive ratio against an oblivious adversary. The term adversary comes from the game theoretical setting of an online problem, played between an online algorithm which needs to make decisions at every time point and a malicious adversary which generates the instance over time. Other adversarial models exist but are not considered in this paper.
2 Related work
This problem has been introduced in 2001, together with a lower bound of on the deterministic competitive ratio [6] and [8] and an upper bound of 2, achieved by the MaxPacket algorithm which schedules always the heaviest pending job. This gap between lower and upper bound generated a series of studies of variants of this problem, mostly with restrictions on the deadlines of the job, such as agreeable deadlines (jobs can be ordered by release times and deadlines at the same time) or uniform or bounded instances ( is or at most ) for some parameter . Eventually in SODA 2019 the gap was closed, with a sophisticated algorithm and analysis [9]. The randomized competitive ratio in the oblivious adversary model of this problem is still open, and known to be between [1] and [4].
The paper [3] considered a variant of the problem, where every job has not unit processing time, but a processing time , all jobs are tight in the sense , and the algorithm can preempt job executions. In this setting the authors give a barely random algorithm with competitive ratio 2, and showed that this optimal for barely random algorithms. By scaling this is equivalent to the problem with unit processing time jobs by fractional release times and deadlines. In our problem these times are restricted to integers, and in this context preemption is of no help to the algorithm.
In particular, we consider a variant of the bounded delay buffer management problem, where every job can have either low or high weight, that is for some parameter . The 2valued variant has been studied in [5] who showed the deterministic competitive ratio is . It is motivated by the fact that some applications, as for example online games, could send packets with two kind of informations: Major updates in the game configuration (such as the arrival or departure of participants), and minor updates (such as not critical moves).
2.1 Contributions
The lower bound of the deterministic competitive ratio for the 2valued variant can be easily transformed into a randomized lower bound. In addition this transformation suggests a randomized online algorithm, which we show to have optimal competitive ratio .
3 Preliminaries
Formally an instance of the bounded delay buffer management problem consists of a finite sequence of jobs. Each job has a unit processing time, a release time , a deadline and a priority weight . The time line consists of time points (also called time slots) . During each time point, at most one job can be executed. A job is pending at time if and if it has not already been scheduled. An online algorithm can schedule at each time point at most one pending job, and has to make this decision without knowledge of futur released jobs. The objective value of a schedule is the total priority weight of all scheduled jobs. This value is compared with the objective value of an optimal schedule, and the resulting value is called the competitive ratio. The optimal schedule can be computed offline by solving a maximum weight bipartite matching problem, matching jobs to time points. The competitive ratio of algorithm is the supremum of its competitive ratio over all instances. The competitive ratio of the problem is the infinum of the competitive ratio over all online algorithms. Usually the online computation paradigm is seen as a game played between the algorithm (making decisions which job to schedule) and the adversary (generating jobs).
If is a randomized algorithm, then the performance of is the expected objective value of the produced schedule. Different adversarial models have been studied in the literature. In this paper we focus on the oblivious adversary, where the input is generated without knowledge of the random choices made by the algorithm.
Online algorithms for this problem, heavily rely on the notion of a provisional schedule, which was introduced in [5]. Recall, that for an algorithm and a point in time , we define the set of pending jobs as the set of jobs released prior or at time , which have their deadline strictly after , and which have not yet been scheduled by . The provisional schedule is a maximum weight subset of pending jobs, which can be scheduled from time on. This set can be computed greedily, by starting with , and processing first all pending heavy jobs, then all pending light jobs, in arbitrary order within each category. Each considered job is then added to if and only if the number of jobs with is strictly less than . This condition ensures that there is a provisional feasible schedule for .
There are two natural deterministic algorithms that are defined in [5]. The first algorithm, called MaxPacket, schedules at every time time step, a job of the provisional schedule of maximum weight, breaking ties by the deadlines of job (earliest deadline has the highest priority). The second algorithm, called FirstPacket schedules at every time time step, a job of the provisional schedule of minimum deadline.
The deterministic lower bound consists of an adversary which releases at time 0 two jobs, see Figure 1. A job of weight and deadline and a job of weight and deadline 2. If the algorithm schedules the heavy job, then no more jobs are released, and the competitive ratio is . If the algorithm schedules the urgent light job, then at time the adversary releases another job of weight and deadline , leading to the ratio . This shows a lower bound of on the deterministic competitive ratio. It also suggests a simple deterministic algorithm. Let be the solution to the equation . If run FirstPacket, else run MaxPacket. In [5] this strategy has shown to be optimal.
4 Randomized competitive ratio
The previous lower bound can be extended into a lower bound against an oblivious randomized adversary.
Proposition 1
No randomized online algorithm can achieve a competitive ratio better than .
Proof We use a game between adversary and the algorithm to derive the result. In the previous lower bound the adversary had two possibilities: either release only two jobs at time (instance 1) or in addition release a job at time (instance 2). The algorithm at time had also two choices, execute the urgent job (Firstpacket) or the heavy job (MaxPacket). The competitive ratios resulting from each choice are as follows:
instance 1  instance 2  

MaxPacket  
FirstPacket 
Von Neumann’s Minimax Theorem tells us that for this game the adversary should play instance 1 with probability
and instance 2 with probability , while the algorithm should play MaxPacket with probability and FirstPacket with probability , for(1) 
By verifying the expressions, indeed one can show that for the choice of , MaxPacket obtains an expected gain of
which equals the expected gain of FirstPacket, namely
In addition one can show that for the choice of , the algorithm has in both instances the competitive ratio
This shows the claimed lower bound.
Note that the above lower bound is maximized at and gives the value
4.1 Upper bound
The lower bound construction suggests a simple barely random algorithm. At time it flips a biased coin and based on its outcome decides between the two already mentioned deterministic algorithms. In other words BarelyRandom will run MaxPacket with probability and FirstPacket with probability , for being the value defined in (1). This surprisingly simple algorithm has optimal competitive ratio.
Theorem 1
Algorithm BarelyRandom has a competitive ratio of against an oblivious adversary.
Proof Fix an instance, and denote by Opt an optimal schedule. We start showing some structural properties of the three schedules Opt, MaxPacket and FirstPacket. For any set of unit length jobs , denote by EDF() the schedule obtained by scheduling from left to right at every time point a most urgent pending job. It is known that EDF schedules all jobs as earliest as possible in the sense, that for every time , it maximizes the number of jobs which can be scheduled among before time . In particular it maximizes the number of jobs scheduled among . In addition for every job , such that EDF() contains one more job than EDF(), we have that the support of EDF() — set of active time slots — is a superset of the support of EDF(). Moreover every job is scheduled in EDF() at the same time slot or one time slot later than in EDF().
These facts imply that MaxPacket maximizes the number of heavy jobs, and that its support is included in the support of Opt. Moreover without loss of generality Opt schedules the same heavy jobs, and for every timeslot where MaxPacket is idle but not Opt, the later executes a heavy job. The same observation holds for time slots where MaxPacket is idle but not FirstPacket. And finally we observe that the schedules Opt and FirstPacket have the same support.
For the remainder of the proof we use the following counters:

w is the number of jobs common to all 3 schedules

x is the number of jobs which are in Opt but not in FirstPacket.

y is the number of 1jobs in MaxPacket.

z is the number of idle time slots where MaxPacket is idle but not Opt.
For convenience we use upper case letters for the corresponding sets. In particular are job sets, while is a set of time slots.
We claim that . For this we construct a surjective mapping from to .
Consider a job scheduled at time in Opt which belongs to . Since did not make it into the plan of FirstPacket, during all its lifespan , FirstPacket executes only jobs. So we map to the job scheduled by FirstPacket at the same time .
Consider a time , i.e. MaxPacket is idle, but Opt executes some job. We observed previously that both Opt and FirstPacket execute an job at time . Let be the job scheduled by FirstPacket at time , and let be the job scheduled by Opt at time . If , then and we map the time to job .
Otherwise if , then we follow a pointer chasing construction as follows, see Figure 3 for an illustration. Job was scheduled by MaxPacket at some earlier time step . Let be the job scheduled by FirstPacket at time and be the job scheduled by Opt at time . We know that is an job, because this is the case for all jobs scheduled by FirstPacket during the lifespan of . We repeat the same argument, namely, if , then we map to otherwise we recourse on a earlier time step, where MaxPacket schedules .
The mapping is surjective, because every job in is executed in a different time slot in Opt. Either it is scheduled to a job in FirstPacket scheduled at the same time or to job in another time slot, find is found through the previously mentioned pointer chasing procedure. The construction of this procedure ensures that different initial time slots, lead to different final time slots.
It remains to show that from the inequality we can derive the claimed competitive ratio . Recall the probability , .
Using the counters we can express the profits of the schedules as follows
MaxPacket  
Opt  
FirstPacket 
Here for convenience we used the same names for the schedules and for their profits. Note that in expression of the profit of FirstPacket has the same variables as for Opt because their support is the same, however the coefficients for differ. Also Opt schedules the same heavy jobs as MaxPacket, this why they both have the same variables with coefficient , but Opt has the additional term , taking into account the additional support of Opt. We show the following inequality through a sequence of simplifications.
Opt  
Opt  
which holds by , and .
5 Conclusion
Now that the randomized competitive ratio of the two valued bounded delay online buffer management problem is tackled — against the oblivious adversary — it would be interesting to see how it can be generalized to more values, for example job weights belonging to the set , or even to the general problem. Current the only known randomized algorithms for the general problem are Rmix and Remix.
The algorithm Rmix was defined in [2] as follows. At every time point, consider the heaviest pending job. Denote its weight. Let be a uniformly chosen real number. Let be a job with minimal deadline and weight . Execute at this time point. We can observe that, if executed on instance 1 of the lower bound instance from Proposition 1, at time it will choose the heavy job with probability . Hence it has a larger tendency to choose the heavy job, than BarelyRandom and is fooled by instance 1.
The algorithm ReMix was defined in [7], and behaves even differently on instance 1. It will execute the heavy job with probability and the light job with probability , but is also not optimal. These comparisons with BarelyRandom are unfair in a sense, because they have been designed for the general weighted case, and mostly for an adaptive adversary. But the comparison indicates room for improvement. The optimal randomized algorithm for the general weighted problem, might combine ideas of all these mentioned algorithms, and in particular borrow from the optimal deterministic algorithm [9].
6 Acknowledgment
This work was partially supported by the French research agency (ANR19CE480016), the CNRS PEPS project ADVICE as well as by the EPSRC grant EP/S033483/1.
We would like to thank Spyros Angelopoulos for helpful discussions.
References
 [1] Yair Bartal, Francis Y. L. Chin, Marek Chrobak, Stanley P. Y. Fung, Wojciech Jawor, Ron Lavi, Jiří Sgall, and Tomáš Tichý. Online competitive algorithms for maximizing weighted throughput of unit jobs. volume 2996, pages 187–198, 2004.
 [2] Francis Y. L. Chin, Marek Chrobak, Stanley P. Y. Fung, Wojciech Jawor, Jiří Sgall, and Tomáš Tichý. Online competitive algorithms for maximizing weighted throughput of unit jobs. Journal of Discrete Algorithms, 4:255–276, 2006.
 [3] Francis Y. L. Chin and Stanley P. Y. Fung. Improved competitivness algorithms for online scheduling with partial job values. In 9th International Computing and Combinatorics Conference, pages 425–434, 2003.
 [4] Francis Y. L. Chin and Stanley P. Y. Fung. Online scheduling for partial job values: Does timesharing or randomization help? Algorithmica, 37:149–164, 2003.
 [5] Matthias Englert and Matthias Westerman. Considering suppressed packets improves buffer management in QoS switches. pages 209–218, 2007.
 [6] B. Hajek. On the competitiveness of online scheduling of unitlength packets with hard deadlines in slotted time. In Conference in Information Sciences and Systems, pages 434–438, 2001.
 [7] Łukasz Jeż. A universal randomized packet scheduling algorithm. Algorithmica, 67(4):498–515, 2013.
 [8] A. Kesselman, Zvi Lotker, Yishay Mansour, Boaz PattShamir, Baruch Schieber, and Maxim Sviridenko. Buffer overflow management in QoS switches. pages 520–529, 2001.
 [9] Pavel Veselý, Marek Chrobak, Lukasz Jez, and Jirí Sgall. A competitive algorithm for scheduling packets with deadlines. CoRR, abs/1807.07177, 2018.