Uniprocessor Feasibiity of Sporadic Tasks with Constrained Deadines is Strongy conp-compete Pontus Ekberg and Wang Yi Uppsaa University, Sweden Emai: {pontus.ekberg yi}@it.uu.se Abstract Deciding the feasibiity of a sporadic task system on a preemptive uniprocessor is a centra probem in rea-time scheduing theory. The computationa compexity of this probem has been a ong-standing open question. We show that it is conp-compete in the strong sense, even when deadines are constrained. This is achieved by means of a pseudo-poynomia transformation from the strongy NP-hard Simutaneous Congruences Probem to the compement of the feasibiity probem. I. INTRODUCTION We et a sporadic task system be ined as a finite mutiset T of tasks, where each task is a tripe (e, d, p) N 3 +, representing its worst-case execution time, reative deadine and minimum inter-arriva separation (or period), respectivey. A sporadic task generates potentiay unbounded sequences of jobs. A job is an instance of the task s workoad, characterized by a reease time, an execution time and an absoute deadine. A job from task (e, d, p) has execution time not arger than e time units and absoute deadine exacty d time units after its reease time. Reease times of two consecutive jobs from (e, d, p) are separated by at east p time units. A sporadic task system T generates any intereaving of job sequences that can be generated by each of the tasks (e, d, p) T. For a sequence of jobs to be successfuy schedued, every job must be executed for a tota duration equa to its execution time, between its reease time and its absoute deadine. In the foowing we assume a preemptive uniprocessor, meaning that ony one job can be executed at a time, but a job can be paused and resumed at a ater time at no additiona cost. Definition I.1 (Feasibiity). A task system T is feasibe if and ony if there is some scheduing agorithm that wi successfuy schedue a job sequences that can be generated by T. A task system T is said to have impicit deadines if d p for a (e, d, p) T, and said to have constrained deadines if d p for a (e, d, p) T. The utiization U(T) of a task system T is ined as U(T) (e,d,p) T e/p. Liu and Layand [1] showed that a task system T with impicit deadines is feasibe if and ony if U(T) 1, but this is not a sufficient condition with constrained deadines. Dertouzos [] showed that Eariest Deadine First (EDF) is an optima scheduing agorithm on preemptive uniprocessors, which means that the terms feasibiity and EDFscheduabiity can be used interchangeaby here. Theorem I. ([]). A task system T is feasibe if and ony if it is EDF-scheduabe. A reated workoad mode is that of (stricty) periodic tasks, where each task is a quadrupe (s, e, d, p) N N 3 +. The difference to the sporadic task mode is that the reease times of two consecutive jobs from task (s, e, d, p) must be exacty p time units apart, and the reease time of the first job is fixed at time point s. A periodic task system is synchronous if s for a tasks (s, e, d, p), and asynchronous otherwise. It is known [3] that feasibiity testing of sporadic tasks is equay hard as that of synchronous periodic tasks, which means that the terms sporadic and synchronous periodic can be used interchangeaby for the resuts in this paper as we. Theorem I.3 ([3]). A sporadic task system T is feasibe if and ony if the synchronous periodic task system {(, e, d, p) (e, d, p) T} is feasibe. A cassic resut is that the feasibiity probem for asynchronous periodic task systems with constrained deadines is strongy conp-compete [], [5]. Baruah et a. [5], [3] aso deveoped a pseudo-poynomia time agorithm for the specia case of synchronous periodic (or sporadic) task systems with utiization a priori bounded by some constant c < 1. However, the compexity of the genera synchronous case remained open for many years. It was isted as one of five open probems in rea-time scheduing by Baruah and Pruhs [6]. Shorty thereafter it was partiay resoved by Eisenbrand and Rothvoß [7] who showed it to be weaky conp-hard, but the question remained if it aowed a pseudo-poynomia time soution ike the specia case with bounded utiization. Eisenbrand and Rothvoß conjectured that it did, but we show that the feasibiity probem for synchronous periodic task systems with constrained deadines is strongy conp-compete, and thus that it can have no pseudo-poynomia time soution uness P NP. Figure 1 summarizes the current knowedge. Asynchronous periodic tasks Synchronous periodic tasks (or sporadic) Genera case conp-compete in the strong sense. [5] conp-compete in the strong sense (from this work). Utiization bounded by a constant c < 1 conp-compete in the strong sense. [5] There exists a pseudo-poynomia agorithm. [5], [3] Fig. 1. The current knowedge on the feasibiity probem of periodic tasks with constrained deadines on preemptive uniprocessors.
II. PRELIMINARIES A. The Simutaneous Congruences Probem The Simutaneous Congruences Probem (SCP) is a number-theoretic decision probem that has been used to estabish severa compexity resuts in rea-time scheduing theory. Definition II.1 (The Simutaneous Congruences Probem). An instance is ined by a mutiset A {(a 1, b 1 ),..., (a n, b n )} and an integer k, such that k n and (a i, b i ) N N + for a i {1,..., n}. The simutaneous congruences probem asks whether there exists a subset A A of at east k eements and an x N, such that x a i (mod b i ) for a (a i, b i ) A. In the remainder of this paper we assume, without oss of generaity, that a i < b i for a (a i, b i ) A. SCP was first shown to be weaky NP-compete by Leung and Whitehead [] via a reduction from CLIQUE, and then used by them to show various hardness resuts concerning fixed-priority scheduing. Leung and Merri [] reduced SCP to the compement of the asynchronous periodic feasibiity probem on uniprocessors, thus showing that probem to be weaky conp-hard. Baruah et a. [5] ater showed that SCP is in fact strongy NP-compete via an aternative reduction from 3-SAT, which then impied the strong conp-hardness of the asynchronous periodic feasibiity probem. Theorem II. ([5]). SCP is strongy NP-compete. B. The Theory of Demand Bound Functions The hardness proof we present in the next section reies heaviy on demand bound functions, and in particuar the foowing, we-known theorem due to Baruah et a. Theorem II.3 ([3], [5]). A sporadic task system T is feasibe on a preemptive uniprocessor if and ony if U(T) 1 and where, dbf(t, ), (1) dbf(t, ) (e,d,p) T ( d p ) + 1 e () is the demand bound function of T in interva engths. As a notationa convenience, et dbf(τ, ) dbf({τ}, ) for any task τ (e, d, p). One of the things that Baruah et a. [3] show using this theorem is that the sporadic feasibiity probem is in conp. A witness to the infeasibiity of a task system is simpy an such that the formua in Eq. (1) is fase (if there exists a witness, we are guaranteed that there is aso one in N representabe with poynomiay many bits). A simiar argument can be made for asynchronous periodic tasks. Theorem II. ([3], [5]). The feasibiity probem for periodic tasks, both synchronous and asynchronous, is in conp. III. THE HARDNESS OF SPORADIC FEASIBILITY Here we wi show the strong conp-hardness of the feasibiity probem for sporadic tasks on preemptive uniprocessors. This is achieved by means of a pseudo-poynomia transformation (as ined by Garey and Johnson [9]) from SCP to the compement of the feasibiity probem. A. Overview of the Transformation First we describe the intuition behind the transformation. In Figure we have marked aong a number ine the x N such that x a i (mod b i ), for four exampe pairs (a i, b i ). (, ) (, 6) (3, ) (, 3) 6 1 1 1 1 Fig.. Congruence casses a i moduo b i for the four different pairs (a i, b i ) A, where A {(, ), (, 6), (3, ), (, 3)}. It is cear from the figure that there are severa x N beonging to two congruence casses simutaneousy, but it can be shown that there is no x beonging to three. Thus, (A, ) is a yes-instance and (A, 3) is a no-instance of SCP. We woud ike to somehow match the structure of these congruence casses with demand bound functions. For each pair (a i, b i ) we want to create a demand bound function (in interva engths ) that is highy reguar, but has hard points of sighty increased demand at those that in some given way are reated to the congruence cass of a i moduo b i. If we have two such functions, their hard points shoud aign at exacty those reated to both congruences casses. Figure 3 iustrates this basic idea. The goa is to take any instance (A, k) of SCP and create A such functions that, when summed, resut in a vioation of Eq. (1) at some if and ony if at east k of them aign such hard points at. (, ) (, 6) Locay increased demand at a reated to the congruence cass of moduo. Asymptotic utiization of 1/ A. 6 1 1 1 1 Hard points aign at a reated to both congruence casses. 6 1 1 1 1 Fig. 3. Conceptua demand bound functions corresponding to the two pairs (, ) and (, 6) from A. The marked areas are where we want sighty increased demand. Note that these functions do not match exacty those that we wi get from the transformation. x
B. Encoding into Task Systems We now show how the high-eve idea for a transformation that was presented in the ast section is encoded with actua task systems. It does not appear possibe to capture the structure of a congruence cass in a way that achieves our goas using ony a singe sporadic task. We can, however, create a set of tasks that have the sought structure in its (joint) demand bound function. The detais of this foow. Definition III.1 (Transformation from SCP to (in-)feasibiity). The transformation takes an arbitrary instance (A, k) of SCP, where A {(a 1, b 1 ),..., (a n, b n )}, and produces a sporadic task system T (A,k). For each (a i, b i ) A, we create the foowing set of b i constrained-deadine sporadic tasks: { } τ y (a y {1,..., b i,b i) i}, where τ y (a i,b i) T (ai,b i) The mutiset (1, a i n + k 1, ), if y a i + 1, (1, yn, ), otherwise. T (A,k) is the produced task system. (3) T (ai,b i) () Each task set T (ai,b i) has a highy reguar demand bound function, where the hard points are encoded in the sighty shorter deadine of the task τ ai+1 (a i,b i). Figure shows the demand bound function of a generated set of tasks T (ai,b i), corresponding to some (a i, b i ) A. It can be noted that it has the same genera structure as the conceptua functions shown in Figure 3. Note that the number of tasks in T (A,k), as we as the vaues of their parameters, are bounded by some two-variabe poynomia in the size and the maximum numerica vaue found in the corresponding SCP instance (A, k). Aso, the transformation can triviay be computed in time bounded by such a poynomia. To estabish that the above is a vaid pseudo-poynomia transformation, what remains to be shown is that T (A,k) is a no-instance of the feasibiity probem if and ony if (A, k) is a yes-instance of SCP. We show this in the next section. C. Correctness of the Transformation Before showing that the transformation in Definition III.1 is correct, we need to prove two auxiiary emmas about the characteristics of the demand bound functions of the generated task systems. The first of the emmas is about the identity property of the demand bound functions at a points {, n, n, 3n,...}. 6 dbf(τ(,) 1, ) n 1n n 3n n 5n 6n 7n n 9n a in b in (a i + b i)n b in 6 dbf(τ(,), ) n 1n n 3n n 5n 6n 7n n 9n a in b in (a i + b i)n b in 6 dbf(τ(,) 3, ) n 1n n 3n n 5n 6n 7n n 9n a in b in (a i + b i)n b in 6 dbf(τ(,), ) n 1n n 3n n 5n 6n 7n n 9n a in b in (a i + b i)n b in 1 dbf(t (,), ) 6 k 1 n 1n n 3n n 5n 6n 7n n 9n a in b in (a i + b i)n b in Fig.. The demand bound functions for the tasks in T (,), generated from an SCP instance (A, k) where A n and k 3. The top four functions are the demand bound functions for the individua tasks. The dotted function is for the task τ(,) 3, which is ined by the specia case in Eq. (3). At the bottom is the sum of their demand bound functions, dbf(t (,), ). Note that dbf(t (,), ) has fixed size steps of width n, except for those corresponding to steps of dbf(τ(,) 3, ), which occur ony k 1 points away from the preceding steps. These shorter steps make up the hard points that we envisioned earier. Lemma III. (Identity of demand). Let (A, k) be any SCP instance, where A {(a 1, b 1 ),... (a n, b n )}, and et x N be any natura number. Then, dbf(t (A,k), xn) xn. Proof: Consider any pair (a i, b i ) A. By construction, a tasks (e, d, p) T (ai,b i) have e 1 and p. By putting these vaues in Eq. () we get ( ) xn d dbf(t (ai,b i), xn) + 1. (e,d,p) T (ai,b i )
Let ω be the remainder of x divided by b i, ω x x/b i b i. Now, take any of the tasks (e, d, p) T (ai,b i), and observe that because d p, we have xn d x + 1 d + 1 b i x + ω d + 1 b i b i x + ωn d + 1 b i x/b i + 1, if d ωn, x/b i, otherwise. How many of the tasks (e, d, p) T (ai,b i) have d ωn? From Eq. (3) it is cear that the ony tasks (e, d, p) T (ai,b i) with d ωn are the tasks τ y (a i,b i) for which y {1,..., ω}. Hence, ω out of the b i tasks in T (ai,b i) have d ωn, and dbf(t (ai,b i), xn) x/b i (b i ω) + ( x/b i + 1) ω x/b i b i + ω (5) x/b i b i + x x/b i b i x. From Eq. (), () and (5) we concude that dbf(t (A,k), xn) dbf(t (ai,b i), xn) xn, which is the caim of the emma. The second auxiiary emma is about the increased demand of task sets T (ai,b i) for a interva engths that are reated to the congruence cass of a i moduo b i. In particuar, for a xn + k 1, where x a i (mod b i ). Lemma III.3 (Increased demand at congruences). Let (A, k) be any SCP instance, where A {(a 1, b 1 ),... (a n, b n )}, and et x N be any natura number. Then, x + 1, if x a i (mod b i ), dbf(t (ai,b i), xn + k 1) x, otherwise, for a (a i, b i ) A. Proof: Let xn + k 1. Again, by construction we have e 1 and p for a (e, d, p) T (ai,b i), and therefore ( dbf(t (ai,b i), ) d ) + 1. (e,d,p) T (ai,b i ) Let ω x x/b i b i be ined as before. Take any (e, d, p) T (ai,b i) and note that d k + 1 p. Hence, d xn (d k + 1) x/b i, if d k + 1 ωn, x/b i 1, otherwise. We rewrite this to obtain d x/b i + 1, if d ωn + k 1, + 1 x/b i, otherwise. From Eq. (3) it is cear that if ω a i, then d ωn + k 1 hods for a the tasks τ y (a T i,b i) (a i,b i), such that y ω. However, if ω a i, then d ωn + k 1 additionay hods for τ ai+1 (a i,b i). Hence, if we et α denote the number of tasks (e, d, p) T (ai,b i) for which d ωn + k 1 hods, then ω + 1, if ω a i, α ω, otherwise. By the inition of ω as the remainder of x divided by b i, we have ω a i if and ony if x a i (mod b i ). Thus, we can rewrite the above as x x/b i b i + 1, if x a i (mod b i ), α x x/b i b i, otherwise. By appying simiar steps as in Eq. (5), we concude that dbf(t (ai,b i), ) x/b i (b i α) + ( x/b i + 1) α from which the emma foows. x/b i b i + α x + 1, if x a i (mod b i ), x, otherwise, We can now prove the correctness of the transformation. Lemma III. (Vaidity of transformation). For any SCP instance (A, k), the corresponding task system T (A,k) is infeasibe if and ony if (A, k) is a yes-instance. Proof: Let A {(a 1, b 1 ),..., (a n, b n )}. First we note that U(T (ai,b i)) 1/n for any (a i, b i ) A, and consequenty that U(T (A,k) ) 1. By Theorem II.3 it foows that the feasibiity of T (A,k) is exacty decided by the truth vaue of the formua in Eq. (1). We prove the two directions of the emma separatey, beginning with the if-case. Figure 5 serves as an iustration. (A, k) is a yes-instance T (A,k) is infeasibe: By assumption, there is a subset A A of size at east k and an x N, such that x a i (mod b i ) for a (a i, b i ) A. Without oss of generaity, et that A be the argest such subset.
Let assumptions, we have xn + k 1. By Lemma III.3 and the above dbf(t (ai,b i), ) x + 1, if (a i, b i ) A, x, otherwise. Because A k, it foows that dbf(t (A,k), ) dbf(t (ai,b i), ) xn + k >, and T (A,k) is infeasibe by Theorem II.3. (A, k) is a no-instance T (A,k) is feasibe: From Eq. () it is cear that dbf(t (A,k), ) is a rightcontinuous, non-decreasing step function in. Let be the set of points at which this function changes vaue, incuding point : { dbf(t (A,k), ) is discontinuous at } {} It is easiy seen that if there exists some such that dbf(t (A,k), ) >, then there must exist some such that dbf(t (A,k), ) >. Hence, by showing that dbf(t (A,k), ) for a, we can concude that there exists no such that dbf(t (A,k), ) >. In order to do so we need to find a more concrete characterization of. Note that from Eq. (3) we know that for a tasks (e, d, p) T (A,k) we have p bn, for some b N, d {yn, yn + k 1}, for some y N. By the inition of demand bound functions given in Eq. (), it foows that the points at which dbf(t (A,k), ) is discontinuous are of the form xn or xn + k 1 for some x N, and therefore {xn x N} {xn + k 1 x N}. From Lemma III. we directy have dbf(t (A,k), ), for a {xn x N}. Consider instead any xn + k 1, where x N. By Lemma III.3, we know that for any (a i, b i ) A, dbf(t (ai,b i), x + 1, if x a i (mod b i ), ) x, otherwise, Now, by assumption, (A, k) is a no-instance of SCP. It foows that there are at most k 1 pairs (a i, b i ) A such that x a i (mod b i ). Hence, dbf(t (A,k), ) dbf(t (ai,b i), ) xn + k 1, for a {xn + k 1 x N}. 1 1n + 1 n n n 6n n 1n 1n 1n 1 dbf(t (,), ) n n n 6n n 1n 1n 1n 1 dbf(t (,6), ) n n n 6n n 1n 1n 1n 1 dbf(t (3,), ) dbf(t (,3), ) n n n 6n n 1n 1n 1n Fig. 5. Demand bound functions for task sets generated from an SCP instance (A, k), where A {(, ), (, 6), (3, ), (, 3)} and k. As we have seen in Figure, (A, ) is a yes-instance of SCP and therefore T (A,) shoud be infeasibe. Indeed, for any x beonging to two of A s congruence casses (such as x 1) we have two eary steps in the corresponding demand bound functions aigning at xn + 1, and dbf(t (A,), ) + 1. If instead k 3, then the eary steps woud move one unit to the right in the figures, and two such steps aigning at some xn + 3 1 is no onger enough to witness infeasibiity, because dbf(t (A,3), ). In concusion, we have shown that dbf(t (A,k), ) for a, and consequenty for a. The feasibiity of T (A,k) is ensured by Theorem II.3. Our main theorem foows. Theorem III.5 (Intractabiity). Deciding whether a sporadic task system with constrained deadines is feasibe on a preemptive uniprocessor is conp-compete in the strong sense. Proof: There is a pseudo-poynomia transformation from SCP to the compement of the feasibiity probem. By Theorems II. and II. we know that SCP is strongy NP-hard and that the feasibiity probem is in conp.
IV. CONCLUSIONS We have showed that there can be no pseudo-poynomia time agorithm for deciding the feasibiity of constraineddeadine sporadic task systems on a preemptive uniprocessor, uness P NP. This highights the inherent practica importance of the specia case where the utiization of the task system is a priori bounded by some constant c < 1, for which Baruah et a. [3] have described a pseudo-poynomia time feasibiity test. This test (or variations thereof) is widey used in the iterature and has proven to be quite tractabe, at east for off-ine anaysis, even for arge c such as.9 or.95. An important outstanding question is whether this specia case aso has a poynomia time soution. REFERENCES [1] C. L. Liu and J. W. Layand, Scheduing agorithms for mutiprogramming in a hard-rea-time environment, Journa of the ACM, vo., no. 1, pp. 6 61, 1973. [] M. L. Dertouzos, Contro robotics: The procedura contro of physica processes, in Proceedings of the IFIP congress, vo. 7, 197, pp. 7 13. [3] S. Baruah, A. Mok, and L. Rosier, Preemptivey scheduing hard-reatime sporadic tasks on one processor, in Proceedings of the Rea-Time Systems Symposium (RTSS), 199, pp. 1 19. [] J. Y.-T. Leung and M. Merri, A note on preemptive scheduing of periodic, rea-time tasks, Information Processing Letters, vo. 11, no. 3, pp. 115 11, 19. [5] S. K. Baruah, L. E. Rosier, and R. R. Howe, Agorithms and compexity concerning the preemptive scheduing of periodic, rea-time tasks on one processor, Rea-Time Systems, vo., no., pp. 31 3, 199. [6] S. Baruah and K. Pruhs, Open probems in rea-time scheduing, Journa of Scheduing, vo. 13, no. 6, pp. 577 5, 1. [7] F. Eisenbrand and T. Rothvoß, EDF-scheduabiity of synchronous periodic task systems is conp-hard, in Proceedings of the ACM-SIAM Symposium on Discrete Agorithms (SODA), 1, pp. 19 13. [] J. Y.-T. Leung and J. Whitehead, On the compexity of fixed-priority scheduing of periodic, rea-time tasks, Performance Evauation, vo., no., pp. 37 5, 19. [9] M. R. Garey and D. S. Johnson, Strong NP-competeness resuts: Motivation, exampes, and impications, Journa of the ACM, vo. 5, no. 3, pp. 99 5, 197.