Pinwheel Scheduling with
Shun-Shii Lin
Dept. of Information and Computer Education, National Taiwan Normal University, Taipei,
Taiwan, R.O.C.
Abstract
Given a multiset of positive integers A = { a l , a2,
...,
an }, the pinwheel problem i s to find an infinite sequence over { I , 2 , ..., n } such that there is at least one symbol i within any subsequence of length ai. The density of A is defined as p ( A ) = ( l l a i ) . In this paper, we limit ourselves to instances composed of three distinct integers. Currently, the best scheduler [SI can schedule such instances with a density less than 0.77. A new and fast scheduling scheme based on spectrum partitioning is proposed in this paper which improves the 0.77 result to a new 516 = 0.83 density threshold.This scheduler has achieved the exact theoretical bound of this problem.
n i=l
1:
IntroductionTwo scheduling models have been commonly used in real-time systems: the cyclic executive (CE) model [ 11 and the fixed priority (Fp) model [9] [lo]. Using the cyclic executive model, applications are divided into a sequence of non-preemptible tasks. Tasks are activated in a fixed order as set in a pre-defined cyclic schedule. In this way, the system has a very deterministic behavior in terms of when and how long each task is executed.
However, since the schedule is fixed, it is very difficult for systems to be fault-tolerant to dynamic failures or unexpected overloads (needing extra execution time).
Using the fixed priority model, a system is implemented as a set of periodic preemptible tasks. The
*supported in part by contracts from the U.S. Navy Office of Naval Research N00014-89-J-1181, NOOOl4-921-1146. and from the NSF CCR-89-11773. This work was done while S.- S. Lin was visiting the University of Illinois at Urbana- Champaign.
Three Distinct N u m b e d
Kwei-Jay Lin
Dept. of Electrical and Computer Engineering University of California, Irvine,
CA 92717, U.S.A.
period of each task is fixed and thus its priority is fixed as well. The execution of a task in one period is independent of the execution of the same task in another period. Moreover, whenever another task with a higher priority is available for execution, the task being executed must be preempted unless it is holding some special resources [ 1 11. Therefore, the response time of a lower priority task at each period depends on if and when some higher priority tasks arrive and are executed. This may cause jitters in low priority tasks: i.e. a task may be executed at different times (relative to the beginning of the period) in each period. If the task produces outputs, we may find that the output timing has irregular patterns. For dependable systems, jitters can make a synchronous system to behave like an asynchronous system and invalidate many system assumptions.
In [6], Han and Lin describe a new scheduling model, called the temporal distance constrained (DC) task model, for real-time periodic tasks and show how this model responds to unexpected events and reduces jitters.
In the DC model, the distance between any two consecutive finishing times of a task must be less than or equal to a certain value. A real-life DC example is the automobile maintenance schedule. Suppose a car needs to have its engine oil changed every 6 months. If the last oil change was done in January, the next oil change must be completed before July. Using the periodic task model to schedule the oil changes with a period of 6 months, it is possible to have one oil change in January but the next one in December. Although there is exactly one oil change in every 6-month period, the actual temporal distance between the two oil changes will be 11 months, rather than 6 months. One way to guarantee the maximum 6-month distance to satisfy the DC requirement is to specify a 3-month period. But this would produce a schedule in which tasks are executed twice as often as necessary. Using the DC scheduling algorithms can reduce such a waste of resources [51 [61.
One of the issues in adopting the DC model is the difficulty in scheduling tasks with different distance
constraints. Many such problems have been shown to be NP-complete [5]. However, we have applied the pinwheel scheduling algorithms [21 [31 171 181 to periodic DC tasks. Earlier techniques [61 transform a set of arbitrary distance constraints into another set which has smaller but harmonic (all numbers are multiples of some base number) distance constraints. Using this approach, tasks can be scheduled as in the fixed priority model at run time, yet the task execution schedule is static and has no jitters as in the fixed priority model. In this paper, we describe another technique which uses the spectrum technique to partition the time slots into execution slots for each task. Using both pinwheel approaches to schedule real-time tasks, we can guarantee that tasks are always executed with a temporal distance less than a desired bound. This makes dependable systems more predictable and have shorter recovery times.
Given a multiset of positive integers A = ( a l , a2,
...,
an ), the pinwheel problem is to find an infinite sequence over ( 1, 2,...,
n ) such that there is at least one symbol i within any subsequence of length ai. The density of A is defined as p(A) = (l/ai). In this paper, we limit ourselves to instances composed of three distinct integers. Currently, the best scheduler [6] can schedule such instances with a density less than 0.77. A new and fast scheduling scheme based on spectrum partitioning is proposed in this paper which improves the 0.77 result to a new 5/6 = 0.83 density threshold.This scheduler has achieved the exact theoretical bound of this problem.
Clearly, if the density p(A) > 1, then A can not be scheduled. That is, there doesn’t exist an acceptable schedule for A. However, this condition is only necessary but not sufficient. For example, the instance A= ( 2, 3, x ) for any arbitrary x can not be scheduled although its total density can be as close to 5/6 = 0.83 as possible. From this example, Chan and Chin [2]
conjecture that any instance with density less than or equal to 5/6 can be scheduled. Unfortunately, up to now, no one can prove or disprove this conjecture. In this paper, we will give some results to support this conjecture. In 171, Holte et. al. have shown that instances with densities 20.5 can be scheduled. Since then, this 0.5 density was pushed up to 2/3 [21 and 0.7 [3]. Because there exists a density bound 5/6 in the general instances of pinwheel problem with 3 or more distinct numbers, Holte et. al. [81 limit themselves to instances in which A contains elements having only two distinct values.
They proved that all such instances with density 5 1 can be scheduled. Recently, Han and Lin [6] have used the pinwheel algorithms to schedule the distance-constrained
It
i=l
hard real-time tasks. From their work, the pinwheel instances A with density p(A) 5 m(
% -
1) can always be scheduled, where A contains elements having only m distinct values. Form = 2, p(A) 50.83; Form = 3, p(A) 20.77; For large m, p(A) 50.69.In this paper, we limit ourselves to instances composed of three distinct integers. An example is A = [ 6 , 6 , 15, 15, 15, 15, 19, 19, 19 ). We can represent it as an ordered 6-tuple ( t l , m l , t2, m2, ‘3, m3 ) = ( 6, 2, 15, 4, 19, 3 ), where t l , ‘2, and t3 are the distinct numbers of A and m l . m2, and m3 specify the numbers of Occurrences of each. The limitation to only three distinct numbers leads to useful and complete results.
Furthermore, the 5/6 bound we achieved points out a possible road to the proof of 5/6 density bound for the general pinwheel problem. Now we can conjecture, with more theoretical supports than [3], that all pinwheel instances with density less than or equal to 516 can be scheduled.
2: Preliminaries
Let a be a positive real number. Define Spec( k, a )
= LkaJ. The spectrum of a is an infinite set of integers [41
S(a) = { Spec( k, a ) I k = 1, 2,
...
)= { La], L2a1, L3aJ,
... 1.
Let us define Specl( k,
p
) = rkpl-1 and Sl(p) = ( Specl( k,p
) I k = 1,2,...
)= { rpi-1, r2pi-1, r3pi-1, ...
to be a variation of the spectrum. Define Spec2(k,a,p) = LLkaJpJ,
Spec3( k,a,P) = L[kal-l)pJ, and S2(a,P)={ Spe~2( k, a,
p
) I k= 1,2, ...)={LLaJpJ,
LL2aJpJ, LL3aJpJ,... 1,
={L[al-l>pl, L(f2al-l)p], L[3a1-l>pJ,
...
).S3(a,p) = ( Spec3(k,a,P) I k = 1,2,
...
)In this paper, we will use a notation which encloses a true-or-false statement in brackets, and says that the result is 1 if the statement is true, 0 if the statement is false. For example,
1,
ifx> 0;
0,
i f x I0.
[ x > O ] = {
3: Scheduler Pinwheel3
Assume the input instance is a 6-tuple ( t l , ml, t2, m2, t3, m3 ) and, without loss of generality, the following properties are held: (1) ti and mi are positive integers, i = 1,2, 3; (2) m l / t l 2 m2/t2 2 m3/t3; and (3)
n 1=1
p ( ~ ) = (I/ai) = ml/t1
+
m2/t2+
m3/t3 I 1. In this paper, we show that if the density p(A) I 5/6, then A can always be scheduled by PinwheeD. On the other hand, if 1 2 p(A) > 5/6, it still has a great chance to be scheduled by P i n w h e e l 3 although there is no guarantee.Scheduler Pinwheel3(tl, ml, t2, m2, ‘3, m3) 1 y t Lt2(1-ml/tl)J/ m2
2 if y l 1 then begin 3
4
5 y t Lt2(1-ml/tl)J/ m2
6 end
7 if y I l then
8 output “not schedulable”
9 e l s e 10 begin
12 if d > t3 then
13 output “not schedulable”
14 e l s e 15 begin
16 Z + y/(y-l) 17
18 19
swap the values of t l and t2 swap the values of m l and m2
11 d t
r
rm3/(1-1/~)1/ (l-ml/tl)lgenerate schedules S1, S2, and S3 Sl(tl/ml) = ( Specl( k, tl/ml ) I k = 1,
represented as:
2,
...
) = ( rktl/mll-i I k = i , 2 ,...
) tl/(tl-ml) ) I k = 1,2,...
) = ( LLkyJtl/(tl-ml)l I k = 1,2,... 1
S3( z, tl/(tl-m1>) = ( Spec3( k, z, tl/(tl-ml) ) I k = 1.2,
...
) =( L[kzl-l)tl/(tl-ml)l I k = 1,2,
...
)S2( y, tl/(tl-ml)> = ( SPeC2( k. y,
20
21 end 22 end.
Example. Consider A = ( 3, 15, 15, 15, 15, 15, 15, 15, 16 ). The 6-tuple ( t l , m l , t2, m2, t3, m3 ) = ( 15, 7, 3, 1, 16, 1 ). Note that we have reordered it such that the assumption m l / t l 2 mdt2 2 m3/t3 is satisfied. This exam le has density 0.8625. In Line 1 of PinwheeU, y t e t 2 ( l - m l / t l ) l / m2 = L3(1-7/15)1/ 1 = 1. Hence in Lines 3 and 4, we swap the values of t l and t2, and swap the values of m l and m2. That is, the new 6-tuple ( t l , m l ,
9,
m2, ‘3, m3 ) = ( 3, 1, 15, 7, 16, 1 ). In Line 5, the new value of y t Lt2(1-ml/tl)l/ m2 = 10/7. Then in Line 11, d tr
rm3/(1-1/y)l/ (l-ml/tl)l= 6. Since d c t3 = 16, the program goes to Line 16. Where z ty/(y-1) = 10/3. In Line 18, we have S1(3/1) = ( Specl(
k, 3/1 ) I k = 1, 2,
...
) = ( 3k-1 I k = 1,2,...
) = ( 2, 5, 8, 11, 14, 17,...
).Now in Line 19, S2( y, tl/(ti-ml)) = ( 1, 3, 6, 7,
...
). Since t2 = 15, m2 = 7 means there are 7 “cars”which have the same service interval. ( i.e. 15 time units ) Therefore, we can partition the set S1 evenly for these 7 “cars”. The service schedule for the fmt car is therefore easily derived as ( LLlOk/7]1.51 I k = 1,8, 15,22,
...
)= ( 1, 16, 31,
...
). The service schedule for the second car is therefore ( LL10k/711.51 I k = 2.9, 16.23,...
) = ( 3, 18,...
). And so on. In Line 20, S3( z, tl/(tl-ml))= S3( 10/3, 1.5) = ( L[lOk/31-1)1.5J 1 k = 1,2,
...
) = ( Theorem 1: The spectra S1, S2, and S3 produced by Scheduler Pinwheel3 do partition the integer set ( 1,2, Proof: To prove this assertion, we will count how many of the elements of S1 are I n, how many of the elements of S2 are I n, and how many of the elements of S3 are I n. We will show that the total is n, for each n. Let N(i, n) denote the number of elements in Si that are I n, i = 1,2, 3.4, 9, 13, 19,
...
).3,
...
).I
= [ ktl/m1 I n
+
1 1 k>O=E
[ O c k I (n+
l ) m l / t l ] = L(n+ k
Since y and z are positive, 1)m l/tlJ.
N(2, n) =
c
[ ukyhl/(tl-ml)J I n1
k>O=
C
[o
k I r(n+
l)(l-ml/tl)l/ zI k
=
L
r(n+i)(i-ml/tl)l / z1.
Let j = r(n+i)(l-ml/tl)l. Since z = y/(y-l), we have N(2, n)
+
N(3, n) = rj/yl+ Lj/zl - 1= rj/yl- 1
+
Lj-j/yJ.Now, if j/y is an integer, then j-j/y is also an integer. If j/y is not an integer, then neither is j-j/y. Let us consider these two cases.
Case I: If j/y is an integer, then
N(2, n)
+
N(3, n) = rj/yl- 1+
Lj-j/yJ= j/y -1
+
j-
j/y = j-
1.N(2, n) + N(3, n) = r./yl- 1 + Lj-j/yJ
= rj/yl- 1
+
j -f
j/yl = j-
1.In the above analyses, we have observed that Case 11: If j/y is not an integer, then
N(2, n)
+
N(3, n) = j - 1 = r(n+l)(l-ml/tl)l- 1.N(l, n)
+
N(2, n)+
N(3, n) = L(n+
I)ml/tlJ Now,+ r(n+i)(i-ml/tl)l - 1
= L(n
+
I)ml/tlJ+
T-(n+i)ml/tll+ n = n.Since the total N(l, n)
+
N(2, n)+
N(3, n) is n, for each n, the three spectra S1, S2, and S3 do indeed partition the integers. This is right because exactly one of the counts must increase when n increases by 1. In other words, it satisfies the following properties:(i) Given any positive integer j, j can only be found in exactly one of S1, S2, or S3. That is, j can not exist simultaneously in more than one spectrum. This can be proved by contradiction. Since N(1, j)
+
N(2, j)+
N(3, j)= j, if j exists simultaneously in any two spectra, then N(l, j-1)
+
N(2, j-1)+
N(3, j-1) = N(1, j)+
N(2, j)+
N(3, j) - 2 = j - 2. This is a contradiction to the condition N(l, n)
+
N(2, n)+
N(3, n) = n for all n.Similarly, if j exists simultaneously in S1, S2, and S3, then N(1,j-1)
+
N(2,J-1)+
N(3, j-1) = N(l, j)+
N(2, j)+
N(3, j)-
3 = j - 3, also a contradiction.(ii) Given any positive integer j, j can only exist no more than once in any spectrum. This can be proved as follows. If any spectrum contains m j ’ s , then
j-1 = N(l, j-1)
+
N(2, j-1)+
N(3, j-1)= N(1, j)
+
N(2, j)+
N(3, j) - m = j - m.Therefore, these three spectra do indeed partition the Theorem 2: The spectra S1, S2, and S3 produced by Scheduler Pinwheel3 will satisfy the following distance constraints for all k = 1,2,3, ... .
d l = Specl&+ml,tl/ml) - Specl(k, tl/ml) I t l , d2 = Spec2&+m29y9 tl/(tl-ml)) -
This equation implies that m = 1.
integers.
I
Spec2&, Y, tl/(tl-ml)) 5 t2, and d3 = Spec3&+m3, z, t1/(tl-ml))
-
Specl&, z, t1/(t1-m1)) 2 ‘3.
Proof The distance constraints for S1 can be easily proved as follows.
d l = Specl(k+ml, tl/ml) - Spec@, tl/m1)
For the distance constraints of S2, since LrJ
-
LsJ I rr-sl for any real r and s, and y = Lt2(l-m l/tl)J / m2, we find= (
r@
+ ml)tl/mll-l)-
( Tktl/mll-i = tl.d2 = Spec2(k+m2, Y. q/(t1-m1)) - Spec2(k, Y, tl/(tl-ml)) Tm2~1+ rrm2~lm1/(tl-m1)1 I rt2(i-m l/tl)tl/(tl-m 1)1= t2.
=
LL<k
+ m2)yJtl/(tl-m1)J - LLkyJtl/(tl-ml)JNow we prove the distance constraints for S3 with some effort. Since rrl
-
Tsl I Tr-sl and LrJ-
LsJ I rr-sl for any real rand s, and z = y/(y-l),d3 = Spec3(k+m3, z, t1/(t1-m1)) - Spec3@, z, tl/(tl-ml))
2 m3 + Tm3/(y-i)1 + T(m3
=
T
Tm3/(i-i/y)l (l-ml/tl)l (3.1) + Tm3/(y-~bm l/(tl-m 111= d.
The formula (3.1) indeed is the one shown in Line 11 of Scheduler PinwheeW. Because we have checked the condition “d > t3“ in Line 12. Therefore, the spectra S1. S2, and S3 can only be produced when d3 2
r
rm3/(1-1/y)l/ (l-ml/tl)l= d I t 3 . This completes our Theorem 3: The spectra S1, S2, and S3 produced by Scheduler Pinwheel3 are correct. The running time of Pinwheel3 is O(1).
Proof: The correctness is derived in both Theorem 1 and Theorem 2. Since the spectra S1, S2, and S3 can be easily represented as their associated spectrum functions, Specl, Spec2, and Spec3, respectively with constant proof.
parameters. So, its running time is O( 1).
U
4: Density bound analysis
In Section 3, we have presented a novel scheduler Pinwheel3 for solving pinwheel instances with three distinct numbers. We have proved that, if Pinwheel3 can produce the spectra S1, S2, and S3, the results will be correct. Now, a more difficult question arises: “When will it succeed ( or fail ) to produce a schedule?” The main difficulty lies with the analysis of the density threshold of the scheduler. Consider the instance A = [ 2, 3, x ) for any arbitrary x 2 6. It can not be scheduled by any scheduler although its total density is as close to 516 as possible. Therefore, Scheduler Pinwheel3 can not guarantee to schedule instances with a density greater than 5/6. In this section, we are able to prove that Scheduler Pinwheel3 can always schedule instances with density I 5/6. This achieves the exact bound of the pinwheel problem with three distinct numbers.
Theorem 4: Any pinwheel instance with three distinct numbers and with density I 5/6 can always be scheduled by Scheduler Pinwheel3.
Proof: A closer look at Scheduler Pinwheel3 shows that if y > 1 in Line 7 and d I t3 in Line 12, then Pinwheel3 will always generate three spectra S1, S2, and S3 with correct results as proved in Theorems 1, 2, and 3. So, in the following, we will prove that if p(A) I 5/6, then y will be greater than 1 in Line 7 and d will be less than or equal to t3 in Line 12. Without loss of generality, we assume the input is ordered such that m l / t l 2 m2/t2 2 m3/t3, where ti and mi are positive integers, i = 1, 2, 3. Furthermore, we assume p(A) = (l/ai) = m l / t l
+
m2/t2+
m3/t3 I 5/6. In Line 2,n
i=l
y equals to Lt2(1-my/tl)J/ m2. If y > 1, it will never need to run Lines 3 to 9. Otherwise, it will swap the values of t l and t2, swap the values of m l and m2, and recompute the value of y again in Line 5. At first, we analyze the properties of y.
Let g = t (l-m1/tl)/m2. Since m2 2 1 and y = t3/m3 2 t2/m2 = g/(l-ml/tl) 2 y/(l-ml/tl). So, t3 2 m3y/(l-ml/tl). Because t3 is an integer, t3 2 rm3y/(1- ml/tl)l. According to the values of g and ml/tl, there are four cases tobeanalyzed.
Case I: If 2 2. In this case, y 2
L J
2 2 and, by (3.1), Lt2(1-ml/tl)1
/ m2 = Lm2gJ / m2, LgJ I y I g. Nowd3 I r1zmy(i-i/y)l/ (l-ml/tl)
7
= dI
r
2m3 (l-ml/tl)l Ir
ym3 (l-ml/tl)l I t3.Case 11: If 1.5 I g < 2 and ml/tl < 0.5. In this case, g
= t2(1-ml/tl)/m2 < 2, so m2/t2 > 0.5
-
0.5ml/tl. Then ml/tl 2 m2/t2 > 0.5-
0.5ml/tl. Hence,Since g = t2(1-ml/tl)/m2 < 2 and ml/tl 2 mdt2, we have
and, m l / t l
+
m2/t2 > 1-
m2/t2 2 1-
m l / t l . Therefore,(4.3) By (4.2) and (4.3), 3ml/tl
+
3m2/t2 > 2, so m l / t l+
m d t 2 > 2/3. Since ml/tl
+
m2/t2+
m3/t3 I 5/6, we know m3/t3 I 5/6-
( ml/tl+
mdt2 ) < 5/6-
2/3 = 1/6.Hence, in this case,
t3 2 6m3
+
1. (4.4)Since g = t2(l-ml/tl)/m2 2 1.5 and ml/tl 2 m2/t2, we have m2/t2 I 2/3
-
(2/3)ml/tl I 2/3-
(2/3)m2/t2. So,m2/t2 I 2/5. (4.5)
By the assumption of Case 11, i.e. ml/tl < 0.5 and g = t2(l-ml/tl)/m2 < 2,
ml/tl > 1/3. (4.1)
2m2/t2
+
ml/tl > 1, (4.2)2ml/tl
+
m2/t2 > 1.mdt2 > 0.5 - 0.5ml/tl > 0.5 - 0.5*0.5
= 0.25. (4.6)
Now we consider two situations:
(a) If m2 2 2, then y = Lm2gJ / m2 2 L2*1.51/ 2 = 1.5 when m2 = 2; and y =Lm2gJ/m2 2Lm2*1.5J / m2 2 (1.5m2-0.5) / m2 = 1.5
-
0.5/m2 2 4/3 when m2 2 3.So, in this situation, y 2 4/3. By (3.1), (4.1), and (4.4), d3 I
r
rmg(i-i/y)l/ (l-ml/tl)l= ds
r
rm3/(i-3/4)1 ( l - m ) l = 6m3 < t3.(b) If m2 = 1, then t2 = 3 because, by (4.5) and (4.6), 1/4 < m2/t2 I 2/5. Furthermore, t l 2 2ml
+
1 because, by the assumption of Case 11, m /tl < 0.5. In this situation, y = Lm2gJ / m2 = Lgj = 1. Scheduler Pinwheel3 will swap the values of tl and t2 in Line 3, swap the values of m l and m2 in Line 4. That is, ( tl*,* * *
m l , t2 , m2 ) t (t2, m2, t i , m l ). Here we use the
"*"
superscript to denote the new values of t i , m l , t2, and m2. Now the new value for y in Line 5 of Scheduler Pinwheel3 will bey t Ltz*(~-ml*/tl*)J / m2*
= Ltl(l-mdtdJ / m l = Lt1(1-1/3)J / m l
= L2t1/3J / m l .
Because t l is a positive integer, L2t1/3J2 2t1/3
-
2/3.Therefore, y 2 ( 2t1/13
-
2/3 ) / m1 2 ( 2(2m1+1)/3-
2/3) / m l = 4/3. Then, by (3.1) and (4.4), d3 I r rmy(i-i&)l/ (l-ml*/tl*)l = d
I
r
rm3/(1-3/4)1/ ( i - i n ) l = 6m3 < t3.The above analyses show that y > 1 and d I t3 in case 11.
Case 111: If 1.5 I g < 2 and ml/tl 2 0.5. In this case, g = t2(1-ml/tl)/m2 < 2, so m2/t2 > 0.5
-
0.5ml/tl.Furthermore, 5/6 > ml/tl
+
m2/t2 > ml/tl+
0.5-
0.5ml/tl = 0.5
+
0.5ml/tl. Hence,Since g = t2(1-ml/tl)/m2 < 2, 2m2/t2
+
2ml/tl > 1.Then because ml/t1 2 0.5, 2m2/t2
+
2ml/tl > 1+
ml/tl 2 1.5. So m2/t2
+
ml/tl > 0.75. Now m3/t3 I 5/6-
( ml/tl+
mdt2 ) < 5/6-
0.75 = 1/12. Therefore,(4.8) There are two situations to be considered:
(a)1fm222,theny=Lm2gJ/m22L2*1.5J/2= 1.5 when m2 = 2; and y = LmZgJ / m2 2 Lm2*1.~J / m2 2 (1 3m2-0.5) / m2 = 1.5
-
0.5 / m2 2 4/3 when m2 2 3.So, in this situation, y 2 4/3. By (3.1), (4.7). and (4.8).
ml/tl < 2M. (4.7 1
t3 2 121113
+
1.d3 s
r
rmg(i-i/y)l/ (l-ml/tI)l= d Ir
hy(1-3/4)1/ (1-2~3)1= 121113 < t3.(b) If m2 = 1. Since ml/tl
+
m2/t2 < 5/6 and, by the assumption of Case 111, ml/tl 2 0.5, we haveOn the other hand, because g = t2(l-ml/tl)/m2 < 2 and m I/tl
+
m2/t2 < 5/6 , we know 2m2/t2+
ml/tl > 1 adm2/t2 < 5/6
-
ml/tl < 516-
0.5 = 1/3. (4.9)m2/t2 > 1 - ( ml/tl
+
m2/t2 ) > 1-
5/6= 1/6. (4.10)
Now t2 has only two possible values: 4 or 5 because, by (4.9) and (4.10), 1/6 < m2/t2 < 1/3. Let us analyze these two subcases denoted as (Subcase b.1) and (Subcase b.2).
(Subcase b.1) If t2 = 4, then 1/2 < ml/t1 < 7/12 because 2 > g = t2(1-ml/tl)/m2 = 4(1-m1/tl) and 5/6 >
m l / t l
+
m2/t2 = ml/tl+
1/4. Therefore, t l 2 12m1/7 +1. In this subcase, y = Lm2gJ / m2 = LgJ = 1.Scheduler Pinwheel3 will swap the values of ti and t2 in Line 3, swap the values of m l and m2 in Line 4. That is, ( tl*, ml*, t2*, m2* t (t2, m2, t i , m i
1.
NOWthe new value for y in Line 5 of Scheduler Pinwheel3 will be
y t Lt2*(1-ml*/tl*)J / m2*
= Ltl(l-m2/t2)J/ ml = L t l ( l - ~ ) J / m l
= L3t1/4J / ml.
Because t l is a positive integer, L3t1/4J 2 3114 - 3/4.
Therefore, y 2 ( 3114
-
314 ) / ml 2 ( 3(12m1/7+1)/4-
3/4 ) / ml = 9/7. Then, by (3.1) and (4.8), d3 I
r
rm3/(i-i/y)l / (l-ml*/tl*)l= dI
r
rm3/(i-7/9)l (1-1/4)1 Ir
4r4.5m31/ 31 < 121113 < t3.(Subcase b.2) If t2 = 5, then 3/5 < ml/tl c 19/30 because 2 > g = t2(1-ml/tl)/m2 = 5(1-ml/tl) and 5/6 >
ml/tl
+
m2/t2 = ml/tl+
1/5. Therefore, t l 2 30m1/19 +1. In this subcase, y = Lm2gJ / m2 = LgJ = 1.Scheduler Pinwheel3 will swap the values of t l and t2 in Line 3, swap the values of m1 and m2 in Line 4. That the new value for y in Line 5 of Scheduler Pinwheel3 will be
* *
is, ( t l , ml , t2*, m2* ) ( t 2 , m2, t l , m l ) . NOW
y t Lt2*(l-ml*/tl*)J / m2*
= Ltl(l-m2/t2)J / m l = Lt1(1-1/5)1/ m l
= L4t1/5J/ ml.
Because t l is a positive integer, L4t1/5J 2 4115 - 4/5.
Therefore, y 2 (4t1/5 - 4/5 ) / m l 2 (4(30m1/19+1)/5- 4/5 ) / ml = 24/19. Then, by (3.1) and (4.8),
d3 I
r
rm3/(i-i/y)l / (l-ml*/tl*)l= d Ir
rm3/(i-i9/24)1 ( i - m l 2r
i.25r4.8m311< 121113 c t3.The above analyses show that y > 1 and d 2 t3 in Case 111.
Case IV: Due to page limit, the proof of this case is omitted here.
All the above four cases have the same properties that the value of y in Line 7 of Pinwheel3 will be greater than 1 and d will be less than or equal to t3 in Line 12 if p(A) I 5/6. Therefore, Scheduler Pinwheel3 will execute Lines 15 to 21 to produce 3 spectra S1, S2, and S3 which are correct as proved in Theorem 3. This completes the proof.
I
5: Concluding remarks
We have presented in this paper a novel scheduler Pin wh e e 13 for scheduling pin wheel instances with three distinct numbers. It can schedule all such instances with density less than or equal to 516
--
an exact bound for this problem. From the mathematical point of view, this paper has given partial reasons and results for theconjecture [2] made by Chan and Chin: Any pinwheel instances with a density less than or equal to 516 is schedulable. Although we have gathered some important results for the pinwheel instances with three distinct numbers, more effort is needed to deal with the pinwheel instances with m distinct numbers, m 2 4. We feel that the approach used in this paper can potentially be further generalized to reach the conjectured bound of 516 for all pinwheel instances.
References
[l] T. P. Baker and A. Shaw, The cyclic executive model and Ada, Journal of Real-Time Systems, Vol. 1, No. 1, pp. 7-25, June 1989.
[2] M. Y. Chan and F. Chin, Schedulers for larger classes of pinwheel instances, Algorithmica, to appear.
[3] M. Y. Chan and F. Chin, General schedulers for the pinwheel problem based on double-integer reduction, IEEE Transactions on Computers, Vol 41, No. 6, pp. 755-768, June 1992.
[4] R. L. Graham, D. E. Knuth, and 0. Patashnik, Concrete Mathematics, Addison-Wesley publishing company, 1990.
[5] C.-C. Han and K. J. Lin, Job scheduling with temporal distance constraints, Technical Report UIUCDCS-R-89-1560, Department of Computer Science, University of Illinois at Urbana- Champaign, December 1989.
[6] C. C. Han and K. J. Lin, Scheduling distance- constrained real-time tasks, in Proc. of Real-Time Systems Symposium, pp. 300-308, December 1992.
[7] R. Holte, A. Mok, L. Rosier, I. Tulchinsky, and D.
Varvel, The pinwheel: a real-time scheduling problem, in Roc. of the 22nd Hawaii International Conference on System Science, pp. 693-702, January 1989.
[8] R. Holte, L. Rosier, I. Tulchinsky, and D. Varvel, Pinwheel scheduling with two distinct numbers, Theoretical Computer Science, to appear.
[9] C. L. Liu and J. W. Layland, Scheduling algorithms f o r multiprogramming in a hard real-time environment, Journal of ACM, Vol. 20, No. 1, pp.
46-61, January 1973.
[lo] L. Sha and J. B. Goodenough, Real-time scheduling theory and Ada, IEEE Computer, Vol. 23, No. 4, pp. 53-62, Apr. 1990.
[ l l ] L. Sha, R. Rajkumar, and J. P. Lehoczky, Priority inheritance protocol: an approach to real-time synchronization, IEEE Transactions on Computers, Vol. 39, No. 9, pp. 1175-1185, Sep. 1990.