Competitive Online Scheduling with Fixed Number of Queues Richard Bryann L. Chua

Jaime D.L. Caro

Department of Physical Sciences and Mathematics University of the Philippines Manila Padre Faura St., Ermita, Manila (632)5265858

Department of Computer Science University of the Philippines Diliman Diliman, Quezon City (632)9202080

[email protected]

[email protected]

ABSTRACT One of the complex parts of an operating system design is CPU scheduling, where the OS schedules a sequence of arriving jobs to use the CPU, without knowledge of the time and number of arriving jobs and their execution times. One of the measures of performance of a scheduling algorithm is the average flow time. For a long time, most major operating systems, like Windows and UNIX used a scheduling algorithm based on the Multilevel Feedback scheduling algorithm. In this research, we present the Randomized Multilevel Feedback 2 (RMLF2) scheduling algorithm, which is a version of the RMLF algorithm proposed by Kalyanasundaram and Pruhs, and show that it has a competitive ratio of O (ln n ) in terms of minimizing flow time against an online adaptive adversary. Since this obtains the Ω(log n ) lower bound for any randomized scheduling algorithm, it has a tight competitive ratio of Θ(ln n ) . Keywords: randomized multilevel feedback, scheduling, competitive analysis, online algorithm, randomized algorithm

1. INTRODUCTION CPU scheduling is essential in any multiprogramming systems. In such system, processes arrive over time and the processor should decide which process to run, in ways that meet system objectives, such as response time and throughput [1]. In [13], Motwani, et. al. complained that many early researches in scheduling have been concerned with clairvoyant scheduling, where the characteristics of a job, like its release time and execution time, are known beforehand. Many scheduling algorithms were created from these researches, including the shortest remaining processing time (SRPT), which is considered the most optimal scheduling algorithm that minimizes the total flow time (see [5, 9]). The clairvoyant approach is not applicable in reality because the nature of the scheduling problems encountered is nonclairvoyant, meaning it is impossible to have a priori knowledge of the running time of processes and the time that they will arrive. Since the operating systems does not know the running time of the processes, it is not possible to obtain an optimal average flow time. Hence, in nonclairvoyant scheduling analysis, one uses the method of competitive analysis. In competitive analysis, the performance of a nonclairvoyant scheduler is compared to that of an optimal

clairvoyant scheduler for each set of input processes. The nonclairvoyant scheduler is compared to that of an optimal clairvoyant scheduler for each set of input processes. The nonclairvoyant algorithm is measured in terms of its competitive ratio, cn, which is defined as

cn = max J

CA (J ) COPT ( J )

where CA(J) denotes the cost of the schedule produced by the nonclairvoyant algorithm A on input J, COPT(J) denotes the cost of the optimal schedule produced by the optimal clairvoyant algorithm OPT, and the maximum is over all inputs J with n processes. In [8], Kalyanasundaram and Pruhs interpreted the competitive ratio as the payoff to a game played between an online nonclairvoyant algorithm and an all-powerful malevolent adversary OPT that specifies the input J, and schedules J optimally. In [9], Kalyanasundaram and Pruhs proposed the Randomized Multilevel Feedback (RMLF) scheduling algorithm, which is a variant of the Multilevel Feedback (MLF) scheduling algorithm used in Windows and UNIX, and showed that it has a competitive ratio of O(log n log log n), where n is the number of jobs. Their result have been obtained with an RMLF algorithm where the highest queue is determined by the length of the longest job. However, in most operating systems, the number of queues is fixed. In this research, we propose a version of RMLF, where the number of queues is fixed, and determine its competitive ratio.

2. RELATED RESULTS In [16], Pruhs et. al. classified scheduling algorithms into online and offline algorithm. In an online algorithm, the algorithm does not have access to the entire input sequence, as it makes its decision. On the other hand, an offline algorithm has access to the entire input sequence. Another classification used by Pruhs et. al. in [16] is whether an algorithm is clairvoyant or nonclairvoyant. A nonclairvoyant algorithm has no knowledge of the characteristics of the running jobs while a clairvoyant algorithm can gain knowledge of the characteristics of the running job. The most widely accepted measure of the performance of a scheduling algorithm is the flow time – the time spent by the job in the system between its release and completion, that is Fi = Ci − ri

where Fi is the flow time of job Ji, Ci is the completion time, and ri is its release time. Flow time is also called wait time or latency [16].

3. 4. 5.

Research on nonclairvoyant scheduling was started by Motwani et. al. in [13]. They have obtained an Ω(2 − 2 / (n + 1)) competitive ratio for any static deterministic nonclairvoyant scheduling algorithm and an Ω n1 / 3 competitive ratio for any dynamic deterministic algorithm. In static scheduling, all jobs are released at time 0, while in dynamic scheduling, jobs have arbitrary and nonnegative release times.

( )

Randomization can be done to a scheduling algorithm to improve its performance. Motwani et. al. have shown in [13] that a static randomized scheduling algorithm has a competitive ratio of Ω(2 − 4 / (n + 3)) , which is the same as the deterministic one, but a dynamic randomized scheduling algorithm has a competitive ratio that improves to Ω(log n ) . Kalyanasundaram and Pruhs proposed the Randomized Multilevel Feedback (RMLF) scheduling algorithm in [9]. RMLF is similar to the multilevel feedback scheduling used in UNIX systems described by Bach in [1]. The idea behind RMLF is to try to approximately behave like SRPT [2]. They have showed that RMLF has a competitive ratio of O (log n log log n ) against an adaptive adversary. In an adaptive adversary, the adversary knows all the actions taken by RMLF for servicing the input instance revealed to RMLF up to time t, and may makes its decision based on this knowledge [4]. Becchetti and Leonardi in [2] performed a competitive analysis against an oblivious adversary and found it to have a competitive ratio of O(log n). In an oblivious adversary, the input sequence is constructed in advance and the adversary pays the optimal cost [4]. Becchetti et al. later in [3] used smoothed competitive analysis with partial bit randomization smoothening model to analyze the multilevel feedback scheduling algorithm and found it to have a smoothed competitive ratio

((

) ( 3

)

2

O 2k / σ + 2k / σ 2 K − k

),

where 2K is the maximum processing time, k is a constant in the smoothed processing time, and σ is the standard deviation of the distribution.

3. SCHEDULING DEFINITION

PROBLEM

We are given a set J of n jobs and these are to be run on a single processor machine. Each job Jj, 1 ≤ j ≤ n, is characterized by a release time rj and an execution or processing time xj, xj > 0. We order the jobs in J by increasing release times, that is, given two jobs Ji and Jj, if i < j, then ri < rj. RMLF2 is an online nonclairvoyant scheduling algorithm which means it does not know the arrival time of a job until the job is released. The RMLF2 also does not know the execution time of a job until the completion of a job. To be more convenient, we will assume that the length of the shortest job is 2 and this is known by the algorithm a priori. Definition 1 Define the following quantities 1. Let J = {J1, J2, …, Jn} be the set of jobs. 2. Let rj be the release time of a job Jj.

6. 7.

Let xj be the processing time of job Jj. Let wj(t) be the amount of time that Jj has been run before time t. Let yj(t) = xj – wj(t) be the remaining time that Jj needs to be processed at time t. Let τ be a constant and is set to 12. Let βj, 3 ≤ j ≤ n, be an exponentially distributed random variable with probability distribution function Pr β j ≤ x = 1 − exp(− τx ln j ) = 1 − j −τx .

[

8. 9.

]

Let l be the index of the highest queue. For all i, 0 ≤ i ≤ l and for all j, 1 ≤ j ≤ n, define a target Ti , j = 2i max 1,2 − β j . Ti,j is the maximum amount of

(

)

time job Jj is run in the machine as it reaches Qi. Randomization is performed on the target in order to improve its performance. 10. For all i, 0 ≤ i ≤ l and for all j, 1 ≤ j ≤ n, define the quantum as  2 i −1 max 1,2 − β j if i ≥ 1 Qi, j =  if i = 0 max 1,2 − β j Quantum is the maximum amount of time job Jj spent running in Qi. 11. Let Cj be the completion time of job Jj. 12. Let Fj = Cj – rj be the flow time of a job Jj. The total flow time of the set J is F ( J ) = F j . The goal of any

(

(

)

)



J j ∈J

scheduling algorithm is to minimize the total flow time. We compare RMLF2 against an online adaptive adversary. We measure the cost of RMLF2 and the adversary by the total flow time. The adversary is charged with the optimal flow time. We can say that any randomized algorithm A has a competitive ratio of c against an adaptive adversary if for any input J, E[FA ( J )] c = max J FOPT ( J ) where the expectation if taken over any possible J.

4. RANDOMIZED MULTILEVEL FEEDBACK ALGORITHM WITH FIXED NUMBER OF QUEUES (RMLF2) RMLF2 has priority queues Q0, Q1, …, Ql. We say that Qi is lower than Qj if i < j. Algorithm 2 At any time t, RMLF2 behaves as follows: 1. When a job Jh is released at time rh, it is placed on Q0 and the target T0,h is set to max(1, 2 – βh). If, just prior to rh, Q0 was empty and Jj is currently running, Jj is preempted and Jh is run. 2. Let Qi-1 be the lowest nonempty queue. RMLF2 always run the job at the front of Qi-1. Let J j ∈ Qi −1 be the job that is being run. If Jj has been run for a time Q i −1, j , a.

If i – 1 ≠ l i. Job Jj is removed from Qi-1 and placed on Qi. ii. The target Ti,j is set to 2Ti-1,j = 2i max(1, 2 – βj). iii. The job at the front of Qi-1 is run. If Qi-1 is empty, the job at the front of the new lowest nonempty queue is run. If none is found, the algorithm terminates. b. If i – 1 = l

i. ii.

Job Jj is removed from Ql and placed on Ql. The job at the front of Ql is run. This process continues until Ql becomes empty. When a job Jj that is being run is completed, it is removed from the queue and the first job of the lowest nonempty queue is run. If there are no more jobs, the algorithm terminates.

3.

5. RMLF2 ALGORITHM ANALYSIS Definition 3 Define the following quantities 1. Let RMLF2 be the RMLF2 scheduler. 2. Let URMLF2(t) be the set of jobs that are released by time t, but not completed by the RMLF2 by time t. 3. Let ADV be the adversarial scheduler. 4. Job Jj is short for Qi if 2i-1 ≤ xj ≤ 2i-1 + 2i-2. Job Jj is long for Qi if xj > 2i-1 + 2i-2. 5. Job Jj is unlucky if it is short for some Qi, and is promoted Mathematically, this to Qi at some time. is 2 i −1 ≤ x j ≤ 2 i −1 + 2 i −2 , in terms of processing time. In terms of quantum, this is 0 < yj ≤ 2i-2. Let BL be the set of jobs J j ∈ U RMLF 2 (t ) such that Jj is not

6.

in the front of a queue at time t, and such that if J j ∈ Qh (t ) then Jj is long for Qh. 7.

A queue Qi is small at some time t if there is a contiguous subqueue C of BL ∩ Qi(t) with

∑ y j (t ) =

J j ∈C

C 2 i −3

τ ln n

, 3≤i≤ n

5.1.1 UNLUCKY JOBS We prove in this section that the probability of the presence of unlucky jobs even for the usual MLF algorithm is low. Lemma 4 The probability that the number of unlucky jobs is greater than (c + 1) ln n / ln ln n is at most 1 / nc, c ≥ 2. Proof. Let Jj be a job that is short for Qi. Note that

Ti −1, j = 2i −1 max(1,2 − β j ) ≥ 2i −1 + 2i −1 (1 − β j )

The first term is the total time that job Jj has been run while in Qi by the usual MLF, and the second term, 2i-1(1 – βj), is its remaining processing time. In the case that a job is moved to Qi from Qi-1, y j = 2 i −1 (1 − β j ) . When a job Jj is removed from Ql and placed again in Ql, y j = 2 l −1 (1 − β j ) since xj = a2l-1 + 2l-1(1 – βj). In any case, for a job to be unlucky, we must have yj ≤ 2i - 2. Therefore, 2i-1(1 – βj) ≤ 2i-2, which means βj ≥ ½. The probability that a job is unlucky is −τ / 2 −6 . Pr β j > 1 / 2 = 1 − Pr β j ≤ 1 / 2 = j = j

]

j =1

x

 µe  Pr[X − µ ≥ x ] ≤    x  To get a value of x such that (µe/x)x ≤ 1 / nc, we have x(ln x − ln µ − 1) ≥ c ln n Let x = d ln n / ln ln n, then

 d ln n   d ln n   ln  − ln µ − 1 ≥ c ln n ln ln n   ln ln n   d ln n +

d ln n (ln d − ln ln ln n − ln µ − 1) ≥ c ln n ln ln n

If we let d = c + 1, this inequality is true. ■

5.1.2 SMALL QUEUES RMLF2 prevents the presence of small queues with high probability. We prove in this section that the presence of small queues happens with low probability. Let C be a contiguous subqueue of jobs. Assume that we have a particular subqueue C that makes Qi small. Number the jobs in C as J1, J2, …, Jk according to increasing order of release times. Let t be a time that C makes Qi small. We first prove that the event that



k j =1

β j is too small

happens with low probability.

5.1 HIGH PROBABILITY ARGUMENTS There are two events that let an adversary significantly defeat RMLF2, namely, the presence of unlucky jobs and small queues [9]. We prove that these two events happen with low probability, therefore, we can ignore them in our analysis.

[

[ ]

E v j = j −6 . Let X be a random variable that denotes the total number of success (unlucky jobs). The expectation of X is n E[x ] = µ = ∑ j −6 . The right tail bound from [6], is

[

]

Let v1, v2, …, vn be Bernoulli trials with the probability that vj is unlucky is j-6. From [14], the expectation of vj is

Lemma 5

 k k  1 Pr ∑ β j ≤ , k≥2 ≤ 2τ ln n  2 k  j =1 Proof. From our definition of βj, Pr[βj ≤ x] = 1 – j-τx ≤ 1 – n-τx. Let β’j be a random variable such that Pr[β’j ≤ x] = 1 – n-τx. For any x,

[

]

[

Pr β j ≤ x ≤ Pr β ′j ≤ x

]

 k  k Pr ∑ β j ≤ x  ≤ Pr ∑ β ′j ≤ x    j =1   j =1 To prove this lemma, it suffices to show that

 k  1 Pr ∑ β ′j ≤ x  ≤ k  j =1  2 Let X1, X2, …, Xk be independent exponential random variables with probability distribution 1 – exp(-n/b), respectively. The sum S = X1 + X2 + … + Xk has the Erlang form of the gamma distribution [7, 10],

 x  k −1 (x / b ) Pr[S ≤ x ] = 1 − exp − ∑  b  j =0 j!

where S = ∑k β ′j and b = 1 /(τ ln n). j =1 The Maclaurin series of

 x  ∞ ( x / b) exp  = ∑  b  h=0 h!

h

j

Thus,

Assume that yj(t) ≤ γ + (xj(t) – 2i). This is equivalent to 2 i −1 β j ≤ γ . Therefore,

 x  (x / b) Pr[S ≤ x ] = 1 − exp − ∑  b  j =0 h! k −1



≤∑

[

(x / b)

It is trivial that

[

(x / b )k 1 +  x  +  x  2 + K     b b

 

For every J j ∈ C , and for all γ < 2i

– 2

(

2 l −1 β j ≥ 2 l +1 − 2 l β j + a 2 l − x j

[

xj ≥ 2

+2

i−2

[

2l −1 β j ≥

]

2l −1 β j ≥

of Jj is 2 − β j . Since the

time

y j (t ) = x j (t ) − Ti −1, j ≥ x j − 2 i −1 (

)

job is promoted from Qi-1 to Qi, we have

[

We have assumed that γ < 2

[

]

Pr y j (t ) ≤ γ

[ = Pr [2 β

, therefore

≤ Pr x j (t ) − 2i −1 (2 − β j ) ≤ γ 2 i β j ≥ 2 i − x j i

[

j

≤ γ + 2i − x j 2i β j ≥ 2i − x j

= Pr 2i β j ≤ γ

]

]

]

The equation above is true because an exponential distribution is memoryless [12]. Case 2. 2 i ≤ x j ≤ Tl , j The remaining processing time of Jj is y j (t ) = x j (t ) − Ti−1, j

= xj − 2 + 2 − 2 i

i

i −1

max (1,2 − β j )

a

+ 2l

 + 2l  

]

[

]

[∑

k j =1

]

y j (t ) ≤ σ by relating this to

k Pr ∑ j =1 β j ≤ σ .

Let σ = C 2i − 2 / (2τ ln n ) then

   C /2  Pr  ∑ y j (t ) ≤ σ  ≤ Pr  ∑ 2 i −1 β j ≤ σ   j =1   J j ∈C 

2i β j ≥ 2i − x j i–2

a

2l +1 − 2 l β j − x j

We now bound the Pr

Lemma 7

≥ Ti −1, j

xj

− 2l β j − x j



Case 1. 2 i −1 + 2 i −2 ≤ x j ≤ 2 i processing

a l +1

 + 2l  

γ  = Pr 2 l −1 β j ≤  a  l −1 ≤ Pr 2 β j ≤ γ

Assume Jj is long for Qi, which means . We divide our proof into three cases. Since

remaining

2l +1 − 2 l β j − x j

 γ 2 = Pr 2 l −1 β j ≤ + a 

, i < l,

our variables are of common time, we will drop our reference on t.

The

]

≤ Pr x j (t ) − 2 l +1 + 2l β j − a 2l + 2 l −1 aβ j ≤ γ

Proof. Consider a job J j ∈ C . By Lemma 4, we can ignore i −1

) 1a

This means that Pr y j (t ) ≤ γ

Pr y j (t ) ≤ γ ≤ Pr 2 i −1 β j ≤ γ .

unlucky jobs.

≥ Tl , j + aQ l , j

xj

We now bound the probability that a particular yj(t) is small by the probability that a βj is small.

[

[

. Since Jj is moved from Ql to Ql,



]

)]

(

]

is The remaining processing time Jj y j (t ) = x j (t ) − Tl , j − aQ l , j ≥ x j − 2 l +1 + 2 l β j − a 2 l + 2 l −1 aβ j

Let x = 1 / (2τ ln n), we have  k 1  1  1 1  Pr ∑ β ′j ≤  ≤ k 1 + + + K  2 ln 2 4 τ n   j =1  2 k!  1 ≤ k 2

[

[

]

]

Case 3. x j > Tl , j

 

The second factor is a geometric series and it converges if xτ ln n < 1 , thus, x < 1 / (τ ln n ) .

Lemma 6

[

Pr y j (t ) ≤ γ ≤ Pr y j ≤ γ + x j (t ) − 2 i = Pr 2 i β j ≤ γ

h!

k!

)]

(

Pr y j (t ) ≤ γ + x j (t ) − 2 i = Pr 2 i β j ≤ γ

h

h= k



h

Proof. We can observe that for all C ′ ⊆ C ,

    Pr  ∑ y j (t ) ≤ σ  ≤ Pr  ∑ y j (t ) ≤ σ    J j ∈C′   J j ∈C Let D be the set of jobs in C such that yj(t) < 2i – 2. We can see that

    Pr  ∑ y j (t ) ≤ σ  ≤ Pr  ∑ y j (t ) ≤ σ   J j ∈C   J j ∈D  If |D| < |C|/2, then there are at least |C|/2 jobs in C with remaining processing time that are at least 2i – 2. Hence,

∑y

j

(t ) ≥

J j ∈C

C 2 i −2 2



C 2 i −2 2τ ln n



We assume that |D| ≥ |C|/2. By Lemma 6,

  σ  σ  Pr  y j (t ) ≤  ≤ Pr 2 i −1 β j ≤  D  D    Since yj ≥ 0 and 2i – 1βj ≥ 0, for every j,

  Dσ  Dσ  i −1 Pr  ∑ y j (t ) ≤   ≤ Pr  ∑ 2 β j ≤ D  D   J j∈D  J j∈D     Pr  ∑ y j (t ) ≤ σ  ≤ Pr  ∑ 2i −1 β j ≤ σ    J j∈D   J j∈D C /2   ≤ Pr  ∑ 2i −1 β j ≤ σ   j =1 

queue is l. Since l is comparatively smaller than n, we can ignore the jobs that are at the front of a queue in our analysis.

5.2.1 JOB PARTITIONING We now use the technique of Kalyanasundaram and Pruhs in [9]. We now partition the unfinished jobs, which will serve as the basis of what DMLF2 and the adversary will run. Definition 9 Let t be the time being considered 1. Order the jobs in BL from highest queue to lowest queue and from the front of a queue to the back of the queue. Let P = {P1, …, Pf}, where Pi is a set of 128τ ln n  jobs in

BL − U ij−=11 P j . The jobs in the lowest queues are not 2. 3.

included in a partition if they are not enough to form a partition. Let Qs(h) be the lowest queue that the jobs in Ph belong. Let Qd(h) be the highest queue that the jobs in Ph belong.

4.

Let

We now conclude that the probability that RMLF2 has a small queue is low.

5.

processing time of the jobs in Ph that are in Qi. Let ni,h= |Ph ∩ Qi| be the number of jobs in Ph that are in Qi.

Lemma 8 The probability that RMLF2 has a small queue is at most 1 / 2|C|/2, where C is a contiguous subqueue of BL ∩ Qi(t).

We now bound the sum of the remaining processing time of the jobs in each Ph.



Yi ,h = ∑ J ∈P h ∩Q y j be the total remaining j

Proof. From Lemma 7,    C /2  Pr  ∑ y j (t ) ≤ σ  ≤ Pr  ∑ 2 i −1 β j ≤ σ   j =1    J j∈C C /2  C 2 i −1  = Pr 2 i −1 ∑ β j ≤  2 ⋅ 2τ ln n  j =1 

  C = Pr  ∑ β j ≤  τ n 2 2 ln ⋅   j =1 1 ≤ C / 2 from Lemma 5 2 C /2



5.2

DETERMINISTIC ANALYSIS The cost of a scheduling algorithm is its total flow time, which can be obtained by counting the number of unfinished jobs over time [2, 9, 11]. Since this is a cost minimization problem, we can use Yao’s technique for cost minimization problem [15]. We have already proven in lemmas 4 and 8 that the events of having unlucky jobs and small queues happen with low probability, therefore, we can ignore them in our analysis. We now assume a deterministic algorithm DMLF2, which is an RMLF2 that never encounters a small queue or more than (c + 1) ln n / ln ln n unlucky jobs. DMLF2 always runs the job that is at the front of the lowest nonempty queue. If a new job arrives, it is placed in Q0. If DMLF2 is currently running a job in a queue that is higher than Q0, the running job is preempted to give priority to the new job that is at Q0. This might result to little remaining processing time for those jobs that are at the front of the queues. But since each queue can have at most one job at its front at any time and there are l queues, the maximum number of jobs at the front of a

For large n and for every P h ∈ P ,

Lemma 10



J j ∈P h

yj > 2

i

s (h)

.

Proof. We drop our reference to h. If any ni ≥ 8τ ln n, since a queue is never small, ∑ h y j > 8τ ln n 2 i − 2 / (2τ ln n ) = 2 i . J ∈P ∩Q j

i

Since 2i ≥ 2s, this proves our lemma for this case. Assume that all ni < 8τ ln n and



J j ∈P

y j ≤ 2 s . We will

do proof by contradiction. Since a queue is never bad, n 2 i−2 Yi ≥ i 2τ ln n Consider the optimization problem: d

min ∑ i=s

ni 2 i −2 2τ ln n d

subject to ∑ ni = 128τ ln n i=s

The functions f(n) = ni2i – 2 / (2τ ln n) and f(i) = 2i – 2 are both increasing functions. If ni < ni+1, we cannot find a solution to the minimization problem. To see this, substitute ni’s to the minimization problem, where ni < ni+1 and consider the sum of two consecutive terms, ni2i – 2 + ni+12i – 1. If we increase ni by a small value and decrease ni+1 by a small value, (ni + 0.01)2i – 2 + (ni+1 – 0.01)2i – 1, we get a much smaller value for the sum of the two consecutive terms. Therefore, to have an optimal solution, we must have ni ≥ ni +1. We should also have this condition in order to have an optimal solution: (1) ni 2 i−2 < (ns + ni )2 s Otherwise, we could get a smaller sum by giving the value meant for ni to ns. From inequality 1, we get

ni 2 i −2 < (ns + ni )2 s < 16τ ln n ⋅ 2 ni < d

∑n

i

i=s

UDMLF2 – UADV. If a vertex Jj is neither a source nor sink, then the sum of the weights of the edges going to Jj is the same as the sum of the weights of the edges going out of Jj.

s

64τ ln n ⋅ 2 s 2i d

< 64τ ln n∑ i =s ∞

< 64τ ln n∑ i=s

s

2 2i

s

2 2i

We use this graph to prove that DMLF2 restricts the adversary in its borrowing strategy.

Lemma 14 If there is a directed path from Jh to Jj in the borrow graph, then lqh(t) ≤ lqj(t). Proof. We now consider DMLF2’.

= 128τ ln n This is a contradiction to the defined size of Ph, which means is not minimized with size 128τ ln n, which then that h yj



J j ∈P

proves our lemma. ■

5.2.2 ADVERSARIAL BORROWING We now describe what an adversary can to defeat RMLF2 and then prove that RMLF2 prevents such strategy of the adversary from defeating it.

Definition 11 Let DMLF2’ be a scheduling algorithm that is similar to DMLF2, except that the job remains in the queue even if they are already completed. In DMLF2’, if a job Jj is completed, it is moved to the back of the next queue. If the queue is already Ql, Jj is placed at the back of Ql. If a completed job Jj is at the front of the lowest nonempty queue, Jj is moved to the back of the next queue. If the queue is already in Ql, Jj is placed at the back of Ql. We use DMLF2’ to define the last queue value and in constructing the borrowing graph.

Definition 12 Let t’ be some time after t. Consider DMLF2’. If a job J j ∈ Qi (t ′) , define the last queue value of Jj at time t’ as

i lq j (t ′) =  i − 1

Q0 , K Qi −1

are empty, r j ≤ t ′ otherwise

Definition 13 Define a graph with these properties: For each job, create a vertex in the graph. For every directed edge from Jh to Jj, assign a nonnegative cost fh,j, such that  s for s amount of time before time t  DMLF2 was running J h  f h, j =  and the adversary was running J j  otherwise  0 We can interpret the edge with positive cost of the graph in Definition 13, fh,j, as the adversary borrowing fh,j amount of time from Jh to give to Jj. This means that the adversary runs Jj, instead of Jh which is the one run by DMLF2, with the objective that running Jj first will result to an optimal schedule. Consider the subgraph of this graph with all the edges having weight fh,j = 0 removed. We will refer to this subgraph as a borrow graph. Let Fi,j be the sum of the weights of the directed edges along the directed path from Ji to Jj. We can interpret Fi,j as the amount of time borrowed by the adversary from Ji to give to Jj. The sources here are the jobs in UADV and the sinks are the jobs in

Base Case: Consider a time t’ that DMLF2’ was running Jh and the adversary was running Jj. Jj can never be in a lower queue that Jh since DMLF2’ always runs a job at the lowest nonempty queue. If Jj is in a higher queue than Jh, by the way DMLF2’ moves jobs along the queues, Jj will always be moved to a higher queue first than Jh, which means lqh(t’) ≤ lqj(t’). If Jh and Jj are on the same queue, Jh is at the front since this is the job run by DMLF2’. Although Jh is moved to a higher queue first than Jj, the lqh will be incremented only if the lower queue is already empty, which means Jj has already been moved to the higher queue, thus lqh(t’) = lqj(t’). Inductive hypothesis: Assume that if there is directed path from Jh to Jj – 1 of k – 1 number of directed edges, then lqh(t) ≤ lqj(t). Inductive step: Consider a directed path from Jh to Ji – 1 and a directed edge from Jj – 1 to Jj. By the inductive hypothesis, lqh(t) ≤ lqj – 1(t). By the base case, lqj – 1(t) ≤ lqj(t). Therefore, lqh(t) ≤ lqj(t). ■ We now find a lower bound for the number of uncompleted jobs of the adversary.

Lemma 15 U ADV (t ) ≥

f 2

Proof. Allow the adversary to be the most powerful form of adversary by letting it borrow time from job Ji to complete job Jj, if lqi(t) ≤ lqj(t), based on Lemma 14. Let P’ = {Pα(1), Pα(2), …, Pα(k)} be a subset of P where all the jobs in Pα(i) are already completed by the adversary. Mathematically, the partitions in P’ have empty intersection with UADV. Let us number the partitions such that if i < j, then α(i) < α(j). Let us also number the jobs in UADV in non-decreasing order of lq values. That is, let UADV = {Jρ(i) | 1 ≤ ρ(i) ≤ |UADV|}, if ρ(a) ≤ ρ(b), then lqρ(a) ≤ lqρ(b). We use mathematical induction to show that for every i, 1 ≤ i ≤ k, UADV contains at least i jobs, and for every h, 1 ≤ h ≤ i, lqρ(h) ≤ s(α(h)) (i.e. the smallest lq value is not greater than the lowest queue in Pα(h)). Base case: i = 1. Since DMLF2 always runs a job at any time, UADV is not empty at any time. If lqρ(1) ≥ s(α(1)), then for every Jj, 1 < j < |UADV|, lqj > s(α(1)), since the jobs in UADV are

ordered in non-decreasing order of lq values. This means that UADV contains no job that has last queue value that is less than or equal to s(α(1)). Thus, the adversary cannot borrow time from any job to finish the job in Pα(1), based on Lemma 14. This is a contradiction to our definition of Pα(1), which is one of the set of jobs completed by the adversary. Therefore, lqρ(1) ≤ s(α(1)). We now have a general i, 1 < i < k. From Lemma 10, Pα(h), 1 ≤ h ≤ i – 1, is completed by the adversary if it borrows, at least, 2s(α(h)) time. We can now have our inductive hypothesis that lqρ(h) ≤ s(α(h)). We now look at Pα(i). Note that |Pα(i) ∩ Qs(α(i))| is at least 1. Let that job be Jc. Let S = {J c } + Uih−=11 P α ( h ) . To finish

Proof. We have already obtained in Lemma 16 an O(ln n) competitive ratio for DMLF2. We have assumed that DMLF2 does not encounter more than (c + 1)ln n / ln ln n unlucky jobs and small queues. If ever RMLF2 encounters these two events separately, it will have a competitive ratio n and n / (n - |C|), respectively, since the adversary will just complete those unlucky jobs and jobs comprising the small queue rather than postponing their execution to a higher queue. Therefore, n 1 ≤ c ≤ ∑ j =1 j −6 , |C| > 2, U RMLF 2 (t ) U DMLF 2 (t ) = + E [unlucky jobs ] + E [small queues] U ADV (t ) U ADV (t )

the jobs in S, the adversary needs to borrow at least i −1 y c + ∑ 2 s (α (h )) . Assume that lqρ(i) > s(α(i)) and |UADV| = i – 1.

= O (ln n ) + n Pr[unlucky jobs] +

h =1

n Pr[small queues] n− C

n  1   1 = O (ln n ) + n c  +  C /2   n  n− C 2

We now consider all jobs Jρ(h), 1 ≤ h ≤ i – 1. From the inductive hypothesis, lqρ(h) ≤ s(α(h)). The adversary can borrow time only from this set of jobs. Note that if lqρ(h) ≤ s(α(h)), the highest queue where Jρ(h) can be located is Qs(α(h))+1, so wρ(h) ≤ 2s(α(h)). This means that the maximum amount of time that can i −1 s (α ( h )) , which falls short by yc. This be borrowed is 2



contradicts our assumption that |UADV| = i – 1 because we need to borrow time from more than i – 1 jobs, thus |UADV| ≥ i. And for us to be able to borrow from Jρ(i), lqρ(i) ≤ s(α(i)), which contradicts our assumption.

[1] Maurice Bach. The Design of the UNIX Operating Systems. Prentice-Hall Inc., 1990.



h =1

We have shown that |UADV| ≥ k. By the definition of k, f – k partitions are not yet completed by the adversary. Each of these partitions can have at least one job, thus |UADV(t)| ≥ f – k. This means that f – k = k, hence, k = f / 2. Therefore, |UADV(t)| ≥ f / 2. ■ We can now obtain the competitive ratio for DMLF2.

Lemma 16

For all late times t, U DMLF 2 (t ) ≤ O(ln n ) U ADV (t )

Proof. The number of jobs in UDMLF2(t) that are not BL is l, because these are the jobs that are at the front of a queue. Since l is small relative to n, we can assume that |UDMLF2(t)| = BL = n. By Lemma 15, |UADV| ≥ f / 2. Since each Pi has 128τ ln n jobs, f = n / 128τ ln n  . Hence,

U ADV (t ) ≥ n U ADV (t )

≤ 2128τ ln n

U DMLF 2 (t ) U ADV (t )

n 2128τ ln n 

≤ O(ln n )

■ We can now get the competitive ratio of RMLF2.

Theorem 17

The competitive ratio of RMLF2 is O(ln n).

= O (ln n )

REFERENCES

[2] Luca Becchetti and Stefano Leonardi. Nonclairvoyant scheduling to minimize the total flow time on single and parallel machines. Journal of the ACM, 51:517-539, July 2004. [3] Luca Becchetti, Stefano Leonardi, Alberto MarchettiSpaccamela, Guido Schäfer, and Tjark Vredeveld. Average case and smoothed competitive analysis of the multi-level feedback scheduling algorithm. Mathematics for Operations Research, 31:85-108, February 2006. [4] Allan Borodin and Ran El-Yaniv. Online Computation and Competitive Analysis. Cambridge University Press, 1998. [5] Peter Brucker. Scheduling Algorithms. Springer-Verlag, 1995. [6] Thomas Cormen, Charles Lieserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms Second Edition. MIT Press, 2001. [7] James Johnson. Probability and Statistics for Computer Science. Wiley, 2003. [8] Bala Kalyanasundaram and Kirk Pruhs. Speed is as powerful as clairvoyance. Journal of the ACM, 47:617-643, July 2000. [9] Bala Kalyanasundaram and Kirk Pruhs. Minimizing flow time nonclairvoyantly. Journal of the ACM, 50:551-567, 2003. [10] Averil Law and W. David Kelton. Simulation Modeling and Analysis Third Edition. McGraw-Hill, 2000.

[11] Stefano Leonardi and Danny Raz. Approximating flow time on parallel machines. Proceedings of the 38th Annual ACM Symposium on Theory of Computing, pages 110-119, 1997. [12] Michael Mitzenmacher and Eli Upfal. Probability and Computing, Cambridge University Press, 2005. [13] Rajeev Motwani, Steven Philips and Eric Torng. Nonclairvoyant scheduling. Theoretical Computer Science, 130:17-47, 1994. [14] Rajeev Motwani and Prabakar Raghavan. Randomized Algorithms. Cambridge University Press. 1995. [15] Kirk Pruhs. Systems.

Competitive Online Scheduling for Server

[16] Kirk Pruhs, Jiří Sgall, and Eric Torng. Online scheduling. In Joseph Leung, editor, Handbook of Scheduling: Algorithms, Models and Performance Analysis, chapter 15, pages 15-1 – 15-41. CRC Press, 2004. [17] William Stallings. Operating Systems Internals and Desing Principles Fourth Edition. Prentice-Hall Inc., 2001.

Competitive Online Scheduling with Fixed Number of ...

jobs to use the CPU, without knowledge of the time and number of arriving jobs and ... Research on nonclairvoyant scheduling was started by. Motwani et. al. in ...

249KB Sizes 0 Downloads 138 Views

Recommend Documents

RT-Seed: Real-Time Middleware for Semi-Fixed-Priority Scheduling
middleware, which implements a semi-fixed-priority scheduling algorithm, called .... (e.g., EUR/USD) from a stock company, the parallel optional parts conduct ..... many-core platform software stack 3.3.4 (released on March. 13, 2015) [16] on ...

Channel-Dependent Scheduling of an Uplink SC-FDMA System with ...
Abstract— Channel-dependent scheduling (CDS) can increase the data throughput of a cellular system by exploiting multi-user diversity and frequency ...

The Stability of Longest-Queue-First Scheduling With ...
is throughput-optimal if it can stabilize the system for all sets of arrival rates that are stabilizable ... requires IEEE permission. See http://www.ieee.org/publications_standards/publications/rights/index.html for more information. ... cumulative

Modulo Scheduling with Regular Unwinding
requires bi ≥ 0 resources for all the time inter- ..... Proof: We defined the modulo scheduling problem ... Definition 1 A q-stationary p-unwinded schedule is a.

Scheduling Multipacket Frames With Frame Deadlines⋆
As a last example, consider a database (or data center) engaged in trans- ferring truly huge files (e.g., petabytes of data) for replication purposes. It is common ..... in C. However, all frames have integer sizes, and thus their total size if at mo

MODULO SCHEDULING WITH REGULAR UNWINDING 1 Introduction
1 Introduction. 1.1 Modulo Scheduling .... In parallel machine scheduling problems, an opera- ... πi = λi The processing period of operation Oi is λi, implying ...

Scheduling with pairwise XORing of packets under ...
Apr 5, 2012 - of all native packets that they overhear from the common medium. Second ... There is an important difference from the classical framework, however, the ..... to design a dynamic list of such size. Many of ...... [2] NCRAWL experiments.

Scheduling Fairness of Real-Time Scheduling ...
MExp, outage capacity, quality of service (QoS), scheduling fairness, ... Wireless industry has been making its way to the field of real-time multimedia applications. ... data applications over both wire-line and wireless channels, multiplexing ...

Modulo Scheduling with Regular Unwinding
Modulo Resource Constraints Each operation Oi requires bi ≥ 0 resources for all the time intervals. [σi + kλ, σi + .... with renewable resources [Dinechin 2003]:.

Scheduling Multipacket Frames With Frame Deadlines⋆
As a last example, consider a database (or data center) engaged in trans- ferring truly huge files (e.g., petabytes of data) for replication purposes. It is common ..... in C. However, all frames have integer sizes, and thus their total size if at mo

Future Number of Children
www.gapminder.org/teach ... Free teaching material for a fact-based worldview .... Attribution - You must make clear to others the license terms of this work and ...

Competitive helping increases with the size of ...
May 6, 2011 - Department of Psychology, University of Guelph, 50 Stone Road East, Guelph, ON, Canada N1G 2W1 ..... an illustration, not as a strict necessity. The most .... effect on fitness (e.g. Hauert et al., 2006; Johnstone and Bshary,.

SILE comes with a number of packages which provide ... - GitHub
SILE comes with a number of packages which provide additional functionality. A box: here. Test underlining several words.

Grade 8 Scheduling Letter & Online Registration Instructions.pdf ...
NATHAN HALE-RAY HIGH SCHOOL IS ACCREDITED BY THE NEW ENGLAND ASSOCIATION OF. SCHOOLS AND COLLEGES, INC. Nathan Hale-Ray High ...