Adaptive Scheduling in Real-Time Systems Through Period Adjustment
AAdaptive Scheduling in Real-Time SystemsThrough Period Adjustment
Shri Prakash Dwivedi
Department of Computer Science and AutomationIndian Institute of ScienceBangalore, IndiaEmail: [email protected]
Abstract —Real-time system technology traditionally developedfor safety critical systems, has now been extended to support mul-timedia systems and virtual reality. A large number of real-timeapplication, related to multimedia and adaptive control system,require more flexibility than classical real-time theory usuallypermits. This paper proposes an efficient adaptive schedulingframework in real-time systems based on period adjustment.Under this model periodic tasks can change their execution ratesbased on their importance values to keep the system underloaded.We propose Period Adjust algorithm, which consider the taskswhose periods are bounded as well as the tasks whose periodsare not bounded.
I. I
NTRODUCTION
The real-time scheduling paradigms, both static such asrate monotonic scheduling [13], and dynamic such as earliestdeadline first scheduling, do not fit well the requirementsof advanced real-time applications in dynamic environments.Real-time systems are being increasingly designed for com-plex systems. For these applications, it is sometime imprac-tical or impossible to provide static guarantees to real-timecomputation. These motivations have led to the emergence ofthe adaptation and overload management as a major researchissue in real-time systems.An overview of prior art in overload management andadaptive scheduling techniques for real-time systems is givenin Lu et al. [14]. Mechanism for detecting and handlingtiming errors including overloads are discussed in Stewart andKhosla [20], with emphasis on a specific application-orientedoperating systems. An interesting technique for overload man-agement in hard real-time control applications is describedin Ramanathan et al. [17]. The author presents a schedulingpolicy deterministically guaranteeing m out of any k periodictask activations, along with a methodology able to minimizethe effects of missed control-law updates. This work providesa solid foundation to graceful degradation policies of periodicreal-time tasks. However, unless the overload duration is veryshort, the application could be significantly impaired by theloss of periodic execution for a number of real-time tasks.Dynamic Window Constrained Scheduling algorithm is similarexcept that the window k is fixed. Mok et al. [16] modifiedDynamic Window Constraint Scheduling, which is primarilydeadline based by using the concept of Pfairness to improvethe success rate for tasks with unit size execution time. Otherframeworks such as the imprecise computation model and reward based model can be applied in the situation wherequality of service is proportional to the amount of workloadcompleted.The need for adaptive management of the Quality of Servicehas been widely recognized in the domain of the distributedmultimedia systems. A graceful degradation of the commu-nication subsystem is obtained in Abdelzaher and Shin [1]by means of QoS contracts specifying degraded acceptableQoS levels. Significant research has also been devoted toschedulers providing some degree of adaptation to cope withthe dynamic overload environment. The need for schedulingsystems providing real-time guarantee to a subset of taskswithin a general operating system has been emphasized inthe Stankovic et al. [19]. In Lu et al. [14] the authors assumea flexibility in timing requirements. To address the dynamicsof the environment, they proposed a modified EDF adaptivescheduling framework based on feedback control methods anduse feedback control loops to maintain a satisfactory deadlinemiss ratio when task execution times change.Many real-time task models have been proposed to ex-tend timing requirements beyond the hard and soft deadlinesbased on the observation that jobs can be dropped withoutseverely affecting performance [4]. Despite the success ofsome models in alleviating overload situation, it is sometimemore suitable to execute jobs less often instead of droppingthem or allocating fewer cycles. The work in Kuo et al. [12]is among the first to address this type of requirement. Load-adjustable algorithms and value-based policies are the maintechniques proposed for graceful recovery from overload. Aload adjustment mechanism is proposed in [12] in order tohandle periodic processes with varying temporal parameters.The aim of this work is to determine feasible time parameterconfigurations (execution time C and period T ) and thusmodify the real-time computation for collections of tasks.The configuration selection problem is solved by a harmonicapproach achieving the maximum exploitation of the computa-tional resources under any time parameter configuration. Whileappealing, this approach does not lend itself to many real-timesystems, where execution times, in spite of their variability,cannot be set or chosen by the designer.In [18] Seto et al. considered the problem of findinga feasible set of task period as a non-linear programmingproblem, which seeks to optimize specific form of control a r X i v : . [ c s . O S ] D ec erformance measure. Cervin et al. used optimization theoryto solve the period selection problem online by adaptivelyadjusting task periods with focus on optimizing specific con-trol performance [9]. Baruah et al. [2] proposed a schedulingalgorithm maximizing the effective processor during overload,given a minimum slack factor for all tasks.Buttazo et al. [5] proposed a flexible framework knownas elastic task model, where deadline misses are avoidedby increasing task periods until some desirable utilization isachieved. The work in [14] extends the basic elastic task modelto handle cases where the computation time is unknown. Inelastic task model [6],[7], periodic computations are modeledas springs with given elastic coefficients and minimum lengths.Requested variations in task execution rates or overload condi-tions are managed by changing the rates based on the spring’selastic coefficients. Generalized elastic scheduling proposedby Chantem et al. [10],[11], by generalizing elastic schedulingapproach. Although the Elastic model is nice but it does notconsider the cases where the task periods of soft real-timesystems may be unbounded or loosely bounded. We developin this paper an efficient adaptive scheduling scheme in real-time systems through period adjustment, which consider thetasks having bounded as well as unbounded periods.This paper is organized as follows. Section 2 describesproblem definition and motivation. Section 3 presents ourproposed task model and the Period Adjust algorithm andits features. In section 4, we present the experimental results.Finally, section 5 contains conclusion.II. P ROBLEM D EFINITION AND M OTIVATION
Many models have been proposed in real-time schedulingtheory to deal with adaptive scheduling and overload man-agement. Some of the proposed models are based on theobservation that less important jobs can be dropped withoutseverely affecting performance. But dropping of jobs may notalways be the best option, because it is sometime more suitableto execute the jobs less often instead of dropping them evenif they are less important. Elastic task model [6] uses flexibleframework but it do not consider the case where some of thesoft real-time task may be loosely bounded or unbounded.We propose a novel scheduling framework based on periodadjustment. Our algorithm considers the tasks whose periodsare tightly bounded as well as the tasks whose periods areloosely bounded. We feel that this is more general model andthis model performs nicely even when all tasks are bounded.Many soft real-time applications require the execution ofperiodic activities, whose rate can usually be defined withina certain range. The higher the frequency, the better theperformance. Depending on the application domain, sometasks are rigidly imposed by the environment whereas otheractivities can be more flexible, producing significant resultswhen their rates are within a certain range. For example,in multimedia systems the activities such as voice sampling,image acquisition, data compression, and video playing areperformed periodically, but their execution rates are not sorigid. Depending on the requested quality of service, tasks may increase or decrease their execution rate to accommodatethe requirements of other concurrent activities. However thisperiod range may be flexible also. Suppose a soft real-timetask has period range ( a, b ) , then in some application it maybe possible to increase few time units above b and decrease fewtime units below a , if by doing so system become schedulable.It is sometime counter intuitive that a soft real-time applicationwhich is schedulable in range ( a, b ) can not be schedulablefor the range ( a, ( b + 1)) or alike. There are many flexibleapplications in multimedia and control applications in whichwe may be able to vary few time units across bound (upperor lower) without severely affecting the performance. Wefeel that there should be a general scheduling frameworkwhich can consider the flexible applications whose periodsare unbounded alongwith the bounded one.III. P ROPOSED W ORK
A. Task Model
We consider the system where each task τ i is periodic and ischaracterized by the following tuple: ( C i , T i , T i min , T i max , w i )for i = 1 , . . . N . Where N is the number of tasks in thesystem, C i is the worst case execution time and T i is theinitial period of τ i . T i min denotes the minimum possible periodof τ i as specified by the application, and T i max representsthe maximum period beyond which the system performanceis no longer acceptable. The weighting factor w i , representsimportance of task τ i , to changing it’s period in face ofchanges. The longer the weighting factor of a task, the morewill be it’s contribution towards the overall utilization. Givena task set Γ , tasks are arranged in a nondecreasing order ofdeadline.Each task τ i in task set Γ is divided in to two parts. Γ h for hard real-time tasks and Γ s for soft real-time tasks suchthat Γ = { Γ h ∪ Γ s } . N is the total number of tasks in thesystems. n h is the number of hard real-time tasks such that ( n h = | Γ h | ) . n s is the number of soft real-time tasks suchthat ( n s = | Γ s | ) . w i is the weighting factor or importancevalue of each soft real-time tasks in Γ s . w i ’s for soft real-time tasks are arranged in such a way that (cid:80) n s i =1 w i = 1 ,in other words w i represents fractional importance value orpercentage of importance value of each soft real-time taskstowards the whole system performance. Furthermore a taskin Γ s may belongs to Γ s bound or Γ sp or Γ s unbound , i.e. Γ s = { Γ s bound ∪ Γ sp ∪ Γ s unbound } where Γ s bound con-sists of those soft real-time tasks for which an upper boundor lower bound or both are imposed on tasks periods prior toexecution or during execution, and Γ sp consists of those softreal-time tasks which have fixed periods or which requests forfixed periods during run time, whereas task set Γ s unbound consists of those tasks which are unbounded. However asa matter of fact period T i can not be less than worst casecomputation time C i of a task. Our scheduling algorithmemphasize such soft real-time application which have morenumber of tasks in Γ s unbound .In this task model, all the tasks τ i , which does not belongsto Γ s bound can have T i min or T i max equal to Φ , which meanshat they are unbounded. For each ( τ i ∈ Γ h ) , w i = h rt = 1 which means that all hard real-time tasks must execute pro-vided they are schedulable. T i denotes the actual period of task τ i , which is constrained to be in the range [ T i min , T i max ] forthe case ( τ i ∈ Γ s bound ) , whereas C i denotes actual executiontime considered to be known a priori. In the case of taskswith variable computation times, C i will denote the actualworst case execution time. Any period variation is alwayssubject to an utilization guarantee and is accepted only if thereexists a feasible schedule such that tasks are scheduled byearliest deadline first algorithm. Hence if (cid:80) ( C i /T i ) ≤ , alltasks can be created at the minimum period T i , otherwise thealgorithm is used to adapt the task’s period to T i such that (cid:80) ( C i /T i ) = U d ≤ , where C i is the actual online executionestimate and U d is some desired utilization factor. Systemdesigner can set w i statically or dynamically depending uponrequirements. In static method, all soft real-time tasks areassigned w i ’s prior to start of the task execution and these w i ’s remains fixed up to the end of the task completions.In dynamic method, assignment of w i is event based i.e.,weighting factor w i may be reassigned during the occurrenceof any event such as, a new task arrival or completion of atask. B. Period Adjust Algorithm
We propose a new scheduling framework namely Pe-riod Adjust algorithm which accepts set of tasks Γ and desiredutilization U d and return set of periods for soft real-time tasksso as to maximize quality of service. We may set U d equal tothe maximum schedulable utilization of individual schedulingalgorithm. We can set U d = 1 for dynamic schedulingalgorithm like EDF, or we can set U d ( n ) = n (2 /n − forthe static scheduling RM algorithm, where n is the number ofindependent, preemptable periodic tasks with relative deadlineequal to their respective periods. In this algorithm we assumethat deadline is equal to the period. We also assume that theexecution time C i of all the tasks is given prior alongwith theperiods of hard real-time tasks. The total task set Γ is dividedin two groups, namely the set of hard real-time tasks Γ h , andthe set of soft real-time tasks Γ s . Furthur the set of soft real-time tasks may consists of Γ sp , in which soft real-time taskrequest for fixed period, Γ s bound in which tasks are boundedby maximum and minimum periods.Our Period Adjust algorithm works as follows: The firstfor loop computes the utilization of hard real-time tasks, thenalgorithm computes the summation of all utilization of taskset Γ h to check for its feasibility. In the second for loopit computes the utilization of those tasks which request forperiod change, if there is no such task U sp is set to zero,after that it again checks for the feasibility of the schedulableutilization. The third for loop computes the tasks periods of allsoft real time tasks in accordance with their weighting factoror importance value. Next the algorithm checks whether theperiods of unbounded tasks are less than their computationtime. If period is less than computation time, it replaces periodby computation time. Finally it checks whether these periods exceeds their bounds for the bounded tasks, if this is the caseit replaces periods with their bounds. Algorithm 1 : Period Adjust (Γ , U d ) for each ( τ i ∈ Γ h ) do U i = C i T i end for U h = (cid:80) U i U s = U d − U h if ( U s ≤ thenreturn inf easible end iffor each ( τ i ∈ Γ sp ) do U i = C i T isp end for U sp = (cid:80) U i U s = U d − U h − U sp if ( U s ≤ thenreturn inf easible end iffor each ( τ i ∈ (Γ s − Γ sp ) do T i = C i (cid:16) w i + (cid:80) wspiN − nh − nsp (cid:17) ( U d − U h − U sp ) return T i end forfor each ( τ i ∈ (Γ s − Γ sp − Γ s bound )) doif ( T i < C i ) then T i = C i end ifend for mod = 0 for each ( τ i ∈ Γ s bound ) doif ( T i < T i min ) then T i = T i min elseif ( T i > T i max ) then T i = T i max Γ s bound = Γ s bound − τ i Γ sp = Γ sp + τ i mod = 1 end ifend ifend forif ( mod == 1) thenreturn Period Adjust (Γ , U d ) elsereturn f easible end if If computed period T i for a bounded task is less thanthe minimum period T i min , we can simply replace T i by T i min , because increasing the period leads to less overallutilization. However, if the computed period T i is greater thanthe maximum period T i max , we can not simply replace T i by T i max , because decreasing the period leads to increasedtilization, which may exceeds the schedulable utilization.Therefore corresponding task is removed from bounded taskset Γ s bound to fixed period task set Γ sp and Period Adjustalgorithm is re-invoked. In this algorithm we assume that insoft real-time application there are many cases where eitherno bounds are available or no bounds are required for softreal-time tasks.IV. E XPERIMENTAL R ESULTS
In this section we present the experimental results per-formed on our task model. We consider period selection withdeadlines equal to periods. In all the following tables hereonwards periods ( T i , T i min , T i max ) and computation times ( C i ) are expressed in milliseconds(ms). TABLE IT
ASK S ET P ARAMETERS
Task C i T i T i min T i max w i τ
18 100 50 150 0.30 τ
18 100 50 150 0.30 τ
18 100 50 150 0.18 τ
18 100 50 150 0.12 τ
18 100 50 150 0.10
To execute the Period Adjust algorithm, we first use the taskset parameters given in Table 1. In this experiment, all tasksstarts at time 0 with an initial period of 100 time units and thetask set is schedulable under EDF. Here the required maximumutilization of the overall system is + + + + =1 . , whereas the required minimum utilization of the overallsystem is + + + + = 0 . . Since thecurrent utilization is + + + + = 0 . ,the task set is schedulable under EDF. Assume that, at the10sec, τ needs to reduce its period to 50 time units, due tosome changes in system dynamics not experienced by othertasks. Since the new required utilization of the system is + + + + = 1 . . which is greater than 1, andtherefore as such it is not schedulable under EDF. We canobserve that the required minimum utilization of the systemis + + + + = 0 . , which is less than1. Therefore to allow for τ to change its period, the periodof tasks τ , τ , τ and τ must increase for the system toremain schedulable. At time 20sec, τ goes back to its originalperiod state. Fig. 1 shows the cumulative number of executedinstances for each task as its period changes over time. Whenwe execute Period Adjust algorithm on the above task sets,it will return the feasible set of task periods ( T = 50 , T =80 , T = 110 , T = 138 , T = 150) .Now we consider the same task set parameters with somechange. Here we assume that soft real-time tasks τ and τ arenot bounded, i.e. although the preferable maximum period is150, some flexibility is provided by the application to increaseor decrease the bound. In this case assume that at 10sec τ needs to reduce the its period to 50 time units and τ needs to reduce the its period to 60 time units, as shown in Table 2. TABLE IIT
ASK S ET P ARAMETERS
Task C i T i T i min T i max w i τ
18 50 50 150 0.30 τ
18 60 50 150 0.30 τ
18 100 50 150 0.18 τ
18 100
Φ Φ τ
18 100
Φ Φ
For these task set parameters Task compress algorithm [5]is infeasible, whereas Period Adjust algorithm is feasible. Infact when we execute the Period Adjust algorithm on theabove task sets, the corresponding periods obtained for thetasks are shown in Fig. 2 ( T = 50 , T = 60 , T = 147 , T =155 , T = 175) .Now, we consider the task set parameters given in Table3 for the case of admission control policy during dynamictask activation. In this experiment τ , τ and τ starts at TABLE IIIT
ASK S ET P ARAMETERS
Task C i T i T i min T i max w i τ
30 100 50 350 0.20 τ
50 200 50 350 0.20 τ
70 300 50 350 0.20 τ
10 100 50 350 0.20 τ
10 70 50 350 0.20 time 0. They have the current utilization + + =0 . and therefore schedulable by EDF. At time 10sec twotasks τ and τ arrives which makes the total utilization + + + + = 1 . . In order to allow the tasks τ and τ for execution, the tasks τ , τ and τ can increase theirperiod. Since both tasks τ and τ are of 10 sec duration, after20 sec tasks τ , τ and τ returns to their previous periods,as shown in the Fig. 3(Dynamic task activation). Now weconsider the above task set parameters with some modification.In this case τ and τ arrives at 10 sec having the computationtimes 30 ms and 20 ms respectively as shown in Table 4.Here task τ is loosely bounded (period of task τ shouldbe preferably between 50 and 350 but not necessarily). In thiscase total utilization is U = + + + + = 1 . . Obviously task sets are not schedulable. Task set parametersalongwith importance values are given in the follwing table.In this case also Task compress algorithm is infeasible. WhilePeriod Adjust algorithm is feasible. On execution periodsreturned by the Period Adjust algorithm are ( T = 150 , T =250 , T = 355 , T = 150 , T = 200) .For the comparison purpose, here we use the task set ig. 1. Dynamic period change using Period AdjustTABLE IVT ASK S ET P ARAMETERS
Task C i T i T i min T i max w i τ
30 100 50 350 0.20 τ
50 200 50 350 0.20 τ
70 300
Φ Φ τ
30 100 50 350 0.20 τ
20 70 50 350 0.20 parameters in [7], and we show that Period Adjust worksnicely in these cases also.
TABLE VT
ASK S ET P ARAMETERS
Task C i T i T i min T i max E i w i τ
24 100 30 500 1 0.30 τ
24 100 30 500 1 0.30 τ
24 100 30 500 1.5 0.25 τ
24 100 30 500 2 0.15
Task set parameters are shown in Table 5. In this experimentfour periodic tasks are created at time t = 0 . All the tasks startexecuting at their initial period, at t = 10 sec τ decreases itsperiod from 100 ms to 33 ms. At t = 20 ms τ returns to itsinitial period. The result of the application of Period Adjustalgorithm and Task compress algorithm on the above task sets is shown in the Fig. 4. It shows the actual number of instancesexecuted by each task as a function of time. Next experimentconsider the case of admission control policy during dynamictask activation (Table 6). Three tasks starts executing at thetime t = 0 at their initial period. An other task τ arrives attime t = 10 sec. Since tasks are not schedulable when τ isstarted, Period Adjust algorithm is invoked which increasesthe periods of other tasks to make the request of task τ fulfilled. TABLE VIT
ASK S ET P ARAMETERS
Task C i T i T i min T i max E i w i τ
30 100 30 500 1 0.25 τ
60 200 30 500 1 0.25 τ
90 300 30 500 1 0.25 τ
24 50 30 500 1 0.25
Fig. 5 shows the actual number of instances executed byeach task as a function of time during the execution of thePeriod Adjust algorithm and Task compress Algorithm.V. C
ONCLUSIONS AND F UTURE W ORK
In this paper we have suggested Period Adjust algorithmfor scheduling of tasks in which periods of soft real-timetasks are flexible. In this framework, periodic tasks can changetheir importance value to provide different quality of service.Importance value or weighting factor of soft real-time tasks arearranged in such a manner to keep the system underloaded. ig. 2. Dynamic period change which is feasible by Period Adjust only