13
Optimality of a Central Processor Scheduling Policy for Processing a Job Stream HISAO KAMEDA The University of Electro-Communications, Chofu, Tokyo, Japan It has been claimed on the basis of empirical studies that a CPU scheduling policy, whereby I/O- bound jobs are given preemptive priority over CPU-bound jobs, produces the highest overall CPU utilization of multiprogrammed computer systems. However, a theoretical result has shown that the CPU utilization is independent of CPU scheduling in a finite-source queuing model of multipro- grammed systems. This paper aims at resolving this seeming conflict and gaining some insight into CPU scheduling by analyzing a Markovian model of job-stream processing. The model studied consists of an infinite backlog of jobs of two classes (a job stream} and a multiple-resource system (the model of a multiprogrammed system which processes the job stream}; the system consists of a cyclic queue of two nodes--a single (CPU) server and an infinite (I/O) server. The system contains a fixed number of jobs concurrently; the values of parameters describing each job class are distinct except for the mean I/O service time. The following result is obtained under the near-complete decomposability of the model: The maximum overall CPU server utilization (and the maximum throughput) is achieved by scheduling policy whereby jobs of the class having a shorter mean CPU service time are given preemptive priority over others at the CPU server, although the CPU server utilization is independent of CPU scheduling so long as the set of jobs in the system remains fixed. Categories and Subject Descriptors: D.4.1. [Operating Systems]: Process Management--multipro- cessing/multiprogramming; D.4.8 [Operating Systems]: Performance--modeling and prediction; queuing theory; stochastic analysis General Terms: Performance, Theory Additional Key Words and Phrases: Job stream, dispatching policy, CPU scheduling, I/O bound, CPU bound, preemptive priority, multiple-resource system, multiprogramming, near-complete decom- posability, finite-source queue, machine repairman model, Markovian queuing model. 1. INTRODUCTION In multiprogrammed computer systems, the central processing unit (CPU) often becomes a performance bottleneck. It is known that there are usually large differences among the CPU burst times of jobs in a system: Some jobs have short CPU burst times (we call them I/O-bound jobs) while others require long CPU Author's present address: Department of Computer Science, The University of Electro-Communica- tions, 1-5-1 Chofugaoka, Chofu-shi, Tokyo 182, JAPAN Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. © 1984 ACM 0734-2071/84/0200-0078 $00.75 ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984, Pages 78-90.

Optimality of a Central Processor Scheduling Policy for

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy for Processing a Job Stream

HISAO KAMEDA The University of Electro-Communications, Chofu, Tokyo, Japan

It has been claimed on the basis of empirical studies that a CPU scheduling policy, whereby I/O- bound jobs are given preemptive priority over CPU-bound jobs, produces the highest overall CPU utilization of multiprogrammed computer systems. However, a theoretical result has shown that the CPU utilization is independent of CPU scheduling in a finite-source queuing model of multipro- grammed systems. This paper aims at resolving this seeming conflict and gaining some insight into CPU scheduling by analyzing a Markovian model of job-stream processing.

The model studied consists of an infinite backlog of jobs of two classes (a job stream} and a multiple-resource system (the model of a multiprogrammed system which processes the job stream}; the system consists of a cyclic queue of two nodes--a single (CPU) server and an infinite (I/O) server. The system contains a fixed number of jobs concurrently; the values of parameters describing each job class are distinct except for the mean I/O service time. The following result is obtained under the near-complete decomposability of the model: The maximum overall CPU server utilization (and the maximum throughput) is achieved by scheduling policy whereby jobs of the class having a shorter mean CPU service time are given preemptive priority over others at the CPU server, although the CPU server utilization is independent of CPU scheduling so long as the set of jobs in the system remains fixed.

Categories and Subject Descriptors: D.4.1. [Opera t ing Systems]: Process Management--multipro- cessing/multiprogramming; D.4.8 [Opera t ing Systems]: Performance--modeling and prediction; queuing theory; stochastic analysis

General Terms: Performance, Theory

Additional Key Words and Phrases: Job stream, dispatching policy, CPU scheduling, I/O bound, CPU bound, preemptive priority, multiple-resource system, multiprogramming, near-complete decom- posability, finite-source queue, machine repairman model, Markovian queuing model.

1. INTRODUCTION In multiprogrammed computer systems, the central processing unit (CPU) often becomes a performance bottleneck. It is known that there are usually large differences among the CPU burst times of jobs in a system: Some jobs have short CPU burst times (we call them I/O-bound jobs) while others require long CPU

Author's present address: Department of Computer Science, The University of Electro-Communica- tions, 1-5-1 Chofugaoka, Chofu-shi, Tokyo 182, JAPAN Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. © 1984 ACM 0734-2071/84/0200-0078 $00.75

ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984, Pages 78-90.

Page 2: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy ° 79

processing between two consecutive input-output (I/O) operations (we call them CPU-bound jobs). To relieve this bottleneck, a scheduling policy has already been proposed, whereby I/O-bound jobs are given preemptive priority over CPU- bound jobs at the CPU. In this paper we call this policy the H-schedule.

A number of experimental works have shown that this policy achieves greater throughput of multiprogrammed computer systems than any other easily con- ceivable discipline [2, 11, 13, 14, 17, 20]. Some of these authors clearly stated their experimental conditions [11, 13, 14]. They provided one or more job streams, each of which consists of a sequence of jobs of various types; they let the multiprogrammed system process the same job stream under different CPU scheduling policies, and obtained the values of performance indices. Their em- pirical conclusions can be summarized as follows:

(1) The overall CPU utilization is maximum when the H-schedule is employed at the CPU.

(2) The total elapsed time is minimum and the throughput is maximum in that case.

Note, however, that we cannot prove the true optimality of the H-schedule only by means of empirical case studies.

To study the effect of CPU scheduling in multiprogramming systems theoret- ically, we would like to analyze suitable queuing network models which embody various scheduling disciplines and which accurately reflect the structure of real systems. With the current state of knowledge, however, such queuing network models as have priority scheduling are difficult to solve analytically, since they do not allow product-form solutions [1, 4, 9], and in most cases, are solvable only by numerical calculation or simulation. It may not be feasible to exhaust the space of parameters which describe the model reflecting the structure of real systems by these methods for the purpose of gaining insight into the optimal scheduling.

Therefore, as one of the second-best methods, we may think of analyzing some tractable, and, therefore, simple and restricted models, each of which has a different set of restrictive assumptions, one at a time [7, 10, 16]. In analyzing the performance of multiprogrammed systems, we sometimes use a finite-source queuing (or machine repairman) model [3, 8, 12] as one such tractable model. (Some reports shows that a finite-source queuing model can be a good model of a multiprogrammed system [3].)

Some theoretical results on a finite-source queuing model of multiprogrammed computer systems have been obtained [8]. The model is a closed cyclic queue of two nodes--a single (CPU) server, and a multiple (I/O) server with no queuing delays. Assume that each class of jobs in the model has exponential service time distributions with a distinct mean at the CPU server and with an identical mean at the I/O servers. Assume the CPU server employs one of such scheduling policies as first-come-first-served (FCFS), preemptive and nonpreemptive prior- ity, generalized processor sharing, etc. Then we have the following theoretical results:

(3) The utilization factor of the CPU server is independent of the CPU sched- uling policy.

ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.

Page 3: Optimality of a Central Processor Scheduling Policy for

80 • Hisao Kameda

JJllllllllll

job stream

I; C P U p~,~ooe~

(a finite-source queuing model)

=0

system

Fig. 1. A model of job-stream processing. The model consists of an infinite backlog of jobs {job stream) and a system depicted inside the dashed quadrangle. The system can be regarded as a multiple-resource system and is considered a model of a multiprogrammed computer system which processes the job stream. It is identical to a finite-source queuing model so long as the set of jobs in it {i.e., the job mix) remains the same. For details, see Section 2.

(4) The sum of the utilization factors of the CPU server and all the I/O servers (i.e., the effective degree of multiprogramming) is maximum if and only if the H-schedule is employed.

At first sight, result (3) seems to conflict with empirical conclusion (1) described above, although result (4) seems to be in harmony with conclusion (2). From this apparent conflict, some people might wonder about the optimality of the H- schedule in the case where the finite-source queuing model is applicable.

This paper aims at resolving the apparent conflict between the empirical conclusions and the theoretical results on the finite-source queuing model, at gaining some insight into the reasons for the optimality of the H-schedule, and at presenting a basis for further, more elaborate and exhaustive studies on the problem.

We may resolve the apparent conflict by the following intuitive reasoning: Let us call the set of jobs that are in the main storage the job mix. Under the H- schedule, I/O-bound jobs receive the highest processing priority and will stay in the job mix for the shortest time. Similarly, CPU-bound jobs will stay in the job mix for the longest time. Thus the total job mix will be the most CPU-bound. The job mix which contains more jobs that are CPU-bound is considered to achieve higher CPU utilization, and hence, although the CPU utilization, given the job mix, is independent of the CPU scheduling discipline, the overall CPU utilization will be maximum under the H-schedule.

In this paper, we show the validity of this intuitive reasoning analytically in a Markovian model of processing a job stream (Figure 1). In the model, a multi- programmed system is regarded as a multiple-resource system which must process ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.

Page 4: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy • 81

an infinite backlog of jobs of two classes (a job stream). The system has an inner structure, which is identical to the finite-source queuing model except that the job mix changes, with the elapse of time, as jobs leave and enter.

Section 2 presents the model assumptions. In Section 3, we analyze the model and show that the H-schedule is optimal under the condition that the model is nearly completely decomposable. In the analysis, we use the technique of variable aggregation based on near-comlete decomposability. We also present another entirely different physical interpretation of the results. Finally, Section 4 points out some implications of the results as well as some suggestions for more exhaustive studies of the problem.

2. THE MODEL

In this section we describe the assumptions behind the model to be analyzed. The entire model consists of an infinite backlog of jobs (i.e., a job stream), and a multiple-resource system (i.e., the model of a multiprogrammed computer system which processes the job stream) (see Figure 1).

The multiple-resource system consists of a fixed storage capacity, which N jobs can occupy concurrently, and a cyclic queue of two service stations, one a single server, and the other consisting of multiple servers, the number of which is not less than N. For convenience, we refer to the single server as the CPU server and to the others as I/O servers. A job leaving the CPU server chooses any of the free I/O servers, and thus suffers no queuing delay at the I/O servers. A job leaving the I/O servers returns to the CPU server, where jobs may suffer queuing delays. All jobs in the model are classified into two classes: class 1 (called I/O-bound) and class 2 (called CPU-bound). Jobs of class j have exponential service time distributions with mean 1/# i at the CPU server and with mean 1/h at all the I/O servers, for j = 1, 2. Assume ~1 > g2 unless otherwise specified. Let r 1 denote k/#j.

Each job in the system runs through the cycle of the CPU server and the I/O servers a geometrically distributed number of times until it leaves the system. That is, when each job of class j finishes each of its CPU service times, it leaves the system (and the job mix) with probability dj (j = 1, 2). Thus, the distribution of the sum of the CPU service times that a class j job requires until it leaves the system is exponential with mean 1/sj (j = 1, 2), where s i = d1~j. The d1 are assumed to be sufficiently small so that the entire model may be nearly completely decomposable. Note that if dl = d2 = 0, then the inner model of the system is identical to a finite-source queuing model (or a machine repairman model).

The job mix is the set of jobs which occupy the storage and thus stay in the system concurrently. The number of jobs in the job mix (i.e., the degree of multiprogramming) is always N (whatever the job mix is), since we assume that the system has an infinite backlog of unprocessed jobs. When a job leaves the job mix, the next job in the backlog replaces it immediately and thus joins the job mix. We assume the probability that the next job is of Class j is pj (j = 1, 2), 2), whatever the class of the leaving job is (pl + P2 = 1). Let qi be 1 - pj. The job mix which consists of i class 1 jobs and N - i class 2 jobs is called job mix (i, N - i). Note that the job mix may be one of N + 1 different types: job mix (0, N), job mix (1, N - 1), . . . , job mix (N, 0).

ACM Transactions on Computer Systems, Vol. 2, No. 1 February 1984.

Page 5: Optimality of a Central Processor Scheduling Policy for

82 • Hisao K a m e d a

Assume that the CPU server employs one of a broad class of work-conserving scheduling policies which use only information about the current and past states of the queuing process in making scheduling decisions. This class excludes scheduling policies which use information on the exact remaining service times and thus are not always realizable in practice. This class of scheduling policies includes FCFS, preemptive and nonpreemptive priority, shortest and longest expected remaining processing time first, preemptive and nonpreemptive last- come-first-served, processor-sharing, generalized processor-sharing (i.e., the dis- cipline whereby the capacity of the CPU server is divided at specified ratios among the jobs at the CPU server), etc. (More precisely, in the closed finite- source queuing model the class of scheduling policies is characterized as follows: Let W be the set of jobs in the closed model. Regard each group of the system state, in which the same set (denoted by T) of jobs stay together at the CPU server and jobs of the set W - T stay at the I/O servers, as an aggregated state (denoted by ST) of the system. Let PT denote the stationary probability of state ST. Let P~ denote the joint stationary probability that the CPU server is processing job j and that the system is in state ST (Y, ievPiv = PT). Let the rate of transitions out of state A mean the average number of transitions, out of state A, that occur per unit time interval in statistical equilibrium. The class consists only of the scheduling disciplines that satisfy the following condition: The rate of transitions Out of an arbitrary state, say ST, due to the event that an arbitrary job, say j (j E T), leaves the CPU server (and thus arrives at a vacant I/O server) is to be uiP~, and the rate of transitions out of state ST due to the event that an arbitrary job, say k (k ~ T), leaves the I/O servers (and thus arrives at the CPU server) is to be ~PT. See [8].) We assume that the overheads due to scheduling and job mix transition are negligible.

Remark. The above assumptions about the way jobs enter the system are satisfied by the following job stream. The job stream can be regarded as a sample process of a finite Ergodic Markov chain as follows: Let p1 denote the probability that a job of class j appears at each point in the job stream, for j = 1, 2. Each job enters the job mix in the order in which jobs appear in the job sequence of the job stream (i.e., on a FCFL (first-come-first-loaded) basis), when a job leaves the job mix. Once a job enters the job mix, it continues to stay in the job mix until all the computation which the job requires is completed.

3. THE ANALYSIS

The most direct way of analyzing this kind of problem seems to be to identify each state of the model, and to obtain a set of global balance equations, each of which shows that the rate of transitions out of a state is equal to the rate of transitions into it, and finally to solve the set of equations for the stationary probability of each state. From the set of state probabilities we derive the properties of our model.

Unfortunately, it seems difficult to follow such a direct method in analyzing our model. We use, therefore, the technique of variable aggregation based on near-complete decomposability, developed by Simon and Ando [15], and Courtois [6], as an approximation method. As Courtois says, the technique is based on the

ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.

Page 6: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy • 83

recognition that system states can be classified into a small number of groups such that

• interactions within each group can be studied as if interactions among groups did not exist, and

• interactions among groups can be analyzed without referring to the interac- tions within groups.

In our problem we aggregate the states where the same job mix is being processed into a group. Thus the interactions within each group can be studied by means of a closed (finite-source) queuing model. On the basis of the equilibrium values of each group we can study interactions among groups and thus obtain the properties of the entire model in an approximate way.

Section 3.1 presents a summary of the technique of variable aggregation based on near-complete decomposability. In Section 3.2 we present some local equilib- rium properties of each group (i.e., the properties of the finite-source queuing model). In Section 3.3 we show the optimality of the H-schedule on the basis of the results of Section 3.2 by using the technique of variable aggregation. Section 3.4 presents another physical interpretation of the model.

3.1 The Technique of Variable Aggregation Based on Near-Complete Decomposability

Consider a stochastic system. Let us aggregate system states into separate groups, each of which is denoted by G1 (I = 1, 2 , . . . , M.) Denote each state in group GI by Ei, (i = 1, 2, . . . , n(I)), where n(I) is the number of system states in G~. Let vit denote the stationary probability of state Ei,. Let v denote the vector [vl,, v2,, . . . . VlI . . . . . Vii , o . . , Vn(M)M]. Let Q denote the transition rate matrix of the system, that is, the (il, jj)-element of Q, QilJj, is the rate at which the system moves from Eilto Ejj, given that the system is currently in the state Ei,. We can obtain v from the equation,

vQ = 0. (3.1)

The following is a method for obtaining an approximate value of v. (The method is derived directly from Courtois [6], by considering T = I + hQ as a stochastic matrix, where I is an identity matrix and h is a sufficiently small positive constant.) Let Q~j denote the submatrix of Q, which contains only and all the (/z, jj)-elements (i = 1, 2 . . . . , n(I),j = 1, 2 . . . . . n(J)).

1) Obtain a completely decomposable transition rate matrix Q* such that

Q = Q* + eC, (3.2)

where

Q~j = 0, for I ~ J ;

e= max( ~. ~ Qi,jj) (3.3) i,1 \ J - ~ l j

is small compared with most nonzero elements of QH (I ---- 1, 2, . . . , M); e can be interpreted as the maximum degree of coupling between groups, each of which is

ACM Transac t ions on Computer Systems, Vol. 2, No. 1 February 1984.

Page 7: Optimality of a Central Processor Scheduling Policy for

84 • Hisao Kameda

described by the submatrix QIi of transition rate matrix Q (I = 1, 2, . . . , M); C has rowsums equal to zero, and

m a x ( ~ ~ Ci , j j )= l . i , I \ J * I j

Denote QTi by Q~'. Then Q* can be expressed as

-Q~ o

Q7 (3.4)

o Q~

Each Q ~ is a square submatrix of the order n(I) . Note that Q~' is an approximation of Qii.

2) Obtain the stationary probability vector v? of Q? such that

v *a* = O, I = 1, 2, M. (3.5) I ~qg I • . .

Let v~ denote the/-element of v?.

3) Obtain the M-dimensional transition rate matrix R such that

R~j = ~ v~ Z Qi,j~,, I, d = 1, 2 , . . . M, (3.6) i j

where R1j denotes the (/, J)-element of R.

4) Obtain the stationary probability vector X of R such that

X R = O. (3.7)

Let Xi denote the / -e lement of X.

5) Finally, xil as follow are used as an approximation of vix:

x i , = X i v ~ , i = 1, 2, . . . , n(I); I = 1 , 2 , . . . , M . (3.8)

The error in this approximation (i.e., xi, - v~ I) is of the order of magnitude of e. Therefore xil becomes a very exact estimate of vi, as e becomes infinitely small (but remains nonzero).

3.2 Properties of the Finite-Source Queuing Model

We demonstrate some properties of the performance measures of the system in equilibrium, given that the job mix is constant. Let p") denote the utilization factor of the CPU server when the job mix is of type (i, N - i). Let p~i> denote the utilization factor of the CPU server for class j jobs in job mix (i, N - i) for j = 1, 2, (p[i) "b p(2 i) = p(i)). We have already derived (or easily can derive) the ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.

Page 8: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy • 85

following three properties [8]:

A1. p~o is independent of the scheduling policy at the CPU server and is obtained:

N-i i N - " -1

where rj has been defined as X/#j fo r j = 1, 2.

A2. p}i) is maximum if and only if all class j jobs are given, at the CPU server, preemptive priority over all other jobs in the job mix (i, N - i) for j = 1, 2. In that case p}i~ is independent of the relative scheduling policy or priority assign- ment within each class fo r j = 1, 2.

A3. Let U <i) denote the sum of the utilization factors of the CPU server and of the I/O servers when the job mix is of type (i, N - i). Then U ~i~ is maximum if and only if the H-schedule is employed at the CPU server.

Remark. Properties A1 and A3 are identical to theoretical results (3) and (4), respectively, described in Section 1.

From Property A1, we can derive Property A4:

A4.

p(i) ~ p(i+l) for O _ < i _ < N - 1 if g l ~ t t 2 .

PROOF. Note that

N - i -

and

('*') (ni)+(n ,) We then have

i ~ (nl + n2)! r2

n~=0 n2

= 2 (nl + n2)! r~ + n2=0 n2

N - i - 1

Z n2=O

( n l + n 2 + l ) ! ( N - i - 1 ) r ~ + l " n 2

Similarly we have

~ (n~+n2)! i + 1 r~' nl= 0 n l

, . (ni "~- n2)! r~l + ~ (nl ~-n2-~ l)! ( ` ~ nl+l o,:o 1 o,=o n,/rl o

ACM Transactions on Computer Systems, Vol. 2, No. i February 1984.

Page 9: Optimality of a Central Processor Scheduling Policy for

86 • Hisao Kameda

Therefore, from eq. (3.9),

( 1 - p ( i ) ) - i _ ( 1 - p . + l ) ) - i

i N - i - 1 (i)(N--i--1)r~lr~2(r2_rl)" = ~ ~ ( n l + n 2 + 1)! nl n2

nl=0 n2=0

By noting that rj = X/#j, we have from this,

p(i) ~ p,+l~ if #1 ~- #2. D

Remark. Property A4 suggests that our intuition that the more CPU-bound jobs in the job mix, the larger the CPU utilization of the job mix, as stated in the Introduction, is correct in this model.

3.3 Optimality of the Scheduling Policy Now we follow the steps of the technique presented in Section 3.1, one by one, to analyze our model.

1) We aggregate states in which the job mix is the same into the same group. Let G~ denote the group of the job mix (I - 1, N - I + 1). Thus, in our model, each Q~' is the transition rate matrix of the closed finite-source queuing model with the job mix of group GI.

Recall the definitions of Qi,j., and Qu; since not more than one job leaves the job mix at the same time,

Q u = 0, [ I - J I -> 2. (3.10)

We have assumed that when a job leaves the CPU server and also the job mix, another job in the backlog replaces that job immediately in the job mix. Therefore, when the system leaves the state Eil and leaves G~, it always goes to one corresponding state in GI-1 or to one corresponding state in Gi+i. Thus, at most two elements of each row of Q are nonzero except those elements which belong to Q H ( I = 1, 2 , . . . , N + 1).

Let flil,k denote the ratio at which the capacity of the CPU server is given to class k jobs while the system is in state Ei~. Naturally 0 _</~,k --< 1. (Under usual scheduling disciplines except processor-sharing, ~,k = 0 or 1.) A class k job leaves the CPU server at the rate of #h, when the job is being served at the CPU server, and leaves the job mix with probability dk; then a job of the other class enters the job mix with probability qk. Thus the value of a nonzero element Q~,i,-, is to be

ql dl#l~il,1---- qlsl~i~,l,

and the value of a nonzero element QilJ,.l to be

q2 d2#21~i~.2 = q2s=fli~,2.

Therefore, the maximum degree of coupling between groups is

e = max(qlsl, q2s=). (3.11)

2) Since Q~' is the transition rate matrix of the closed finite-source queuing model with job mix (I - 1, N - I + 1), some results on v7 which satisfy eq. (3.5) have been obtained in Section 3.2. ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.

Page 10: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy • 87

3) Le t us ob ta in the t r ans i t i on ra te ma t r i x R (as in eq. (3.7)) for our model. F r o m eq. (3.6), by recal l ing the def in i t ion of psi) (Sec t ion 3.2),

Rl, I-1 = 2 v~qlsit~ivl = qlslp~ I-1), and i

= = ~ S ^ ( t - i ) Rl, l+l 2 v~q2s2~il,2 t / 2 2 p 2 • i

F r o m eq. (3.10),

R u = O , I I - J I _> 2.

N o t e tha t , s ince R is a t r ans i t i on ra te mat r ix ,

RH = - (Rz j+ l + Rm-i) .

4) Le t Pi deno te the es t ima te of the p robab i l i ty o f job mix (i, N - i), t h a t is, Pi = Xi-1. T h e n eq. (3.7) will be

q o ~ ( i + i ) D _ 1 ° 1 / J 1 ~ t i + l q2s2p~i)pi (i)p = qls lp l i + q2s2p~i-1)pi-1 0

for i = 1, 2, . . . , N - 1,

qlSlp~N)pN . . . . t/2,~2P2(N-I)PN-1 "~ O,

and

qlslp~l)P1 - ~2~ s2v2~(°)Po = O.

F r o m the above we have

Pi

Pi-1

L e t ai deno te

q2s2p~ i-1) ql sl p ~ i)

for i = 1, 2, . . . , N. (3.12)

q2s2p~ i-i)

qisip~i) •

Le t a0 be 1. T h e n 0 < ai < oo, for i = 0, 1 . . . . , N. And, f rom eq. (3.12), we have

i

Pi = Po I] ak for i = 0, 1, 2 . . . . . N (3.13) kffi0

where

Po = ak • (3.14) i = 0 kffi0

Note t h a t ~j=o Pj is t he p robab i l i ty t h a t the n u m b e r of class 2 (CPU-bound ) jobs in the job mix is g rea te r t h a n or equal to N - i. F r o m eq. (3.13),

P1 = jfoL ~ o ~ ak

There fo re , for i = 1, 2, . . . , N - 1,

Pj = 1 + . (3.15) j=o 1 + 2}---~ H~fj+i (1/ak)

A C M T r a n s a c t i o n s o n C o m p u t e r S y s t e m s , Vo l . 2, N o . 1 F e b r u a r y 1 9 8 4 .

Page 11: Optimality of a Central Processor Scheduling Policy for

88 • Hisao Kameda

Then, from eqs. (3.14) and (3.15), we have the following lemma.

LEMMA 1. All of ~=o Pj (i = 0, 1, . . . , N - 1) are max imum if and only if all of aj (j = 1, 2 . . . . . N ) are min imum.

From Property A2 of Section 3.2, we have the following lemma.

LEMMA 2. ai is m i n i m u m if and only if class 1 jobs have preemptive priority over class 2jobs at the C P U server when the job mix is either (i, N - 1) or (i - 1, N - i + 1 ) , f o r i = 1,2, . . . , N .

Remark. From Lemmas 1 and 2, we see tha t ~=o Pi is maximum for 0 _< i _< N - 1 if the H-schedule is used at the CPU server. Thus, the total job mix is the most CPU-bound under the H-schedule, which agrees with our original intuit ion as described in Section 1.

5) Let p denote the est imate of the overall utilization of the CPU server. Let VSg denote the s tat ionary probability tha t the CPU server is idle in the closed finite-source queuing model with job mix (i, N - i); let Xoi denote the estimate of the joint s tat ionary probability tha t the job mix is (i, N - i) and tha t the CPU server is idle. Then, from eq. {3.8), we have

Xoi = Piv~i, i = 0, 1, 2, . . . , N.

Since p " ) = 1 - v~g and p = 1 - ~/N=o Xog, we have

p

Let gi be p"> - p(i+l). Then gi > 0 (i = #1 > it2. Let gN be p ~N~. Then we have

N p ( i ) p i .

i=0

0, 1, 2 . . . . . N - 1) from Property A4 and

N i

p = ~ gi ~ Pj. (3.16) i=O j=0

We see, from Property A1, tha t values of gi are independent of the scheduling policy at the CPU server. Thus, from eq. (3.16) and Lemmas 1 and 2, we have the main result of this paper as the following theorem.

THEOREM 1. The estimate of the overall utilization of the C P U server (and the estimate o[ the system throughput) is maximum, if and only i[ jobs of the class with a shorter mean C P U service time are given preemptive priority over others at the C P U server (i.e., if the H-schedule is used).

Similarly we have the following proposition.

THEOREM 2. The estimate of the overall utilization of the C P U server (and the estimate of the system throughput) is min imum, if and only if jobs of the class with a longer mean C P U service time are given preemptive priority over others at the C P U server.

Remark. Note tha t the estimates in Theorems I and 2 are only approximations and tha t their errors are on the order of magnitude of e = max(qxdl#l, q2d2#2) (eq. 3.11)). Therefore the results are asymptotically exact as dl and d2 become infinitely small (but remain nonzero). Note, furthermore, tha t these results are ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.

Page 12: Optimality of a Central Processor Scheduling Policy for

Optimality of a Central Processor Scheduling Policy • 89

independent of the relative scheduling within each class as seen from Properties A1 and A2. It is interesting to note that the optimality of the H-schedule depends only on the I/O-boundedness of jobs and is independent of the relative values of 81, 82, Pl, and P2.

3.4 Another Interpretation of the Model

The theoretical model described above has another physical interpretation. The system consists of N terminal operators that process two classes of transactions on a computer that consists of only one processor. Each class of transactions has a distinct exponential processor service time distribution per visit to the proces- sor, and a geometrically distributed number of visits. The think time at each terminal is identically exponentially distributed. When one transaction is com- pleted, the class of the" next one is chosen randomly.

The result is interpreted as follows: If the system is nearly completely decom- posable, then the policy which services, at the processor, the transaction class with the shorter mean service time per visit, with preemptive priority, will maximize the overall processor occupancy.

4. CONCLUSIONS

We have considered a Markovian model of a multiprogrammed computer system which processes a job stream; the job stream consists of I/O-bound jobs and CPU-bound jobs. We have shown in the model that the CPU scheduling policy (H-schedule) whereby I/O-bound jobs are given preemptive priority over CPU- bound jobs achieves the maximum overall CPU utilization (and the optimal throughput) in processing the job stream. It is interesting to note that no amount of sophistication in a CPU scheduling strategy can do better than the above mentioned simple CPU scheduling policy, at least in the case where the assump- tions of the model given in this paper hold. Note that the above result holds only approximately but is asymptotically correct as the degree of near-complete decomposability grows. Note also that the model has restrictive assumptions, such as Markovian properties and no queuing delay at the I/O devices, etc.

The result agrees with the intuitive reasoning presented in the Introduction. The intuitive reasoning may be extended somewhat to allow us to conjecture that an argument similar to that presented in this paper can be applied to more general cases: Under the H-schedule, I/O-bound jobs will stay in the job mix for the shortest time; therefore, the total job mix will be the most CPU-bound; the more CPU-bound the job mix, the higher the CPU utilization of the job mix; then, even if the CPU utilization, given the job mix, may not be improved (or may even be slightly degraded) by the schedule, the overall CPU utilization (and the throughput) will be improved if the H-schedule is used.

In this study, we see that there are two kinds of effects of CPU scheduling: the effect on the utilization factors of the servers while the type of the job mix is kept constant (we call this the short-term effect), and the effect on the occurrence ratio of each different type of the job mix (we call this the long-term effect). Thus, in the model, the CPU scheduling policies have no different short-term effects on the CPU utilization, but have different long-term effects on the CPU- boundedness of the total job mix. A number of theoretical research efforts on this kind of problem seem to have been devoted mainly to the analysis of the

ACM Transactions on Computer Systems, Vol. 2, No. 1 February 1984.

Page 13: Optimality of a Central Processor Scheduling Policy for

90 • Hisao Kameda

short-term effect [7, 10, 16]. The study presented here suggests that there might be some apparent discrepancies between the empirical facts and the theoretical results wherein only the short-term effect is considered, and that such discrep- ancies would be dissolved if the long-term effect were taken into consideration.

Strictly speaking, general application of the theoretical results presented here must await the removal of some of the restrictive assumptions of the model. We feel, however, that some new methods of attack may be necessary before it will be possible to extend the results analytically to more general realistic cases.

ACKNOWLEDGMENT

The author is grateful to the referees for various helpful comments.

REFERENCES

(Note: References [18] and [19] are not cited in the text.) 1. BASKE'rT, F., CHANDY, K.M., MUNTZ, R.R., AND PALACIOS, F.G. Open, closed, and mixed

networks of queues with different classes of customers. J. ACM 22, 2 (April 1975), 248-260. 2. BLEVINS, P.R., AND RAMAMOORTHY, C.V.. Aspects of a dynamically adaptive operating system.

IEEE Trans. Comput. C-25, 7 (July 1976), 713-725. 3. BOYSE, J.H., AND WARN, D.R. A straightforward model for computer performance prediction.

ACM Comput. Surv. 7, 2 (June 1975), 73-93. 4. CHANDY, K.M., HOWARD, J.H., AND TOWSLEY, D.F. Product form and local balance in queueing

networks. J. ACM 24, 2 (April 1977), 250-263. 5. COURTOIS, P.J. Decomposability, instabilities, and saturation in multiprogramming systems.

Commun. ACM 18, 7 (July 1975), 371-377. 6. COURTOIS, P.J. Decomposability: Queueing and Computer System Applications. Academic Press,

N.Y. (1977). 7. KAMEDA, H. Optimality of a central processor scheduling strategy in multiprogrammed com-

puter systems. Transaction of IECE of Japan E64, 3 (March 1981), 120-125. 8. KAMEDA, H. A finite-source queue with different customers. J. ACM 29, 2 (April 1982), 478-

491. 9. KELLY, F.P. Reversibility and Stochastic Networks. Wiley, New York, 1979.

10. LAZOWSKA, E.D., AND SEVCIK, K.C. Scheduling in systems with two scarce resources. In Proc. ACM Nat'l Conf. (San Diego, Calif., Nov. 1974), ACM, New York, pp. 66-73.

11. MARSHALL, B.S. Dynamic calculation of dispatching priorities under OS/360 MVT. Datamation 15 (Aug. 1969), 93-97.

12. PRICE, T.G. A note on the effect of the central processor service time distribution on processor utilization in multiprogrammed computer systems. J. ACM 23, 2 (April 1976), 342-346.

13. RYDER, K.D. A heuristic approach to task dispatching. IBM Syst. J. 9, 3 (1970), 189-198. 14. SHERMAN, S., BASKETT, F., AND BROWNE, J.C. Trace-driven modeling and analysis of CPU

scheduling in a multiprogramming system. Commun. ACM 15, 12 (Dec. 1972), 1063-1069. 15. SIMON, H.A., AND ANDO, A. Aggregation of variables in dynamical systems. Econometrica 29

(April 1961), 111-138. 16. SPIRN, J.R. Multi-queue scheduling of two tasks. Acta Inf. 7, 2 (1976), 217-226. 17. STEVENS, D.F. On overcoming high priority paralysis in multiprogramming systems: a case

history. Commun. ACM 11, 8 (Aug. 1968), 539-541. 18. STRAUSS, J.C. An analytic model of the Hasp Execution Task Monitor. Commun. ACM 17, 12

(Dec. 1974), 679-685. 19. STRAUSS J.C. Dynamic dispatching in job class scheduled systems. In Proc. AFIPS 1975

National Computer Conference, Vol. 44, AFIPS Press, Montvale, N.J., (1975), 343-350. 20. WULF, W.A. Performance monitors for multi-programming systems. In Proc. 2nd Symposium

on Operating System Principles, ACM, New York, (Oct. 1969), 175-181.

Received October 1981; revised January 1983; accepted November 1983

ACM Transactions on Computer Systems, Vol. 2, No. 1, February 1984.