Rejecting Jobs to Minimize Load and Maximum Flow-time
Anamitra Roy Choudhury, Syamantak Das, Naveen Garg, Amit Kumar
aa r X i v : . [ c s . D S ] O c t Rejecting jobs to Minimize Load and Maximum Flow-time
Anamitra Roy Choudhury ∗ Syamantak Das † Naveen Garg † Amit Kumar † Abstract
Online algorithms are usually analyzed using the notion of competitive ratio which comparesthe solution obtained by the algorithm to that obtained by an online adversary for the worstpossible input sequence. Often this measure turns out to be too pessimistic, and one popularapproach especially for scheduling problems has been that of “resource augmentation” whichwas first proposed by Kalyanasundaram and Pruhs. Although resource augmentation has beenvery successful in dealing with a variety of objective functions, there are problems for which evena (arbitrary) constant speedup cannot lead to a constant competitive algorithm. In this paperwe propose a “rejection model” which requires no resource augmentation but which permits theonline algorithm to not serve an epsilon-fraction of the requests.The problems considered in this paper are in the restricted assignment setting where eachjob can be assigned only to a subset of machines. For the load balancing problem where theobjective is to minimize the maximum load on any machine, we give O (log /ε )-competitivealgorithm which rejects at most an ε -fraction of the jobs. For the problem of minimizing themaximum weighted flow-time, we give an O (1 /ε )-competitive algorithm which can reject atmost an ε -fraction of the jobs by weight. We also extend this result to a more general settingwhere the weights of a job for measuring its weighted flow-time and its contribution towardstotal allowed rejection weight are different. This is useful, for instance, when we consider theobjective of minimizing the maximum stretch. We obtain an O (1 /ε )-competitive algorithm inthis case.Our algorithms are immediate dispatch, though they may not be immediate reject. All theseproblems have very strong lower bounds in the speed augmentation model. ∗ IBM Research - India, New Delhi. email: [email protected] † Department of Computer Science and Engg., IIT Delhi. email: { sdas, naveen, amitk } @cse.iitd.ac.in Introduction
Online algorithms are usually analyzed using the notion of competitive ratio which compares thesolution obtained by the algorithm to that obtained by an offline adversary for the worst possibleinput sequence. Researchers have tried to address the criticism of this measure being too pessimisticby either limiting the power of the adversary – oblivious adversary, stochastic adversary – or givingmore power to the online algorithm – lookahead, additional resources, etc. One popular approachespecially for scheduling problems has been that of “resource augmentation” and was first proposedby Kalyanasundaram and Pruhs [29]. In this model the machines of the online algorithm havemore speed than those of the offline algorithm. Many scheduling problems for which no constantcompetitive online algorithm is possible now have such algorithms in this resource augmentationmodel. The success of the speed augmentation model lies in the fact that many natural algorithmscan be analysed in this framework.In this paper, we propose a “rejection model” in which there is no resource augmentation, butwe allow the online algorithm to not serve an ε -fraction of requests. There are two principal reasonsfor considering this model: (i) although resource augmentation has been very successful in dealingwith a variety of objective functions, there are problems for which even a (arbitrary) constantspeedup cannot lead to a constant competitive algorithm – we consider two such problems in thispaper, and (ii) this might be a natural assumption in many settings where job rejection is part ofthe service provided by a system (e.g., “Server busy: Please try again later” message we often seewhen accessing popular websites).For most scheduling problems, an algorithm in the resource augmentation model can be “simu-lated” in this rejection model by roughly letting each machine drop every (1 /ε ) th job assigned to it.However, the rejection model is much more powerful than the resource augmentation model sincewe are not restricted to drop an ε -fraction of jobs assigned to each machine, i.e., we could dropmany more jobs assigned to one machine as compared to another as long as the overall number ofrejected jobs stays within ε -fraction of the total number of jobs. We demonstrate this by consid-ering two classical problems – load balancing and maximum (weighted) flow time. For both theseproblems we give constant competitive algorithms in the rejection model while no such algorithmsare possible in the resource augmentation model. This is the key contribution of this paper.The problems considered in this paper are in the restricted assignment setting where each jobcan be assigned only to a subset of machines. All our algorithms are pre-emptive, immediatedispatch – a job is assigned to a machine as soon as it is released and non-migratory – a job isprocessed only on the machine to which it is assigned. While ideally we would also like to makerejection decisions immediately when the job is released, we also allow for the job being rejectedwhile it is waiting in the queue. We justify this by showing that no online algorithm with immediatedispatch and immediate rejection can be constant competitive for the load balancing problem (andhence, the maximum flow-time problem). Our Results : For the load balancing problem(
LoadBalancing ) where the objective is to minimizethe maximum load on any machine, we give an O (log (cid:0) ε (cid:1) ) competitive immediate rejection algo-rithm when all jobs have unit processing time and the online algorithm can reject an ε -fraction ofthe jobs. For general processing times our algorithm is not immediate reject and is O (log (cid:0) ε (cid:1) )-competitive. We show that one cannot get a constant competitive algorithm if we require immediaterejection. Note that there is a Ω(log m ) lower bound on the competitive ratio of any online algo-rithm for this problem where m is the number of machines [10]. Further, making the machines an ε -fraction faster has no significant impact on this lower bound.1or the maximum flow-time problem Anand et. al [4] show that no immediate dispatch algorithmcan be constant competitive even when the jobs are unit length and we allow resource augmentation.For this setting of unit jobs we show an immediate reject algorithm which is O (1 /ε )-competitive andrejects at most an ε fraction of the jobs. When jobs have weights( WtdMaxFlowTime ), the objectiveis to minimize the maximum weighted flow-time of a job. For this setting Anand et. al [4] show thatno online algorithm can be constant competitive even when we allow non-immediate dispatch andresource augmentation. Our algorithm for this setting is immediate dispatch but not immediatereject and is allowed to reject jobs of total weight at most an ε -times the total weight of all jobsand has a competitive ratio of O (1 /ε ). We also show that it is not possible to get better than O (1 /ε )-competitive algorithm in this model, and that one cannot get a good competitive algorithmif we are required to perform immediate reject and immediate dispatch.We further generalize our result to a setting where each job has two kinds of weight – rejectionweight and flow-time weight. The weighted flow-time of the job is defined as its flow-time times itsflow-time weight, and the goal, as before, is to minimize the maximum weighted flow-time of a job.However, the total rejection weight of the jobs which get rejected should be at most ε fraction of thetotal rejection weight of all the jobs. We obtain an O (1 /ε )-competitive algorithm for this problem.The problem of minimizing maximum stretch is a special case of this setting in the rejection model.Here, the rejection weights are all unit while the flow-time weights are the inverse of processingsizes. Load Balancing . Graham [26] considered this problem in the context of identical machines andshowed that the simple greedy heuristic of assigning the next task to the least loaded machine is 2-competitive (see also the survey by Azar [8]). Albers [1] improved the competitive ratio to 1 .
923 andalso showed a lower bound of 1 .
852 on the competitive ratio of any deterministic online algorithm,while Albers et al. [2] shows improved bounds in the special case where the online algorithm knowsthe sum of job sizes at any point. For related machines model, Berman et al. [14] gave constantcompetitive algorithms. However, the problem becomes significantly harder in the unrelated ma-chines model, where a job can have different processing time on different machines. Azar et al. [10]considered the problem in the restricted assignment setting, and gave an O (log m )-competitivealgorithm for load balancing( m being the number of machines). They also complemented thisresult by proving lower bound of Ω(log m ) for any deterministic and Ω(ln m ) for any randomizedonline algorithm under the restricted assignment model. Buchbinder et al.[15] gave an alternative,more general upper bound on the load on any prefix of the most loaded machines. For the unre-lated machines setting, Aspnes et al. [6] gave an O (log m )-competitive algorithm. There has beensome work on resource augmentation in this setting. Azar et al.[9] showed a competitive ratio of1 + 1 / nm (1 − o (1)) when the online algorithm is allowed to use n identical machines while the offlineoptimal is restricted to m < n identical machines. Flow-time minimization . There has been considerable work on scheduling with the objectiveof minimizing a suitable norm of the flow-time of jobs. For the objective of average flow-time ofjobs, a logarithmic competitive algorithm in the identical machines setting is known [30, 7]. Gargand Kumar [23] extended this result to the related machines setting. Garg and Kumar [24] showedthat the problem becomes considerably harder in the restricted assignment setting and no onlinealgorithm with bounded competitive ratio is possible. Bansal and Pruhs [12] showed that thecompetitive ratio can be as high as Ω( n c ) for the problem of minimizing ℓ p (for any 1 < p < ∞ )2orm, where n is the number of jobs, even for a single machine. For minimizing the maximumflow-time in the identical machines model, Amb¨uhl and Mastrolilli [3] gave a simple 2-competitivealgorithm. However, Anand et al. [4] showed that the competitive ratio of any online algorithm forthe restricted assignment setting is as high as Ω( m ), where m is the number of machines.One approach for circumventing such strong lower bounds has been speed augmentation, wherewe allow each machine in the online algorithm ε -fraction more speed than the corresponding machinein the offline algorithm. This model was first proposed by Kalyanasundaram and Pruhs [29] whoused it to get an O (1 /ε )-competitive algorithm for minimizing total flow time on a single machine inthe non clairvoyant setting. Bansal and Pruhs [12] proved that several natural scheduling algorithmsare O (1 /ε )-competitive algorithm for minimizing ℓ p norm (for any 1 < p < ∞ ) of flow-time of jobsin the single machine setting. Golovin et al. [25] extended this result to parallel machines setting.Chekuri et al. [19] showed that the immediate dispatch algorithm of Avrahami and Azar [7] is also O (1 /ε )-competitive for all ℓ p norms ( p ≥ O (1 /ε )-competitive algorithm for minimizing the sum of flow-time of jobs, whichwas improved and extended to the case of ℓ p norm of flow-time by Im and Moseley [28] andAnand et al. [5]. However, the competitive ratio remained a function of p , and in fact, Anandet al. [4] showed that one cannot obtain competitive ratio better than Ω (cid:16) pε − O (1 /p ) (cid:17) even in therestricted assignment model.For the objective of minimizing the maximum (unweighted) flow time on unrelated machinesunder the speed augmentation model, Anand et al. [4] gave a O (1 /ε )-competitive algorithm; howevertheir algorithm is not an immediate dispatch algorithm. In fact, Azar et al. [10] showed that anyimmediate dispatch algorithm for minimizing maximum flow time will have a competitive ratio canbe as high as Ω(log m ) in the restricted assignment setting even with constant speed augmentation.In the maximum weighted flow-time case, this lower bound holds even if we allow non-immediatedispatch [4]. Chekuri et al. [21, 20] considered the problem of minimizing the maximum delay factorof a job in the parallel machines setting, where jobs come with deadlines and the delay factor ofa job is the ratio of its flow-time to the difference between the deadline and its release date. Thisproblem is equivalent to minimizing the maximum weighted flow time, where the weight of a job j can be seen as ( d j − r j ) − . They gave a (1 + ε )-speed O (1 /ε )-competitive algorithm. Scheduling with Rejection.
There has been considerable work on online scheduling with jobrejections in the prize collecting setting. Here, each job comes with a specified penalty which isto be incurred in case it is not scheduled. The goal is to minimize the sum of a suitable objectivefunction of the completion times of the jobs (which are not rejected) and the total penalty cost ofrejected jobs. Bartal et al. [13] considered the problem of minimizing makespan in the identicalmachines model with penalties and gave a 2.618-competitive algorithm. Epstein et al. [22] extendedthis work to the problem of minimizing makespan on two related machines. Bansal et al. [11]considered the online problem of minimizing total flow-time of jobs and total idle time on a singlemachine along with uniform rejection penalty for all jobs. They gave 2-competitive algorithmsfor both the objectives. For the case of arbitrary penalties and average weighted flow-time, theyshowed strong lower bound of Ω(max( n , C )) on the competitive ratio of any randomized onlinealgorithm. They complemented this with an O ( ε (log W + log C ) )-competitive algorithm with(1 + ε )-speed augmentation, where W is the ratio between maximum and minimum weights and C is the ratio between maximum and minimum penalties. These results were extended to non-clairvoyant settings (i.e., the size of a job is not known till the time it finishes processing) in theidentical machines setting by Chan et al. [17] – they considered an objective function which also3ad an energy term, and gave constant competitive 2(1 + ε )-speed algorithm. Minimizing averageflow-time and completion time with rejections has also been studied in the offline context [27].Charikar and Khuller [18] studied the online problem of minimizing maximum flow-time in moregeneral context of broadcast scheduling, where both the online algorithm and the offline optimumare allowed to ignore a fixed fraction of the jobs. They showed that no randomized online algorithmcan be constant competitve, while the offline problem admits a 5-approximation. We formally define the problems considered in this paper. We consider the online problem ofscheduling in the restricted assignment setting. The input instance specifies a small enough positiveparameter ε . We have a set of m machines, and jobs arrive in an online manner. A job j arrives attime r j , and can only be scheduled on a subset S j of machines. Further, it specifies a processingrequirement (or size) of p j units.In the LoadBalancing problem, a solution needs to dispatch each job to a machine. It can alsochoose to reject a job (either when it arrives or after a job has been dispatched to a machine).However, for any time t , the total number of jobs rejected by the algorithm till time t must beat most ε fraction of the number of jobs that have arrived till time t . The load assigned to amachine at any point of time t is defined as the total processing requirement of jobs which havebeen dispatched to it till time t – note that this does not count jobs which get rejected by time t ,but it counts jobs which will get rejected after time t . The goal of the scheduling algorithm is tominimize (for all time t ) the maximum load assigned to any machine.In the WtdMaxFlowTime problem, an input instance can be described as above. Further, we alsohave a weight w j associated with each job j . A solution needs to process a job j on one of themachines in S j for p j amount of time. Note that any machine can perform 1 unit of processingin unit time, and we allow jobs to be pre-empted. However, migration is not allowed – a jobdispatched to a machine i must be completed on i or rejected. The flow-time of a job is definedas the difference between its completion time C j and its release time r j . The goal is to minimizethe maximum weighted flow-time of a job, i.e., max j w j · ( C j − r j ). As before, till any time t , ouralgorithm is allowed to reject ε -fraction of jobs which have arrived till this time. This rejection caneither happen on arrival of a job or later.In the GenWtdMaxFlowTime problem, the setting is same as above, but the weights for flow-timeand the weight for rejection are different. In other words, instead of having one weight w j , a job j has two weights associated with it, the rejection-weight w rj and flow-time-weight w fj . Again theobjective is to minimize the maximum over all jobs j of w fj F j , where F j denotes the flow-time of job j in a schedule; and we are allowed to reject jobs of total rejection-weight at most ε times the totalrejection-weight of all the jobs. Note that in the case of WtdMaxFlowTime problem, w rj happens tobe same as w fj .Our algorithms for MaxFlowTime and
WtdMaxFlowTime (and
GenWtdMaxFlowTime ) satisfy theimmediate dispatch property – when a job j arrives, it is dispatched to a machine at time r j . Notethat it may still get rejected later.We now give an outline of rest of the paper. In Section 4, we give a brief outline of our algorithmsand the ideas involved. In Section 5, we give an algorithm for the LoadBalancing problem. InSection 6, we describe our algorithm for the
WtdMaxFlowTime problem. To illustrate some of theideas, we first consider the special case of unit size and unit weight in Section 6.1. Although one4oes not need to invoke an LP relaxation here, we give a more detailed explanation in this sectionso that similar ideas in later section can be clearer. In Section 6.2, we describe the algorithm for thegeneral case. The algorithm is split in two parts – A and B . We first describe these two algorithmsand give their analysis in Section 6.2.1. In Section 7, we show how to extend our results to the GenWtdMaxFlowTime problem. Finally, in Section 8, we give lower bounds on competitive ratios forthe problems considered in this paper.
In both the
LoadBalancing and the
WtdMaxFlowTime problems, we assume that we know the valueof the offline optimum solution, denoted by T ⋆ . Removing this assumption requires standard ideasin online algorithms (details are given in Section 5.3 and Section 6.3).In the LoadBalancing problem, we first consider the special case when all jobs are of unitsize. Here, the algorithm is quite natural – when a job arrives, it is dispatched to the least loadedmachine (among the ones it can be dispatched to). However, we do not allow the load on a machineto exceed αT ⋆ where α = log (cid:0) ε (cid:1) – if we dispatch a job to a machine on which the load is alreadyat this limit, we reject this job. Clearly, the algorithm is O (log (cid:0) ε (cid:1) )-competitive. To bound thenumber of rejected jobs, we use the following argument. Let m l denote the number of machineswhere the algorithm dispatches at least lT ⋆ jobs ( l is some integer between 1 and log (cid:0) ε (cid:1) ). Anaive argument will show that the total number of jobs is at least m l · lT ⋆ , but a slightly morecareful argument can show that the number of jobs in the system is at least m l · l T ⋆ . A roughargument goes as follows: let M l be the set of machines where the algorithm assigns at least lT ⋆ jobs. Consider the jobs dispatched to M l which are at level ( l − T ⋆ or above (level of a job is itsposition in the queue of the corresponding machine). There will be 2 | M l | T ⋆ such jobs, and so theremust be a set of 2 | M l | machines where such jobs can be processed (otherwise optimum value cannotbe T ⋆ ). Each of these machines must have at least ( l − T ⋆ jobs assigned to them (because of thejob dispatch policy). Thus, the total number of jobs is at least 2( l − | M l | T ⋆ . Continuing thisargument gives the exponential scaling with l . Now, if the number of rejected jobs is large, thenthere must be many machines where the load is up to the maximum limit, which means that theremust be a huge (exponential in α times number of such machines) number of jobs in the system.For the more general case of the LoadBalancing problem when job sizes are arbitrary, we canreduce the problem to the case of unit size jobs. Assume wlog that all job sizes are powers of 2.For each value of index j , we run the above algorithm independently for jobs of size 2 j . This willensure that for any fixed j , the total load (i.e., processing time) of jobs of size 2 j assigned to amachine is at most αT ⋆ . In case this limit is reached on a machine for many values of the index j ,one can show that we can reject many (large) jobs. Note that this algorithm may reject a job afterit gets dispatched to a machine. We show that this is unavoidable (details in Theorem 8.2).In the WtdMaxFlowTime problem, each job j has a weight w j and the goal is to minimize themaximum over all jobs j , of w j F j , where F j is the flow-time of j . In this problem, the ideas aremore subtle and technically involved. In fact, we show that unlike the LoadBalancing problem,one cannot obtain better than O (1 /ε )-competitive algorithm (details in Theorem 8.3). To giveintuition about our algorithm and analysis techniques, we consider some special cases: Unit size and unit weight:
Suppose all jobs are of size 1 and weight 1. In this case a naturalalgorithm is as follows: each machine maintains a queue of jobs assigned to it. When a new jobarrives, it is dispatched to the machine with the smallest queue (among the machines to which itcan be processed on). However, if all such machines have at least T ⋆ /ε jobs in their queue, we5 ( ( (( ]]] ]]( (] ] T ⋆ I I I I I I I TimeQueueSize T ⋆ T ⋆ T ⋆ T ⋆ Figure 1: Example showing intervals I ( i,l ) for a machine i . Here I ( i, = { I } , I ( i, = { I } , I ( i, = { I , I , I } , I ( i, = { I } , I ( i, = { I } reject this job. The analysis is somewhat trickier than the corresponding case for LoadBalancing .The reason is as follows: suppose there is a job j which can go on two machines i and i , andboth have the same queue size when j is released. Suppose we dispatch j to i . But in future, i will continue to get more jobs assigned to it (because perhaps these jobs could only get processedon i ), whereas i ’s queue will decrease with time. In the LoadBalancing problem, queues do notdissipate with time, and so the proof gets much simpler.Our proof idea is as follows. For each machine i and parameter l ( l varies between 1 and 1 /ε ),we define a set of disjoint intervals I ( i,l ) . An interval I in this set is a minimal interval such thatthe queue size in i at the left end-point is ( l − T ⋆ and that at the right end-point is lT ⋆ (seeFigure 1). For different values of l and fixed i , these intervals form a laminar family. Let m l be thenumber of intervals in ∪ i I ( i,l ) . Suppose the algorithm rejects kT ⋆ jobs. Then it is not difficult toshow that m l − T ⋆ + L l − ≥ m l T ⋆ + L l + kT ⋆ , (1)where L l denotes the total length of all the intervals in ∪ i I ( i,l ) . Indeed, the RHS above denotes aset of jobs which get released during an interval in ∪ i I ( i,l ) , and each such interval can only take T ⋆ jobs beyond its own length. Summing the above for all l between 1 and 1 /ε shows that the numberof jobs is at least kT ⋆ /ε , and so the algorithm rejects only ε fraction of the jobs. The formal proofis given in Section 6.1. Although one can simply formalize the argument given above, we give asomewhat longer proof which sets dual variables for a natural LP relaxation of this problem. Thisproof generalizes to the more general case.In more general settings, we split the algorithm in two parts: the first part ensures that thequeues on each machine are bounded, and the second part uses this property to ensure that alljobs which do not get rejected finish within the required time. We describe details of the first partbelow. Unit weight and arbitrary size
For sake of simplicity, assume that job sizes are 1 or 2. Each6achine i maintains two queues: Q i, and Q i, for the two job sizes respectively. When a job ofsize p arrives, it goes to that machine i for which Q i,p has the least load (load of a queue is thetotal remaining processing time of jobs in it). Again, if the load on all such queues is more than αT ⋆ , we reject the job – here α is a parameter which is O (1 /ε ). Thus, the algorithm ensures thatall queue sizes remain bounded. The non-triviality lies in figuring out which job a machine choosesto process. Given the above dispatch rule, popular and simple heuristics like always processing theshortest sized job or the job with shortest remaining processing time will not guarantee boundedrejection ratio: Below we provide an example on how this fails.Assume ε = 1 /
4, i.e., we are allowed to reject at most th of the jobs; and the maximum queuelength of any job size which our online algorithm can afford on any machine is 4 T ⋆ . In this example, T ⋆ will be 2. Suppose there are 8 machines m , m , · · · , m ; also let the jobs can be of two sizes1 and 2. At time t = 0, seven jobs each of size 2 and one of size 1 arrive; the online algorithmsees the jobs in the following order: the first four jobs of size 2 can be processed on any machine,so our algorithm dispatches them to machines, say m , m , · · · , m ; the fifth (sixth) job of size 2can be processed on m , m (respectively m , m ), so our algorithm dispatches them to machines m and m respectively; the seventh job of size 2 can be processed on m only. The eighth jobof size 1 can be processed on any machine, suppose our algorithm dispatches it to m . Thus atend of time t = 0, the load on machine m for size 2 jobs and size 1 jobs are 6 and 1 respectively.Since our processing rule picks the shortest sized (or the shortest remaining processing timed) job,the 1 sized job will be processed on machine m at this time step. Now suppose for every timesteps t = 1 , , · · · , a job of size 1 arrives which can be processed on any machine, and for everyalternate time steps t = 2 , , , · · · , a job of size 2 arrives which can be processed only on machine m . Suppose our algorithm dispatches the size 1 jobs to m (since the algorithm will always preferprocessing size 1 jobs over size 2 jobs, the queue size of size 1 jobs on all machines at the end ofa time step will be zero, and hence the algorithm may dispatch the size 1 job arriving in the nexttime step to m ). The algorithm will start rejecting all the size 2 jobs arriving in time 4 , , , · · · .Thus the fraction of the rejected jobs will be close to 1 / t = 2 , , , · · · to m and the size 1 jobs to some other machine. Thus the optimal solution willhave a maximum flow time of 2.The processing policy which our algorithm employs is as follows. For a machine i , let load i, ( t )and load i, ( t ) denote the load in the two queues at time t . At time t , the machine processes jobfrom the queue for which load i,p ( t ) /p is largest – this quantity is roughly equal to the number ofjobs in the corresponding queue. Let us see why this strategy works. First we consider jobs of size1. Note that the queue for size 1 jobs can contain up to αT ⋆ jobs, while that for size 2 jobs can onlycontain αT ⋆ / I ( i,l ) for the size 1 queues,and write down inequalities (1) as long as l ≥ α/ αT ⋆ /
2, the machine will not give preference to a size 2 job, and so we can pretend thatthere are size 1 jobs only). This suffices to bound the number of size 1 jobs which get rejected interms of the total number of size 1 jobs that has arrived.When we need to bound the number of size 2 rejected jobs, we need to define the intervals morecarefully. For a parameter l , I ( i,l ) consists of those minimal intervals I where the load of Q i, is atmost ( l − T ⋆ / and that of Q i, is at most ( l − T ⋆ at the left end point of I , whereas the loadof Q i, is at least lT ⋆ / or that of Q i, is at least lT ⋆ at the right end-point. Using these intervals,one can again write down inequalities similar to (1) involving both size 1 and size 2 jobs. Usingthese inequalities, one can prove that the total number of rejected size 2 jobs is at most the total7umber of size 2 jobs and half the total number of size 1 jobs.More generally, suppose jobs sizes are powers of 2. Then each machine i maintains a separatequeue Q i,k for jobs of size 2 k , and jobs are dispatched to machines according to load on correspondingqueues only. At any time t , a machine i processes job from the queue Q i,k for which the load dividedby 2 k is highest. Another way of thinking about this rule, which forms the intuition in more generalcase, is that we prioritize the queues on a machine based on how full they are. Suppose the queue Q i,k is full to a fraction of f k (i.e., load on it is equal to f k · αT ⋆ ). Then, we prefer the queue forwhich f k / k is largest. Arbitrary weight and unit size
Again assume that all weights are powers of 2. Each machine i maintains queues Q i,w for jobs with weight 2 w , and as before, jobs are dispatched based on theircorresponding queue. A machine i prioritizes these queues in the decreasing order of w . Drawinganalogy from the above case, if f w denotes the fraction to which the queue Q i,w is full (note that aqueue for jobs of weight 2 w is full, if the total number of jobs in it is αT ⋆ / w , where α is O (1 /ε )),then machine i picks the next job from the queue for which f w · w is highest. General Case
For simplicity, assume all jobs sizes and weights are powers of 2. For each machine i , we have queues Q i,w,p for jobs of size 2 p and weight 2 w . However, it is unclear how to prioritizethese queues because we can have two queues Q i,w ,p and Q i,w ,p for which w < w but p < p .Suppose the queues Q i,w ,p and Q i,w ,p are full to the extent of f and f respectively. We knowfraction f for Q i,w ,p corresponds to fraction f / p − p for Q i,w ,p (using the argument abovefor unit weight and arbitrary size), and the fraction f / p − p for Q i,w ,p corresponds to fraction f · w − w p − p for Q i,w ,p (using the argument for unit size and arbitrary weight). Thus, machine i prefers a job from Q i,w ,p over Q i,w ,p iff f ≥ f · w − w p − p . Our algorithm is based on this rule.The proof that all queues remain bounded again relies on carefully defining a set of intervals,and corresponding dual variables for an LP relaxation. However there are subtle and non-trivialdetails. While defining the intervals for a particular type of jobs (say of size 2 p and weight 2 w ),it may happen that the algorithm processes other kinds of jobs during these intervals: (i) if thesejobs are of very high density, then we are completing lot of weight in small time, and so this shouldbe somehow beneficial, (ii) if there are jobs whose density is close to the density of such jobs, thenwe cannot handle these directly; in fact, we need to go back and define these intervals for a group of jobs of similar density, and (iii) if these jobs have low density, then we need to somehow provethat either they have very high weight and so need to finish soon in any solution, or else such jobscannot be processed during such intervals.This completes our informal description of the first part of our algorithm where we ensure thatqueues remain of bounded size. The second part of the algorithm makes sure that a job of weight w j does not starve for too long (much longer than a constant times T ⋆ /w j ). To accomplish this,it runs the algorithm above in background. If the first algorithm tries to process a job j at sometime t on a machine, the second algorithm processes j as well unless there is a job of much higherdensity in the queue of machine i . If the latter case happens, it processes such a job. A job whichwaits for too long (compared to T ⋆ /w j ) gets rejected. We prove that the weight of such jobs issmall. The difficulty in the analysis arises for the following reasons: (i) the algorithm A ensuresthat the size of each of the queues on a machine remains within a limit, whereas we would like the total size of the queues to remain close to this limit; to ensure this, we need to prove that many ofthese jobs will get rejected, (ii) we may reject a job after processing it for a while – the time usedfor processing such jobs gets wasted, and so we need to ensure that this remains very small.Finally, we consider the more general problem GenWtdMaxFlowTime where a job j has twoweights – w fj and w rj . Recall that the weight w fj is used for computing weighted flow-time, whereas8e do not want to reject jobs whose total w rj weight is high. This is a generalised version of theproblem of minimizing the maximum stretch. It turns out that the first part of the algorithmdescribed above carries over without much change to this problem as well. However, the secondpart of the algorithm requires some subtle changes – in particular, we cannot bound the amountof time in which a machine processes jobs which eventually get rejected, and so the above ideas donot apply directly. LoadBalancing problem
In this section, we describe our algorithm for the
LoadBalancing problem. We first consider aspecial case when all jobs have size 1. This will illustrate the main ideas involved, and then weshall extend it to the case of general processing time. We shall assume that we know the optimalvalue, denoted by T ⋆ . We shall show how to get rid of this assumption later. Our algorithm A is greedy. We pick a threshold α (which depends on ε ) to be defined later. Eachmachine maintains the current load on it, i.e., the number of jobs assigned to it so far (not countingthe jobs which have been rejected). Let load i ( t ) be the load on machine i at time t . When a job j arrives, it is dispatched to the machine in S j with the least load, provided the load on this machineis less than αT ⋆ . If the load on this machine happens to be greater than αT ⋆ , we reject this job.Clearly, our algorithm ensures that we do not exceed the load on a machine by more than αT ⋆ .We need to prove that we will not reject more than ε fraction of the jobs. Suppose this fact is nottrue, and let n be the first time when we reject more than ε fraction of the jobs – call these rejectedjobs J R .We divide the machines into several groups. Let M α denote the set of machines i for which load i ( n ) = αT ⋆ . For an integer s , 0 ≤ s < α , let M s be the set of machines i for which load i ( n ) ≥ s · T ⋆ . Note that M s ⊆ M s − . Let m s denote | M s | . Now we show that m s increases exponentiallyas we decrease s .Consider a job j which arrives at time t . Suppose it is dispatched to machine i . Define level ( j )as load i ( t ) (not counting j ) – we can think of this as the position of j in the queue of machine i .For an index u , let J ( u ) be the set of jobs whose level is at least u . Claim 5.1.
For any s , ≤ s < α , m s ≥ α − − s · m α .Proof. For any job j ∈ J ( sT ⋆ ) , S j ⊆ M s . Indeed, if a machine i / ∈ M s , then load i ( n ) < sT ⋆ .Further if i ∈ S j , then j had the option of getting dispatched to i , and then level ( j ) should beless than sT ⋆ , a contradiction. Therefore, we get the following lower bound on T ⋆ : T ⋆ ≥ | J ( sT ⋆ ) | m s . (2)Now, it is easy to see that | J ( sT ⋆ ) | is at least T ⋆ · ( m s +1 + . . . + m α ). Substituting this in the lowerbound above, we get m s ≥ m s +1 + . . . + m α . Corollary 5.2.
The number of jobs is at least (2 α − · T ⋆ · m α . roof. Using the lemma above, the number of jobs is at least( m + m + . . . + m α − ) T ⋆ ≥ (2 α − · m α T ⋆ . . Corollary 5.2 implies that | J R | is more than ε · (2 α − · T ⋆ m > T ⋆ m , if we pick α to belog (cid:0) ε (cid:1) + 2 . Now, observe that for any job j ∈ J R , S j ⊆ M . Indeed, the fact this job isrejected means that all the machines in S j were loaded to the maximum capacity. Now we get acontradiction – we have a set of jobs J R of cardinality greater than T ⋆ m α which can be scheduledonly on a subset of m α machines. Hence, the optimal value must be larger than T ⋆ . Remarks:
If instead of unit size jobs, the processing times of jobs were in the range [1 , α to be slightly larger – 2 · log (cid:0) ε (cid:1) + 2. The algorithmremains unchanged, except for the fact that load i ( t ) is now defined as the total processing times ofjobs dispatched to machine i till time t . We highlight the main changes in the analysis. Claim 5.1continues to hold – in inequality (2), the numerator on the right hand side gets replaced by the totalprocessing time of jobs in J ( sT ⋆ ). Corollary 5.2 holds with a weaker bound of (2 α − − · T ⋆ m α on the number of jobs – this is because the jobs could have size 2. Rest of the arguments remainunchanged. Thus, we get the following result. Theorem 5.3.
Consider an input instance where all job sizes lie between 1 and 2, and the optimumvalue is T ⋆ . Then the algorithm described above is O ( α ) -competitive and rejects at most ε -fractionof the jobs. We now extend the above result to general processing times. Some definitions first. We say that ajob j is of class k if p j ∈ [2 k , k +1 ). We do not know the smallest job size, and so cannot assume(by scaling) that all job sizes are at least 1. Hence, the class of a job could be negative as well. Wesay that a set of jobs is ∆ -separated for a positive integer ∆ >
0, if there exists an integer k suchthat the class of any job j in this set belongs to { k + i ∆ : i is an integer } .∆ -separated jobs: We first assume that the jobs are ∆-separated. Our scheduling algorithmworks in two stages. In the first stage, it may violate the objective value by a large amount, butthis will get fixed in the second stage. However, we shall ensure that in the first stage, the numberof rejected jobs is at most ε -fraction of the total number of jobs. As before, assume that we knowthe optimal value T ⋆ . Stage 1:
Each machine i maintains a queue of jobs assigned to it. For a class l , let load i,l ( t )denote the total processing time of jobs of class l in the queue of machine i at time t . We say that i is full with respect to class l at time t if load i,l ( t ) ≥ α · T ⋆ , for some parameter α to be specifiedlater. The dispatch algorithm is as follows: when a job j of class l arrives at time t , dispatch it tothe machine i ∈ S ( j ) for which load i,l ( t ) is smallest; unless all such machines are full with respectto class l . If the latter case happens, we reject the job. Stage 2:
This is a pruning step. Note that (and this is important) this step does not affect stage 1at all. So, while computing load i,l ( t ) in the algorithm described above, we will assume that nopruning happens. However, without this step, the queue sizes may go much beyond T ⋆ . For amachine i , and time t , let load i ( t ) = P l load i,l ( t ) denote the total load on this machine at time t .In this stage, we do the following for each machine i and time t : if at time t , load i ( t ) > α · T ⋆ ,10e keep removing the largest jobs in the queue of machine i till load i ( t ) becomes at most 2 α · T ⋆ (we can assume a fixed way of breaking ties).This completes the description of the algorithm. We now analyze the algorithm. We fix a time t ⋆ (and we assume that the offline optimum has objective value T ⋆ ).For a fixed class l , the stage 1 algorithm is same as the algorithm for unit size jobs (or whenthe job sizes differ by a factor of 2 only) described in the previous section. Hence, Theorem 5.3implies that the total processing time of jobs of class l dispatched to any particular machine is atmost α · T ⋆ . Further, the total number of rejected jobs in stage 1 is only ε -times the total numberof jobs.Now, in Stage 2, we ensure that the total load on a machine is at most 2 α · T ⋆ . We need tobound the number of jobs which get rejected. Fix a machine i . Let the jobs which get dispatchedto i (in Stage 1) till t ⋆ be j , . . . , j n . We assume that the total processing time of these jobs ismore than 2 αT ⋆ , otherwise we do not reject any of these jobs in Stage 2. Also assume that thesejobs are arranged in ascending order of processing time. Let r T ⋆ be the smallest index u for which p j + · · · + p j u ≥ α · T ⋆ and r T ⋆ be the smallest index u such that p j + · · · + p j u ≥ α · T ⋆ . Clearly, r T ⋆ ≥ r T ⋆ . We make some important observations:(i) During stage 2, we will not remove the jobs j , . . . , j r T⋆ . Indeed, in order to remove a job j ,there must be at least 2 · α · T ⋆ volume of smaller jobs.(ii) During stage 2, we will remove all jobs j u for u > r T ⋆ . This is true because at time t ⋆ , wehave at least 2 · α · T ⋆ volume of jobs which are smaller than this job.(iii) The class of job j r T⋆ is strictly less than that of j r T⋆ : Since j r T⋆ comes before j r T⋆ in theordering, the class of j r T⋆ is at most that of j r T⋆ . Suppose the two jobs are of the sameclass. Then, the jobs in j r T⋆ , j r T⋆ +1 , . . . , j r T⋆ are of the same class, and their total processingvolume is strictly larger than αT ⋆ . But this is a contradiction – we argued above that for anyparticular class, we will not dispatch more than α · T ⋆ volume to a machine. Since the jobsare ∆-separated, class of j r T⋆ is at least ∆ less than that of j r T⋆ .Let c T ⋆ and c T ⋆ denote the class of the jobs j r T⋆ and j r T⋆ respectively. As observed in (iii)above, c T ⋆ ≥ c T ⋆ + ∆. We are only rejecting jobs of class c T ⋆ or higher (from the queue of machine i ). Further, the total number of jobs of a class l that can be rejected is at most α · T ⋆ l , because thetotal volume of jobs of class l assigned to this machine is at most α · T ⋆ . Thus, the total numberof rejected jobs (among those dispatched to machine i ) in Stage 2 is at most X l ≥ c T⋆ α · T ⋆ l ≤ α · T ⋆ c T⋆ − ≤ α · T ⋆ c T⋆ +∆ − ≤ ε · α · T ⋆ c T⋆ +1 , provided ∆ = log (cid:0) ε (cid:1) + 2 . Now, observe that the jobs in j , . . . , j r T⋆ have volume at least α · T ⋆ ,and their class is at most c T ⋆ . Hence, the number of these jobs, r T ⋆ , is at least α · T ⋆ c T⋆ +1 . Comparing this with the expression above, we see that at most ε fraction of the jobs are removedin a Stage 2.Combining the above observations, we get (replacing ε by ε/ emma 5.4. Assuming we know the value of the offline optimum and that the jobs are ∆ -separated,the above algorithm is O (cid:0) log (cid:0) ε (cid:1)(cid:1) -competitive, where ∆ = log (cid:0) ε (cid:1) + 2 . Further, it rejects at most ε -fraction of the jobs. Any set of jobs can be partitioned into ∆ disjoint sets, each of which is ∆-separated. Runningthe above algorithm on each such set independently, we get
Corollary 5.5.
Assuming the value of the offline optimum is at most T ⋆ , the algorithm describedabove assigns load O (cid:0) log (cid:0) ε (cid:1)(cid:1) · T ⋆ on any machine, and rejects at most ε -fraction of the jobs. T ⋆ So far we have assumed that we know the value of the offline optimum solution. We now showhow to relax this assumption. The idea is fairly standard. We start with a small guess for T ⋆ ,and double it whenever we realize that the guess was less than the actual offline optimum value.The details are given in Figure 2. For a parameter T ⋆ , let A ( T ⋆ ) denote the algorithm given byCorollary 5.5 where the estimate for the optimal value is T ⋆ . We shall call each iteration of Step 2 as a phase . Note that when we run A ( T ⋆ ) in the beginning of a phase, the algorithm ignores thejobs that have been assigned in the previous phase. It only considers the jobs that arrive next(and hence, quantities like load i ( t ) needed by A ( T ⋆ ) do not take into account the jobs which wereassigned in previous phases). Load Balance:
1. Initialize T ⋆ ← p j , where j is the first released job.2. Repeat (i) Run A ( T ⋆ ) on the jobs which arrive next.(ii) If the algorithm rejects more than ε -fraction of the jobs which arrivedafter the time it started running,Stop the algorithm and update T ⋆ ← T ⋆ .Figure 2: Algorithm for LoadBalancing
Now we analyze the competitive ratio of this algorithm. It is clear that it does not reject morethan ε -fraction of the jobs because in each phase, the algorithm rejects at most ε -fraction of thejobs which arrive in that phase. Let T O denote the objective value of the offline optimum solution.We first argue that the estimate T ⋆ always stays (almost) below T O . Claim 5.6.
Except perhaps for the last phase, the value of T ⋆ is at most T O .Proof. Consider the first phase for which T ⋆ is more than T O . Note that the optimal value for theset of jobs which arrive during this period will be at most T O , which is at most T ⋆ . Corollary 5.5now implies that A ( T ⋆ ) will not reject more than ε -fraction of the jobs released during this phase,and so this is the last phase of the algorithm.The main result now follows easily from the above claim. Theorem 5.7.
The algorithm
Load Balance is O (cid:0) log (cid:0) ε (cid:1)(cid:1) -competitive and rejects at most ε -fraction of the jobs. roof. We have already argued that for any time t , the total number of jobs rejected by thealgorithm till time t is at most ε -fraction of the jobs released till this time. The final value of T ⋆ is at most 2 T O . Since T ⋆ increases by a factor of 2 after each phase, Corollary 5.5 and Claim 5.6imply that the total load assigned to a particular machine is at most O (cid:18) log (cid:18) ε (cid:19)(cid:19) · (cid:18) T O + 2 T O T O . . . (cid:19) ≤ O (cid:18) log (cid:18) ε (cid:19)(cid:19) T O . This proves the desired result.
MaxFlowTime problem
In this section, we consider the
MaxFlowTime problem. Again, we shall begin by assuming that weknow the optimal value T ⋆ . In Section 6.1, we consider the special case when all jobs have unitsize. Here, the algorithm turns out to be a natural one: when a job arrives, send it to the leastloaded machine (among the ones it can be processed on). However, the extension to arbitrary jobsizes and arbitrary weight turns out to be quite tricky, and although the algorithm remains simple,it does not correspond to a natural idea. We give details of this algorithm in Section 6.2. Finally,we show how to remove the assumption about the knowledge of T ⋆ . We consider the special case when all jobs have size 1. The algorithm is greedy: for each machine i and time t , it maintains the number of jobs waiting in the queue of machine i at (the beginningof) time t , call this value load i ( t ). When a new job j arrives at time t , it gets dispatched to themachine i ∈ S j for which load i ( t ) is smallest, unless the load on every machine i ∈ S j is at least αT ⋆ , where α = ε . If the latter happens, we reject the job. Each machines processes jobs in orderthey are dispatched to it. This completes the description of the algorithm. Analysis:
We first give a way of proving lower bounds on the optimum value. A machine interval is defined as a pair (
I, i ) where I is an interval and i is a machine. Lemma 6.1.
Let I be a set of machine intervals and J be a set of jobs. Let α j be non-negativevalues assigned to the jobs j ∈ J such that the following condition is satisfied for all jobs j andmachines i ∈ S j : α j ≤ |{ ( I, i ) ∈ I : r j ∈ I }| . Then, T ⋆ ≥ P j α j − P ( I,i ) ∈ I length ( I ) | I | (3) Proof.
This result follows from weak duality. Consider the following LP relaxation for (the offlineoptimum of) this problem. For a job j and machine i ∈ S j , we have a variable x ij which is 1 iff j
13s dispatched to i . It is easy to check that the following is a valid LP relaxation:min TT ≥ X j : r j ∈ I,i ∈ S j x ij − length ( I ) for all machine intervals ( I, i ) X i : i ∈ S j x ij ≥ jx ij ≥ i, j The dual LP is as follows (variables are α j and β ( I,i ) ):max X j α j − X ( I,i ) length ( I ) · β ( I,i ) α j ≤ X ( I,i ): r j ∈ I,i ∈ S j β ( I,i ) for all j and i ∈ S j X ( I,i ) β ( I,i ) ≤ α j , β ( I,i ) ≥ β ( I,i ) = 1 for all machine intervals ( I, i ) ∈ I .We now prove correctness of our algorithm. It is easy to see that the flow-time of any jobwhich does not get rejected is at most αT ⋆ . When a job is dispatched to a machine, the load onthe machine is at most α · T ⋆ , and since the machine processes jobs in the order in which theyget dispatched to it, this job will finish within α · T ⋆ time. We now need to bound the number ofrejected jobs. Fix a time t ⋆ – we shall bound the number of rejected jobs till time t ⋆ . Recall thatwe are assuming that the value of the optimal solution for this input (till time t ⋆ ) is at most T ⋆ .We now give some definitions. For a time t and machine interval ( I, i ), we shall often abusenotation and say t lies in ( I, i ) (or (
I, i ) contains t ) when t ∈ I . Similarly, we shall say that twomachine intervals ( I , i ) and ( I , i ) are disjoint if the corresponding intervals I and I are disjoint.Given a set I of machine intervals, the set of intervals in I refers to the multi-set { I : ( I, i ) ∈ I } .For each index l , 0 ≤ l < α , and machine i , we define a set (possibly empty) of mutually disjointmachine intervals I ( i,l ) . The procedure for defining these intervals is described in Figure 3.It is easy to see that for any value of l and machine i , the set of machine intervals in I ( i,l ) aremutually disjoint. We now prove a few simple properties of these sets of intervals. For a job j which gets released at time t and dispatched to machine i , let level ( j ) denote load i ( t ) (withoutcounting the job j itself). Lemma 6.2.
Fix a machine i and parameter l . The sets of machine intervals I ( i,l ) satisfy thefollowing properties: • (covering) Suppose a job j satisfies level ( j ) ≥ l · T ⋆ , and assume i ∈ S j . Then, there existsa machine interval ( I, i ) ∈ I ( i,l ) such that r j ∈ I . • (nesting) Given any machine interval ( I l , i ) ∈ I ( i,l ) , there exists a machine interval ( I l − , i ) ∈I ( i,l − such that I l − contains I l . onstructing I ( i,l ) :
1. Initialize t ← t ⋆ .2. Repeat (i) Let t be the highest time before (or equal to) t such that load i ( t ) ≥ l · T ⋆ . (ii) Let t be the earliest time before t such that load i ( t ′ ) > ( l − T ⋆ for all t ′ ∈ ( t , t ].(iii) Add the machine interval ([ t , t ] , i ) to I ( i,l ) .(iv) t ← t .3. Until
No more machine intervals can be added to I ( i,l ) .Figure 3: Construction of the set of intervals in I ( i,l ) • For any machine interval ( I l , i ) ∈ I ( i,l ) , the total number of jobs which get dispatched to i during I l is at least length ( I l ) + T ⋆ .Proof. Consider a job j such that level ( j ) ≥ l · T ⋆ , and a machine i ∈ S j . Then load i ( r j ) ≥ l · T ⋆ as well. Suppose, for the sake of contradiction that there is no machine interval in I ( i,l ) such that r j lies in it. Among the set of intervals in I ( i,l ) , let I f be the first interval (if any) to the right of r j ,and suppose s is the starting time of I f (if I f does not exist, s is defined as t ⋆ ). After adding ( I f , i )to I ( i,l ) , our algorithm for constructing I ( i,l ) would have tried t = r j , and hence there should bea machine interval containing r j in I ( i,l ) .The argument above shows that if for any time t , load i ( t ) ≥ l · T ⋆ , then there exists a machineinterval in ( I, i ) ∈ I ( i,l ) containing t . Consider ( I l = ( s l , e l ) , i ) ∈ I ( i,l ) . Since load i ( e l ) ≥ lT ⋆ , thereexists an interval ( I l − = ( s l − , e l − ) , i ) ∈ I ( i,l − such that e l ∈ I l − . Since load i ( t ) > ( l − T ⋆ for all t ∈ ( s l , e l ), the left end-point of I l − will appear before s l .The third claim is easy to see. If I l = [ s, t ], then load i ( t ) − load i ( s ) ≥ T ⋆ . Further, the machineis busy during [ s, t ], and so must have processed t − s volume during this period.For an index l , let I ( l ) denote the union over all machines i of the machine intervals in I ( i,l ) .Let L ( l ) denote the total length of the intervals in I ( l ) , and m l denote the cardinality of I ( l ) . Let J ( l ) be the set of jobs which get dispatched to a machine i during the intervals in I ( i,l ) .Let I denote ∪ αl =1 I ( l ) . Let J R denote the set of rejected jobs. Consider the following assignmentof dual variables: if j ∈ J R , then we set α j = α , otherwise if level ( j ) ∈ [( l − · T ⋆ , lT ⋆ ), then weset α j = l −
1. The following claim is easy to see.
Claim 6.3.
The set of machine intervals I and the α j values defined above satisfy the conditionsof Lemma 6.1.Proof. If j ∈ J R , load i ( r j ) ≥ α · T ⋆ for all i ∈ S j . Lemma 6.2 now shows that for any i ∈ S j andall l, ≤ l ≤ α, there exists a machine interval ( I, i ) ∈ I ( i,l ) containing r j . Hence, for any i ∈ S j , |{ ( I, i ) : r j ∈ I }| is equal to α . Now suppose j / ∈ J R . Let k denote α j . Since level ( j ) ≥ k · T ⋆ ,Lemma 6.2 again implies that if i ∈ S j , then for all l , 1 ≤ l ≤ k , there is a machine interval( I, i ) ∈ I ( i,l ) such that r j ∈ I . Hence, the desired result holds in this case as well.Using the above claim, we can applying Lemma 6.1 to I and α j values to get T ⋆ · ( m + . . . + m α ) ≥ X j α j − α X l =1 L ( l ) (4)15 laim 6.4. X j / ∈ J R α j ≥ X l> L ( l ) + X l> m l T ⋆ . Proof.
We first argue that P j / ∈ J R α j ≥ P l> | J ( l ) | . Consider a job j with α j = k . This implies that level ( j ) < ( k + 1) · T ⋆ . So j / ∈ J ( l ) for any l > k + 1. Indeed, suppose j is dispatched to machine i and there is a machine interval ( I, i ) ∈ I ( i,l ) for some l > k + 1 such that r j ∈ I . Then the load onmachine i stays above ( k + 1) · T ⋆ during I . So level ( j ) ≥ ( k + 1) · T ⋆ , a contradiction. Therefore, j can only contribute towards J (2) , . . . , J ( k +1) in the right hand side of the above inequality. Hence, P j / ∈ J R α j ≥ P l> | J ( l ) | . The claim now follows from Lemma 6.2 (third part).We can now show that the number of rejected jobs is small. Corollary 6.5.
The total number of rejected jobs is at most ε times the total number of jobs.Further, the flow-time of any job is at most T ⋆ /ε .Proof. Applying Claim 6.4 to inequality (4), we get T ⋆ · m + L (1) ≥ X j ∈ J R α j = α · | J R | . Observe that the number of jobs is at least T ⋆ · m + L (1) – this follows from the third part ofLemma 6.2 and the fact that for any machine i , all intervals in I ( i, are disjoint. If we pick α = ε ,the desired result follows. The second statement follows from the fact that the queue size neverexceeds αT ⋆ . WtdMaxFlowTime
We now extend the above result to the case of arbitrary job sizes and associated weights. We canassume without loss of generality that weight of a job is a power of 2 – this will affect the objectivefunction by a factor of 2 only. Further, the weight of rejected jobs could be off by a factor of 2 –but we can replace ε by ε/ A –this algorithm may not ensure that flow-time of all jobs (which are not rejected) are small, but itwill ensure that the queue sizes at all times (on any machine) will be small. Our actual algorithm,which we call B , will use A in the background . It will emulate A , but will periodically reject morejobs, and may prefer to process higher density jobs at a time slot (as compared to A ). Algorithm A : Before we describe the algorithm A , we give some definitions. These definitionsgroup jobs into various classes depending on their processing requirement or weight or density. Wesay that a job j is of size class p if p j ∈ [2 p , p +1 ). We say that it is of weight class w if w j = 2 w (recall that weight of a job is a power of 2), and of density class d if its density, i.e., w j /p j lies inthe range [2 d , d +1 ). Observe that if the size, weight and density classes of a job are p, w, and d respectively, then d = w − p − p j or w j , and so, the classes could be negative.Define type ( j ) = ( w, d ), if its density class is d , and its weight class is w .Each machine i maintains a queue for jobs of a particular type. For a machine i , time t , andpair ( w, d ), let Q i,w,d ( t ) denote the jobs of type ( w, d ) waiting in the queue of machine i at time t .16et load i,w,d ( t ) denote the total weighted remaining processing time of the jobs in Q i,w,d ( t ) – if ajob j has remaining processing time p ′ j , then its weighted remaining processing time is defined as w j p ′ j .When a job j of type ( w, d ) arrives at time t , we dispatch it to the machine i ∈ S j for which load i,w,d ( t ) is minimum, unless for all i ∈ S j , load i,w,d ( t ) + p j . w ≥ α · T ⋆ . If the latter casehappens, we reject this job. Here α = ε . It remains to specify which job is processed at any timeby a machine.For a time t and machine i , let ( w ⋆i ( t ) , d ⋆i ( t )) be the pair ( w, d ) with the highest 2 d · load i,w,d ( t )value. We process the earliest released job from the queue Q i,w ⋆i ( t ) ,d ⋆i ( t ) ( t ) on machine i at time t .Assume a fixed rule of breaking ties.This completes the description of the algorithm A . We note a few important aspects: (i) Fora machine i and pair ( w, d ), the algorithm always prefers the earliest released job in the queue oftype ( w, d ) jobs. Hence, at any time t , there will be at most one job in Q i,w,d ( t ) which is partiallyprocessed, (ii) The policy which decides which job to process at a time t on a machine i balancestwo aspects: it prefers jobs of higher density, but also prefers jobs for which the correspondingqueue is close to the maximum limit – the total weighted remaining processing times of jobs in thequeue Q i,w,d ( t ) should not exceed a constant times T ⋆ . Algorithm B : Now we describe the actual scheduling algorithm B . When a job j arrives at time t , it is dispatched according to A : if A rejects this job, B also rejects it; and if A dispatched itto machine i , then B also dispatches this job to i . Now, we describe the processing policy for afixed machine i . Consider a time t . Let d A ( t ) denote the density class of the job processed by A at time t . Then, B processes the following job at time t : if there is a job of density class at least d A ( t ) + log (cid:0) ε (cid:1) in the queue of machine i at time t , then B processes any such job; otherwise itprocesses the job of density class d A ( t ) with the highest weight class (it prefers the earliest releasedjob in case of ties). Also note that if the second case happens and there is no job of density d A ( t )in the queue of machine i at time t (in B ), we can process any job at this time.The algorithm B may reject some more jobs. For a weight class w , we divide the time line intosegments of length α T ⋆ ε w . Suppose a job of weight class w gets released during such a segment S ,and let S ′ be the segment immediately to the right of S . If the job does not complete processingby the end of S ′ , the algorithm B rejects the job. This completes the description of B . We now analyze the scheduling algorithm. We first consider the algorithm A and prove that thequeues remain bounded in size. Analysis for algorithm A : As in the case of unit sized jobs, we first give a lower bound for T ⋆ . A weighted machine interval is defined as a triplet ( I, i, w ) where I is a time interval, i is a machine,and w denotes a weight class. We say that a time t lies in (or belongs to) a weighted machineinterval ( I, i, w ) if t ∈ I . Similarly, we say that two machine intervals are disjoint (or nested) if thesame holds for the associated time intervals. Lemma 6.6.
Let I be a set of weighted machine intervals. Let α j be non-negative values assignedto the jobs j ∈ J such that the following condition is satisfied for all jobs j and machines i ∈ S j : α j p j ≤ |{ ( I, i, w ′ ) ∈ I : r j ∈ I, w ′ ≤ w }| , (5)17 here w denotes the weight class of j , i.e., w j = 2 w . Then, T ⋆ ≥ P j α j − P ( I,i,w ) ∈ I length ( I ) P ( I,i,w ) ∈ I w (6) Proof.
The proof again follows from LP duality. It is easy to check that the following is a valid LPrelaxation – here x ij is a variable which is 1 if job j is assigned to machine i , 0 otherwise.min T X j : r j ∈ I,i ∈ S j ,w j ≥ w p j · x ij − length ( I ) ≤ T w for all weighted machine intervals ( I, i, w ) X i : i ∈ S j x ij ≥ jx ij ≥ j and machines i , i ∈ S j The dual LP is as follows (variables are α j and β ( I,i,w ) ):max X j α j − X ( I,i,w ) length ( I ) · β ( I,i,w ) α j p j ≤ X ( I,i,w ): r j ∈ I, w ≤ w j β ( I,i,w ) for all jobs j and machines i ∈ S j X ( I,i,w ) β ( I,i,w ) w ≤ α j , β ( I,i,w ) ≥ β ( I,i,w ) to 1 if ( I, i, w ) ∈ I , 0 otherwise.Now we bound the weight of jobs rejected by A . We fix a time t ⋆ – this is the time by whichall the jobs finish processing. For rest of the discussion, we shall also fix a density class d ⋆ . Weshall first bound the total weight of jobs of density class d ⋆ which are rejected by the algorithm A .Finally, we shall take a sum over all values of d ⋆ to bound the total weight of jobs rejected by A .We begin with some definitions. Define ∆ = log( α ) (assume wlog that α is a power of 2). Weshall be interested in jobs whose density class lies in the range [ d ⋆ , d ⋆ + ∆]. For an integer l , let γ l denote 4 lαT ⋆ . We will ensure that α/ ≤ l ≤ α/
4, and hence, γ l will lie in the range [ α T ⋆ / , α T ⋆ ].For a machine i , density class d and time t , let load i,d ( t ) denote the maximum, over all pairs ( w, d )of the total weighted remaining processing time of jobs in the queue Q i,w,d , i.e., load i,d ( t ) = max w load i,w,d ( t ) . Consider a job j of type ( w, d ) which gets dispatched to machine i . We define level ( j ) as load i,w,d ( r j ) + w j · p j – this is the load it sees on machine i (including its own weighted processingsize). For a parameter l , we define a set of jobs J ( l,d ⋆ ) as follows: a job j of density class d ∈ [ d ⋆ , d ⋆ + ∆] lies belongs to J ( l,d ⋆ ) iff level ( j ) ≥ γ l d − d⋆ .For each machine i and parameter l lying the range as mentioned above, we define a set ofdisjoint weighted machine intervals I ( i,l,d ⋆ ) . The procedure for this is given in Figure 4. For amachine i and time t , maxload i,d ⋆ ( t ) is defined as max d ∈ [ d ⋆ ,d ⋆ +∆] d − d ⋆ · load i,d ( t ).We now prove the analogue of Lemma 6.2. 18 onstructing I ( i,l,d ⋆ ) :
1. Initialize t as t ⋆ and I ( i,l,d ⋆ ) ← ∅ Repeat (i) Let t be the highest time before (or equal to) t such that maxload i,d ⋆ ( t ) ≥ γ l .(ii) Let t be the earliest time such that maxload i,d ⋆ ( t ′ ) > γ l − for all t ′ ∈ ( t , t ].(iii) Let w be the smallest weight class of a job j ∈ J ( l − ,d ⋆ ) such that r j ∈ ( t , t ] and i ∈ S j .(iv) Add the weighted machine interval ([ t , t ] , i, w ) to I ( i,l,d ⋆ ) .(v) t ← t . Until
No more intervals can be added to I ( i,l,d ⋆ ) .Figure 4: Construction of the set of intervals in I ( i,l,d ⋆ ) for a machine i and parameter l . Lemma 6.7.
The sets of intervals in I ( i,l,d ⋆ ) satisfy the following properties: • (covering) Consider a job j ∈ J ( l,d ⋆ ) and a machine i ∈ S j Then there exists a weightedmachine interval ( I, i, w ) ∈ I ( i,l − ,d ⋆ ) such that r j ∈ I and w j ≥ w . • (nesting) Given any weighted machine interval ( I l , i, w ) ∈ I ( i,l,d ⋆ ) , there exists a weightedmachine interval ( I l − , i, w ′ ) ∈ I ( i,l − ,d ⋆ ) for some w ′ ≤ w such that I l − contains I l . • (processing) For any weighted machine interval ( I, i, w ) ∈ I ( i,l,d ⋆ ) , the total duration in I during which jobs of density class in [ d ⋆ , d ⋆ + ∆] are processed on machine i is at most thetotal processing size of jobs in J ( l − ,d ⋆ ) ∩ { j : w j ≥ w , r j ∈ I } which get dispatched to i during I .Proof. Consider a job j ∈ J ( l,d ⋆ ) of type ( w, d ), and a machine i ∈ S j : load i,d ( r j ) ≥ load i,w,d ( r j ) ≥ level ( j ) − w j · p j ≥ γ l d − d ⋆ − T ⋆ ≥ γ l d − d ⋆ − αT ⋆ d − d ⋆ = γ l − d − d ⋆ , where the second inequality follows by our dispatch rule and the third inequality follows from thefact that T ⋆ ≥ w j · p j for any j . Therefore, maxload i,d ⋆ ( r j ) ≥ γ l − . Suppose, for the sake ofcontradiction that there is no weighted machine interval in I ( i,l − ,d ⋆ ) containing r j . Let I f be thefirst interval (if any) in I ( i,l − ,d ⋆ ) to the right of r j , and suppose s is the starting time of I f (if I f doesnot exist, s is defined as t ⋆ ). After adding I f to I ( i,l − ,d ⋆ ) , our algorithm for constructing I ( i,l − ,d ) would have tried t = r j , and hence there should be a weighted machine interval in I ( i,l − ,d ⋆ ) containing r j . This is a contradiction. Therefore, there is a ( I, i, w ′ ) ∈ I ( i,l − ,d ⋆ ) containing r j .Since j ∈ J ( l − ,d ⋆ ) , and r j ∈ I, i ∈ S j , it must be the case that w ′ ≤ w . This proves the first partof the lemma.The argument above shows that if for any time t , machine i and density class d ∈ [ d ⋆ , d ⋆ + ∆], load i,d ( t ) ≥ γ l d − d⋆ , then there exists a weighted machine interval ( I, i, w ) ∈ I ( i,l − ,d ⋆ ) containing t . Suppose ( I l = ( s l , e l ) , i, w ) ∈ I ( i,l,d ⋆ ) . Since maxload i,d ⋆ ( e l ) ≥ γ l , there is a density class d ∈ [ d ⋆ , d ⋆ + ∆] such that load i,d ( e l ) ≥ γ l d − d⋆ . Hence, there exists ( I l − = ( s l − , e l − ) , i, w ′ ) ∈ I ( i,l − ,d ⋆ ) containing e l . Since maxload i,d ⋆ ( t ) > γ l − for all t ∈ ( s l , e l ), the left end-point of I l − will appearbefore s l . Moreover, w ′ ≤ w (follows from the definition of w or w ′ in Step 2(iii) of Figure 4 andthe fact that I l is contained in I l − ). This proves the second part of the lemma.It remains to prove the third part. Consider a weighted machine interval ( I, i, w ) ∈ I ( i,l,d ⋆ ) .19 laim 6.8. Suppose we process a job j of type ( w, d ) on machine i at a particular time t ∈ I . Thenit must be the case that d ≥ d ⋆ and load i,d ( t ) = load i,w,d ( t ) > γ l − d − d ⋆ . Proof.
Suppose d < d ⋆ . We know that there is a density class d ′ ∈ [ d ⋆ , d ⋆ +∆] such that load i,d ′ ( t ) > γ l − d ′− d⋆ . The job processing rule for A implies that 2 d · load i,w,d ( t ) ≥ d ′ · load i,d ′ ( t ) > d ⋆ γ l − , andso, load i,w,d ( t ) > γ l − ≥ α T ⋆ , because γ l − ≥ αT ⋆ /
2. But this is a contradiction (because of thejob dispatch policy of A ). Hence, d ≥ d ⋆ .If load i,d ( t ) > load i,w,d ( t ), then let w ′ be the weight class for which load i,d ( t ) = load i,w ′ ,d ( t ).But then 2 d · load i,w,d ( t ) < d · load i,w ′ ,d ( t ), and so A cannot process j on machine i at time t .Similarly, if d ′ is as above, then it must be the case that2 d · load i,w,d ( t ) ≥ d ′ · load i,d ′ ( t ) > γ l − · d ⋆ . This implies the claim.Now consider a density class d ∈ [ d ⋆ , d ⋆ +∆] , and a weight class w ′ . Let t f be the first time in I atwhich A processes a job j of type ( w ′ , d ). The claim above shows that load i,d ( t f ) = load i,w ′ ,d ( t f ) > γ l − d − d⋆ . Further, load i,w ′ ,d ( t ) remains at least γ l − d − d⋆ after t f till the end of the interval I – indeed,Claim 6.8 says that if load i,w ′ ,d ( t ) is at most γ l − d − d⋆ for some time t ∈ I , then the algorithm doesnot process a job of type ( w ′ , d ) at this time on machine i . Hence, load i,w ′ ,d ( t ) will not go below γ l − d − d⋆ after t f (during I ). Also, for any time t during [ t , t f ), load i,w ′ ,d ( t ) < γ l − d − d⋆ , where t is theleft end-point of I (by definition of t f and the fact that this statement holds for t ). Let V denotethe total volume of time during I when we process a job of type ( w ′ , d ). Then it must happen thatat least V volume of jobs of type ( w ′ , d ) are released during [ t f , t e ], where t e is the right end-pointof I – if this does not happen then we will end up processing a job of type ( w ′ , d ) at a time t in I even when load i,w ′ ,d ( t ) < γ l − d − d⋆ , a contradiction. For any job j ′ of type ( w ′ , d ) released during[ t f , t e ], load i,w ′ ,d ( r j ) ≥ γ l − d − d⋆ , and so, j ′ ∈ J ( l − ,d ⋆ ) . Recall that the weighted machine interval wasdenoted by ( I, i, w ) – by definition of w , it must be satisfy w ≤ w ′ . Summing over all w ′ gives usthe lemma.We now define a set of weighted machine intervals I and dual values α j for all jobs j which willsatisfy the conditions of Lemma 6.6. Let I be the set of weighted machine intervals defined above,i.e., ∪ α/ l = α/ ∪ i I ( i,l,d ⋆ ) – note that this is a multi-set, i.e., if a weighted machine interval ( I, i, w )appears in several of the sets I ( i,l,d ⋆ ) , it is counted these many times. For each job j ∈ ∪ α/ l = α/ J ( l,d ⋆ ) which does not get rejected, define α j = p j · ( l j − α/ l j is the largest value l such that j ∈ J ( l,d ⋆ ) . Further, if j is a job of density class d ⋆ gets rejected, we set α j = p j · α/
8. For remainingjobs, we set α j = 0. Claim 6.9.
The set of intervals I and the values α j defined above satisfy the feasibility condi-tions (5) .Proof. Consider a job j for which α j = p j · ( l j − α/ , and a machine i ∈ S j . Lemma 6.7 shows thatthere are weighted machine intervals ( I l , i, w l ) ∈ I ( i,l,d ⋆ ) for l = α/ , . . . , l j −
1, such that r j ∈ I l and 2 w l ≤ w j . Thus, the conditions (5) are satisfied for j . Similarly, if j is a job of density class d ⋆ which gets rejected, and i ∈ S j , then level ( j ) ≥ α T ⋆ ≥ γ l , for l = α/
4. Thus, j ∈ J ( α/ ,d ⋆ ) , andso, the same argument as above applies here as well.20laim 6.9 implies that we can apply Lemma 6.6. We give some notation first. For a parameter l and weight class w , let I ( l,w,d ⋆ ) denote the following set of weighted machine intervals: { ( I, i, w ) : (
I, i, w ) ∈ ∪ i ′ I ( i ′ ,l,d ⋆ ) } . Let m l,w,d ⋆ denote | I ( l,w,d ⋆ ) | , and L ( l,w,d ⋆ ) denote the total length of (associated intervals in) theweighted machine intervals in I ( l,w,d ⋆ ) . Applying Lemma 6.6, we get T ⋆ · X w α/ X l = α/ m l,w,d ⋆ w ≥ X j α j − X w α/ X l = α/ L ( l,w,d ⋆ ) . (7) Claim 6.10.
Let J R ( d ⋆ ) denote the jobs of density class d ⋆ which get rejected. Also let P ≥ d ⋆ +∆ denote the total processing time of jobs of density class higher than d ⋆ + ∆ . Then, X j / ∈ J R ( d ⋆ ) α j ≥ X w α/ X l = α/ L ( l,w,d ⋆ ) − α/ · P ≥ d ⋆ +∆ . Proof.
We split L ( l,w,d ⋆ ) into two parts – let L ( l,w,d ⋆ ) ′ denote the volume during intervals in I ( l,w,d ⋆ ) where A processes a job of density class lying in the set [ d ⋆ , d ⋆ + ∆], and L ( l,w,d ⋆ ) ′′ be the volumeduring intervals in I ( l,w,d ⋆ ) where A processes a job of class density higher than d ⋆ + ∆. Claim 6.8implies that L ( l,w,d ⋆ ) = L ( l,w,d ⋆ ) ′ + L ( l,w,d ⋆ ) ′′ .Lemma 6.7 (third part) implies that P w L ( l,w,d ⋆ ) ′ ≤ P j ∈ J ( l − ,d⋆ ) ,j / ∈ J R ( d ⋆ ) p j (the intervals in I ( w,l,d ⋆ ) ∩ I ( i,l,d ⋆ ) are disjoint). Summing over l = α/ , . . . , α/
4, we get α/ X l = α/ X w L ( l,w,d ⋆ ) ′ ≤ α/ X l = α/ X j ∈ J ( l − ,d⋆ ) ,j / ∈ J R ( d ⋆ ) p j = X j / ∈ J R ( d ⋆ ) p j · ( l j − α/
8) = X j / ∈ J R ( d ⋆ ) α j Now we bound L ( l,w,d ⋆ ) ′′ . For a fixed l , P w L ( l,w,d ⋆ ) ′′ is at most P ≥ d ⋆ +∆ . Thus, α/ X l = α/ X w L ( l,w,d ⋆ ) ′′ ≤ α/ · P ≥ d ⋆ +∆ . Combining the above inequalities gives us the desired result.Hence, inequality (7) can be simplified as T ⋆ · X w α/ X l = α/ m l,w,d ⋆ w + α/ · P ≥ d ⋆ +∆ + X w L ( α/ ,w,d ⋆ ) ≥ X j ∈ J R ( d ⋆ ) α j = X j ∈ J R ( d ⋆ ) α · p j d ⋆ which get rejected.Some more notation. For a weight class w and density class d , let V w,d denote the total weightedprocessing size of jobs of type ( w, d ), and let W w,d be the total weight of such jobs, i.e., V w,d = X j : type ( j )=( w,d ) w j p j , W w,d = X j : type ( j )=( w,d ) w j . a, b, a ≤ b , let V w,d ( a, b ) and W w,d ( a, b ) denote the corresponding sum for jobs j with level ( j ) ∈ [ a, b ], i.e, V w,d ( a, b ) = X j : type ( j )=( w,d ) , level ( j ) ∈ [ a,b ] w j p j , W w,d ( a, b ) = X j : type ( j )=( w,d ) , level ( j ) ∈ [ a,b ] w j . Claim 6.11. T ⋆ · X w α/ X l = α/ m l,w,d ⋆ w + X w L ( α/ ,w,d ⋆ ) ≤ X d ∈ [ d ⋆ ,d ⋆ +∆] X w α d ⋆ W w,d + P ≥ d ⋆ , where P ≥ d ⋆ denote the total processing time of jobs of density class at least d ⋆ .Proof. First we consider P w L ( α/ ,w,d ⋆ ) – this is just the total length of the weighted machineintervals ∪ i I ( i,α/ ,d ⋆ ) . Note that these weighted machine intervals are disjoint and Lemma 6.7implies that we will only process jobs of density class at least d ⋆ during these intervals. Hence, P L ( α/ ,w,d⋆ ) is at most P ≥ d ⋆ .Finally, we consider the term T ⋆ · P w P α/ l = α/ m l,w,d⋆ w . We shall upper bound each term of thesummation as follows. Consider a machine interval ( I, i, w ) ∈ I ( i,l,d ⋆ ) . Let I = [ s, t ]. We know thatthere exits a pair ( w, d ) such that load i,w,d ( s ) < γ l − d − d⋆ , but load i,w,d ( t ) ≥ γ l d − d⋆ . Let j be the firstjob of type ( w, d ) dispatched to i during I for which level ( j ) ≥ γ l − d − d⋆ and j be the first suchjob for which level ( j ) ≥ γ l d − d⋆ . All jobs of type ( w, d ) dispatched to i after j and before j willhave level in the range (cid:16) γ l − d − d⋆ , γ l d − d⋆ (cid:17) , because as argued in the proof of Lemma 6.7(third part),once load i,w,d ( t ) goes above γ l d − d⋆ , it will never go below this quantity till the end of I . Furtherthe total weighted volume of such jobs will be at least γ l d − d ⋆ − γ l − d − d ⋆ − w j p j − w j p j ≥ αT ⋆ d − d ⋆ − T ⋆ ≥ αT ⋆ d − d ⋆ , where the last inequality follows from the fact that α ≥ d − d ⋆ . Thus, we get T ⋆ w ≤ d − d ⋆ α w · X j : r j ∈ I, type ( j )=( w,d ) , level ( j ) ∈ (cid:16) γl − d − d⋆ , γl d − d⋆ (cid:17) w j p j Summing over all weighted machine intervals in ∪ i I ( i,l,d ⋆ ) , we get X w T ⋆ · m l,w,d ⋆ w ≤ X d ∈ [ d ⋆ ,d ⋆ +∆] X w d − d ⋆ α w · V w,d (cid:16) γ l − d − d ⋆ , γ l d − d ⋆ (cid:17) . Summing over all l and using the fact that if a ≤ b ≤ c , then V ( a, b ) + V ( b, c ) = V ( a, c ), we get α/ X l = α/ X w T ⋆ · m l,w,d ⋆ w ≤ X d ∈ [ d ⋆ ,d ⋆ +∆] X w d − d ⋆ α w · V w,d (cid:16) γ α/ − d − d ⋆ , γ α/ d − d ⋆ (cid:17) ≤ X d ∈ [ d ⋆ ,d ⋆ +∆] X w d − d ⋆ α w · V w,d ≤ X d ∈ [ d ⋆ ,d ⋆ +∆] α d ⋆ · X w W w,d , j of type ( w, d ) w d +1 < p j ≤ w d andso, 2 d w V w,d ≤ X j : type ( j )=( w,d ) w j /p j · p j = W w,d . Thus we have shown the desired result.We are now ready to bound the weight of jobs rejected by A . Lemma 6.12.
The total weight of jobs rejected by A is at most ε times the total weight of all thejobs, provided we pick α = ε .Proof. We first bound the total weight of jobs of density class d ⋆ which get rejected by A . We have X j ∈ J R ( d ⋆ ) w j ≤ d ⋆ +1 · X j ∈ J R ( d ⋆ ) p j ( ) ≤ · d ⋆ T ⋆ α · X w α/ X l = α/ m l,w,d ⋆ w + 2 d ⋆ +1 · P ≥ d ⋆ +∆ + 16 · d ⋆ α X w L ( α/ ,w,d ⋆ ) Claim . ≤ X d ∈ [ d ⋆ ,d ⋆ +∆] X w α W w,d + 16 · d ⋆ α P ≥ d ⋆ + 2 d ⋆ +1 · P ≥ d ⋆ +∆ = 8 α · d ⋆ +∆ X d = d ⋆ X j ∈ J d w j + 16 · d ⋆ α X d ≥ d ⋆ X j ∈ J d p j + 2 d ⋆ +1 X d ≥ d ⋆ +∆ X j ∈ J d p j where J d denotes the jobs of density class d . Summing over all values of d ⋆ , the total weight ofrejected jobs can be expressed as X d ⋆ X j ∈ J R ( d ⋆ ) w j ≤ α X d ⋆ d ⋆ +∆ X d = d ⋆ X j ∈ J d w j + X d ⋆ · d ⋆ α X d ≥ d ⋆ X j ∈ J d p j + X d ⋆ d ⋆ +1 X d ≥ d ⋆ +∆ X j ∈ J d p j ≤ α X d X j ∈ J d w j + X d X j ∈ J d p j X d ⋆ ≤ d · d ⋆ α + X d X j ∈ J d p j X d ⋆ ≤ d − ∆ d ⋆ +1 ≤ α X j w j + 64 α X d X j ∈ J d p j d +1 + 4 α X d X j ∈ J d p j d ≤ (cid:18) α + 64 α + 4 α (cid:19) X j w j ≤ ε · X j w j , if we pick α = ε .Thus we have shown the main theorem of this section. Theorem 6.13.
The algorithm A rejects jobs of total weight at most ε times the total weight ofall jobs, and ensures that for any machine i , time t , and pair ( w, d ) , the total weighted remainingprocessing time of jobs of type ( w, d ) at time t on machine i is at most α T ⋆ . Further, A is animmediate dispatch algorithm which rejects jobs on arrival only. Analysis for algorithm B : Now we analyze the algorithm B . It is clear that the weighted flow-time of any job j is at most 2 βT ⋆ , where β denotes α ε . We need to bound the weight of jobs23ejected by B . We can restrict our attention to a fixed machine because B processes the same setof jobs on a machine as A does. Further, A does not reject any job once it gets dispatched to amachine. For rest of the discussion we fix a machine i ⋆ , and bound the weight of jobs which weredispatched by A to i ⋆ , but got rejected by B . We also fix a density class d ⋆ and first bound thejobs of density class d ⋆ which get rejected by B . Let J A i ⋆ ,d ⋆ denote the set of jobs of density class d ⋆ which are dispatched by A to the machine i ⋆ .Let J rej i ⋆ ,d ⋆ denote the subset of jobs in J A i ⋆ ,d ⋆ which get rejected by B . First we divide the timeline into disjoint intervals I , I , . . . with the following properties: (i) for any j ∈ J rej i ⋆ ,d ⋆ , there is aninterval I r which contains the time period when j was waiting in the queue of machine i ⋆ (i.e., thetime period from r j to the time when it gets rejected), (ii) for any interval I r and time t ∈ I r , thereis a job from J rej i ⋆ ,d ⋆ which is waiting in the queue of machine i ⋆ . We can easily form these intervalsby a greedy procedure. For sake of completeness, this procedure is described in Figure 5. Constructing I , I , . . . :
1. Initialize t as 02. For r = 1 , , . . . (i) Let t be the first time after t when a job from J rej i ⋆ ,d ⋆ gets dispatched to i ⋆ .(ii) Let t be the first time after t when there is no job from J rej i ⋆ ,d ⋆ in the queue of machine i ⋆ (in the algorithm B ).(iii) I r ← [ t , t ), and update t ← t .Figure 5: Construction of the set of intervals I , I , . . . .For an interval I r , let J rej i ⋆ ,d ⋆ ( I r ) denote the jobs in J rej i ⋆ ,d ⋆ which are released during I r . Define J A i ⋆ ,d ⋆ ( I r ) similarly. We fix an interval I r and bound the weight of jobs in J rej i ⋆ ,d ⋆ ( I r ). Let w min ( I r )denote the smallest weight class of a job in J rej i ⋆ ,d ⋆ ( I r ). For a time t and density class d , we definean indicator variable A i,d ( t ) which is 1 iff A processes a job of density class d at time t on machine i . Define B i,d ( t ) similarly. Let P A i ⋆ ,d ⋆ ( I r ) be the total volume of processing of density class d ⋆ jobsperformed by A during I r on machine i ⋆ , i.e., P A i ⋆ ,d ⋆ ( I r ) = Z t ∈ I r A i ⋆ ,d ⋆ ( t ) dt. Claim 6.14.
The total processing size of jobs in J A i ⋆ ,d ⋆ ( I r ) whose weight class is at least w min ( I r ) is at most P A i ⋆ ,d ⋆ ( I r ) + α T ⋆ w min( Ir ) . Proof.
In the schedule A , the jobs in J A i ⋆ ,d ⋆ ( I r ) will either get processed during I r or will appearin the queue of machine i ⋆ at the end of I r . The total volume of the former quantity is at most P A i ⋆ ,d ⋆ ( I r ). For the latter quantity, observe that we are interested in weight classes w min ( I r ) andhigher. Theorem 6.13 shows that this quantity can be at most X w ≥ w min ( I r ) α T ⋆ w ≤ α T ⋆ w min ( I r ) . i ⋆ ,d ⋆ ( t ) which is 1 iff both A i ⋆ ,d ⋆ ( t ) and B i ⋆ ,d ⋆ ( t ) are 1 (theabsence of superscript means it is applied to both A and B ). Again, define P i ⋆ ,d ⋆ ( I r ) as the volumeof time during I r for which i ⋆ ,d ⋆ ( t ) = 1. Note a few important points: (i) If i ⋆ ,d ⋆ ( t ) = 1, forsome t ∈ I r , then B processes a job of density class d ⋆ and weight class at least w min ( I r ) at time t , because among all jobs of density d ⋆ , it prefers jobs of higher weight, and there is always a jobof weight class at least least w min ( I r ) waiting in the queue of machine i ⋆ , (ii) If A i ⋆ ,d ⋆ ( t ) = 1 , t ∈ I r and B i ⋆ ,d ⋆ ( t ) = 0 , then B processes a job of density class at least d ⋆ + log (cid:0) ε (cid:1) at time t .Now, we want to disregard the part of P i ⋆ ,d ⋆ ( I r ) where B processes a job which eventually getsrejected. We say that a time t satisfying i ⋆ ,d ⋆ ( t ) = 1 is bad if B processes a job from J rej i ⋆ ,d ⋆ ( I r ) attime t on i ⋆ . We first show that the total volume of bad time is small. Lemma 6.15.
The total volume of bad time in I r is at most length ( I r ) β .Proof. For each weight class w ≥ w min ( I r ), we bound the volume of bad time at which B isprocessing a job of weight class w . Note that for a job of density class d ⋆ and weight class w , itsprocessing time lies in the range [2 w − d ⋆ , w − d ⋆ − ). Let p w denote w − d ⋆ .Fix a weight class w . Recall that the algorithm B divides the time line into segments of length βT ⋆ / w . Consider such a segment S which intersects with I r . Let S L be the segment to the left of S . Any job of weight class w processed by B during S must have been released in S or S L (if itwere released earlier, B would have rejected it by the end of S L ). Since B processes jobs in orderof release dates, there will be at most one job j for which r j ∈ S L and B processes j during a badtime in S . If there were two such jobs j and j ′ (and say r j ≤ r j ′ ), then B would have completed j before starting j ′ (note that j can get rejected at the end of S only). But then it could not haverejected j , a contradiction (recall that a job processed during a bad time gets rejected). Hence, thetotal number volume of bad time in I r during which B processes a job of weight class w is at mostthe number of such segments which intersect I r times the maximum size of a job of weight class w (and density class d ⋆ ), i.e., (cid:18) length ( I r ) βT ⋆ / w + 2 (cid:19) · p w ≤ · p w · length ( I r ) βT ⋆ / w = 3 · w length ( I r ) βT ⋆ d ⋆ , where the first inequality follows from the fact that I r must contain at least one segment for theweight class w min ( I r ), and so, length ( I r ) ≥ βT ⋆ w min( Ir ) ≥ βT ⋆ / w .We sum over all w ≥ w min ( I r ), and let w max be the highest weight class among all jobs ofdensity class d ⋆ . The total volume of bad time in I r can now be bounded as X w ≤ w max · w length ( I r ) βT ⋆ d ⋆ ≤ · w max length ( I r ) βT ⋆ d ⋆ ≤ · length ( I r ) β , where the last inequality follows from the fact that T ⋆ ≥ w max · w max − d ⋆ − (the weighted size ofa job of density class d ⋆ and weight class w max ). Corollary 6.16.
The total processing time of density class d ⋆ jobs which are rejected by B during I r on machine i ⋆ is at most P A i ⋆ ,d ⋆ ( I r ) + 4 · ε length ( I r ) − P i ⋆ ,d ⋆ ( I r )25 roof. The result follows from combining Lemma 6.15 and Claim 6.14. Claim 6.14 shows that thetotal processing time of such jobs is P A i ⋆ ,d ⋆ ( I r ) + α T ⋆ w min( Ir ) . minus the processing times of such jobswhich complete processing in B . Lemma 6.15 shows that the latter quantity is at least P i ⋆ ,d ⋆ ( I r ) − length ( I r ) β . Therefore, the processing time of density class d ⋆ jobs which are rejected by B during I r on machine i ⋆ is at most P A i ⋆ ,d ⋆ ( I r ) + 2 α T ⋆ w min ( I r ) + 8 length ( I r ) β − P i ⋆ ,d ⋆ ( I r ) . Since length ( I r ) ≥ βT ⋆ w min( Ir ) = α T ⋆ ε w min( Ir ) , the result follows. Theorem 6.17.
The total weight of jobs rejected by B is at most ε times the total weight of alljobs.Proof. Fix an interval I r . Corollary 6.16 gives the total weight of density d ⋆ jobs which get rejected.We write it in a form which will be more useful. For a density class d and time t , let B i ⋆ ,d ( t ) bethe indicator variable which is 1 iff B processes a job of density class d at time t on machine i ⋆ .Similarly, define B i ⋆ , ≥ d ( t ) to be 1 iff B processes a job of density class at least d during t on machine i ⋆ . We first observe that P A i ⋆ ,d ⋆ ( I r ) − P i ⋆ ,d ⋆ ( I r ) ≤ Z t ∈ I r B i ⋆ , ≥ d ⋆ +log ( ε )( t ) dt, because the LHS is 1 iff at time t , B processes a job of density class at least d ⋆ + log (cid:0) ε (cid:1) at time t .Further, length ( I r ) = Z t ∈ I r B i ⋆ , ≥ d ⋆ − log ( ε )( t ) dt, because if at any time t ∈ I r , there is a job of density class d ⋆ waiting in the queue at machine i attime t , and so, the processing rule for B dictates that it cannot process a job of density class lessthan d ⋆ − log (cid:0) ε (cid:1) at time t . Combining the above two inequalities with Corollary 6.16, the totalweight of jobs of density d ⋆ rejected during I r is at most4 ε · d ⋆ +1 Z t ∈ I r B i ⋆ , ≥ d ⋆ − log ( ε )( t ) dt + 2 d ⋆ +1 · Z t ∈ I r B i ⋆ , ≥ d ⋆ +log ( ε )( t ) dt. Summing the above for all intervals I r and noting that these intervals are disjoint for a fixed d ⋆ ,the total weight of jobs of density class d ⋆ rejected is at most4 ε · d ⋆ +1 Z t B i ⋆ , ≥ d ⋆ − log ( ε )( t ) dt + 2 d ⋆ +1 · Z t B i ⋆ , ≥ d ⋆ +log ( ε )( t ) dt. Summing the above for all density classes d ⋆ , we see that the total weight of jobs rejected by B isat most 4 ε X d ⋆ d ⋆ +1 Z t X d ≥ d ⋆ − log ( ε ) B i ⋆ ,d ( t ) dt + X d ⋆ d ⋆ +1 · Z t X d ≥ d ⋆ +log ( ε ) B i ⋆ ,d ( t ) dt = 4 ε Z t X d X d ⋆ ≤ d +log ( ε ) 2 d ⋆ +1 B i ⋆ ,d ( t ) dt + Z t X d X d ⋆ ≤ d − log ( ε ) 2 d ⋆ +1 B i ⋆ ,d ( t ) dt ≤ ε Z t X d d B i ⋆ ,d ( t ) dt P i R t P d d B i,d ( t ) dt is at most twice the total weight of all jobs processed by B (ajob of class density d has density at most 2 d +1 ). This proves the theorem. T ⋆ So far we have assumed that we know the value of T ⋆ . Now we explain how to get rid of thisassumption. Our algorithm starts with an estimate for T ⋆ and updates it whenever we end uprejecting more than the desired weight of jobs. For a parameter T , let A ( T ) denote the algorithm A when the estimate for T ⋆ is given by T . Define B ( T ) similarly. The modification to the schedulingalgorithm is described in Figure 6. Note that when running A ( T ) in Step 2(i), the algorithm A ( T )completely ignores the jobs dispatched before j , and so, these jobs do not figure in the calculationof load . In fact, these jobs will never get processed by A ( T ). We shall refer to each iteration inStep 2 as a phase . When we run B ( T ) in Step 2(ii), we treat the unfinished jobs of previous phaseas being released at the beginning of this phase. So even though such jobs do not affect A ( T ) inthe current phase, B ( T ) may schedule them (or reject them). Modified Scheduling Algorithm :
1. Initialize T ← p j w j , where j is the first released job, and time t ← r j .2. Repeat (i) Run A ( T ) on the jobs arriving after j (including j ).(ii) Run B ( T ) alongside A ( T ) while treating all unfinished jobs releasedbefore j (including j ) as being released at time t .(iii) If the algorithm A ( T ) rejects jobs of total weight more than ε -fraction of the jobs which arrived after j (including j ),Stop the algorithm A ( T ) and update T ← T. Let j be the last job which was rejected by A ( T ). Update t ← r j .Figure 6: Scheduling algorithm without any assumption on T ⋆ .We now analyze the scheduling algorithm. Theorem 6.18.
The above algorithm is O (1 /ε ) -competitive, and rejects jobs of total weight O ( ε ) times the total weight of all jobs.Proof. Let T ⋆ denote the value of the offline optimum. Let T i be the value of T at the beginningof phase u . First observe that in the last phase u ⋆ , T u ⋆ ≤ T ⋆ . Indeed, if T u becomes larger than T ⋆ , then A ( T u ) will not reject jobs of weight more then ε -fraction of the weight of all the jobs inthis phase (the offline optimum for jobs released in this phase can only be at most T ⋆ ).Also, observe that A ( T u ) rejects jobs of weight at most ε -times the weight of all jobs released inthis phase, and so, the total weight of jobs rejected by it is within ε -fraction of all the jobs. Now,observe that in a phase u , the total load of jobs of type ( w, p ) waiting in the queue of a machine i at time t is at most X u ′ ≤ u α T u w ≤ α T u w . This follows from Theorem 6.13 about the properties of A . Thus, the previous phases worsen thequeue size by a factor of 2 only. 27ow, we consider B . Suppose it completes a job j in a phase u which was released in phase u ′ ≤ u . In a phase u ′′ between u ′ and u , j could have waited for at most α T u ′′ ε w j amount of time(otherwise it would get rejected). So, the total waiting time for this job is at most α T u ε w j ≤ α T ⋆ ε w j . Thus, the scheduling algorithm is O (1 /ε )-competitive.Further in a phase u , the total weight of jobs rejected by B ( T u ) is at most O ( ε )-times the totalweight processed by B ( T u ) – this follows from the analysis for algorithm B . The fact that the queuesizes in A ( T u ) are twice the estimate from Theorem 6.13 (because of the effect of previous phases)only doubles the weight of rejected jobs. This proves the theorem. GenWtdMaxFlowTime
We now extend our result to the
GenWtdMaxFlowTime problem. Recall that in this problem a ajob j has two weights associated with it, the rejection-weight w rj and flow-time-weight w fj ; the firstone is used for counting the rejection weight of rejected jobs, while the second one is used in theweighted flow-time expression.It turns out that almost all the details for the algorithm A carry over with cosmetic changesin notation to this problem as well, however the algorithm B needs some change; in particularLemma 6.15 cannot be applied as it because this is the only place where we critically need the factthat the two weights are same. We now outline the modified algorithm and then the changes thatare needed in the analysis. As before we shall assume that the offline optimum value T ⋆ is known– the details for removing this assumption are exactly as in the case of WtdMaxFlowTime problem.
Algorithm A We define the notion of weight class and density class for each of these two weights.Again, assume wlog that both the weights are powers of 2. We say that a job j is of rejection-weight class w r if w rj = 2 w r . Define flow-time-weight class similarly. The rejection-density of ajob is defined as w rj /p j ; and we say that its rejection-density class is d r if its rejection-density liesin [2 d r , d r +1 ). Define flow-time-density and flow-time-density class similarly. We now go over thedefinitions that were used in defining A and mention the changes in them.A job j is said to be of type ( w f , d r ) if its rejection-density class is d r and flow-time-weight classis w f . For a machine i , time t , and pair ( w f , d r ), let Q i,w f ,d r ( t ) denote the jobs of type ( w f , d r )waiting in the queue of machine i at time t ; and define the load i,w f ,d r ( t ) as the total weightedremaining processing time of the jobs in Q i,w f ,d r ( t ) – if a job j has remaining processing time p ′ j ,then its weighted remaining processing time is defined as w fj p ′ j . When a job j of type ( w f , d r )arrives at time t , we dispatch it to the machine i ∈ S j for which load i,w f ,d r ( t ) is minimum, unlessfor all i ∈ S j , load i,w f ,d r ( t ) + p j . w f ≥ α · T ⋆ . If the latter case happens, we reject this job.It remains to specify which job is processed at any time by a machine. For a time t and machine i , let ( w fi ( t ) , d ri ( t )) be the pair ( w f , d r ) with the highest 2 d r · load i,w f ,d r ( t ) value. We process theearliest released job from the queue Q i,w fi ( t ) ,d ri ( t ) ( t ) on machine i at time t . Assume a fixed rule ofbreaking ties. Algorithm B : Now we describe the modified algorithm B . When a job j arrives at time t , it isdispatched according to A : if A rejects this job, B also rejects it; and if A dispatched it to machine i , then B also dispatches this job to i . Now, we describe the processing policy for a fixed machine i .Consider a time t . Let d A ( t ) denote the rejection-density class of the job processed by A at time t .Then, B processes the following job at time t : if there is a job of rejection-density class higher than d A ( t ) + 2log (cid:0) ε (cid:1) in the queue of machine i at time t , then B processes any such job; otherwise it28rocesses the job of rejection-density class d A ( t ) with the highest flow-time-weight class (it prefersthe earliest released job in case of ties). Also note that if the second case happens and there is nojob of rejection-density class d A ( t ) in the queue of machine i at time t (in B ), we can process anyjob at this time.The algorithm B may reject some more jobs. There are two kinds of rejections: (i) immediaterejection: for each triplet ( w f , d r , p ), B rejects every (cid:0) ε (cid:1) th job of type ( w f , d r ) and size-class p dispatched to it – note that these jobs are rejected as soon as they are released (the algorithm A isimmediate dispatch), (ii) delayed rejection: for every flow-time-weight class w f , we divide the timeline into segments of length α +2) T ⋆ ε wf . Suppose a job of flow-time-weight class w f gets releasedduring such a segment S , and let S ′ be the segment immediately to the right of S . If the job doesnot complete processing by the end of S ′ , the algorithm B rejects the job. This completes thedescription of B .Now we outline how the analyses of these two algorithms change. Analysis of A : The goal is to prove the following extension of Theorem 6.13.
Theorem 7.1.
The algorithm A rejects jobs of total rejection-weight at most ε times the totalrejection-weight of all jobs, and ensures that for any machine i , time t , and pair ( w f , d r ) , the totalweighted remaining processing time of jobs of type ( w f , d r ) at time t on machine i is at most α T ⋆ .Further, A is an immediate dispatch algorithm which rejects jobs on arrival only.Proof. We give a brief description of the changes that are needed from the proof of Theorem 6.13.A weighted machine interval is again a triplet (
I, i, w f ), where w f corresponds to a flow-time-weightclass. Lemma 6.6 holds if we replace weight by flow-time-weight (the lemma gives a lower bound on T ⋆ , which does not depend on rejection at all). Again, we fix a time t ⋆ , and a rejection-density class d ⋆ . The quantities α and γ l are defined as before. For a machine i , time t , and rejection-densityclass d r , load i,d r ( t ) is defined as the maximum over all flow-time-weight class w f , of load i,w f ,d r ( t ).The quantities level ( j ) , J ( l,d ⋆ ) and maxload i,d ⋆ ( t ) are defined analogously.The weighted machine intervals I ( i,l,d ⋆ ) are constructed as in Figure 4 (in Step 2(iii), w refers toflow-time-weight class). Lemma 6.7 follows without any change (in the proof, we use d to refer torejection-density class and w to flow-time-weight class). The dual variables are defined as before,and so, Claim 6.8 follows without any change.For a parameter l and flow-time-weight class w f , let I ( l,w f ,d ⋆ ) is defined as before, and thequantities m l,w f ,d ⋆ , L ( l,w f ,d ⋆ ) are defined analogously. Inequality (7) holds without any change (ifwe replace w by w f ). The same applies to Claim 6.10 and inequality (8). The definitions V w,d and W w,d get replaced by (note the subtle change below – the weights in the summation are theflow-time weights in the definition of V but the rejection-weights in the definition of W ) : V w f ,d r = X j : type ( j )=( w f ,d r ) w fj p j , W w f ,d r = X j : type ( j )=( w f ,d r ) w rj .V w f ,d r ( a, b ) is defined analogously. Claim 6.11 goes through without any changes (if we replace w by w f and d by d r ). Note that in the proof of this claim, the last line will now read as2 d r w f V w f ,d r = X j : type ( j )=( w f ,d r ) d r w fj w fj p j = X j : type ( j )=( w f ,d r ) d r p j ≤ X j : type ( j )=( w f ,d r ) w rj = W w f ,d r . Proof of Lemma 6.12 now follows without any changes.29 w w I I I I I I Figure 7: The intervals I , I , I are maximal intervals where a job of flow-time weight class at least w is waiting in the queue. Out of these I ( w ) = { I , I } because these are the intervals where adelayed rejected job of type ( w , d ⋆ ) is released. Similarly, for a flow-time weight class w , w ≥ w , I ( w ) = { I , I } . Finally, I = { I , I , I . } Analysis of B : We give some intuition about where the analysis differs from that in the case of
WtdMaxFlowTime . As noted earlier, in the case of
WtdMaxFlowTime , we needed to bound the volumeof bad time slots, i.e., time where B processes a job, but then decides to reject it later. For this,we crucially needed the fact that the two kind of weights are same. However, we do not have thisluxury anymore. This is where we use the immediate rejection – if volume V of jobs (of a certainrejection density class d ) are dispatched to a machine i , about εV of this will get immediatelyrejected. Now, it may happen that B rejects the remaining jobs after processing them to almostcompletion, but even then the volume of bad jobs will remain at most (1 − ε ) V . In the remaining εV time slots (meant for such jobs), B must process very high density jobs, and so will be able tobound the weight of rejected jobs.We now proceed with the analysis of B . We only need to bound the total rejection weight ofjobs which are rejected. The case of immediate rejection is easy. Claim 7.2.
The total rejection weight of jobs which are rejected by B using immediate reject is atmost ε times the total rejection weight of all jobs.Proof. Consider a job of flow-time weight class w f , rejection density class d r and size class p . Itsrejection weight is at least 2 p · d r and at most 2 p +1 · d r +1 . In other words, any two such jobs willdiffer in their rejection weight by a factor 4 only. Since B rejects such jobs after every 1 /ε arrivals,the claim follows.The case of delayed rejects is more non-trivial. Again, we fix a machine i ⋆ and rejection densityclass d ⋆ . For ease of notation, we shall remove the subscripts involving i ⋆ and d ⋆ . Let J R denotethe set of jobs of rejection density class d ⋆ which are rejected (using delayed reject) by B . We shallagain define a set of disjoint intervals but their definition is more tricky. For a flow-time weightclass w f , we can divide the time line into disjoint set of intervals I ( w f ) such that any interval I ∈ I ( w f ) satisfies: (i) at any point of time t ∈ I , there is a job of type ( w, d ⋆ ) , w ≥ w f , in thequeue of machine i ⋆ in B , and (ii) at least one job of type ( w f , d ⋆ ) in J R is released during I . Inother words, we first divide the time line into disjoint maximal intervals where we have a job oftype ( w, d ⋆ ) , w ≥ w f , in the queue of machine i ⋆ . From these intervals, we pick out those where ajob in J R of type ( w f , d ⋆ ) is released.Note that if I ∈ I ( w f ) , I ′ ∈ I ( w f ), then either I and I ′ are disjoint or one is contained in theother. Let I denote the (containment wise) maximal intervals in ∪ w f I ( w f ), i.e., any two intervals in I are disjoint and no interval in I is contained inside any other interval in ∪ w f I ( w f ) (see Figure 7).30ix an interval I ∈ I for rest of the discussion. Let J R ( I ) be the set of jobs in J R which are releasedduring I .Let w min ( I ) be the smallest flow-time weight class of a job in J R ( I ) – observe that I ∈I ( w min ( I )). Further, at every point of time in I , there is a job of type ( w, d ⋆ ) , w ≥ w min ( I ) inthe queue of machine i ⋆ in the algorithm B . The maximality of I shows that there is no such jobin the queue of machine i ⋆ just before the left end-point of I .For a size class p and flow-time weight class w f , let P A d ⋆ ,p,w f ( I ) denote the total volume of timein I during which A processes jobs of type ( w f , d ⋆ ) and size class p (on the machine i ⋆ ). Let J A d ⋆ ,p,w f ( I ) denote the set of jobs of type ( w f , d ⋆ ) and size-class p which are dispatched by A to i ⋆ during I , and n d ⋆ ,p,w f denotes the cardinality of this set. Note that A will either process these jobsduring I or they will end up in the queue of i ⋆ at the end of I .First observe that for any w f , X p X j ∈ J A d⋆,p,wf ( I ) p j ≤ X p P A d ⋆ ,p,w f ( I ) + α T ⋆ / w f , (9)because any job in the LHS will either be processed by A during I or will end up in the queue oftype ( w f , d r ) jobs at the end of i ⋆ , and the latter part can have total remaining processing volumeat most α T ⋆ / w f (Theorem 7.1). Claim 7.3.
The total volume of time in I during which B processes jobs of type ( w f , d ⋆ ) , w f ≥ w min ( I ) , is at most (1 − ε/ P A d ⋆ ( I ) + 2( α + 2) T ⋆ / w min ( I ) , where P A d ⋆ ( I ) denotes P p P w f ≥ w min ( I ) P A d ⋆ ,p,w f ( I ) , i.e., the total volume of time in I during which A processes jobs of rejection-density class d ⋆ and weight-flow-time class w min ( I ) or higher.Proof. Observe that any job of type ( w f , d ⋆ ), w f ≥ w min ( I ), processed by B during I (on machine i ⋆ ) has to either: (i) appear in the queue of B on machine i ⋆ at the beginning of I , or (ii) dispatchedto i ⋆ by A during I and not get immediately rejected by B . By definition of I (maximality property),there is no job in (i). We now estimate (ii). Note that for any flow-time weight class w f and sizeclass p , B will immediately reject at least P p ( ε · n d ⋆ ,p,w f −
1) jobs from J A d ⋆ ,p,w f ( I ), and so, the totalvolume of such jobs rejected by B is at least X p ( ε · n d ⋆ ,p,w f − · p ≥ X p ε · n d ⋆ ,p,w f · p − T ⋆ / w f ≥ ε/ · X p X j ∈ J A d⋆,p,wf ( I ) p j − T ⋆ / w f , where the first inequality follows from the fact that the maximum processing time of any job offlow-time-weight class w f is at most T ⋆ / w f . Inequality (9) and the above inequality now implythat the total volume of time during I at which B processes a job of type ( w f , d ⋆ ) is at most X p X j ∈ J A d⋆,p,wf ( I ) p j − ε/ · X p X j ∈ J A d⋆,p,wf ( I ) p j + 2 T ⋆ / w f ≤ (1 − ε/ X p P A d ⋆ ,p,w f ( I ) + ( α + 2) T ⋆ / w f Summing over all w f ≥ w min ( I ), we get the desired result.It follows from the above claim that there must be at least P A d ⋆ ( I ) − (cid:16) (1 − ε/ P A d ⋆ ( I ) + 2( α + 2) T ⋆ / w min ( I ) (cid:17) = ε/ · P A d ⋆ ( I ) − α + 2) T ⋆ / w min ( I ) (10)31olume of time during I at which B is performing jobs of rejection-density class d ⋆ + 2log (cid:0) ε (cid:1) orhigher – indeed, there is always a job of type ( w f , d ⋆ ) , w f ≥ w min ( I ) in the queue of i ⋆ during I , andyet, B processes such jobs during (1 − ε/ P A d ⋆ ( I ) + 2( α + 2) T ⋆ / w min ( I ) out of the possible P A d ⋆ ( I )volume (during which A processes such jobs in I ). Now, define an indicator variable B i ⋆ , ≥ d ⋆ ( t )which is 1 if B processes job of rejection-density class at least d ⋆ at time t on i ⋆ . Lemma 7.4.
The total processing time of J R ( I ) , the jobs of rejection-density class d ⋆ which getdelayed rejected by B during I , is at most ε Z t ∈ I B i ⋆ , ≥ d ⋆ +2log ( ε ) dt + ε Z t ∈ I B i ⋆ , ≥ d ⋆ − ( ε ) , (11) Proof.
Inequality (10) implies that the first term in the summation above is at least2 /ε (cid:16) ε/ · P A d ⋆ ( I ) − α + 2) T ⋆ / w min ( I ) (cid:17) = P A d ⋆ ( I ) − α + 2) T ⋆ ε · w min ( I ) , and the second term is at least (recall that at all time during I , B will be processing a job ofrejection density class at least d ⋆ − (cid:0) ε (cid:1) ) ε · length ( I ) ≥ α + 2) T ⋆ ε · w min ( I ) , because I contains a job of rejection-weight w min ( I ), and so must be as long as one segmentcorresponding to this rejection-weight class (according to the description of algorithm B ). Therefore,the expression in (11) is at least P A d ⋆ ( I ) + 2 α T ⋆ ε · w min ( I ) , which is at least the total processing size of J R ( I ) (using inequality (9) and summing over all w f ≥ w min ( I )).Rest of the argument follows as in the case of Theorem 6.17 – we sum the expression in (11)over all I ∈ I , and then over all rejection-density classes d ⋆ to show that the total rejection weightof rejected jobs is within ε fraction of the total rejection weight of all jobs. Thus, we have shown Theorem 7.5.
The algorithm B is O (1 /ε ) -competitive algorithm and rejects jobs of total rejectionweight at most O ( ε ) -times the total rejection-weight of all jobs. In this section, we show results on some lower bounds of the
LoadBalancing and the
MaxFlowTime problems. The first result shows that for
LoadBalancing , the trade-off that we obtain betweencompetitive ratio and the fraction of jobs rejected is nearly optimal.
Lemma 8.1.
Given a parameter ε , and an (deterministic) online immediate dispatch algorithm A for the LoadBalancing problem, there is an input I ( ε ) consisting of unit size jobs such that A rejects at most ε -fraction of the jobs and the competitive ratio of A on I ( ε ) is at least Ω (cid:0) log (cid:0) ε (cid:1)(cid:1) . roof. The input I ( ε ) has m machines, and will have at most 2 m jobs. So, the algorithm can rejectat most 2 εm jobs. The jobs are released in several phases. At the beginning of phase l , we have aset M l of machines on which load is at least l . We shall use m l to denote | M l | .This is clearly true for l = 0 with M being the initial set of machines and m = m . Supposethe invariant is true at the beginning of a phase l . During phase l , we shall assume wlog that thealgorithm first dispatches all the jobs released during this phase, and then rejects some of them.This will not change the competitive ratio of the algorithm because we will only look at the endof a particular phase. We partition the machines in M l into m l disjoint pairs. For each such pair i, i ′ , we release 2 jobs which can only go on these two machines. Without loss of generality, assumethat the algorithm A dispatches at least one of these two jobs to i . Then we add i to a set X .Thus, X has m l machines. Assuming m l ≥ εm , we can reject at most 2 εm ≤ | X | jobs dispatchedto the machines in X during this phase. Thus, at least half of the machines in X get at least onejob during this phase – we let M l +1 be these machines. Observe that m l ≤ m l +1 ≤ m l . Furtherthe load on a machine in M l +1 is at least l + 1. Thus, the invariant holds at the end of this phaseas well.Note that we require m l ≥ εm . This will hold if we have only (cid:0) log (cid:0) ε (cid:1)(cid:1) phases. It is easyto check that the optimal load is at most 2 – during phase l , when we send 2 jobs to a pair ofmachines i, i ′ , the offline schedule sends these jobs to the machine which does not get added to X .Further, the total number of jobs released is at most P l m l ≤ m . This completes the proof of thelemma.The next result shows that for arbitrary processing times, an immediate dispatch and immediatereject algorithm for the LoadBalancing problem will incur high competitive ratio.
Theorem 8.2.
Any online algorithm A for the LoadBalancing problem which satisfies immediatedispatch and immediate reject has unbounded competitive ratio, even if it can reject ε -fraction ofthe jobs.Proof. The proof is very similar to that of Lemma 8.1. However, in subsequent phases, jobs sizeswill start decreasing, and so, the number of phases will not be bounded by a function of ε . Weshall maintain the following invariants for all phases l = 0 , , , . . . : • At the beginning of phase l , there will be a set M l of m l = m l machines such that the loadon each of them (in the schedule produced by algorithm A ) will be at least l . Here m is theinitial number of machines. • During phase l −
1, we shall release 2 l · m jobs each of length l .These invariants hold at l = 0: M is the initial set of machines. Suppose these properties hold forsome l . Again, we assume wlog that the algorithm first dispatches all the jobs released in a phase,and then rejects some of them. During phase l , we pair up the machines in M l into m l pairs. Foreach such pair of machines i, i ′ , we release 2 · l jobs, each of length l , which can only be processedby these two machines. Assume without loss of generality that the algorithm A dispatches at least8 l of these jobs to i – we add i to a set X . Hence, X will be a set of m l machines.Note that the total number of jobs released in phase l is m l · l = m · l . Therefore, the totalnumber jobs released so far is at most m · l +1 , and so, A can reject at most ε · m · l +1 = 2 ε · m l l jobsreleased during this phase – note that A is not allowed to reject jobs released in previous phasesduring phase l . This implies that at least half of the machines in X will receive at least l jobs33uring this phase – otherwise, the total number of rejected jobs will be at least | X |· l = · m l · l ,which will be a contradiction (assuming ε < / | X | / ≥ m l /
4, we pick M l +1 to be m l / l + l · l = l +12 . This provesthe invariant for l + 1.It is also easy to see that the optimal offline load on any machine is at most 2 (using thesame argument as in the proof of Lemma 8.1. Since the number of phases can be arbitrarily large(depending on the value of m ), we see that the competitive ratio of A is unbounded.Next we give a strengthening of Lemma 8.1 for the MaxFlowTime problem.
Lemma 8.3.
Given a parameter ε , and an (deterministic) online immediate dispatch algorithm A for the MaxFlowTime problem, there is an input consisting of unit size jobs such that A rejects atmost ε -fraction of the jobs and the competitive ratio of A is Ω (cid:0) ε (cid:1) . Proof.
In our input, we shall release jobs at the end of a time interval I . We assume that thealgorithm A dispatches all the jobs released during I , and rejects jobs only at the end of I . Thiswill be without loss of generality: we will only consider the queue size on a machine at the end ofthe interval I . If A was rejecting any job during I , then it could instead dispatch this job arbitrarilyand reject it at the end of I . This will not affect the queue length of machines at the end of I .We shall use the following gadget while building the input. Claim 8.4.
Suppose at some time t , the algorithm A is given as input, a set M of m + 1 machineswith i unit sized jobs in the queue of the i th machine, i = 0 , . . . , m . Then one can release m + 3 unit size jobs during the interval [ t, t + 2] such that at time t + 2 , the load (queue size) on thesemachines (in some other order) are , , , . . . , m − , m + 1 .Further, there is an offline algorithm which given the machines in M with unit load at time t and the same input as above during [ t, t + 2] ends up with unit load on all machines at time t + 2 .The maximum load on any machine during this interval is .Proof. We will release several jobs at the same time in a sequence , i.e., the next job will be releasedonly after the current one is dispatched by A . We label the machines M , . . . , M m , with M i havingload i at time t in A . All jobs have unit size. The procedure for releasing jobs is described inFigure 8. We first observe that at the beginning of Step 3(i), both M i − and M i have load i .Hence, at the end of time t , machine M i has load i + 1. Due to Step 4, at the end of time t + 1, M m continues to have load m + 1, but now, M i has load i for all i = 0 , . . . , m −
1. Further, no changein load happens due to Step 5, because M already had 0 load. This step is needed to argue aboutthe offline algorithm.Finally, it is easy to check that there is an offline schedule with the desired properties. InStep 3(ii), the job j i is dispatched to M i − . Thus, at the end of time t , M has 3 jobs in its queue, M , . . . , M m − get 2 jobs, and M m has one. Step 4 ensures that at the end of time t + 1, M has 2jobs in its queue, and the remaining machines have one jobs each in their queue. Finally, in Step 5, M at the end of time t + 2 also ends up with one job in its queue. This proves the desired result.In our input, we shall have ∆ machines, where the parameter ∆ will be specified later. Thejobs are released in ∆ − l , following invariants are satisfied: (i)In the schedule produced by A , there are l machines with load 1 , , . . . , l , and rest of the machineshave 0 load, (ii) In the offline schedule, load is 1 on all machines. Further, the maximum load onany machine till the beginning of stage l was 3. 34 ncreaseLoad:
1. At time t , release a job j which can only be processed by M .3. For i = 1 to m do (i) Release a job j i at time t which can be processed by { M i − , M i } (ii) Assume (upto relabeling) that A dispatches j i to M i .4. At time t + 1, release one job j ′ m which can only go on machine M m .5. At time t + 2, release one job j ′′ i for i = 1 , . . . , m , such that j ′′ i can be processed by M i only.Figure 8: Dispatching jobs for Claim 8.4Clearly, this is true at the beginning of stage 0. Suppose this holds true for l – let t l denotethe time at the beginning of stage l . We iteratively call the procedure IncreaseLoad definedin Claim 8.4. The procedure is described in Figure 9. Assume that machine M i has load i for i = 1 , . . . , l . The load on other machines remains 0. The procedure uses two other machines, whichwe call M and M ′ (note that we have at least l + 2 machines). During the procedure, we maykeep a machine busy during a time period. This essentially means that we release one (unit size)at every unit time step during this time period – hence, the load on this machine does not changeat all. ReleaseJobs(Stage l):
1. Initialize time t ← t l For i = l downto 1 do (i) Machines M , . . . , M i have load 0 , . . . , i (upto reordering) andmachines M i +1 , . . . , M l have load i + 2 , . . . , l + 1 (upto reordering)(ii) Call IncreaseLoad at time t with machines M , . . . , M i – these machinesget load 0 , , , . . . , i − , i + 1 (upto reordering) at time t + 2(iii) For j = i + 1 to l Keep machine M j busy during [ t, t + 2].(iv) t ← t + 2.3. Upto reordering M , . . . , M l have load 2 , . . . , l + 1, and M has load 0.(i) At time t release a job which can be processed by M and M ′ only,assume A dispatches this job to M (upto reordering).(ii) Keep M , . . . , M l busy during [ t, t + 1].Figure 9: Jobs released in a stageIt is easy to check that at the end of this procedure, we have l +1 machines with load 1 , . . . , l +1respectively. Suppose there is an offline algorithm in which all machines have load 1 at time t i .Then Claim 8.4 implies that during Step 2, the maximum load on any machine stays 3, and we endup with 1 load on all machines. In Step 3(i), the job released is sent to M ′ by the offline schedule,and then during Step 3(ii), M ′ processes this job to end up with 1 load. This proves that theinvariants hold for the next stage as well. Note that the total number of jobs released during this35tage (using Claim 8.4) are at most:1 + l X i =1 [( i + 3) + 2( l − i )] + 1 + ( l + 1) ≤ l . Thus, the total number of jobs released till ∆ − ∆ . At the end of final stage,we have at ∆ − , , . . . , ∆ −
1. Now, the online algorithm can delete at most ε · ∆ ≤ ∆ jobs (assuming ∆ = ε ). Thus, we will still have at least one machine with total loadat least ∆2 = ε – indeed, otherwise the total number of deleted jobs will be at least1 + 2 + · · · + ∆ − ≥ ∆ . This proves the lemma. Observe that here, the input size is constrained by a function of ε – but wecan make it independent of ε by taking multiple copies of the above construction in parallel. In this paper, we proposed a new model for avoiding the pessimistic bounds arising from com-petitive analysis of online algorithms for scheduling problems. We could give constant-competitivealgorithms for load balancing and minimizing maximum weighted flow-time problems in this model,even though such results cannot be obtained in the speed augmentation model. It is not difficultto show that if there is a single machine, then a policy which rejects every ( ε ) th job (for eachweight-class and job size class) and follows HDF rule has competitive ratio within a constant ofthat when we allow the machine (1 + ε )-speed augmentation. Hence, the results which give im-mediate dispatch algorithms with competitive ratio of pε O (1) for minimizing ℓ p norm of flow-timein the unrelated machines model with speed augmentation ( [5, 28]) can be proved here as well(with an extra 1 /ε factor loss in competitive ratio). It is an interesting problem to give algorithmsfor minimizing ℓ p norm of flow-time in the rejection model with competitive ratio independent of p . More generally, we feel that more interesting results can be given for other online schedulingproblems in this model. References [1] Susanne Albers. Better bounds for online scheduling.
SIAM J. Comput. , 29(2):459–473, 1999.[2] Susanne Albers and Matthias Hellwig. Semi-online scheduling revisited.
Theor. Comput. Sci. ,443:1–9, 2012.[3] Christoph Amb¨uhl and Monaldo Mastrolilli. On-line scheduling to minimize max flow time:an optimal preemptive algorithm.
Oper. Res. Lett. , 33(6):597–602, 2005.[4] S. Anand, Karl Bringmann, Tobias Friedrich, Naveen Garg, and Amit Kumar. Minimizingmaximum (weighted) flow-time on related and unrelated machines. In
ICALP (1) , pages13–24, 2013.[5] S. Anand, Naveen Garg, and Amit Kumar. Resource augmentation for weighted flow-timeexplained by dual fitting. In
SODA , pages 1228–1241, 2012.366] James Aspnes, Yossi Azar, Amos Fiat, Serge Plotkin, and Orli Waarts. On-line routing of vir-tual circuits with applications to load balancing and machine scheduling.
J. ACM , 44(3):486–504, May 1997.[7] Nir Avrahami and Yossi Azar. Minimizing total flow time and total completion time withimmediate dispatching. In
SPAA , pages 11–18, 2003.[8] Yossi Azar. On-line load balancing. In
Theoretical Computer Science , pages 218–225. Springer,1992.[9] Yossi Azar, Leah Epstein, and Rob van Stee. Resource augmentation in load balancing. In
SWAT , pages 189–199. Springer, 2000.[10] Yossi Azar, Joseph Naor, and Raphael Rom. The competitiveness of on-line assignments.
J.Algorithms , 18(2):221–237, 1995.[11] Nikhil Bansal, Avrim Blum, Shuchi Chawla, and Kedar Dhamdhere. Scheduling for flow-timewith admission control. In
Proc. ESA, 2003 .[12] Nikhil Bansal and Kirk Pruhs. Server scheduling in the lp norm: a rising tide lifts all boat. In
STOC , pages 242–250, 2003.[13] Yair Bartal, Stefano Leonardi, Alberto Marchetti-Spaccamela, Jiri Sgall, and Leen Stougie.Multiprocessor scheduling with rejection.
SIAM J. Discrete Math. , 13(1):64–78, 2000.[14] Piotr Berman, Moses Charikar, and Marek Karpinski. On-line load balancing for relatedmachines. In
WADS , volume 1272, 1997.[15] Niv Buchbinder and Joseph (Seffi) Naor. Fair online load balancing. In
Proceedings of theEighteenth Annual ACM Symposium on Parallelism in Algorithms and Architectures , SPAA’06, pages 291–298, 2006.[16] Jivitej S. Chadha, Naveen Garg, Amit Kumar, and V. N. Muralidhara. A competitive algo-rithm for minimizing weighted flow time on unrelatedmachines with speed augmentation. In
STOC , pages 679–684, 2009.[17] Ho-Leung Chan, Sze-Hang Chan, Tak Wah Lam, Lap-Kei Lee, and Jianqiao Zhu. Non-clairvoyant weighted flow time scheduling with rejection penalty. In
SPAA , pages 246–254,2012.[18] Moses Charikar and Samir Khuller. A robust maximum completion time measure for schedul-ing. In
SODA , pages 324–333, 2006.[19] Chandra Chekuri, Ashish Goel, Sanjeev Khanna, and Amit Kumar. Multi-processor schedulingto minimize flow time with epsilon resource augmentation. In
STOC , pages 363–372, 2004.[20] Chandra Chekuri, Sungjin Im, and Benjamin Moseley. Online scheduling to minimize maxi-mum response time and maximum delay factor.
Theory of Computing , 8(1):165–195, 2012.[21] Chandra Chekuri and Benjamin Moseley. Online scheduling to minimize the maximum delayfactor. In
SODA , pages 1116–1125, 2009. 3722] Leah Epstein and Hanan Zebedat-Haider. Preemptive online scheduling with rejection of unitjobs on two uniformly related machines.
J. Scheduling , 17(1):87–93, 2014.[23] Naveen Garg and Amit Kumar. Better algorithms for minimizing average flow-time on relatedmachines. In
ICALP (1) , pages 181–190, 2006.[24] Naveen Garg and Amit Kumar. Minimizing average flow-time : Upper and lower bounds. In
FOCS , pages 603–613, 2007.[25] Daniel Golovin, Anupam Gupta, Amit Kumar, and Kanat Tangwongsan. All-norms and all- ℓ p -norms approximation algorithms. In FSTTCS , pages 199–210, 2008.[26] R. L. Graham. Bounds for certain multiprocessing anomalies.
Bell System Technical Journal ,45:1563–1581, 1966.[27] Anupam Gupta, Ravishankar Krishnaswamy, Amit Kumar, and Danny Segev. Scheduling withoutliers. In
APPROX-RANDOM , pages 149–162, 2009.[28] Sungjin Im and Benjamin Moseley. Online scalable algorithm for minimizing ;k-norms ofweighted flow time on unrelated machines. In
SODA , pages 95–108, 2011.[29] Bala Kalyanasundaram and Kirk Pruhs. Speed is as powerful as clairvoyance. In
FOCS , pages214–221, 1995.[30] Stefano Leonardi and Danny Raz. Approximating total flow time on parallel machines.