task sets with an original density less than 0.9,
Sr
3 can schedule about 90% of the tasks schedulable bySr
b, and with original density less than 0.95,Sr
10 can schedule about 92% of tasks schedulable bySr
b. ForSr
100 in Figure 3.6, it performs almost as good asSr
b. In other words, trying any base larger than 100 will not improve the schedulable percentage signicantly at all.32
4.5 5 5.5 6 6.5 7 7.5 8 8.5 9
1 1.1 1.2 1.3 1.4 1.5 1.6
r
density function
points checked in Sxg(g=2)
Figure 3.7: Density function of
Sr
g for Example 2.1For all these reasons, we design a new scheduler
Sx
g base onSr
g.Sx
g transforms the distance constraints of all tasks to multiples of integerx
using any baseg
. The execution times and distance constraints used inSx
g can be real numbers. Moreover, the optimal schedule can be found in polynomial time.Sx
4] tests all the integers in (c
1=
2c
1] (starting from the largest one) until it nds a schedulable one. It thus takes exponential time to nd the integer with the minimum density increase. However, as will be shown in Lemma 3.3, only a subset of these numbers needs to be tested to nd the optimalx
with the minimum total density increase. Moreover, since we may use any baseg
to transform the distance constraints,x
can only be in the range ofc
1=g < x
c
1.Lemma 3.3
Ifk
gv;1< r < r
0k
gv, for somev
, 1v
u
, then gT
(r
)>
gT
(r
0).The proof of Lemma 3.3 is given in Appendix B. Lemma 3.3 shows that, for each
v
, the density function gT
in the domain (k
gv;1k
gv] is monotonically decreasing. Therefore, for eachv
, only the largest integer less thank
gvis tested when searching for the integer with the minimum total density increase. This can be done in polynomial time. Figure 3.7 shows the density function gT
for Example 2.1. Only two integers, f5 9g, need to be tested tond the optimal solution.
Sx
g appliesSr
g to nd allk
gv's and gT
(k
gv)'s. Among the largest integers less thank
gv for eachv
,Sx
g transforms the distance constraints with respect to fx
g, wherex
is the integer with the minimum gT
value. According to Lemma A.1 in Appendix A, the gT
values can be easily computed.
Sx
g works as follows.Algorithm Sx
gInput: DCTS
T
=fT
i = (e
ic
i)j 1i
n
g, wherec
ic
j 8i < j
g
is the specialization base.Output:
x
, gT
(x
), andT
0=f(e
ib
i)j 1i
n
g, whereb
ijb
j 8i < j
.1 Apply
Sr
g to get allk
gv's and gT
(k
gv)'s, for 1v
u
.2 Let (
x
g1x
g2::: x
gj) be the resulting sequence of (bk
g1c bk
g2c:::
bk
guc)3 with duplicates and
x
gik
g0 =c
1=g
removed4
i
=j
5
for v
=u downto
1do
6
if
(x
gi =k
gv)7 g
T
(x
gi) = gT
(k
gv)8
i
=i
;19
elseif
(x
gi> k
gv)10 g
T
(x
gi) = kv +1gxgi gT
(k
gv+1) // See Lemma A.1, where(xggi
) = 0.
11
i
=i
;112
endif
13 nd
x
such that gT
(x
) = minx2fxg1xg2:::xgjggT
(x
)14
for i
= 1to n do b
i=x
g
blogg(ci=x )c15 output
x
gT
(x
) andT
0:
Theorem 3.5
The time complexity of specialization operationSx
g isO
(n
logn
).Proof: It is easy to see that all steps in Algorithm
Sx
g can be done inO
(n
) time, except step 1 (applyingSr
g), which can be done inO
(n
logn
). 23.3.2 Optimal Scheduler for Integer Constraints
Similar to
Sr
b,Sx
b tests all possible bases to nd the optimal one such that the total density increase after specialization is minimized.Sx
b works as follows.34
Algorithm Sx
bInput: DCTS
T
=fT
i = (e
ic
i)j 1i
n
g, wherec
ic
j 8i < j
. Output:r
, gT
(r
), andT
0=f(e
ib
i)j 1i
n
g, whereb
ijb
j 8i < j
.1
foreach
baseg
2f2 3 5 6 7:::
bc
n=c
1cgdo
f2 apply
Sx
g using the baseg
3
if
(gT
(r
) is the minimum ever found),g
=g
4 g
5 apply
Sx
g using the baseg
6 output
g
x
gT
(x
) andT
0:
The following theorem proves the optimality of
Sx
b.Theorem 3.6
Given a distance-constrained task setT
, ifSx
b can not nd a schedule of integer distance constraints forT
then no scheduler based on the pinwheel-problem with single-number reduction can nd a schedule of integer distance constraints.Proof: We prove this theorem by contradiction. Assume some pinwheel scheduler nds a schedule for distance constraint multiset
C
= fc
ig using single-number reduction with respect tofx
gwhileSx
bcan not nd one. W.l.o.g., suppose the algorithm transformsC
into a set of distance constraints consist of solely multiplesB
=fb
ijb
i =xg
j for some integerj
g, for an integerx
2(c
1=g c
1] and an integer baseg
such thatb
ic
i andgb
i> c
i.Now we can use
Sx
g with respect to fx
g to transformC
intoB
0=fb
0ig, so thatb
0ic
iand
gb
0i> c
i. From the denitions ofB
andB
0, we know that both consist of solely multiples. Therefore,B
=B
0, i.e.B
is the transformed multiset forC
usingSx
g with respect tofx
g.Since
Sx
bsearches through all bases (includingg
),B
0will be found usingSx
b. Therefore,Sx
b can nd a schedule forC
. This contradicts our assumption. 2 According to Theorem 3.4, the schedulability condition ofSr
b is the same asSr
. In 4], the schedulability condition forSx
is shown to be at least 0:
65. That is, if the utilization of a task setT
is less than 0:
65,Sx
is guaranteed to nd a schedule meeting the distanceconstraints for
T
. However, the bound is not tight and the proof is very complicated. We conjecture that if there is a tight bound forSx
, it is also the bound forSx
b. SinceSx
bis a special case of
Sr
b, the schedulability condition forSx
b cannot be better than the schedulability condition forSr
b, which isn
(21=n;1) for a system ofn
tasks, or ln2 = 0:
69 whenn
is large. On the other hand,Sx
b is a general case ofSx
, so the schedulability condition forSx
b is at least as high as the schedulability condition forSx
. Therefore, the bound of the schedulability condition forSx
b is somewhere in 0:
65 ln2]. At this time, we do not have the exact tight bound yet. Even though we don't have simple schedulability condition forSx
g, the schedulability still can be checked in polynomial time by runningSx
g.3.3.3 Heuristic Scheduler HSx
Similar to
Sr
b,Sx
b is of exponential-time complexity. We have designed a near-optimal heuristic schedulerHSx
forSx
b, so that the schedulability of most task sets can be checked in polynomial time.HSx
appliesHSr
to get the sub-optimal baseg
0 for task setT
, then appliesSx
g using the baseg
0 to schedule the task set. If gT
0(x
) 1,x
is the integer with the minimum total density increase using baseg
0, the task setT
is schedulable.HSx
works as follows.
Algorithm HSx
Input: DCTS
T
=fT
i = (e
ic
i)j 1i
n
g, where 8i < j c
ic
j. Output:x
, gT
0(x
), andT
0 =f(e
ib
i)j 1i
n
g, where 8i < j b
ijb
j.1 apply
HSr
to nd the suboptimal baseg
02 apply
Sx
g using the baseg
03 output
g
0x
gT
0(x
) andT
0:
The time complexity of
HSx
isO
(n
2log(c
n=c
1)) asHSr
. Simulation has been conducted to compare the performance ofSx
b andHSx
. In the simulation, the number of tasks ranges from 2 to 20 and the original density ranges from 65% to 100%. We randomly generated 10000 task sets (uniformly distributed) for each simulation and compared the36 density increase and percentage of schedulability with those of using
Sx
(Here,Sx
stands forSx
g andg
= 2 instead of the originalSx
in 4]). From our simulation result, we nd that the performance ofHSx
is the same asSx
b. In the following, we therefore compare the performance ofSx
,Sx
3 (Sx
g using only bases 2 and 3),Sx
10 (Sx
g using bases less or equal to 10),Sx
100 (Sx
g using bases less or equal to 100) andSx
b.Figure 3.8 shows the dierences of the total densities after task sets are specialized by
Sx
and bySx
b. Figure 3.8(a) shows the average dierence for the task sets which are and Figure 3.8(b) shows the average dierence for all task sets schedulable bySx
b. Figure 3.8(a) has decreasing values when the total utilization for the task set is greater than the schedulability bound ofSr
. In other words, for those schedulable cases, the density dierences between the two get smaller as the system utilization increases. However, wend the improvement of using
Sx
b for the task sets with higher original utilization is not as substantial asSr
b. This is due to the requirement for the distance constraints to be integers after specialization.Figure 3.9(a) shows the percentage of schedulable tasks using
Sx
and usingSx
b. Among those schedulable bySx
b, Figure 3.9(b) shows the percentage of those also schedulable bySx
.Figures 3.10, 3.11 and 3.12 show similar comparisons as in Figure 3.9 except we compare