The optimal greedy scheduling algorithm:
1. Sort penalties in non-increasing order.
2. Find tasks of independent sets: no late task in the sets.
3. Schedule tasks in a maximum independent set in order
of nondecreasing deadlines
4. Schedule other tasks (missing deadlines) at the end
arbitrarily.
Task Ni(A)=0<=1
1 2 3 4 5 6 7 Nx(A) = 1<=2
d 1 NA) =2<=3
i 4 4 4 6 N -
4A) =4<=4
wi 30 20 N5(A)=4<=5
optimal scheduling: (2, 4, 1, 3,7, 5, 6) No(A)=5<=6
penalty: 30+20 = 50
For any set of tasks 4, the following statements are equivalent.
1. The set Ais independent.
2. Fort=0, 1,2, .., m,we have N,(A) <
3. Itthe tasks in'A are scheduled in order of monotonically increasing
deaalines, then no task is late.
Proof Clearly, if Ns(A) >; t for some t, then there is no way to make a schedule with no
late tasks for Set A, because there are more than f tasks to finish before time ¢. Therefore,
(1) implies (2). 1f (2) holds, then (3) must follow: there is no way to “get stuck" when
A unit-time tasks a job, such as a program to be run on a computer, that requires
exactly one unit of time to complete. Given a finite set S of unit-time tasks, a schedule
for Sis a permutation of S specifying the order in which these tasks are to be
performed. The frst task in the schedule begins at time 0 and finishes at time 1, the
second task begins at time 1 and finishes at time 2, and so on.
The problem of scheduling unit-time tasks with deadlines and penalties for a
single processor has the following inputs:
saset S={a,, a5, —, a,} of n unit-time tasks;
"a set of integer deadlines d;, ds, .., dp, Such that each d; satisfies 1