Information Processing Letters 111 (2011) 334–337
Contents lists available at ScienceDirect
Information Processing Letters www.elsevier.com/locate/ipl
Comments on “Generalized rate monotonic schedulability bounds using relative period ratios” Moonju Park Department of Computer Science and Engineering, University of Incheon, 12-1 Songdo-dong, Yeonsu-gu, Incheon 406-772, Republic of Korea
a r t i c l e
i n f o
a b s t r a c t
Article history: Received 19 January 2010 Received in revised form 22 December 2010 Accepted 22 December 2010 Available online 28 December 2010 Communicated by A.A. Bertossi Keywords: Real-time systems Scheduling Real-time scheduling Rate-monotonic analysis Schedulability test
In this Letter, it is shown that the schedulability test method for task sets with the maximum period ratio larger than or equal to 2 presented in the paper [Wei et al., Generalized rate monotonic schedulability bounds using relative period ratios, Information Processing Letters 107 (5) (2008) 142–148] is not exactly correct by presenting a counterexample. Correct sufficient conditions for using period ratios in RM schedulability test when the maximum period ratio is not less than 2 are also presented. © 2010 Elsevier B.V. All rights reserved.
where 0.5 < r 1. When there are n tasks, the schedulability bound is
1. Introduction From the early work of Liu and Layland [1], there has been much research for better schedulability condition on Rate Monotonic (RM) scheduling. Since the response time calculation is NP-hard [2], many researchers have studied on sufficient schedulability conditions to find a tighter schedulability bound, such as the hyperbolic bound in [3,4]. Another attempt to find a higher schedulability bound has been made using period ratios. Let the period of a task τi be T i . Throughout this Letter, given a task set τ = {τi }, we assume that n tasks of a task set τ are sorted in nondecreasing order of period. Then T 1 is the shortest and T n is the longest period. For this task set, the smallest period ratio in the set is given by r = T 1 / T n . In [5], it is shown that a task set τ is schedulable by RM algorithm if the total utilization of the task set is less than or equal to
2r − ln r − 1
(1)
E-mail address:
[email protected]. 0020-0190/$ – see front matter doi:10.1016/j.ipl.2010.12.015
© 2010
Elsevier B.V. All rights reserved.
1/(n−1)
2r + (n − 1)
1 r
− 1 − 1.
(2)
The schedulability test using period ratio is improved in [6] using the smallest (r1 = T 1 / T n ) and largest (r2 = T n−1 / T n ) period ratios. Given the smallest period ratio r1 and the largest period ratio r2 , a task set is schedulable by RM algorithm if the total utilization is less than or equal to
r1 + 1/r2 + ln r2 − ln r1 − 2
(3)
where 0.5 < r1 r2 1. For n tasks, the schedulability bound is given by
2r1 + 1/r2 + (n − 2) (r2 /r1 )1/(n−2) − 1 − 2.
(4)
Recently, this result is further generalized in [7]. They introduced the concept of conditional bound CB( Z x ), where Z x is a tuple of x period ratios. Given a Z x , CB( Z x ) is the lowest total utilization of all saturated task sets with period ratios of Z x . Then any task set with Z x that has a total utilization lower than CB( Z x ) is RM schedulable. When we let r i = T i / T n , Z x = (r1 , rn−x+1 , rn−x+2 , . . . , rn−1 ) for 1 x n − 1. In [7], it is shown that
M. Park / Information Processing Letters 111 (2011) 334–337
CB( Z x ) = 2r1 +
x (rn−i +2 /rn−i +1 )
v4 =
i =2
+ (n − x) (rn−x+1 /r1 )1/(n−x) − 1 − x
(5)
for tasks with period ratio less than 2; that is, 0.5 < r i 1 (or, 2T 1 < T n ). Though they obtain the CB( Z x ) for tasks with period ratio less than 2, it is not known how we can calculate CB( Z x ) when period ratio greater than or equal to 2. It was claimed in [7] that the schedulability conditions given in Eq. (5) can be applied by applying the concept of virtual period for task sets with period ratio greater than or equal to 2 (that is, T n 2T 1 ). However, the claim made in [7] is not exactly correct. In this Letter, a counter-example is presented showing the above claim is not applicable to all task sets. And correct sufficient conditions for using CB( Z x ) in RM schedulability test are also presented. 2. Counter-example In [7], a virtual period v i of a task i is defined by v i = T n / T i T i . The virtual period is introduced to make the period ratios less than 2 virtually for task sets with maximum period ratio greater than or equal to 2. They claim that: Theorem 3 of [7]. Let zi be the ratio of the ith smallest virtual period to T n for 1 i n − 1. Then the task set τ is RM schedulable if U (τ ) CB( Z x ) = 2z1 + (1/ zn−1 + zn−1 / zn−2 + · · · + zn−z+2 / zn−x+1 ) + (ln zn−x+1 − ln z1 ) − x, where 1 x n − 1, Z x = ( z1 , zn−x+1 , zn−x+2 , . . . , zn−1 ), and U (τ ) is the total utilization of τ . The above claim is not exactly correct. In the proof of Theorem 3 in [7], the authors implicitly assume that if a task set is not schedulable, then the task with the longest period, which has the lowest priority, would miss its deadline. It is not always correct, especially when the maximum period ratio is very large. Now we present a counter-example of the above claim. Let us consider a task set τ = {τ1 = (28, 5), τ2 = (57, 13), τ3 = (71, 17), τ4 = (90, 12), τ5 = (99, 5), τ6 = (1000, 1)}, where τi is associated with a tuple ( T i , C i ) where T i is the period and C i is the worst case execution time. The utilization of a task τi is given by U (τi ) =C i / T i , and the n total utilization of a task set τ is U (τ ) = i =1 U (τi ). The total utilization of this task set is 0.8309 approximately. When τ is scheduled by RM algorithm, τ is not schedulable since τ5 ’s worst case response time is 109 > 99, while other tasks will meet their deadlines. Calculating the virtual periods of tasks, we have:
v1 =
v2 =
v3 =
1000 28 1000 57 1000 71
28 = 980,
57 = 969,
71 = 994,
v5 =
1000 90 1000
335
90 = 990,
99 = 990.
99
Then we get z1 = 0.969, z2 = 0.980, z3 = 0.990, z4 = 0.990, and z5 = 0.994. Applying these values to Eq. (5), we have U (τ ) = 0.8309 < CB( Z 5 ) = 2z1 + (1/ z5 + z5 / z4 + z4 / z3 + z3 / z2 ) + (ln z2 − ln z1 ) − 5 ≈ 0.9696. Even CB( Z 1 ) is about 0.9695, so the task set passes the schedulability test based on the virtual period ratios presented in [7], although it is not schedulable. 3. Schedulability conditions for tasks with T n / T 1 2 When 2T 1 T n , Theorem 3 of [7] is only applicable to task sets whose tasks are all schedulable, or whose lowest priority task is not schedulable. Note that the lowest priority task has the longest period. The following lemma due to Lehoczky et al. [8] gives the necessary and sufficient schedulability condition for RM algorithm. Lemma 1. (From [9].) Given a set of real-time tasks τ1 , τ2 , . . . , τn . Assume the tasks are ordered with increasing period, T 1 · · · T n . Then, a task τk always meets its deadline T k under RM scheduling, if and only if there exists a time 0 < t < T k such that
t
k
t i =1
Ti
Ci.
(6)
Based on Lemma 1, the following lemma shows that the non-schedulability of the lowest priority task is not affected by replacing a higher priority task τi = ( T i , C i ) with another task (xi T i , xi C i ), where xi is an integer and 1 xi TTn . i
Lemma 2. For a task set τ , if the lowest priority task τn is not schedulable by RM algorithm, then the task set τ = {τi = (xi T i , xi C i )} for 1 i n is not schedulable with RM algorithm where xi is an integer such that 1 xi TTn . i
Proof. Note that xn = 1. By Lemma 1,
t i =1 T i
C i > t for C i for an integer xi 1 n t for ∀i, we have i =1 xi T i xi C i > t for all
all t T n . Since and xi T i T n t Tn . 2
n
xitT i
xi C i
Tti
We can see that the virtual period of [7], v i = TTn T i , i is the largest xi value for τi in the above lemma. Lemma 2 implies that we can determine the schedulability of a task τ with RM by testing the schedulability of each τi with the virtual period ratios for every task subset {τ1 , . . . , τi } where 1 i n. This method requires sorting virtual periods for each task subset, thus has O (n2 log2 n) time complexity. Another schedulability test that can be applied to task sets with T n / T 1 2 is presented in [5].
336
M. Park / Information Processing Letters 111 (2011) 334–337
CalculateScale( T i , T n ) begin ki = 1 while 2ki T i < T n do ki = 2ki endwhile return ki end
X1 =
X2 =
...,
. If τ is schedulable on one processor using RM
ki = 2 algorithm, then τ is schedulable on one processor with RM.
The above theorem is based on the following lemma in [9]. Lemma 3. (See Lemma 2 of [9].) Given a task set τ = {( T 1 , C 1 ), ( T 2 , C 2 ), . . . , ( T n , C n )}, if τ is not schedulable with RM, then also the task set {(2T 1 , 2C 1 ), ( T 2 , C 2 ), . . . , ( T n , C n )} is not schedulable with RM. (log
Tn
n −1
−log
Tn
)
2 T i We can easily see that T n / T i = 2 2 T i <2 and U (τi ) = U (τi ). Using Theorem 1, we can obtain a schedulability test for task sets with T n / T 1 2. Let zi be the ratio of the ith smallest T i to T n for 1 i n − 1, and Z x = { z1 , zn−x+1 , zn−x+2 , . . . , zn−1 }. Then we can see that τ is schedulable by RM if ni=1 U (τi ) CB( Z x ) since τ has the maximum period ratio less than 2. Thus, since τ is schedulable if τ is schedulable by Theorem 1, the task set τ is RM schedulable if U (τ ) CB( Z x ). For example, let us reconsider the task set in Section 2. For this task set, k1 = 25 , k2 = 24 , k3 = 23 , k4 = 23 , and k5 = 23 . So we have T 1 = 896, T 2 = 912, T 3 = 568, T 4 = 720, and T 5 = 792, thus z1 = 0.568, z2 = 0.720, z3 = 0.792, z4 = 0.896, and z5 = 0.912. For these values, since we have CB( Z 5 ) ≈ 0.7188, the task set does not pass the schedulability test. This test takes O (n log2 n) time because it needs sorting T i . However, it requires the calculation of logarithm
function, or, log2 TTn times of doubling operation ([5], see i Fig. 1) for each task to obtain ki . Thus the efficiency of the above test may depend on the period ratio when TTn is i large. From Lemma 2, we can establish a new task set such that if it is schedulable then the given task set τ is schedulable. The following theorem repeatedly applies Lemma 2 to obtain such a task set.
τ = {τ1 , . . . , τn }, let X i = T j +1 for i < n and X = 1. If the task set τ = {τi = n j =i Tj ( X i T i , X i C i )} is schedulable with RM, then τ is schedulable with
Theorem 2. Given a task set
n−1
RM.
i −1
yj ·
n −1
j =1
y j = T2
j =2
i −1
yj =
j = i −1
yj =
i −1
j =i
yj ·
i −1
yj =
j =i
yj ·
j = i −1
y j Xi ,
j =1
n −1
j =2
n −1
X i −1 =
Theorem 1. (See Lemma 2 of [5].) Given a task set τ = {( T i , C i )} where 1 i n, let τ = {τi } where T i = T i ki , C i = C i ki and Tn Ti
yj =
j =1
Fig. 1. Doubling operation to obtain ki .
log2
n −1
i −1
y j Xi ,
j =2 n −1 j =i
yj =
i −1
y j Xi ,
j = i −1
Xi = Xi , which shows that X i is a common divisor of X 1 , X 2 , . . . , X i . Thus the schedulability of the task subset {( X 1 T 1 , X 1 C 1 ), . . . , ( X i T i , X i C i )} is the same as that of the task set {( XX1i T 1 , XX1i C 1 ), . . . , ( T i , C i )} which is obtained by dividing both X j T j ’s and X j C j ’s by X i where 1 j i. Thus if the , X 1 C 1 ), . . . , ( X i T i , X i C i )} is schedulable, then subset {( X 1 T 1 {( ij−=11 y j T 1 , ij−=11 y j C 1 ), . . . , ( T i , C i )} is also schedulable.
i −1
T
Note that 1 j =k y j T i for 1 k i − 1. Therefore, by k Lemma 2, τi is schedulable for all i. 2 Because it does not guarantee 2 X 1 T 1 > T n , the utilization bound using period ratio in [7] may not be directly applied to the task set {( X i T i , X i C i )}. In such a case, we can apply Lemma 3 to the task set as Theorem 1. FurX T thermore, since i+X1 T i+1 < 2, we have XT nT < 2n , thus only 1 1 i i O (n) times of doubling operations are required for each task. Thus the schedulability test based on Theorem 2 requires O (n2 ) for obtaining X i ’s, O (n2 ) for doubling operations, and O (n log2 n) for sorting, which gives O (n2 ) time complexity overall. New schedulability test method. Given a task set τ = {τi = ( T i , C i )} where 1 i n, let T i = ki X i T i where X i =
n−1 j =i
T j +1 Tj
log2
for i < n, X n = 1, and ki = 2
the ratio of the ith smallest T i to T n for 1
Z x = { z1 , zn−x+1 , zn−x+2 , . . . , zn−1 }. Then n RM if i =1 U (τi ) CB( Z x ).
Tn Xi T i
. Let zi be
i n − 1, and
τ is schedulable by
ki in the above test method is obtained using the calculation method in Fig. 1. Applying the above test method to the task set in Section 2, we have X 1 = 2 · 1 · 1 · 1 · 10 = 20, X 2 = 1 · 1 · 1 · 10 = 10, X 3 = 1 · 1 · 10 = 10, X 4 = 1 · 10 = 10, and X 5 = 10. Then the scaled periods are X 1 T 1 = 560, X 2 T 2 = 570, X 3 T 3 = 710, X 4 T 4 = 900, X 5 T 5 = 990, and T 6 = 1000. Since 2 X 1 T 1 > T 6 , no doubling operation is required. Then we have z1 = 0.56, z2 = 0.57, z3 = 0.71, z4 = 0.9, and z5 = 0.99. For these values, we get CB( Z 5 ) ≈ 0.761 < U (τ ) = 0.8309, so the task set does not pass the schedulability test. 4. Conclusion
Proof. Let y i = Ti+1 . By Lemma 2, if τ is schedulable, i then τn is schedulable also. For a task τi with i < n, consider a subset {( X 1 T 1 , X 1 C 1 ), . . . , ( X i T i , X i C i )} of τ . Since n−1 X i = j =i y j , we can see that T
It is shown that the RM schedulability test for task sets with period ratio greater than or equal to 2 presented in [7] is not exactly correct by a counter-example. The utilization bound using period ratios can be calculated us-
M. Park / Information Processing Letters 111 (2011) 334–337
ing Lemma 2 of [5] in O (n log2 n) time but it requires the calculation of logarithm function or log2 TTn times of i
doubling operation. A new test method with O (n2 ) time complexity is presented combining the concept of the virtual period in [7] and the idea of doubling periods in [5] and [9]. References [1] C. Liu, J. Layland, Scheduling algorithms for multiprogramming in a hard real-time environment, Journal of ACM 20 (1) (1973) 46–61. [2] F. Eisenbrand, T. Rothvoss, Static-priority real-time scheduling: Response time computation is NP-hard, in: Proceedings of the 29th IEEE Real-Time Systems Symposium, 2008, pp. 397–406. [3] J.W.S. Liu, Real-Time Systems, Prentice Hall, 2000. [4] E. Bini, G.C. Buttazzo, G.M. Buttazzo, Rate monotonic analysis: The
[5]
[6]
[7]
[8]
[9]
337
hyperbolic bound, IEEE Transactions on Computers 52 (7) (2003) 933– 942. S. Lauzac, D.M.R. Melhem, An improved rate-monotonic admission control and its applications, IEEE Transactions on Computers 52 (3) (2003) 337–350. W.C. Lu, H.W. Wei, K.J. Lin, Rate monotonic schedulability conditions using relative period ratios, in: Proceedings of the IEEE International Conference on Embedded and Real-Time Computing Systems and Applications, 2006, pp. 3–9. H.-W. Wei, K.-J. Lin, W.-C. Lu, W.-K. Shih, Generalized rate monotonic schedulability bounds using relative period ratios, Information Processing Letters 107 (5) (2008) 142–148. J.P. Lehoczky, L. Sha, Y. Ding, The rate monotonic scheduling algorithm: Exact characterization and average case behaviour, in: Proceedings of the IEEE Real-Time Systems Symposium, 1989, pp. 166–171. A. Burchard, J. Liebeherr, Y. Oh, S. Son, New strategies for assigning real-time tasks to multiprocessor systems, IEEE Transactions on Computers 44 (12) (1995) 1429–1442.