New Results on On-demand Broadcasting with
Transcription
New Results on On-demand Broadcasting with
New Results on On-demand Broadcasting with Deadline via Job Scheduling with Cancellation Wun-Tat Chan∗ Tak-Wah Lam† Hing-Fung Ting‡ Prudence W.H. Wong§ Abstract This paper studies the on-demand broadcasting problem with deadlines. We give the first general upper bound and improve existing lower bounds on the competitive ratio of the problem. The novelty of our work is the introduction of a new job scheduling problem that allows cancellation. We prove that the broadcasting problem can be reduced to this scheduling problem. This reduction frees us from the complication of the broadcasting model and allows us to work on a conceptually simpler model for upper bound results. 1 Introduction This paper revisits the on-demand broadcasting problem with deadlines. Improved lower bound and upper bounds are presented. In particular, the upper bounds are based on a reduction of the broadcasting problem to a job scheduling problem that allows cancellation. This reduction allows us to work on a conceptually simpler model for improved upper bounds. On-demand Broadcasting: The input is a sequence of page requests for a broadcasting server. These requests arrive at arbitrary times. The pages requested have possibly different length. At any time, the server can broadcast only one page and preemption is allowed. A unique feature of this problem is that all pending requests for a page can be satisfied with one single broadcast. Previous work on the broadcasting problem mainly focused on minimizing the total or maximum flow time [1, 11, 3, 10, 4, 5]. Broadcasting with deadline has not been studied until recently [8, 7]. Here each request has a deadline, and no profit is gained if a page is delivered beyond the deadline. The objective is to maximize the total (weighted) page length of the requests served by their deadlines. Kim and Chwa [8] studied the kind of preemptive broadcasting in which a preempted page will ∗ Department of Computer Science, University of Hong Kong, Hong Kong, [email protected]. This research was supported in part by Hong Kong RGC Grant HKU-5172/03E. † Department of Computer Science, University of Hong Kong, Hong Kong, [email protected] ‡ Department of Computer Science, University of Hong Kong, Hong Kong, [email protected] § Department of Computer Science, University of Liverpool,UK, [email protected]. 1 be re-broadcasted from the beginning (intuitively, this model does not assume that all preempted clients to have buffered a partial page properly). This version of broadcasting problem will be referred to√as Broadcasting in the rest of this paper. Kim and Chwa gave a lower bound of min{ ∆, r} on the competitive ratio of any on-line algorithm for Broadcasting, where ∆ is the ratio between the length of the longest and shortest page, and r is the maximum number of requests for a page arriving at a time. For the special case when ∆ = 1, i.e., all pages have the same length, they showed that a heuristic based √ on highest profit is (3 + 2 2)-competitive. Finding an upper bound for the general case was left as an open problem. Consider that each request asks for a different page, the broadcasting problem is equivalent to a deadline job scheduling problem. Woeginger [?] showed that in the deadline job scheduling problem where all jobs are of equal length, no algorithm is better than 4-competitive. In terms for Broadcasting, if ∆ = 1, no algorithm is better than 4-competitive. More recently, Kalyanasundaram and Velauthapillai [7] considered a stronger preemption model in which the server can resume broadcasting of a preempted page at the point of preemption and they also showed some interesting lower bound and upper bound results. Summary of results: In this paper we study broadcasting with deadline and focus on the preemption model used by Kim and Chwa (i.e., a preempted page will be rebroadcasted from the beginning). Our first result is an improved lower bound on the competitive ratio. We show that even if r = 1, no online algorithm for Broadcasting √ is ∆/ ln ∆, thus improving the previous lower bound of min{ ∆, r} to simply ∆/ ln ∆. This paper also contributes new results on the upper bounds. In particular, a (4∆ + 3)competitive algorithm is given. Note that this is the first performance guarantee for the general case. Further, when ∆ = 1, a more stringent analysis shows that the algorithm √ is 5-competitive, improving the previous upper bound of 3 + 2 2. The following table summarizes all the above results. General ∆ ∆=1 Upper Bound 4∆ + 3 •5 √ • 3 + 2 2 [8] Lower Bound • ∆/ ln√ ∆ • min{ ∆, r} [8] 4 [?] The improvement on the upper bounds of Broadcasting is based on a reduction to a new job scheduling problem that allows cancellation. This job scheduling problem is conceptually simpler, allowing us to obtain a better analysis of the highest-profit heuristic. This reduction result should be contrasted with the observation by Kalyanasundaram and Velathapillai that existing upper bound results on the traditional scheduling problem do not hold for the broadcasting problem [7]. Scheduling jobs with possible cancellation: Online deadline scheduling is a classical real-time problem [2, 9, 6]. In the traditional model, users can release jobs at arbitrary times for scheduling on a single processor. These jobs have different processing times, profits and deadlines, and the processor can process one of these jobs at a time. The objective is to maximize the total profit of the jobs completed by their deadlines. To obtain a relation with Broadcasting, we consider a variant of job scheduling in which 2 every job has an indefinite deadline but a user can cancel the job while the job is waiting for processing. Denote this variant as JS-Cancellation. In fact, JS-Cancellation is natural in real-life applications. For example, schedulers for printing jobs usually allow a user to cancel a printing job. Note that following the setting of Broadcasting, preemption is allowed and a preempted job will be restarted (instead of resummed at the point of preemption). We say that an online problem P is reducible to another online problem Q, denoted as P ≺ Q, if the following is true: Given any online algorithm for Q, we can construct an online algorithm for P with the same competitive ratio. It is easy to prove that if P ≺ Q, then any upper bounds (on the competitive ratio) for Q implies the same upper bounds for P . The main result in this paper is that Broadcasting ≺ JS-Cancellation. Motivated by the above reduction, we work on upper bound results for JS-Cancellation. We show a refined analysis of the highest-profit heuristic; this leads to a (4∆0 + 3)competitive algorithm for JS-Cancellation, where ∆0 is the ratio between the processing time of the longest and shortest job. Together with the relationship Broadcasting ≺ JS-Cancellation, we give the first upper bound for broadcasting in the general setting. Furthermore, when ∆0 = 1, the competitive ratio can be improved to 5. Organization of the paper: The rest of the paper is organized as follows. In Section 2, we give some definitions and notations. In Section 3, we present lower bound results for Broadcasting. In Section 4, we present upper bound results for JS-Cancellation. In Section 5, we present the reduction of Broadcasting to JS-Cancellation. 2 Definitions and Notations In this section, we give the definitions and notations needed for our discussion. The input for Broadcasting is a sequence σ of page requests. Every page P has a length `(P ). Every page request R has an arrival time a(R), a deadline d(R), a weight w(R), and a name of a page p(R) that it asks for broadcasting. We say that R is alive at time t if (1) a(R) ≤ t ≤ d(R) and (2) it has not received the complete p(R) yet. We say that it is healthy at time t if it is alive at t and t + `(p(R)) ≤ d(R). Note that if R is healthy at t, then we can broadcast p(R) at time t and R can still receive the complete p(R) before its deadline. Given any schedule S for σ, its profit ρ(S) Pis the total weighted page length of the requests served by their deadlines, i.e., ρ(S) = R∈R w(R)`(p(R)) where R is the set of requests served by their deadlines. The input for JS-Cancellation is a sequence σ of jobs interleaved with cancel requests. Every job J has an arrival time a(J), a processing time `(J) and a profit ρ(J). A cancel request C has an arrival time a(C) and the name of a job j(C) that it asks for cancellation. Given any schedule S for σ, its profit ρ(S) is the total profit of jobs completed. 3 Lower bound results for Broadcasting In this section, we give a lower bound on the competitive ratio of any online algorithm for Broadcasting. Recall that ∆ is the ratio between the length of the longest and shortest 3 page, and r is the maximum number of requests for a page arriving at a time. Our results show that even if r = 1, the competitive ratio of any online algorithm cannot be smaller than Ω(∆/ ln ∆). Note that r = 1 means that no two requests for the same page arrive at the same time. Theorem 1. The competitive ratio of any online algorithm for Broadcasting cannot be smaller than Ω(∆/ ln ∆). This holds even if r = 1. Proof. Assume that there are two pages, P and Q whose length are ∆ and 1, respectively. Given any online algorithm A, we construct a sequence of requests as follows. At time 0, a request for P arrives with deadline at time ∆, i.e., it has a tight deadline. The weight of the request is 1. There are at most d∆e request for Q, denoted by Ri for 0 ≤ i ≤ d∆e − 1. Ri arrives consecutively, i.e., a(Ri ) = i, and they all have tight deadline, i.e., d(Ri ) = i+1. The weight of Ri , i.e., w(Ri ), is ∆r (i + 1)k where r and k are some constants which will be defined later. If A broadcasts Q at any time t, no more request of Ri arrives for i > t. Now we analyze the performance of A against the optimal offline algorithm O. There are two cases. (1) If A satisfies the request for P by broadcasting P at time 0, the O will satisfy all requests Ri by broadcasting Q at time i for 0 ≤ i ≤ d∆e − 1. Hence, P Px y r k y+1 we have ρ(A) = ∆ and ρ(O) = d∆e−1 ∆ (i + 1) . Since /(y + 1)), i=0 i=1 i = Θ(x r−1 k+1 r+k ρ(O)/ρ(A) = Θ(∆ d∆e /(k + 1)) ≥ Θ(∆ /(k + 1)). (2)If A broadcasts Q at time time t, only Rt can be satisfied. However, O can either satisfy the request for P by broadcasting P at time 0 or satisfy all Ri by Q Ptbroadcasting r k r k at time i for 0 ≤ i ≤ t. We have ρ(A) = ∆ (t+1) and ρ(O) = max{∆, i=0 ∆ (i + 1) }. Hence, ρ(O)/ρ(A) = max{∆, ∆r (t + 1)k+1 /(k + 1)}/∆r (t + 1)k = max{∆1−r /(t + 1)k , (t + 1)/(k + 1)}. In order to minimize the ratio, A should choose t = (∆1−r (k + 1))1/(k+1) − 1. In that case, the ratio is Θ(∆(1−r)/(k+1) /(k + 1)k/(k+1) ) ≥ Θ(∆(1−r)/(k+1) /(k + 1)). In order to maximize the minimum ratio among the two cases, we let r = (1 − k − k 2 )/(k + 2). Hence, the competitive is Θ(∆1−1/(k+2) /(k + 1)) ≥ Θ(∆1−1/(k+2) /(k + 2)). We further let k + 2 = ln ∆ where the function ∆1−1/(k+2) /(k + 2) achieves the maximum, i.e., ∆1−1/ ln ∆ / ln ∆. Since ∆1/ ln ∆ is the constant e, i.e., the base of natural logarithm, we have proved that the competitive ratio is Ω(∆/ ln ∆). 4 Upper bound results for JS-Cancellation In this section, we present an algorithm, called GREEDY, for JS-Cancellation and analyze its competitive ratio. Recall that ∆0 is the ratio between the processing time of the longest and shortest job. We consider the general case in which ∆0 is arbitrary and the special case in which ∆0 = 1. We first define the online algorithm GREEDY as follows. When the first job arrives or when a job completes, GREEDY schedules a job with the highest profit (ties are broken arbitrarily). When a job is being processed and a new job arrives, GREEDY will preempt the current job and start the new job if the new job carries at least twice the profit of the current job. 4 We now analyze the performance of GREEDY. Let SG and SO be the set of jobs completed by GREEDY and the optimal offline algorithm OPT, respectively. For any set of jobs S, let ρ(S) be the sum of the profit of all the jobs in S. We prove the competitive ratio by constructing a mapping f to map each job in SO to some job in SG such that for every job J ∈ SG , the total profit of all jobs in SO that map to J is at most (4∆0 + 3) times the profit of J. More precisely, let F (J) denote the set of jobs J 0 such that f (J 0 ) = J. We · (4∆0 + 3). As Pwill show that forPany job J ∈ SG ,0 ρ(F (J)) ≤ ρ(J) a result, ρ(SO ) = J∈SG ρ(F (J)) ≤ J∈SG ρ(J) · (4∆ + 3) = (4∆0 + 3) · ρ(SG ). The following theorem states the competitive ratio of GREEDY for JS-Cancellation. Theorem 2. GREEDY is (4∆0 + 3)-competitive for JS-Cancellation. Proof. We first define the mapping as follows. For each job J ∈ SG , define a sequence of jobs QJ = (J1 , J2 , . . . , Jk ) with Jk = J such that for 1 ≤ i ≤ k − 1, Ji is preempted by Ji+1 during the execution of GREEDY. (Note that J1 , J2 , . . . , Jk−1 may not be in SG .) For all 1 ≤ i ≤ P k, we let β(Ji ) = J. Notice that for 1 ≤ i ≤ k − 1, 2ρ(Ji ) ≤ ρ(Ji+1 ), hence, ρ(QJ ) ≤ 1≤i≤k ρ(J)/2k−i ≤ 2ρ(J). The mapping f is constructed as follows. For any job J ∈ SO ∩ SG , we set f (J) = J. For any job J ∈ SO − SG , suppose when J starts being processed by OPT, GREEDY is processing a job J 0 , then we set f (J) = β(J 0 ). Note that J 0 must exist, otherwise GREEDY will schedule to process J. Consider any job J ∈ SG . We claim that for every job Ji ∈ QJ , during the time interval Ii that GREEDY is processing Ji , the profit obtained by OPT is at most 2∆0 ρ(Ji ). Note that in the time interval Ii , OPT may be processing some jobs whose start time or finish time is outside Ii but we only count the profit obtained in Ii . Let τ be the processing time of Ji . Suppose that in the time interval Ii , OPT has processed jobs s1 , . . . , sm , with processing time τ1 , . . . , τm and profit ρ1 , . . . , ρm , respectively. We have (τ1 + . . . + τm ) = τ . By the definition of ∆0 , we have min(τ1 , . . . , τm ) ≥ τ /∆0 . Combining these two constraints, we have ∆0 ≥ m. In the execution of GREEDY in the interval Ii , none of the jobs s1 , . . . , sm preempts the job Ji . Therefore, by the definition of GREEDY, ρx ≤ 2ρ(Ji ) for all 1 ≤ x ≤ m. In other words, max(ρ1 , . . . , ρm ) ≤ 2ρ(Ji ). Hence, ρ1 + . . . + ρm ≤ 2mρ(Ji ) ≤S 2∆0 ρ(Ji ). Recall that The sum of the Pρ(QJ ) ≤ 2ρ(J). 0 profit of F (J) within the interval 1≤i≤k Ii is at most 1≤i≤m 2∆ ρ(Ji ) ≤ 4∆0 ρ(J). Notice that OPT may be still processing an un-completed job when GREEDY completes J, and this job has a profit at most J and OPT may S 2ρ(J). Furthermore, F (J) may contain 0 process J outside the interval 1≤i≤k Ii . As a result, ρ(F (J)) ≤ 4∆ ρ(J) + 2ρ(J) + ρ(J) = ρ(J) · (4∆0 + 3). Hence, the theorem follows. Now, we consider the special case ∆0 = 1. We can see that GREEDY is 7-competitive by substituting ∆0 = 1 to Theorem 2. Yet, by a more stringent analysis of GREEDY for ∆0 = 1, GREEDY is shown to be 5-competitive. Notice that ∆0 = 1 means that all jobs require the same processing time. Theorem 3. GREEDY is 5-competitive for JS-Cancellation when ∆0 = 1. Proof. The proof uses a similar framework as that of Theorem 2. For any job in SO , we define the same mapping f as before. Consider any job J ∈ SG . Define the sequence QJ = 5 (J1 , J2 , . . . , Jk ) as before. Because the processing time is the same for every job, there are at most k jobs other than J, say J10 , J20 , . . . , Jk0 , in SO mapping to J such that when Jp0 starts processed by OPT, GREEDY is processing Jp , for 1 ≤ p ≤ k. Since Jp0 does not preempt Jp , we have ρ(Jp0 ) ≤P 2ρ(Jp ). Furthermore, FP (J) may contain the job J itself. 0 Therefore, ρ(F (J)) ≤ ρ(J) + 1≤p≤k ρ(Jp ) ≤ ρ(J) + 1≤p≤k 2ρ(Jp ) = ρ(J) + 2ρ(QJ ) ≤ 5ρ(J). Therefore, the theorem follows. 5 The reduction In this section, we describe a reduction from Broadcasting to JS-Cancellation. Precisely, suppose that we have an online algorithm A for JS-Cancellation with competitive ratio c. We show how to construct from A an online algorithm B for Broadcasting with competitive ratio at most c. Roughly speaking, B works as follows. From the input sequence σB of page requests for Broadcasting, B creates a sequence σJ of jobs and cancel requests for JS-Cancellation. Whenever B creates any job or cancel request, it passes it to A immediately for scheduling. B monitors the behavior of A. If A takes any action such as starting a job, B takes some corresponding action such as broadcasting a page. When creating the jobs or cancel requests, B makes sure that at any time t and for every page P , if there are healthy requests R with p(R) = P P, then there will be a single job J for JS-Cancellation such that `(J) = `(P ) and ρ(J) = R∈H w(R) · `(P ), where H is the set of healthy requests. Thus, if both A starts job J and B broadcasts P at some time t and there is no preemption, then both A and B receive the same profit and the two tasks finish at the same time, namely t + `(P ). To get an idea on how the competitive ratio is preserved, let SJ and SB be the schedules decided by A and B, and let OJ and OB be the optimal offline schedules for σJ and σB , respectively. We will prove below that 1. ρ(SJ ) = ρ(SB ) (i.e., the profit of the two schedules are equal) and 2. ρ(OB ) ≤ ρ(OJ ). B) J) Recall that A has competitive ratio c. Then, we have ρ(O ≤ ρ(O ≤ c, and hence the ρ(SB ) ρ(SJ ) competitive ratio of B is no more than c. Before giving the details, we need some definitions. For any page P , let H(P, t) be the set of page requests R that are healthy at time t and p(R) = P . When B creates a job J at t, its profit and length will be set according to some healthy page P at t. To remember this relationship, we define g(J) = P . Now, we summarize the actions of B. At any time t, for any page P , the following events may occur. • A page request R with p(R) = P arrives. • A healthy page request R with p(R) = P becomes not healthy. • A broadcast of the page P has been preempted. 6 • The page P has been broadcasted completely. In all these cases, B first creates cancel requests to delete all waiting jobs (i.e., not being processed) associated with P . More precisely, for each waiting job J with g(J) = P , B creates a cancel request C with j(C) = J. Then, if H(P, Pt) is not empty, B creates a job Jo with g(Jo ) = P , `(Jo ) = `(P ) and its profit ρ(Jo ) = R∈H(P,t) w(R) · `(P ). Note that all the jobs and cancel requests created will have arrival time t. Recall that B will also monitor A to see how A schedules the jobs. When A starts or restarts a job J, then B broadcasts the page g(J). When A preempts a job J, then B preempts the current broadcasting, which must be for page g(J). Below, we analyze the profits of the schedules. Lemma 4. ρ(SB ) = ρ(SJ ). Proof. By how B creates jobs and cancel requests, it is clear that at any time t, every waiting job J has the property that X ρ(J) = w(R) · `(P ). R∈H(g(J),t) The profit of scheduling J at time t is equal to the profit of broadcasting page g(J) at time t. For every job J, A schedules J at time t if and only if B broadcasts g(J) at time t. Thus, we have ρ(SJ ) = ρ(SB ). Lemma 5. ρ(OB ) ≤ ρ(OJ ). Proof. We prove the lemma by constructing a job schedule S for σJ such that ρ(OB ) ≤ ρ(S) and ρ(S) ≤ ρ(OJ ). Then we can conclude that ρ(OB ) ≤ ρ(OJ ). Notice that OJ is the optimal schedule for σJ , thus, we have ρ(OJ ) ≥ ρ(S). The schedule S is constructed to satisfy a property, which leads to the proof of ρ(OB ) ≤ ρ(S). Consider the set of requestsPRB and RO served by SB and OB , respectively. P S will have the property that ρ(S) = R∈(RO ∪RB ) w(R)`(p(R)). Then, we have ρ(S) ≥ R∈RO w(R)`(p(R)) = ρ(OB ). Now, we show how S schedules jobs in σJ and prove that it satisfies the property mentioned above. Note that the requests that are served by SB correspond to a set of jobs in σJ that are scheduled by SJ . In other words, there are no cancel requests in σJ that Pcancel these jobs; S must be able to schedule these jobs and obtain at least a profit of R∈RB w(R)`(p(R)). We then consider the requests that have been served by OB but not by SB . Suppose that k pages, P1 , P2 , · · · , Pk are broadcasted by OB such that Pi is broadcasted at time ti for 1 ≤ i ≤ k. Notice that all requests in RO − RB that are served by OB at time ti are healthy, thus, there is a job Ji ∈ σJ at time ti such that g(Ji ) = Pi . We make S to schedule Ji at time ti , thus, obtaining a profit of the corresponding requests. P Therefore, S can obtain a total profit of R∈(RO −RB ) w(R)`(p(R)). Combining with the P profit obtained from jobs that are scheduled by SJ , the total profit of S equals to R∈(RO ∪RB ) w(R)`(p(R)). Hence, the lemma follows. By the above two lemmas, we have the following theorem. Theorem 6. Given a c-competitive online algorithm for JS-Cancellation, we can design an online algorithm that is c-competitive for Broadcasting. 7 References [1] Y. Bartal and S. Muthukrishnan. Minimizing maximum response time in scheduling broadcasts. In Proceedings of the Annual ACM/SIAM Symposium on Discrete Algorithms, pages 558–559, 2000. [2] S. Baruah, G. Koren, D. Mao, B. Mishra, A. Raghunathan, L. Rosier, D. Shasha, and F. Wang. On the competitiveness of on-line real-time task scheduling. Real-Time Systems, 4:125–144, 1992. [3] J. Edmonds and K. Pruhs. Multicast pull scheduling: when fairness is fine. Algorithmica, 36:315–330, 2003. A preliminary version appears in SODA 2002. [4] J. Edmonds and K. Pruhs. A maiden analysis of longest wait first. In Proceedings of the 15th Annual Symposium on Discrete Algorithms, pages 811–820, 2004. [5] B. Kalyanasundaram, K. Pruhs, and M. Velauthapillai. Scheduling broadcasts in wireless networks. Journal of Scheduling, 4(6):339–354, 2001. A preliminary version appears in ESA 2000. [6] B. Kalyanasundaram and Kirk Pruhs. Speed is as powerful as clairvoyance. Journal of the ACM, 47(4):214–221, 2000. [7] B. Kalyanasundaram and M. Velauthapillai. On-demand broadcasting under deadline. In Proceedings of the 11th Annual Annual European Symposium on Algorithms, pages 313–324, 2003. [8] J.H. Kim and K.Y. Chwa. Scheduling broadcasts with deadlines. In Proceedings of the 9th Annual International Conference on Computing and Combinatorics, pages 415–424, 2003. [9] G. Koren and D. Shasha. Dover : An optimal on-line scheduling algorithm for overloaded uniprocessor real-time systems. SIAM Journal on Computing, 24(2):318–339, 1995. [10] K. Pruhs and P. Uthaisombut. A comparison of multicast pull models. In Proceedings of the 10th Annual European Symposium on Algorithms, pages 808–819, 2002. [11] S. Muthukrishnan Swarup Acharya. Scheduling on-demand broadcasts: New metrics and algorithms. In The Fourth Annual ACM/IEEE International Conference on Mobile Computing and Networking, pages 43–54, 1998. 8