(m,k)-firm constraints and DBP scheduling: impact of the initial k-sequence and exact schedulability test
aa r X i v : . [ c s . O S ] S e p (m, k)–firm constraints and DBP scheduling: impact ofthe initial k-sequence and exact schedulability test Joël GoossensUniversité Libre de Bruxelles (U.L.B.)Brussels, [email protected] 27, 2018
Abstract
In this paper we study the scheduling of (m, k)–firm synchronous periodic task systemsusing the Distance Based Priority (DBP) scheduler. We first show three phenomena: (i) choos-ing, for each task, the initial k-sequence 1 k is not optimal, (ii) we can even start the schedulingfrom a (fictive) error state (in regard to the initial k-sequence) and (iii) the period of feasi-ble DBP-schedules is not necessarily the task hyper-period. We then show that any feasibleDBP-schedule is periodic and we upper-bound the length of that period. Lastly, based on ourperiodicity result we provide an exact schedulability test. Keywords. (m, k)–firm constraints, real-time scheduling, uniprocessor, periodic tasks, non-preemptive tasks.
In this paper we consider the scheduling of (m, k)–firm real-time periodic task sets. The (m, k)–firm model was initially introduced by Hamdaoui et al. [1]; this model is intermediary betweenhard real-time constraints (where deadline misses are fatal) and soft real-time constraints (wheredeadline misses are tolerated but minimized). Indeed, the (m, k)–firm constraint imposes that“few” request deadlines can be missed. More formally, for each task, the (m, k)–firm constraint ischaracterized by two parameters: m and k, and the constraint requires that at least m requestsmeet their deadline for any k consecutive requests of the task. This model is very often usedto handle the scheduling of messages on real-time networks, the tasks represent the handlingof network frames and are consequently and inherently non-preemptive in the model. Hence, inthe following, the term task denotes either a non-preemptive task (scheduled on a uniprocessor)or a message (scheduled on a network channel). The seminal paper of Hamdaoui et al. [1]defined also a scheduling algorithm for that kind of constraints: the Distance Based Priority (DBPin short). Under DBP, the priority of each task is dynamic and is based on the number of taskrequest[s] which can miss their deadline without violating the (m, k)–firm constraint.
Related research.
Since the seminal paper of Hamdaoui et al. [1], there is a huge literatureabout scheduling firm real-time systems for various kinds of schedulers. It is out of the scopeof this paper to summarize that literature. Our study concerns a specific task model ((m, k)–firmperiodic tasks) for a specific scheduler (DBP). Concerning the more specific case of (m, k)–firmconstraints and the scheduler DBP, the literature proposes sufficient schedulability conditions [4].Hamdaoui in [2] evaluated the probability failure; Lindsay et al. [5] extend the analysis to handlepoint-to-point networks; Stringel et al. [8] handle multihop networks; Poggi et al. [6] introduceatrix-DBP scheduling and show the improvement. Related particular cases include the work ofJeffay et al. [3] and the work of Quan et al. [7].In all those papers, the choice/value of the initial k-sequences used by DBP to start thescheduling is not really studied. There is no discussion in the literature about the value of theinitial k-sequence. Very often, the researchers seem to assume that choosing the pattern k forthose sequences is optimal regarding the system schedulability without any discussion. Authorsalso consider very often, e.g., in experimental studies, that examining the first hyper-period ofthe schedule is significant to conclude. Lastly, the literature, to the best of our knowledge, onlyproposes sufficient (or necessary) schedulability tests. This research.
In this research we show that the choice of the initial k-sequences is significantand that the period of the schedule can be larger than the hyper-period. We first show threephenomena: (i) choosing, for each task, the initial k-sequence 1 k is not optimal, (ii) we can evenstart the scheduling from a (fictive) error state (in regard to the initial k-sequence) and (iii) theperiod of feasible DBP-schedules is not necessarily the task hyper-period. We then show that anyfeasible DBP-schedule is periodic and we upper-bound the length of that period. Lastly, basedon our periodicity result we provide an exact schedulability test. From the best of our knowledge,this is the first exact (i.e., necessary and sufficient) such test. Organization.
Section 2 presents our model of computation, preliminary definitions and as-sumptions. Section 3 presents the three (counter-intuitive) important phenomena, generally ig-nored by the literature, concerning the initial k-sequences. Section 4 studies the periodicity ofDBP schedules. Section 5 provides a feasibility interval and, based on our periodicity result, ourexact schedulability test. Lastly, in Section 6, we conclude.
We consider the scheduling of synchronous periodic task systems. A system τ is composed byn periodic tasks τ , τ , ... , τ n , each task is characterized by a period T i , a relative deadline D i ,an execution requirement C i . Such a periodic task generates an infinite sequence of jobs, withthe k th job arriving at time-instant (k − i (k = 1, 2, ...), having an execution requirement of C i units, and a deadline at time-instant (k − i + D i . We consider constrained-deadline systems,i.e., D i ≤ T i . Two additional task characteristics are m i and k i which mandate that at least m i out of any k i consecutive jobs of τ i must meet its deadline. We consider in this paper a discretemodel, i.e., the characteristics of the tasks and the time are integers.In order to schedule dynamically such a system, the scheduler will typically based its decisionon the k-sequence for each task, with the following definition: Definition 1 (k-sequence) . The k-sequence of task τ i is a binary string W = [w i,1 , w i,2 , ... , w i,k i ]which represents the recent past of the task jobs. By definition a deadline miss corresponds tothe value ‘0’ and a deadline met to the value ‘1’, the leftmost bit represents the oldest job.Notice that at time 0, this notion of k-sequence is not really defined since the “past” is some-what undefined, or empty. We assume that initially, at time 0, the scheduler based its decision onan initial k-sequence for each task; generally the authors consider the string 1 k i for task τ i , butwe will see that is not optimal and causes a loss of generality.The algorithm DBP assigns a dynamic priority to each active task (say τ i ) based on the num-ber of task request[s] which can miss their deadline without violating the (m i , k i )–firm constraint.In other words, DBP bases its decision on the distance between the current state (k i -sequence) Informally, for each task, the k-sequence represents the recent past of the task in regard with deadline failures. SeeDefinition 1 for a formal definition. In this document we use the formal language notation, w α means w repeated α times. i C i m i k i τ τ
10 8 3 4Table 1: System characteristics. τ τ ❄ ❄ ❄ ❄ ❄ ❄ ❄ [0010] Figure 1: System not DBP-schedulable choosing the initial k-sequence 1 k : at time 16, τ reachesan error state, the (2, 4)–firm constraint of τ being violated.and the closest error state (i.e., where the number of ‘1’ is less than m i ). For instance, if τ i is sub-ject to a (2, 3)–firm constraint and if the current 3-sequence is [101], the distance is 1 (the currentjob of τ i must be executed) while if the current 3-sequence is [011] the distance is 2 (the currentrequest of τ i could be executed, but if not the next one must be). By definition, any k-sequencewith less than m i ‘1’ violates the (m i , k i )–firm constraint and corresponds to an error state.DBP assigns the highest priority to the active task with the smallest distance; variants of DBPare based on the additional rule used to break ties, e.g., EDF-DBP or RM-DBF if we use theEarliest Deadline First or the Rate Monotonic scheduler. We do not consider a specific tie-brokerin this study but we assume that the tie-broker is deterministic and memoryless with the followingdefinitions: Definition 2 (Deterministic algorithm) . A scheduling algorithm is said to be deterministic if itgenerates a unique schedule for any given set of jobs.
Definition 3 (Memoryless algorithm) . Anon-preemptiveschedulingalgorithmissaidtobe mem-oryless iftheschedulingdecisionmadebyitattimet (whichcorrespondstojobarrivalorcomple-tion)dependsonlyonthestaticcharacteristicsofactivetasks(i.e.,T i , C i , m i , k i )andonthecurrentstate of the system (i.e., the current k-sequence and the time elapsed since the last request, ofeach task).In the previous definition, it may be noticed that since we consider non-preemptive systems,the scheduler does not consider the remaining processing time, the latter is always equal to C i for any active task τ i at scheduling time. k -sequences k i In this section we will see that choosing, for each task (say τ i ), the initial k-sequence to be 1 k i ,i.e., consider that the k i previous requests completed by their deadline is not optimal and causesa loss of generality. Observation 1 (Non-optimality of 1 ∗ ) . Choosing the pattern 1 k i for the initial k-sequenceof eachperiodic task τ i is not optimal under DBP. 3 τ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ Figure 2: The system is DBP-schedulable since all (m, k)–firm constraints are met in [0, 20) andthe system is in the same state at time 20, than at time 10. τ τ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ Figure 3: The system is DBP-schedulable since all (m, k)–firm constraints are met in [0, 20) andthe fact that the system is in the same state at time 20 than at time 0 in Figure 2.Proof. The proof is based on a (counter-)example which exhibits a system which is not DBP-schedulable choosing the pattern 1 k i for the initial k-sequence of each periodic task τ i while thesystem is DBP-schedulable for another initial k-sequences. Our counter-example is describedby Table 1. Figure 1 shows that the system is not DBP-schedulable if we start to schedule thesystem with the k-sequence 1 k i for each task τ i . (Notice that Figure 1 corresponds also to bothRM-DBP and EDF-DBP schedules.)On the contrary, with the following k-sequences: [0101], [1111] for τ and τ , respectively, thesystem is DBP-schedulable as illustrated by Figure 2. (Notice that Figure 2 corresponds to bothRM-DBP and EDF-DBP schedules.) (cid:3) In the previous section we saw that starting with the k-sequence 1 k is not always optimal, wealso show, with the next example, that we can even start from an error state. Example 1.
We consider this time the very same periodic task system than the one consideredintheprevioussection(i.e.,definedbyTable 1)butweconsiderthefollowing initial k-sequences:[0010], [1011] for τ and τ , respectively. Although we consider an initial fallacious k-sequencefor τ (since [0010] includes asingle ‘1’), Figure 3showsthat thesystemis DBP-schedulable: all(m, k)–firm constraints are met (since they are met in [0, 20), and since at time 20 we reach thesamesystemstatethanthescheduleillustratedbyFigure2(attime0),consequentlythefeasibleschedule repeats from time 20).We leave open the question of choosing efficiently/optimally the initial k-sequences and weassume in the following that those sequences are already chosen but are possibly different from1 k i . In our figures, picture ❄ represents a task request, we denote by d[W] the corresponding k-sequence W and thecurrent distance d from the closest error state. i C i m i k i τ τ τ τ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ Figure 4: The system is DBP-schedulable since all (m, k)–firm constraints are met in [0, 15) andthe system is in the same state at time 15 than at time 9.
In this section we will study the periodicity of DBP-schedules, an instrumental property to designan exact schedulability test.It is quite obvious that any feasible (deterministic and memoryless) schedule is periodic (wewill show that property below). Previous examples show that the periodic part of the scheduledoes not necessarily start from the origin (e.g., Figure 3). Another important phenomenon is thefact that the period of the schedule is not necessarily equal to the hyper-period P def = lcm { T i | i =1, ... , n } as exhibited by the next example. Example 2.
Consider the task characteristics described by Table 2. Figure 4 shows that thesystemisDBP-schedulableandthattheperiodofthescheduleis twice thehyper-period(3). Theschedule repeats from time 6 but the period is 6.Now we will prove the schedule periodicity and (upper-)bound the length of that period. Thatresult (and its proof) is instrumental to design our exact schedulability test for the DBP algorithm(see Algorithm 1).
Theorem 1 (Period upper-bound) . Any feasible DBP-schedule of a synchronous (m, k)–firmpe-riodic task set is finally periodic. Moreover, the period of the schedule is a multiple of P, upper-bounded by Q ni=1 P k i j=m i (cid:0) k i j (cid:1) × P.Proof. DBP is an on-line scheduling algorithm, i.e., it takes its decisions based on the (static)task characteristics and the (dynamic) current state of the system: the current k-sequence andthe time elapsed since the last request, of each task. Since we consider synchronous periodic,constrained-deadline, and DBP-feasible task systems, we know that at each instant t = k · P(k ∈ N ) all requests which occur strictly before t have completed their execution. Moreover,a new request of each task occurs at time t. Consequently, regarding the time elapsed sincethe last request, the system is in the same state at time 0, P, 2P .... The only difference (if any)concerns the k-sequences. For a given task (say τ i ) we can distinguish between P k i j=m i (cid:0) k i j (cid:1) distinctk-sequences (i.e., k-sequences with at least m i ‘1’ of length k i ). Consequently, in the worstcase we have to consider Q ni=1 P k i j=m i (cid:0) k i j (cid:1) hyper-periods before reaching a state already consideredin the past. The property follows from the fact we consider a deterministic and memorylessscheduler. (cid:3) Exact schedulability test
Now we have the material to provide an exact schedulability test (and an algorithm) for anydeterministic and memoryless DBP scheduler. Notice that we assume that the initial k-sequencesare fixed.
Definition 4 (Feasibility interval) . A feasibility interval is a finite interval such that if no (m, k)–firm constraint is missed while considering only requests within this interval then no (m, k)–firmconstraint will ever be missed.
Corollary 2.
The interval h Q ni=1 P k i j=m i (cid:0) k i j (cid:1) × P (cid:17) is a feasibility interval for the scheduling of syn-chronous constrained-deadline (m, k)–firmperiodic systems using DBP.Proof. It is a direct consequence of the proof of Theorem 1: in the worst case the system state attime 0, P, 2P, h ( Q ni=1 P k i j=m i (cid:0) k i j (cid:1) ) − i P are different but the system state at time Q ni=1 P k i j=m i (cid:0) k i j (cid:1) × Pby Theorem 1 occurred already in the past. (cid:3)
Based on Corollary 2 a straightforward exact schedulability test consists in building the schedule(by means of simulation) in the time interval [0, Q ni=1 P k i j=m i (cid:0) k i j (cid:1) × P). We designed a faster (inaverage) algorithm (Algorithm 1) which stops once the schedule repeats (or a failure occurs).The idea is to compare, at each hyper-period, the system state with the previous hyper-periodstates. Algorithm 1 assumes that the function
Schedule stops the simulation and returns falseonce a (m, k)–firm constraint is violated. The system-state considered in Algorithm 1 is thecurrent k-sequence for each task.The worst-case time complexity of the exact schedulability test is O ( Q ni=1 P k i j=m i (cid:0) k i j (cid:1) × P). Webelieve that for many real real-time applications the time complexity of our off-line test is rea-sonnable, e.g., if we consider harmonic task periods and limited (m, k) parameters.
In this study we showed that the choice of the initial k-sequences is significant regarding thesystem schedulability. We exhibited three phenomena: (i) choosing, for each task, the initial k-sequence 1 k is not optimal, (ii) we can even sometimes start the scheduling from a (fictive) errorstate and (iii) the period of feasible DBP-schedules is not necessarily the task hyper-period. Wethen showed that any feasible DBP-schedule is periodic and we upper-bounded the length of thatperiod. Lastly, based on our periodicity result we provided an exact schedulability test. Future work.
We left open the question of choosing efficiently/optimally the initial k-sequences.We left also open the following question: does the initial k-sequence impact the period of the(feasible) schedule? This research could be also extended to consider sporadic or asynchronousperiodic task sets.
Acknowledgments.
The author would like to thank Qiong Ye Song and Raymond Devillersfor taking part in interesting discussions. Finally, comments of anonymous reviewers helpedimproving the presentation of the paper. 6 lgorithm 1 : Exact DBP-schedulability test.
Input : task set τ Output : feasible
Data : State St[max] /* max = Q ni=1 P k i j=m i (cid:0) k i j (cid:1) *//* array St is indexed from 0 */ begin /* we save the current system state */ St[0] := system-state ; ℓ := 0;current-time := 0 ;periodic := false ;feasible := true ; repeat feasible := Schedule from current-time to current-time + P ;current-time := current-time + P ; if ℓ = max − thenfor j := 0 to max − do St[j] := St[j + 1]; else ℓ := ℓ + 1;St[ ℓ ] := system-state ;j := ℓ − while (j > ∧ ¬ periodic) do periodic := (St[j] = St[ ℓ ]) ;j := j − until (periodic ∨ ¬ feasible) ; return feasible; end eferences [1] H amdaoui , M., and R amanathan , P. A dynamic priority assignment technique for streams with(m, k)–firm deadlines. IEEE Transactions on Computers 44, 12 (December 1995), 1443–1451.[2] H amdaoui , M., and R amanathan , P. Evaluating dynamic failure probability for streams with (m, k)–firm deadlines. IEEE Transactions on Computers 46, 12 (December 1997), 1325–1337.[3] J effay , K., S tanat , D., and M artel , C. On non-preemptive scheduling of periodic and sporadictasks. In Real-Time Systems Symposium (1991).[4] L i , J., S ong , Y. Q., and S imonot -L ion , F. Schedulability analysis for systems under (m, k)–firmconstraints. In Factory Communication Systems (September 2004), IEEE Computer Society,pp. 23–30.[5] L indsay , W., and R amanathan , P. Dbp-m: a technique for meeting end-to-end (m, k)–firm guaran-tee requirements in point-to-point networks. In Annualconferenceonlocalcomputernetworks(1997), I. C. Society, Ed., pp. 294–303.[6] P oggi , E., S ong , Y. Q., K oubaa , A., and W ang , Z. Matrix-dbp for (m, k)–firm real-time guarantee.In Real-Time and Embedded Systems (Paris, France, 2003), Y. Trinquet, Ed., pp. 457–480.[7] Q uan , G., and H u , X. Enhanced fixed-priority scheduling with (m, k)–firm guarantee. In Real-time systemssymposium (2000), I. C. Society, Ed., pp. 79–88.[8] S triegel , A., and M animaramanimaram