Вы находитесь на странице: 1из 26

Proportionate Progress

A Notion of Fairness in Resource Allocation

S K Baruah N K Cohen C G Plaxton D A Varvel

Departmen t of Computer Science

University of Texas at Austin

September

Abstract

Giv en a set of n tasks and m resources where each task x has a rational weight

x

w x e x p x w a is one that allocates a resource to a

task x

for exactly x e time units in each interval x p k x p

k for all k N

We de ne a notion of proportionate progress called P fairness and use it to design an

e cient algorithm which solves the periodic scheduling problem

Keywords Euclid s algorithm fairness network ow periodic scheduling re

source allocation

This research was supported by NSF Research Initiation Award CCR and Texas Advanced

Research Program TARP

puter Science University of

Award Contact author Prof Greg

Texas at Austin Taylor Hall Austin Texas

Plaxton Department of Com

Telephone

FAX Email plaxton cs utexas edu

Introduction

Sc heduling is the act of assigning resources to activities or tasks Scheduling problems

typically involve a set of constraints e g deadlines that must be met by any schedule

Often these constraints are designed to enforce

some notion of fairness for example a very

weak fairness constraint might be that any task

will eventually get to use the resource it has

requested For

any particular set of constraints there

are two problems to be addressed i

the

decision problem i e determining whether or

not a given instance is

feasible and

ii

the scheduling problem i e actually constructing the schedule for a

given

feasible

instance Many sets of constraints result in an intractable decision problem

 

The p eriodic scheduling problem was rst discussed by Liu in Given a

set of n

tasks and m resources where each task

a periodic schedule is one that allocates

x has rational weight x w x e x p x w

a

resource to a task x for exactly x e time units or

slots

in

each interval x p k x p k

for all

k N

Scheduling decisions may be made

only

at

integral times and a task may use

either

zero or one resources at a time

We might also consider a relaxed version

of the periodic scheduling problem in which

tasks are not restricted to using zero or one resources at a time Consider for example

allowing resource sharing that is in each unit of time a task may use a fraction f of a

resource f If n x w m the following straightforward resource sharing

x

algorithm may be used to solve this relaxed version

of the problem Allocate a fraction x w

of a resource to each task during each time unit A

second relaxed version requires integral

resource usage but allows a task to

with arbitrary concurrency In this

to single resource scheduling

use more than one resource at a time that is to run

version multiple resource scheduling is easily reduced

There are several optimal single resource scheduling algorithms for the periodic schedul

ing problem The Earliest Deadline

algorithm of Liu and Layland is one example None

of them extends directly to multiple

resources As Liu pointed out the simple fact that a

task can use only one resource even

when several resources are free at the same time

adds

a surprising amount of di culty to the scheduling of multiple resources

The decision problem has an

e cient solution Clearly systems in which n x w

x

m

cannot be scheduled If resource sharing is allowed those in which n x w m can be

x

scheduled by the resource sharing algorithm mentioned above Baruah Howell and Rosier

used this fact the network reduction of Horn and the Ford Fulkerson algorithm to

show that there are solutions to the periodic scheduling problem Thus the decision problem

for such a periodic task system reduces to

to that of Baruah Howell and Rosier will

checking that n

x

x w m A method similar

be used in Section

A more general form of the problem

characterizes each task x by four parameters x s

x e x d and x p commonly referred

to

as starting time execution requirement deadline

and period respectively Here a task

x must receive exactly x e units of the resource in the

time interval x s x p k x s x p k x d

for all k N Leung s application of the Least

Slack algorithm to this problem represents a recent improvement

on Earliest Deadline

for the case where scheduling decisions are not required to occur at integer time instants

Leung was able to show that Least Slack schedules all instances that can be scheduled by

Earliest Deadline as well as some instances that Earliest Deadline cannot schedule Both

are optimal for sc heduling a single resource but not for multiple resources in fact there is no

known optimal algorithm for this problem Our model may be viewed as a four parameter

model in which for all x x s and x d x p The general four parameter model will not

be addressed here

Given a feasible instance of the periodic scheduling problem a sche dule generation al

gorithm performs a possibly empty pre processing phase followed by an in nite execution

phase No output is produced during the pre processing phase During the execution

phase

the algorithm produces an

in nite sequence of outputs h X i i i where X i is the

subset

of up to m tasks scheduled

i e assigned one copy of the resource in slot i Note that any

output free pre x of the computation may be designated as the pre processing phase

Let

t i denote the elapsed running time in

the usual RAM model between the beginning of the

execution phase and the time at which

output X i is produced i Also let t Then

for any schedule generation algorithm A we de ne the per slot time complexity of A as the

maximum over all feasible instances and over all i of t i t i We further de ne the pre

processing time complexity of A as the maximum running time of the pre processing phase

over all feasible instances A schedule generation algorithm is polynomial time if and only if

both the per slot time complexity and the pre processing time complexity are polynomial in

the input size Prior to this paper no polynomial time schedule generation algorithm was

known for the periodic scheduling problem

Because all

algorithms for

of the scheduling algorithms considered in this paper are

the sake of brevity we hereafter use the term scheduling

schedule generation

algorithm to mean

schedule generation algorithm Furthermore because the scheduling algorithm that we

consider has an empty pre processing phase i e

pre processing time complexity we will

focus our attention on slot time complexity Accordingly throughout the paper every

time

bound given for a scheduling algorithm should be assumed to be a bound on

the slot

time

complexity

We solve the periodic scheduling problem by imposing an even stronger

fairness con

straint Our approach is based on maintaining proportionate progress each task is sched

uled resources in proportion to its weight Speci cally at every time t a task x must have

been scheduled either bx w tc or dx w te times We call this proportionate fairness or

P fairness P fairness is a strictly stronger condition than periodic scheduling in that any

P fair schedule is periodic while the converse is not generally true P fairness is a natural

and

desirable notion in certain practical applications To the best of our knowledge none of the

scheduling algorithms currently known generate P fair schedules even in the case of a single

resource We prove that any periodic scheduling problem instance for which n

x

x w m

has a P fair schedule This proof makes use of certain results from network ow theory

We then describe and prove correct a polynomial time

a P fair schedule for any feasible instance Since every

algorithm solves the periodic scheduling problem

scheduling algorithm that generates

P fair

schedule is also periodic this

We consider the research described here to be signi cant for several reasons First we

introduce a new and potentially important notion of fairness in resource sharing prove that

this notion of fairness is actually achievable and demonstrate its practical applicability

Second as a corollary to our main results we

solve the periodic scheduling problem

The remainder of this paper is organized as follows Section de nes P fairness and

some related concepts and gives examples of practical applications of P fairness Section

establishes that P fair schedules exist for the periodic scheduling problem The algorithm

corresponding to the proof has exponential time complexity however Section

proves the

correctness of a simple algorithm for producing such P fair schedules The naive

implemen

tation of that algorithm

an example execution of

schedules each slot

our algorithm on a

in pseudo polynomial time Section presents

particular input instance Section proves the

correctness of a polynomial time implementation Section o ers some concluding remarks

P Fairness

This section de nes P fairness and some related concepts We start with some conventions

Scheduling decisions occur at integral values of time numbered from The real

interval between time

as slot t t N

t and time t including t excluding t will be referred to

For integers a and b let a b fa b g Furthermore let a b a b

a b a b and a b a b

We will consider an instance

of

the fair resource sharing problem with m resources

and n tasks Speci c tasks will be denoted

by identi ers x and y which range over

the set of all tasks

Each task x has an integer period x p x p

an integer execution requirement x e

x e x p and a

loss of generality we

rational weight x w x e x p Note that x w Without

con ne our attention

to the case where x x w m

Let i denote the ith symbol of string i

N

Now some de nitions

A schedule S for instance is a function from N to f g where x S x t m

t N Informally S x t if and only if task x is scheduled in slot t

A schedule S is periodic if and only if

i x i N x t x p i S x t x e i

The lag of a task x at time t with respect to schedule S denoted lag S x t is de ned

by

lag S x t x w t i t S x i

A

schedule S is P fair if and only if

x t x t N

lag S x t

A schedule S is P fair at time t if and only if there exists

a P fair schedule S such that

x x lag S x t lag S x t

Informally lag S x t measures the di erence between the number of resource allocations

that task x should have received in the set of slots t and the

received

Periodic schedules can also be

S is periodic if and only if

de ned in terms of lag constraints

number that it actually

In particular a schedule

i x i N x lag

S x x p i

from which it follows that every P fair schedule is periodic Note that in

the de nition of

lag the term x w t is independent of S and the term i t S x i is an integer

P fairness

is a very strict requirement It demands that the

absolute value of the di erence

between the expected allocation and the actual allocation to every task always be strictly

less than In other words a task never gets an entire slot ahead or behind In general it

is not

possible to guarantee a smaller variation in lag Consider n identical tasks sharing a

single

resource where the weight of each task is n For n su ciently large we can make

the lag of the rst resp last task scheduled come arbitrarily close to resp

P fairness is the natural notion of fairness

are two examples

for many resource allocation problems Here

Example An airline has m airplanes and n ight crews n m all of which are based in

the same city Assume that exactly m ight

crews are scheduled to work on

any given day

Due to seniority job performance or other

factors it may be desirable to

schedule some

ight crews more often than others For each ight crew x set x w to the desired fraction

of all days that x should work while ensuring that x x w m

A P fair scheduler will

produce a schedule in which every ight crew works at a steady rate after t days ight crew

x will have worked either bx w tc or dx w te days

Example Consider a node in a real time communications

network with a number of

incoming and outgoing edges The weight x w on an edge x corresponds to the relative

amount of tra c expected on that edge A P fairness requirement may be necessary to

maintain the real time nature

of the communications and to prevent exceptionally long

queueing delays from building up

along certain edges

To see how the concepts of lag

and P fairness arise within our as yet unde ned schedul

ing algorithm for the periodic scheduling problem the reader may now wish to brie y ex

amine Section before continuing with Section

Existence of a P Fair Schedule

In Sections and we will develop a polynomial time P fair scheduling algorithm The proof

of correctness of that algorithm relies on the existence of a P fair

schedule

for the resource

sharing problem In this section we use a network ow argument

to prove

the existence of

such a P fair schedule In principle the network reduction could itself serve as the basis

for a P fair scheduling algorithm Unfortunately the size of the network generated by our

reduction

is exponential in the size of the given scheduling instance and so the network

reduction

argument does not by itself provide a polynomial time algorithm

With respect to instance of the resource scheduling problem let ea rliest x j resp

latest x j denote the earliest resp latest slot during which task x may be scheduled

for

the j th time j N

in any P fair schedule We can easily derive closed form expressions

for

earliest x j

and latest x j Note that earliest x j min t t N x w

t j

and latest x j max t t N x w t j

Hence

earliest x j bj x w c and

 

latest x j d

j

x w e

Note that earliest x j

latest x j x j

N Furthermore earliest x j latest x j

is either or In other

words there is at most one slot where either the j th or the j

st

scheduling of task x may occur

The remainder of this section is devoted to proving the existence of a P fair schedule

for

any

instance of the resource sharing problem Our proof strategy is as

follows First we

will

describe a reduction from instance to a weighted digraph G with a

designated source

and

sink such that certain ows in G correspond exactly

in a manner that will be

made

precise to a P fair schedule for Then we will prove the

existence of such a ow

in

G

Throughout this section

L lcm x x p

let L denote the

Lemma Instance has

a P fair schedule

that

x t x t L

least common multiple of the task

periods

if and only if there exists a schedule S such

lag S x t

Proof An in nite P fair schedule S may be obtained from S by scheduling in slot t those

tasks scheduled by S in slot t mod L

Theorem Instance has a P fair

S in slot t mod L Theorem Instance has a P fair schedule Before proving this

schedule

Before proving this theorem we will present some de nitions and an important lemma

Recall that x w x e x p We

describe below the

construction of a weighted digraph G

The vertex set V of G is the union

of disjoint sets of

of G is the union of disjoint sets of edges E E

vertices V V and the edge set E

where E i is a subset of V i V i N

i That is G is a layered graph with all edges

connecting vertices in adjacent

layers The sets of vertices are as follows

V fsourceg

V fh xi j x g

V fh x j i j x j x w L g

V fh x ti j x t L g

V fh ti j t L g and

V fsinkg

An edge is represented by a tuple For u v V and w N the tuple u v w E

represents an edge from u to

v of capacity w The sets of edges in G are as follows

E f source h xi x w L j x g

E f h xi h x j i j x j x w L g

E f h x j i h x ti j x

j x w L t earliest x j latest x j

g

E f h x ti h ti j x t L g and

E f h ti sink m j t L g

Lemma

If there is an integral ow of size m L in G then there exists a P fair schedule

for

Proof By Lemma it su ces to prove that the existence of an integral ow of size

m L in G implies the existence of a schedule

S for such that

x t x t L lag S x t

Suppose there

is an integral ow of

size m L in G The total

capacity of E the set of

edges leading out of the source vertex is equal to x x w L m L Hence each edge

in E is lled to capacity and each vertex h xi receives exactly x w L units of ow Since

there are x w L vertices in V each connected by an edge of unit capacity to vertex h xi

and no two vertices in V are connected to the same vertex in V it follows that each vertex

in V receives a unit ow Accordingly each vertex in V sends a unit ow to some

V

We will construct the desired schedule S

from the given ow

according to the

vertex in

following

rule Allocate a resource to task x in slot t if and only if there is a unit ow from vertex

h x j i to vertex h x ti

Because the total ow into the sink vertex is m L each of the L edges of capacity m in

E

carries m units of ow Hence for all

from vertices in V Each vertex h x ti

t L vertex h ti receives exactly m unit ows

in V is connected by an edge of unit capacity

to

vertex h ti and is not connected to any other vertex in V Thus S schedules exactly m

tasks in each time slot t for

observe that for each task x

all t L To see that no

lag constraints are violated by S

and for all j x w L the j

th scheduling of task x occurs

at a slot in the interval earliest x j latest x j The j th scheduling corresponds to the

unique

unit

ow out of vertex h x j i

unique unit ow out of vertex h x j i

We

will now show the existence of an integral ow

Proof of Theorem Since all edges of the graph have integral capacity if there is a

fractional ow of size m L in the graph then there is an integral ow of that size It

remains to be shown that such a fractional ow exists We use

the following ow assignments

Each

edge

source h xi x w L E carries a ow of

x w L

Each

edge

h

xi h

x j i E carries a unit ow

Each

edge

h

x ti

h ti E carries a ow of size x w

Eac h edge h t i sink m

The ows through edges

Each edge h x j i

E carries a ow of size m

in E are as follows

h x earliest x j i carries a ow of size

x w j

x w bj x wc

which is less than the capacity of

the edge

Each edge h x j i h x latest x j i such that latest x j earliest

carries a ow of size

j x w b j x w c

x j

which

is also less than

the capacity of the edge

Every

other edge h x j i h x ti

E carries a ow of size x w

We will now prove that the ow just de ned is a valid ow of size m L The capacity

constraints

have been met The ow out of the source vertex is

x x w L m L We

will now complete the proof

by showing that ow is conserved at every interior vertex

The ow into each vertex in V is x w L and there are

x w L edges leaving each carrying

a unit ow The ow into each vertex in V is Below we will prove that the ow out of

each vertex in V is

and that the ow into each vertex in

V is x w Each vertex in V has

only one

outgoing edge carrying a ow of x w Each vertex

in V has n incoming edges each

carrying

a ow of size x w since x x w m the

ow in is

m which equals the ow out

on the one outgoing edge

It remains to prove that i

the ow out of each

vertex in

V is and ii the ow into

each vertex in V is x w

For i consider an arbitrary

vertex h x j i in V There

are latest

x j earliest x j

or d j x w e bj x w c outgoing edges from h x j i If earliest x j latest x j

equivalently d j

x w e b

j x w c then the ow

out of h x j i is

x

w j x w

bj x w c x w d j x w e bj x w c

j x w b j x w c

which simpli es to Otherwise earliest x j latest x j equivalently d j

x w e b j x w c j x w and the ow out of h x j i is

x

w j x w bj

x w c x w d j

x w e bj

x w c

which also simpli es to

 

For ii consider an arbitrary vertex h x ti in

V If t latest x j

earliest x j

for some j

N then there are two incoming

edges to h x ti namely h x j i h x ti

and h x j i h x ti These

edges carry ows of size j x w

b j x w c and

x w j x w b j x w c

respectively for a total incoming ow

of x w Otherwise

there is only one

incoming edge to h x ti and

it carries a ow of x w

ow of x w Otherwise there is only one incoming edge to h x t i

A P Fair Scheduling Algorithm

In this section we present our scheduling algorithm Algorithm PF and prove that it pro

duces a P fair schedule Algorithm PF has the following high level structure At each time

t a dynamic priority is assigned to each task and the m highest priority tasks are

scheduled in slot t ties are broken arbitrarily An example execution of our scheduling

algorithm is presented in Section The reader may wish to brie y examine that example

before continuing with

the formal presentation that follows

First some de nitions

The char acteristic string of task x denoted x is an in nite string over f g

with

t x sign x w t bx w tc t N

The characteristic substring of task x at time t is the nite string

x t t x t x t x

where t min i i t i x

With respect to P fair schedule S at time t we say that task x is

ahead if and only if

lag S x t task x is behind if and only

only if it is neither ahead nor behind

if lag S x t task x is punctual if and

With respect to P fair schedule S at time t we say that task x is tnegru if and only

if x is ahead and t x task x is urgent if and only if x is behind and t x

task x is contending if and only if it is neither tnegru nor urgent

Lemmas to provide the logical machinery that we will need in order

about the terms introduced above

to reason

Lemma If task x is ahead at time t under P fair schedule S then

a If

b If

c If

d If

t

t

t

t

x

then S x t

and task x is ahead at time t

x

then S x t

and task x is punctual at time t

x

and S

x

t

then

task

x

is

ahead at time t

x

and S

x t

then

task

x

is

behind at time

t

Proof Assuming that task x is ahead at time t under P fair schedule S we have

i t S

i t S

x i

x i

dx w te where x w t N hence dx w te bx w tc and bx w tc

We now deal with each part in turn For Part a we have

t x i t S x i dx w te

x w t bx w tc i t S x i dx w te

x w t i t S x i

lag S x t S x t

Because sc hedule S is P fair lag S x t

and the inequality lag S x t S x t

implies

that S x t Hence lag

S x