You are on page 1of 10
Efficient Scheduling of Sporadic, Aperiodic, and Periodic Tasks with Complex Constraints Damir Isovié and Gerhard Fohler Department of Computer Engineering ‘Milardalen University, Sweden {dic,gfr} @mdh.se Abstract Many industrial applications with real-time demandsare composed of mized sts of tasks witha variety of requre- iments. These can bein the form of standard timing con- straints, such as period and deadline, or complex. e210 express application specie or non temporal constrains, reliably performance, tc. Arrival patterns determine whether tats wil be treated as periodic, sporadic, or ape- Fiodie. As many algorithms focus on specif sets of task ‘ypes and consrants ons, system design has o focus on ‘hose supported by a particular algorithm, ai the expense af the ree. In this paper we present an algorithm to deal with @ combination of mixed sets of tasks and constrains: peri odie tasks with compler and simple consraints, soft and firm aperiodic, and sporadic ask. Instead of providing an algorithm tailored for a specific set of constraints, we propose an EDF based rintine algorithm, and the wse of an offtine scheduler for complexity reduction to transform complex constraints into the EDF model. At runtime, an extension 10 EDF, two level EDF, ensures feasible execu- fiom of tasks with complex consirants inthe presence of ad- ditional tasks or overloads We present an algoritin for handling offine guaranteed sporadic tasks, with minimum interarrival times, in his context which keeps track of ar- rivals of instances of sporadic tasks to reduce pessimism about future sporadic arvivals and improve response times and acceptance of firm aperiodic tasks. A simulation study underlines the effectiveness of the proposed approach. 1 Introduction ‘Many industrial applications with real-time demands are ‘composed of tasks of various types and constraints. Arrival pattems and importance, for example, determine whether 207 0-7695.0500-290 $10.0 © 2000 EEE, tasks are periodic, aperiodic, sporadic, and soft, frm, or hard, ‘The controlling real-time system has to provide for «combined set of such task types. The same holds for the various constraints of tasks. In addition to basic temporal constraints, such as periods, start-times, deadlines, and syn- ‘chronization demands, e-., precedence, jitter, or mutual ex- 0, EDF is applied on the set of ready tasks - “normal level”. se{J.) = 0 indicates that a guaran teed task has to be executed or else deadline violation in the tsk set will occur. I will execute immediately - “prior- level". Since the amount of time spent at priority level known and represented in spare capacity, guarantcealgo- rithms inclode this information. Aher each scheduling decison, the spare capacities of the affected intervals are updated. If, in the curent inter- val J, an aperiodic task executes, or the CPU remains idle for one slot, current spare capacity in Ze is decreased. If an offline tsk assigned 10 Te executes spare capacity does not change. If an offline task T assigned toa later interval, 4j,j > c exces, the spare capacity of Fy is increased -T Was supposed to execute there but does 20, and that of Ze decreased. If Jy “borrowed” spare capacity, the “ending™ interval) willbe updated. This mechanism ensures that negative spare capacity tums zer0 or positive at runtime. Curent spare capacity is reduced either by aperiodic tasks oridle execution and will eventually become 0, indicating a garaniced task has tobe executed, See [8] for more detail 4 Aperiodic Tasks A first verion of slot shifting presented an algorithm to guarantee aperiodic tasks by inserting them into an offine schedule. Once guaranteed, the resources allocated for the aperiodic were removed by creating a new interval and ad- justing spare capacity. While efficient for guaranteeing se- quences of aperiodic tasks without removal, the runtime ‘overhead for handling sporadic tasks efficiently is too high. Further, changes inthe set of guaranteed tasks require costly deletion of imervals, recalculation of spare capacities, and ‘new guarantees. Thus, flexible schemes for rejections, re ‘moval of guaranteed tasks, and overload handling induce prohibitively high overhead. ‘The new method presented here separates acceptance and guarantee. It eliminates the online modificiation of tervals and spare capacities and thos allows rejection strate- ies over the entire aperiodic task set. au 4.1 Acceptance test ‘The basic idea behind our method is based on standard. earliest deadline frst guarantee, but sts it to work on top of the offine tasks. EDF is based on having full availability of| the CPU, so we have to consider interference from offline scheduled tasks and pertain their feasibility. ‘Assume, at time t), we have a set of guaranteed aperi- odie tasks G., and an offiine schedule represented by offine tasks, intervals, and spare capacities. At time t2,f1 < ta a new aperiodic A arrives. Meanwhile, a number of tasks of Ge, may have executed; the remaining task set atte is de- noted Gig. We test if AU G,, can be accepted, considering offine tasks. If s0, we add A to the set of guaranteed ape- rodics. No explicit reservation of resources is done, which ‘would require changes inthe intervals and spare capacities. Rather, resources are guaranteed by accepting the task only if it can be accepted together with the previous guaranteed ‘and offline scheduled ones. This enables the efficient use of | rejection strategies. ‘The finishing time of a firm aperiodic task Ay, with an execution demand of o(A,), is calculated with respect 10 the finishing time of the previous task, Aj-1. Without any offine tasks, it is calculated the same way as in the EDF algorithm: S(Ad) = ftAsa) + ofA) Since we guarantce fim aperiodic tasks together with of- fline tasks, we extend the formula above with a new term that refleets the amount of resources reserved for offline tasks t+ Rie fe(4:)1 Hannan ia Sei ‘where {ty ,t2] stands for the amount of resources (in slots) reserved for the exceution of offine tasks from time f, 10 time fa. We can access Rit, ta] via spare capacities and intervals at runtime: Rltiste) = (tet) — SD mar(seffe},0) nce) |As f¢(A,) appears on both sides of the equation, a simple solution i not possible. Rather, we present an algorithm for computation of finishing times of hard aperiodic tasks with complexity of O(N). 42. Algorithm Let Aj be a firm aperiodic task we want to guarante. Let G denote the set of previously guaranteed but not yet completed firm aperiodic tasks, such as each ask in G has a dA} Here is the pseudo code for the acceptance test and algo- rithm for finishing time calculation: {t= getFinishingTime(maz(ft(As-1)st),0(Ai)); 7 ebeck if acepting Ac causes any ofthe previously _guranzed firm aperiodic tasks omit deadline *7 if(ft s a(Ad)){ for(j =itlyj dl(G;)) => not feasible! insert(A,9); else reject A getFiniohingTime( ftp, reme){ 1 determine ft by “ling up” fre sot unt the cs exhouted, */ sey = start( le) + sell.) ~ ftp ‘while (reme > se,){ if(6cr (Le) > 9) reme = reme ~ seri ert Sty = start( Ie) sep = acl.) t eum (ftp + reme); ‘reme = remaining execution time ‘Sty = the finnishing time of predecessor task ‘The complexity of algorithm is O(N), because we go through all tasks only once, and calculate their finishing times on the way. More detailed description of the algo- rithm can be found in (12). 5 Sporadic Tasks In the previous section we described how firm aperiodic tasks are guaranteed online assuming no sporadic tasks in the system. Now we will see how sporadic tasks can be ‘included in the aperiodic guarantee, ‘We will discuss ways to handle sporadic tasks with pe- riodic tasks with complex constraints. We present a new algorithm which keeps track of sporadic task arrivals and reduces pessimism about possible future arrivals to improve guarantees and response times of aperiodic tasks. a2 5.1 Handling sporadic tasks Pseudo-periodic tasks ~ Sporadic tasks can be trans- formed offine into pseudo-periodic tasks {18} which can ‘be scheduled simply at runtime. The overhead induced by the method, however, can be very high: in extreme cases, a task handling an event which is rare, but has a tight deadline ‘may require reservation of all resources. Offine test —In an earlier paper [11], we have presented ‘an offline test fr sporadic tasks on offine tasks. Ivensured that the spare capacity available was sufficient forthe worst ‘case arrival of sporadic tasks without reflecting it in the spare capacity. Consequently, firm aperiodic tasks cannot be handled at runtime. OtMine test and online aperiodic guarantees — A bet- ter algorithm will perform the offline test and decrease the needed resources from spare capacity. The resulting pes- simismn can be reduced by reclaiming a slot upon non arrival cof asporadic task, Aperiodic guarantee will be possible, but have to consider worst case arrival patterns of the sporadic tasks at any time. Offtine test and online aperiodic guarantees and reduced pessimism - The algorithm presented here performs the offline test, but does not change intervals and spare capacity for runtime efficiency. At runtime, its keeps track of spo- radic arrivals to reduce pessimism, by removing sporadic tasks from the worst case arrival which are known to not arrive up 10 a certain point. An aperiodic task algorithm ublizes this knowledge for short response times. 52. Interference window ‘We do not know when a sporadic task; € S, will in- voke its instances, but once an instance of ; aves, we do know the minimum time until the arrival ofthe next n- stance — the minimum inter-arrival time of Sj. We also ‘know the worst cae execution time ofeach sporadic tsk in ‘S. We use this information forthe acceptance est of frm ‘aperiodic tasks. "Asfume a sporadic ask) invokes an instance atime ¢ (see figure 1), Let S¥ denote current invocation of S;, and SSH the successive one. ALtime ¢ we know that SP wit live no sooner than 2, where isthe minimam inter- aval time of 5. So, when S# has fnished its execution, ‘5 will not inlvence any ofthe firm aperiodic tasks at east, ‘nil SP aries. ‘This means tha, when ealelatng the amount of resources available fra frm aperiodic ask with ‘an execution that intersects with S's exceuton window, we ‘donot need to take into account the inererence from Sj, at east between the finishing time of its current invocation, ‘SP, and the start time on the next invocation, Sf", as de- picted in figure ro influence on fem aperiodie athe a em t THA Figure 1. A sporadic task. Let EW(4s) denote the execution window of As, i, the interval between Aj’s arival and its deadline: EW (Aa) = [ar(As),dl(Ad)], [EW] = al(Aa) ~ ar(Aa) [Now we wll see how the execution ofa previously guaran- teed sporadic tsk 5; € S can influence A's guaran. Let St denote the curent invocation of Si, i, the last invocation af 5; before Ay acved. Let IW; be the inter ference window of S;, that is the time interval in which S; ‘may preempt and imerfere with the execution of Ay. The following ses ean be denied case 1: SP is unknown, ic, the sporadic tsk S; has not stared yet to invoke its instances. 5; can arrive any time and we must assume the worst cas, that s Si will tart to fvoke its instances att, with maximum frequency. The interference window is the entire exe- caution window of As, 1% = EW. ease 2: St is known, ie, S; has invoked an instance before {The following sub-cases can occur: 8) start(S#) +A < t, ie, the last invocation com- pleted before A arsved, and the next invocation, 'SF*, could have arrived bot it has not ye. This means SP" can enter A's execution window at anytime, thus the same as incase 1, TW; = BW. b) end{ St)

You might also like