Data & Analytics

A Feasibility Decision Algorithm for Rate Monotonic and Deadline Monotonic Scheduling

Description
A Feasibility Decision Algorithm for Rate Monotonic and Deadline Monotonic Scheduling
Published
of 7
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  A Feasibility Decision Algorithm for Rate Monotonic Scheduling of Periodic Real-Time Tasks Yoshifumi Manabe Shigemi Aoyagi NTT Basic Research Laboratories 3 1 Morinosato-Wakamiya Atsugi-shi Kanagawa 243-01 Japan Abstract The rate monotonic scheduling algorithm is a com- monly used task scheduling algorithm for periodic real- time task systems. This paper discusses feasibility de- cision for a given real-time task system by the rate monotonic scheduling algorithm. It presents a new necessary and suficient condition for a given task sys- tem to e feasible, and a new feasibility decision algo- rithm based on that condition. The time complexity of this algorithm depends solely on the number of tasks. This algorithm can e applied to the inverse-deadline scheduling algorithm, which is an extension of the rate monotonic scheduling algorithm. Introduction In real-time systems there is a time constraint on computation which is just as important as the correctness of computation. In an attempt to sat- isfy this constraint many scheduling algorithms have been discussed [3]. The rate monotonic scheduling algorithm [lo] is one of commonly used scheduling algorithms for periodic real-time task systems be- cause it is optimal among fixed-priority preemptive scheduling algorithm. Furthermore various exten- sions have been discussed for example scheduling aperiodic tasks while still meeting the deadlines of periodic tasks [ll] cheduling when a task is added or deleted or a task period is modified [4][5][12] and scheduling when some tasks share resources [l] 13]. A necessary and sufficient condition for a given pe- riodic real-time task system to be feasible by the rate monotonic scheduling algorithm has been shown [lo]. Two feasibility decision algorithms the scheduling point test algorithm [6] and the completion-time test algorithm [14], have been shown. The time complexi- ties of these two algorithms depend on both the num- ber of tasks and the task periods. This paper presents a new necessary and sufficient condition for feasibility along with a new feasibility de- cision algorithm a reduced scheduling point test algo- rithm. The time complexity of this algorithm depends solely on the number of tasks. Thus it is a constant if the number of tasks is a constant. This algorithm can also be applied to determine the feasibility by the inverse-deadline scheduling algorithm [9]  [7] which is an extension of the rate monotonic scheduling algo- rithm. In this paper section 2 defines real-time task scheduling. Section 3 summarizes previous results for feasibility decision algorithms. Section gives the necessary and sufficient condition to be feasible and shows the feasibility decision algorithm based on this condition. Section 5 discusses an extension for the inverse-deadline scheduling algorithm. Section 6 sum- marizes the paper. Scheduling periodic real-time tasks This section gives the formulation of the real-time scheduling. Definition 1 (Periodic real-time task system) [lo1 Perzodzc real-tzme task system {q r2 rn} s a set of tasks. These tasks are zndependent an that job requests for a certazn task do not depend on the completzon of requests for other tasks. Each task r zs perzodzc, wzth a constant znterval p, between job requests. Each task r has an znztzahzataon tzme I (> ) Assume that minl< < I 0 r are znztzated at I, + kp, k 0 1 The jobs for task 12 1080-1812/95 04.00 995 IEEE  Each task I ; has deadline di 5 pi). job ini- tiated t Ii kpi k = 0,1,. . must be completed before Ii kpi d; k 0,1,. . . The computation requirement in each job for task r is a constant e; < di). Jobs can be preempted at any time and the over- head for job swapping can be ignored. Unless otherwise stated we assume that d = pi 1 5 i 5 n , that is each task must be completed before the next request for it. Section 5 will discuss the case in which d < pi. When Ii Ij for all 5 n, he task system is said to be synchronous. Otherwise it is asynchronous. This paper addresses only synchronous systems. Note that as easily derived from Property 1 a synchronous system is less feasible than an asynchronous system with the same intervals deadlines and computation requirements. Thus when the initialization times are unknown the worst case can be obtained by testing the feasibility of a synchronous system. The feasibility of asynchronous systems has been discussed in some A scheduling algorithm is a set of rules that deter- mine the jobs to be executed at aparticular time. This paper is concerned only with fixed-priority preemptive scheduling algorithms which work as follows. A dis- tinct and fixed priority is assigned to each task. When a job request arises with a priority higher than the one currently being executed the current job is immedi- ately interrupted and the new job is started. Dynamic- priority scheduling algorithms in which the priority for each request varies during execution have also been discussed [2][8]. Although these can be more ef- fective than fixed-priority scheduling algorithms they are more difficult to implement. This paper thus con- siders only fixed-priority scheduling algorithms. papers PI PI Definition 2 Feasibility) [lo] For a task system X and scheduling algorithm S, X is feasible by S if and only if all deadlines of the tasks in X are met by 3 X is feasible if and only if it is feasible by some scheduling algorithm. Thus the optimal scheduling algorithm S is consid- ered to be the one which satisfies the following: if X is feasible X is feasible by S 3 Previous results on the rate mono- tonic scheduling algorithm This section summarizes previous results on feasi- bility by the rate monotonic scheduling algorithm. Definition 3 Rate monotonic scheduling) [lo] The rate monotonic scheduling algorithm is a fixed- priority preemptive scheduling algorithm which assigns a higher priority to a task with a shorter period. The rate monotonic scheduling algorithm is opti- mal among fixed-priority preemptive scheduling algo- rithms [lo]. Unless otherwise stated we label the tasks so that Pl L P2 . . L Pn. Definition 4 Critical instant) [lo] The response time for a job request of a certain task is defined as the time span between the request and the end of the response to that request. critical instant for a task is defined as an instant t which a job request for that task will have the longest response time. Property 1 [lo] When dj pi for all i a criti- cal instant for any task occurs whenever the task is requested simultaneously with requests for ll higher priority tasks. Since I; 0 1 5 n , he following property can be immediately derived from this property. Property 2 [lo] Task system X is feasible by the rate monotonic scheduling algorithm if the first job of each task meets its deadline. Let us define the utilization factor Ui of task ri as Ui c;/pi. The following relations between feasibility and the utilization factor have been shown. The latter is trivial. Property 3 [lo] rate monotonic scheduling algorithm if Task system X is feasible by the cyz1 ; 5 n 21/n 1). Property 4 Task system X is not feasible by any scheduling algorithm if cy=l ; > 1. The following necessary and sufficient condition to be feasible has been proved. 213  Property [6] Task system X is feasible by the rate monotonic scheduling algorithm i and only ifL = maxl<i<nLi 5 1 where L~ = mintEs,~i t)7 ut = c;=lcj ~t/~~i/t, s {k pj j = 1 2 . . ,i; l = i 2 . . , bi/pj]}. The scheduling point set Si for task ri is defined as T~’ first deadline pi and the deadlines of higher priority tasks prior to pi. This means that the task system is feasible if and only if at some scheduling point all currently existing jobs can be executed. Example 1 n = 3, l = 100, 1 = 40, 2 = 150, c2 = 40, 3 = 350, nd c3 = 100. When the scheduling point test algorithm is applied to this task system the following equations are checked: i = 1: S = (100). t = 100: Li(100) = 40/100 < 1. Thus L1 < 1. t = 100: Lz(100) = 80/100 < 1. Thus L < 1. 3: S3 = { 100,150,200,300,350). t = 100: L3(100) = 180/100 > 1. t = 150: L3(150) = 220/150 > 1. t = 200: L3(200) = 260/200 > 1. = 300: (300) = 300/300 = 1. i = 2: Sz = { 100,150}. i Thus L3 5 1 so the task system is feasible. Example 2) n = 3, 1 = 100, I = 60, 2 = 150, c = 50, 3 = 350, nd c = 20. i = 1: s = (100). t = 100: Ll(100) = 60/100 < 1. Thus L1 < 1. i = 2: Sz = (100, 50}. t = 100: Lz(100) = 110/100 > 1. t = 150: Lz(150) = 170/150 > 1. Thus L > 1 {TI Z} is not feasible so the whole task system is not feasible. Note that Li 5 1 does not imply that Lj 5 l j < i . In the above example (300) = 1 and thus L3 5 1. Calculation of Li for all i l 5 i 5 n is therefore necessary. Though this algorithm presents all instant when jobs might be preempted the time complexity of this algorithm depends on the number of tasks and the maximum period when the task periods are integers. There are cases that the time complexity of this algo- rithm is not so small even if the number of tasks is a constant. Lemma 1 For any integer k, there s a task system X which satisfies x = 2 and the time complexity of the scheduling point test algorithm for X is at least O k)- Proof) Consider the following task system: T, 2 = k2 2)/k. T, and c = k2 k + l)/(k2 ) . T. T is arbitrary and all values of pi and ci can be in- tegers if T is selected appropriately. This task system is not feasible. Now apply the scheduling point test algorithm. Since k 1)pl < pa < kp~, 2 = {T,2T,. .. , k 1)T, k2 2)/k T}. In order to detect that this task system is not feasible it is necessary to calculate Lz t) for all t E S2 Therefore the time complexity of the scheduling point test algorithm is at least O k). Sha et al. [14] ave shown another algorithm called the completion-time test algorithm. This algorithm is shown in Figure 1 ’ The completion-time test al- gorithm first determines the computation requirement necessary for initially existing jobs. The value is ob- tained from t := cj . Some new jobs might arise until t. Thus by calculating t’ := cj rt/pjl, the computation necessary for all jobs until time t is obtained. If t’ = t, all current jobs can be executed at time t. Thus {TI . . , i} s feasible. If t’ > t, the computation necessary for all jobs until t’ is calculated again using the above expression. If t’ satisfies t’ > pi, the task system is not feasible. Example 3 Apply the completion-time test to Example 1. i = 1: It is trivial that T~ is feasible. i = 2: Initially t = c1 + c = 80. In the repeat-untilloop, t’ = c1 .[80/pll +c2.r8O/pz] = 80. Since t‘ = t is satisfied ~1,722) s feasible. i = 3: Initially t = c1 + c + c = 180. In the repeat-until loop t’ = c1 . r180/pl] + c . Since t t’ and t’ 5 p3, he repeat-until loop is ex- ecuted again and t = 260, t‘ = c1 . [260/p11 + c . Since t t‘ and t’ 5 p3, he loop is executed again and Example 4 Apply the completion-time test to TI = 2, pi = T, 1 = k 2)/ k 1) [180/pzl+ c . ri80/~~1 260. r260/~,l+ c3 . r260/~~1 300. t = 300 ti = cl~~~oo/pl~ c2~~~o~~p2~ c3.~300/p   300. Since t’ = t, he task system is feasible. Example 2. i = 1: It is trivial that 71 is feasible. i = 2: Initially t = c1 + c = 110. In the repeat-until loop t’ = c1 rllO/pll + c2 . Since t’ > pa is satisfied (71, TZ} is not feasible and riio/p21 = 170. thus the whole task system is not feasible. ‘The srcinal algorithm does not answer “not feasible” when the task set is not feasible. The algorithm in Figure 1 is there- fore modified to answer “not feasible”. 2 14  Though this algorithm gives the minimum time when all existing jobs are completed, the complexity depends on both the number of tasks and the maxi- mum period when the periods are integers. There are some cases that the complexity of the algorithm is not so small even if the number of tasks is a constant. Lemma 2 For any integer k, there is a task system X which satisfies x = 2 and the time complexity of the completion-time test algorithm for X is at least O(k). W Proof) Consider the example in the proof of Lemma 1. Note that jp1 < jcl+cz < (j+l)pl j = 1,. . . , k- 1) holds. For i = 2, initially t = c1 + cg In the repeat-until 2cl+ c2, since pl < c1+ cz < 2pl. In the next iteration of the repeat-until loop, t‘ = 3cl + c2. Similarly, t‘ is calculated as 4cl + CZ, 5c1 + CZ . , k 1)cl + cz in each iteration of the loop. Since there are k iterations, W loop, t’ = c1 . [(Cl + CZ)/Pll cz . [(Cl cz)/p21 = the time complexity is at least O le). A new feasibility decision algorithm This section shows the new necessary and sufficient condition for a given task system to be feasible by the rate monotonic scheduling algorithm. Now, we define the reduced scheduling point set, R, as follows: Definition 5 Reduced scheduling point set) Ri = U;,, Qi, where Qi = {pi}, Qj={lt/pjJ.pjl tEQ +l<k<i)} (l<j<i). This set satisfies Ri Si, where S is the scheduling point set. R, consists of the following elements: pi, the last deadline of task ~i-1 efore pi, the last dead- lines of ri-z before each of these two deadlines, the last deadlines of 7-i-3 before each of these four dead- lines, and so on. Since some of the elements might be identical, (Ri( 5 2i-1. Example 5) For the task system in Examples 1 and 2 R1 = {lOO} Rz = {100,150}, and R3 = {300,350}. For the task system in the proof of Lemma 1, Rl = Consider the task system in the proof of Lemma 1. The scheduling point test algorithm does not have to test Lz(t) at t = T. The reason is as follows. Suppose that {TI} is feasible. The total length of time when the {T} nd Rz = { k )T, k2 2)/k. T}. jobs of 71 is not executed is longer in the time interval [0, (k 1)T] than in [0, TI Thus, the possibility to finish the execution of the job for 72 is greater at k l)T than at T, because the number of 72’s jobs in [0, TI and [0, IC )T] are the same. Thus, if &((k 1)T) > 1 Lz(T) > 1 andif L2(T) 5 1, Lz((k-l)T) 5 1. Therefore, it is unnecessary to test LZ(t) at t = T if Lz(t) is tested at t =: le - l)T. By a similar argument, it is enough to test Li(t) only at the “last” deadlines. The formal proof that the feasibility can be determined by examining Li(t) only at . is as follows. Theorem 1 Task system X is feasible y the rate monotonic scheduling algorithm if and only if L’ = maz:l<i<,Li - < 1, where L: = mint (t), Li(t) = E;=, j . [t/pJ/t. w Proof) Since Ri S;, it is trivial that, if L’ 5 1, the task system is feasible. Now assume that the task system is feasible. From Property 5, for all i, Li(t) 5 1 for some t(t E Si). Let T be the maximum t(t E Si which satisfies Li(t) 5 1. If T E R,, the theorem is proved. Thus, suppose that T R, and show a contradiction. Since pi E Ri, T < pi holds. From the definition of Si, T is a deadline of one or more tasks. Among these tasks, let rj be the one whose priority is lowest. j satisfies j < i. Now, let T* be a deadline of a task rk(j 5 k < i , which satisfies the following conditions: T 5 T*, T* +pk <pi, and there is no deadline of any task Th(k < h 5 i within the time interval (T, * + pk). First, prove that there exists T* which satisfies these conditions. To do so, consider the following pro- cedure. t :=T; z:= j; repeat t’ := the first time after t which is a deadline if t +p, 5 t’ then return t); * T* = t. */ z := y if t’ is a deadline of several tasks, of some task ry y > z ; t := ‘; let y be the lowest priority task’s index); until t 2 pi; Error ‘T* is not found.’); This procedure returns the value T*. If an error oc- curs, the value sequence oft during the iteration of the procedure, TI = ),Tj*,, . . ,Tm = ;) satisfies the following condition: Note that let rj be the task whose priority is the lowest among the tasks which have a deadline at q 215  j1 = j) < j, < . . . < jm(= ). q < q ... < qm. qh pj, > T;h+l(l 5 h 5 m- 1). There is no deadline of any task whose prior- ity is lower than rjh within the time interval (T, h+l )' Tj*_ = pi) E Qjm(= i holds. Since Tj _-, pjm-, > Tj*_, ;m-l is the last deadline of rjm- before Tjm(E Qjm). hus Tm- Qfm-l is satisfied. Similarly Th h m 2, m ,. . . 1 s the last deadline of rjh before T~*,+, E Q~,,,), thus Th Qjh h = m-2,m- 3,. . , 1). Therefore T(= Tj: Qjl and T E Ri. t is contradictory that T 6 Ri. Thus there is a T* which satisfies the above conditions. Now consider the interval [T, T* + pg and suppose there are no jobs requested before T. Since there is no deadline of any task whose priority is lower than rg in [T, T* + pk), there are no new jobs for such a task during that interval. This situation can be regarded as the case that the task system is {TI,. . . Q} and each task is initiated at some time after T, hat is Ii 2 T(i = 1,. . , k) and Ig = T*. Let fi(t) be the number of ri's jobs requested during the time interval [T, ). Let to be the time when the rg s job requested at T* s finished. Since 71,. . . , Tk} is feasible to satisfies T to 5 T*+pk. Ch.fh(t0) 5 to-Tissatisfied because all current jobs are finished at to. Since Li(T) 5 1, ch . rT/phl 5 T. Now calculete (to). Since there are no new jobs for {Tg+l . . . Ti} in [T,to), E ,=, h . [tO/Phl cL=l h . rT/Phl + T* < to 5 T* + pg 5 pi), &(to) 1. Let T' be the first deadline after to. T' satisfies Li(T') 5 1 and T' E Si. It is contradic- tory that T is the maximum t t E Si which satisfies The new feasibility decision algorithm based on this theorem is shown in Figure 2. At the beginning of the loop by j, rlist contains the elements of U +l Qi. In the repeat-until loop each element t QJ is calcu- lated. If t rlist, Li(t) 5 1 is tested for feasibility and t is appended to rlist. If (t) 5 1 for some t E dist, Li 5 1. Now estimate the time complexity of the algorithm. / I 5 2i-1 and for each element t E , O(i) multi- plications and divisions are necessary to test whether Li(t) 5 1. Since this procedure is executed for each i = 1, . . , n, the number of multiplications and divi- sions are at most O xy=l i .2i-1 , that is O(n 2 ). k ch fh(t0) 5 T + to - T) = o. Therefore at to(T L;(t) 5 1. Therefore T E R . Note that the time complexity of this algorithm is independent of the task periods. It is bounded by a function of the number of tasks. Thus if n is a constant the time complexity is also a constant. Feasibility of the inverse-deadline scheduling algorithm This section considers the case in which d, p, for some i This paper assumes that d, 5 p,. For the case in which d, > p,, Shih et al. have presented a feasibility condition [15]. The inverse-deadline scheduling algorithm [9] is a fixed-priority preemptive scheduling algorithm which is an extension of the rate monotonic scheduling algorithm2. It assigns higher priorities to tasks with shorter deadlines and it is the optimal fixed-priority preemptive scheduling algorithm when d, 5 p, [9]. In this section we label the tasks so that dl 5 d, 5 . . . 5 d,. For the inverse-deadline scheduling algo- rithm the following properties have been proved. Property 6 [9] A crztrcal anstant for any task occurs whenever the task 2s requested samultaneously wzth re- uests for all hzgher priorzty tasks. Property [9] Task system X is feasible by the inverse-deadline scheduling algorithm i the first job H f each task meets its deadline. The following lemma can be shown by a proof similar to that in Ref. [6]. Lemma Task system X as feaszble by the znverse- deadlane schedulang algorathm f and only z L = max1<2<nLz 1, where __ L = mintE5,i,(t), ~(t) cJ . rt/p , k = 11 2, . . . Ld,/P,l). Sz ={d,}U{k.PJI j= 112,..,,i-1; The reduced scheduling point set R for the inverse- deadline scheduling algorithm is defined as follows. Definition 6 & Q;, where Q = { Lt/pjl . pj t E t j 1 5 k 5 i) and Q = {dz}, t < WPJJ -Pj +dJ}(l 5 j < 9. W 'The inverse-deadline scheduling algorithm is different from the deadline scheduling algorithm [lo] whi h is a dynamic scheduling algorithm. 2 6
Search
Similar documents
View more...
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks