• 沒有找到結果。

Pinwheel Schedulers for Integer Distance Constraints

task sets with an original density less than 0.9,

Sr

3 can schedule about 90% of the tasks schedulable by

Sr

b, and with original density less than 0.95,

Sr

10 can schedule about 92% of tasks schedulable by

Sr

b. For

Sr

100 in Figure 3.6, it performs almost as good as

Sr

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.1

For all these reasons, we design a new scheduler

Sx

g base on

Sr

g.

Sx

g transforms the distance constraints of all tasks to multiples of integer

x

using any base

g

. The execution times and distance constraints used in

Sx

g can be real numbers. Moreover, the optimal schedule can be found in polynomial time.

Sx

4] tests all the integers in (

c

1

=

2

c

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 optimal

x

with the minimum total density increase. Moreover, since we may use any base

g

to transform the distance constraints,

x

can only be in the range of

c

1

=g < x



c

1.

Lemma 3.3

If

k

gv;1

< r < r

0

k

gv, for some

v

, 1

v



u

, then g

T

(

r

)

>

g

T

(

r

0).

The proof of Lemma 3.3 is given in Appendix B. Lemma 3.3 shows that, for each

v

, the density function g

T

in the domain (

k

gv;1

k

gv] is monotonically decreasing. Therefore, for each

v

, only the largest integer less than

k

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 g

T

for Example 2.1. Only two integers, f5 9g, need to be tested to

nd the optimal solution.

Sx

g applies

Sr

g to nd all

k

gv's and g

T

(

k

gv)'s. Among the largest integers less than

k

gv for each

v

,

Sx

g transforms the distance constraints with respect to f

x

g, where

x

 is the integer with the minimum g

T

value. According to Lemma A.1 in Appendix A, the g

T

values can be easily computed.

Sx

g works as follows.

Algorithm Sx

g

Input: DCTS

T

=f

T

i = (

e

i

c

i)j 1

i



n

g, where

c

i

c

j 8

i < j



g

is the specialization base.

Output:

x

, g

T

(

x

), and

T

0=f(

e

i

b

i)j 1

i



n

g, where

b

ij

b

j 8

i < j

.

1 Apply

Sr

g to get all

k

gv's and g

T

(

k

gv)'s, for 1

v



u

.

2 Let (

x

g1

x

g2

::: x

gj) be the resulting sequence of (b

k

g1c b

k

g2c

:::

b

k

guc)

3 with duplicates and

x

gi 

k

g0 =

c

1

=g

removed

4

i

=

j



5

for v

=

u downto

1

do

6

if

(

x

gi =

k

gv)

7 g

T

(

x

gi) = g

T

(

k

gv)

8

i

=

i

;1

9

elseif

(

x

gi

> k

gv)

10 g

T

(

x

gi) = kv +1gxgi g

T

(

k

gv+1) // See Lemma A.1, where



(



xgg

i

) = 0.

11

i

=

i

;1

12

endif

13 nd

x

such that g

T

(

x

) = minx2fxg1xg2:::xgjgg

T

(

x

)

14

for i

= 1

to n do b

i=

x



g

blogg(ci=x )c

15 output

x

 g

T

(

x

) and

T

0

:

Theorem 3.5

The time complexity of specialization operation

Sx

g is

O

(

n

log

n

).

Proof: It is easy to see that all steps in Algorithm

Sx

g can be done in

O

(

n

) time, except step 1 (applying

Sr

g), which can be done in

O

(

n

log

n

). 2

3.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

b

Input: DCTS

T

=f

T

i = (

e

i

c

i)j 1

i



n

g, where

c

i

c

j 8

i < j

. Output:

r

, g

T

(

r

), and

T

0=f(

e

i

b

i)j 1

i



n

g, where

b

ij

b

j 8

i < j

.

1

foreach

base

g

2f2 3 5 6 7

:::

b

c

n

=c

1cg

do

f

2 apply

Sx

g using the base

g



3

if

(g

T

(

r

) is the minimum ever found),

g

=

g



4 g

5 apply

Sx

g using the base

g



6 output

g



x

 g

T

(

x

) and

T

0

:

The following theorem proves the optimality of

Sx

b.

Theorem 3.6

Given a distance-constrained task set

T

, if

Sx

b can not nd a schedule of integer distance constraints for

T

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

= f

c

ig using single-number reduction with respect tof

x

gwhile

Sx

bcan not nd one. W.l.o.g., suppose the algorithm transforms

C

into a set of distance constraints consist of solely multiples

B

=f

b

ij

b

i =

xg

j for some integer

j

g, for an integer

x

2(

c

1

=g c

1] and an integer base

g

such that

b

i

c

i and

gb

i

> c

i.

Now we can use

Sx

g with respect to f

x

g to transform

C

into

B

0=f

b

0ig, so that

b

0i

c

i

and

gb

0i

> c

i. From the denitions of

B

and

B

0, we know that both consist of solely multiples. Therefore,

B

=

B

0, i.e.

B

is the transformed multiset for

C

using

Sx

g with respect tof

x

g.

Since

Sx

bsearches through all bases (including

g

),

B

0will be found using

Sx

b. Therefore,

Sx

b can nd a schedule for

C

. This contradicts our assumption. 2 According to Theorem 3.4, the schedulability condition of

Sr

b is the same as

Sr

. In 4], the schedulability condition for

Sx

is shown to be at least 0

:

65. That is, if the utilization of a task set

T

is less than 0

:

65,

Sx

is guaranteed to nd a schedule meeting the distance

constraints for

T

. However, the bound is not tight and the proof is very complicated. We conjecture that if there is a tight bound for

Sx

, it is also the bound for

Sx

b. Since

Sx

b

is a special case of

Sr

b, the schedulability condition for

Sx

b cannot be better than the schedulability condition for

Sr

b, which is

n

(21=n;1) for a system of

n

tasks, or ln2 = 0

:

69 when

n

is large. On the other hand,

Sx

b is a general case of

Sx

, so the schedulability condition for

Sx

b is at least as high as the schedulability condition for

Sx

. Therefore, the bound of the schedulability condition for

Sx

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 for

Sx

g, the schedulability still can be checked in polynomial time by running

Sx

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 scheduler

HSx

for

Sx

b, so that the schedulability of most task sets can be checked in polynomial time.

HSx

applies

HSr

to get the sub-optimal base

g

0 for task set

T

, then applies

Sx

g using the base

g

0 to schedule the task set. If g

T

0(

x

)  1,

x

 is the integer with the minimum total density increase using base

g

0, the task set

T

is schedulable.

HSx

works as follows.

Algorithm HSx

Input: DCTS

T

=f

T

i = (

e

i

c

i)j 1

i



n

g, where 8

i < j c

i

c

j. Output:

x

, g

T

0(

x

), and

T

0 =f(

e

i

b

i)j 1

i



n

g, where 8

i < j b

ij

b

j.

1 apply

HSr

to nd the suboptimal base

g

0

2 apply

Sx

g using the base

g

0

3 output

g

0

x

 g

T

0(

x

) and

T

0

:

The time complexity of

HSx

is

O

(

n

2log(

c

n

=c

1)) as

HSr

. Simulation has been conducted to compare the performance of

Sx

b and

HSx

. 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 the

36 density increase and percentage of schedulability with those of using

Sx

(Here,

Sx

stands for

Sx

g and

g

= 2 instead of the original

Sx

in 4]). From our simulation result, we nd that the performance of

HSx

is the same as

Sx

b. In the following, we therefore compare the performance of

Sx

,

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) and

Sx

b.

Figure 3.8 shows the dierences of the total densities after task sets are specialized by

Sx

and by

Sx

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 by

Sx

b. Figure 3.8(a) has decreasing values when the total utilization for the task set is greater than the schedulability bound of

Sr

. In other words, for those schedulable cases, the density dierences between the two get smaller as the system utilization increases. However, we

nd the improvement of using

Sx

b for the task sets with higher original utilization is not as substantial as

Sr

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 using

Sx

b. Among those schedulable by

Sx

b, Figure 3.9(b) shows the percentage of those also schedulable by

Sx

.

Figures 3.10, 3.11 and 3.12 show similar comparisons as in Figure 3.9 except we compare

Sx

bwith

Sx

3,

Sx

10 and

Sx

100 respectively. We can see for the task sets with an original density less than 90%,

Sx

3 can schedule about 90% of the tasks schedulable by

Sx

b, and with original density less than 95%,

Sx

10 can schedule about 90% of tasks schedulable by

Sx

b. For

Sx

100 in Figure 3.12, it performs almost as good as

Sx

b.

相關文件