Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Information

Processing
Information Processing Letters 48 (1993) 39-45
Letters

Rate monotonic scheduling in hard real-time systems


J. Santos *, J. Orozco
Departamento de Ingenieria Elktrica, Universidad National de1 Sur, Av. Alem 1253, 8000 Bahia Blanca, Argentina

Communicated by F. Dehne
Received 4 August 1992
Revised 1 July 1993

Abstract

We present a systematic method that improves previous results to determine if a Real-Time Multiple Tasks-Single
Processor or any other isomorphic system can be Rate Monotonic (RM) scheduled, even with a coarse granularity of
priority levels.

Key words: Real-time systems; Rate monotonic scheduling

1. Introduction the results obtained in the field of Local Area


Networks CLANS), both operating in a hard real-
A real-time system is one in which its correct- time environment. They improve previous results
ness depends not only on the logical results of and give a systematic method that allows first to
computations but also on the time at which the determine if a set of tasks can be Rate Mono-
results are produced [ll]. Examples of hard real- tonic (RM) scheduled even if the processor uti-
time systems, in which one missed deadline can lization is above the theoretical schedulability
have catastrophic effects, can be found in multi- bound given in [7]. If this is not the case, it allows
tasking with a single processor [71, local area the identification of the subsystem with the maxi-
networks [8] and message communications among mum number of tasks that can be run. Secondly,
processors or other devices across a bus [4,9]. it allows to determine if and how the system can
They are isomorphic in the sense that in all cases be enlarged by adding new tasks.
there is one resource (the processor, the medium, In Multitasks-Multiprocessor systems, three
the bus) that must be shared among several users problems may be pointed out: task allocation,
(tasks, nodes, processors). processor scheduling and network scheduling. Al-
The purpose of this paper is to extend to though all of them are NP-hard [l], an approach
Multiple Tasks-Single Processor (MTSP) systems to solve the task allocation problem by means of
a global optimization technique called simulated
annealing [2] has been proposed by Tindell et al.
* Corresponding author. 1121. The scheduling method described in this

Elsevier Science Publishers B.V.


SSDI 0020-0190(93)E0139-B
40 .I. Santos, J. Orozco /Information Processing Letters 48 (1993) 39-4S

paper improves the method derived by Leung and mum and that it is feasible if U G m(2”‘” - 1)
Whitehead [6] used as part of that approach. holds. The inequality represents a theoretical
bound to the utilization factor and it is rather
conservative. As a matter of fact, examples can be
found showing that the condition is sufficient but
2. Multiple Tasks-Single Processor Systems and not necessary. In [5] a method is given to find if
Local Area Networks the idle processor time can be used to enlarge a
given Ci, for instance to improve the accuracy of
Liu and Layland [7] have considered MTSP a given task’s computation.
systems working under the following assumptions: In [81, LANs operating in a hard real-time
(a) Each task must be completed before the next environment were considered. Transmissions are
request for it occurs. (b) The requests are peri- not preemptible, the time is slotted and messages
odic and the request rate is the reciprocal of the must be transmitted in the time allocated to one
deadline. (c) The time it takes to execute a task slot (slot-time). The system of y1 nodes is denoted
(run time) is constant for that task and does not S(n), slots are notated t and numbered 1, 2,. . . .
vary in time. (d) The tasks are independent in the The expressions at the beginning of slot t and
sense that requests for a certain task do not instant t mean the same. In all calculations, the
depend on the initiation or completion of other unit of time is the slot-time. The request periods
tasks. are assumed to be multiples of the slot-time and
The set of m tasks, r,, TV,. . . , T,,, is completely the generation of messages ready to be trans-
specified as S(m) = {CC,, T,), CC,, T,), . . . , mitted takes place at the beginning of slots. At
(C,, T,)}, where C, and T, denote the run time that instant, the single resource (the transmission
and the period of task r,, respectively. C,/T, is medium) is allocated for the duration of the slot
the fraction of processor time spent in executing according to a certain scheduling algorithm. The
task ri; for the m tasks, the processor utilization medium goes idle during a slot-time, generating
factor is therefore an empty slot, only if at its beginning no node has
a message ready to be transmitted.
The worst case of load is the simultaneous
lJ= F Ci/T.
i= I generation of messages at all the nodes of the
network. If that happens at instant 1, the expres-
For a given set of tasks, a scheduling algorithm sion
is feasible if tasks are scheduled so that all dead-
n
lines are met. Tasks are preemptible and priori-
ties may be assigned to tasks according to their
w?(t) = c It/T1
1=1-
request periods, independent of their run times.
If tasks with shorter request periods have higher gives the total number of messages generated at
priorities, the assignment is called the Rate all the nodes in the closed slot-interval [l, t].
Monotonic priority assignment and the system is 1 1 denotes the monadic ceiling operator, that is
said to be Rate Monotonic scheduled. the smallest integer larger than or equal to t/T,.
Rate Monotonic Scheduling, notated RMS, is Since the transmission of messages can be seen
one of the three main deterministic schedules to as tasks executed in one unit of time, the network
be used in hard real-time systems [81. It has been can be specified as a system S(n) = ((1, T,),
specified, for instance, for use in the McDonnell (1, T2), . . . ,(l, T,)). S(n) is said to be non-
Douglas Space Station on-board software as the saturated iff W,(M) <M, where M denotes the
means for scheduling multiple independent tasks least common multiple of all T,s. If the system is
execution [ 131. non-saturated, in the period [l, M] there are
The deadline of task T, is denoted D,. In [7] it more slots than generated messages and there-
is proved that for Dj = T;, such schedule is opti- fore, some slots will go empty. The number of
.I. Santos, J. Orozco /Information Processing Letters 48 (I 993) 39-45 41

empty-slots in [l, M] is M - W,(M). In non- the first empty slot in S(i - 2) and, on the other
saturated systems M - W,(M) > 0 or, what is hand, the computation is irrelevant after c. This
equivalent, C;==,l/T. < 1. means that each r is considered at most only
The jth empty slot, symbolized eicn), will ap- once as a candidate for the first empty slot. Since
pear when there are j slots on top of the slots an upper bound to the number of candidates for
necessary to transmit all the messages generated empty slots is T,, and an upper bound to the
up to it. In [B] it is formally proved that ejcn) is the number of quotients in the expression 1 -t
least t such that t = j + w,(t). Zi:‘,‘,rt/T,] is n, the upper bound to the com-
If in the closed slots-interval [l, Tmin], where plexity of the calculation is O(n * T,>.
Tmin symbolizes the minimum T in the set of The upper bound is never reached for several
periods, there are enough slots to transmit all the reasons. It has been proved in [4] that if S(n) is
messages generated in the interval, the Fair such that the minimum period is bigger than or
Round Robin (FRR) discipline guarantees that equal to the number of nodes, the system is RM
each node will have the chance to transmit its schedulable. The tests, therefore, can be started
message. S(n) is therefore FRR schedulable iff from i = T, + 1. The actual number of quotients
Tmina n. This has been formally proved in [Sl. contributing to the calculation of each empty slot
A systematic method to determine if S(n) is is not n but grows from T, to (n - 1). Finally, if
RM schedulable has also been formally proved in for a given t, 1 + E~:l,[t/Th] = t’ > t + 1, the next
[B]: The basic idea is to test all subsystems pro- try is performed not for t + 1 but for t. All this
gressing from S(1) on and find out if they are avoids several improductive computations and the
non-saturated; if this is the case, the first empty process is then shortened.
slot is determined and a node may be added to
the tested subsystem iff its period is longer than
or equal to that slot. S(n) is therefore RM 3. RM schedulahility of MTSP systems
schedulable iff for i = 2,. . . , II,
So far, the MTSP systems of [71 and the LANs
i-l
of [B] do not seem to be isomorphic. In the first
c l/T,, < 1
h=l
case, time is continuous, tasks are preemptible
and for all i, Ci 2 1; in the second case, time is
and slotted, messages are non-preemptible and for all
i, ci = 1.
i-l
However, when talking about MTSP pre-
T a el(i- 1) =leasttsuchthatt=l+ c [t/Tnl.
h=l
emptible systems, time can be considered slotted.
As a matter of fact, although a task may preempt
The conditions are necessary and sufficient another task of lesser priority, the interruption is
and improve the schedulability test proposed by not instantaneous. In the case of tasks pro-
Leung and Whitehead [6]. For instance, S(n) = grammed in assembly language, the preemption
((1, 2), (1, 3), (1, 7)} is RM schedulable according takes place after the interrupted task has at least
to the expressions above but not according to completed the machine instruction being exe-
those authors. cuted and its execution status is preserved. If
Several simplifications may be introduced in tasks are not programmed in assembly language,
the routine. In the first place, if S(n) is non- the preemption takes place after completing the
saturated, S(n - 11, S(n - 21,. . . , S(1) will also be execution of the language instruction, usually
non-saturated and therefore the saturation test is composed of several machine instructions, and
necessary only on S(n). In the second place, the the task execution status is preserved [3]. Those
computation of eici_ i) is made for t E [e,(,_,, + would be the shortest slot-times. Short slot-times
1, ql. This is because, on one hand, the first favour preemptability but pay the penalty of larger
empty slot in S(i - 1) must obviously occur after overheads so the chosen slot-time will be a com-
42 .I. Santos, J. Orozco /Information Processing Letters 48 (1993) 39-45

promise. Nevertheless, no matter what the se- . . . (C,,


) T,)) is schedulable iff for i = 2,. . . , m,
lected slot-time is, considering a slotted time is
i-l
not only a valid assumption but it describes better
the real behaviour of the preemptible system.
c Ch/Th< 1
h=l
The selected slot-time shall be used as unit of
time, C,s and T,s can be assumed to be multiples and
of it and the generation of tasks to occur at the
i-1
beginning of slots. Moreover, a system of m tasks
T, &least t such that t = Cj + c Ch[t/Thl
S(m) = NC,, T,), CC,, T,), . . . ,(C,, T,,J can be h=I
considered as a system S(n) of n unitary tasks
(executable in one slot-time) such that hold.
The two conditions constitute the RM schedu-
n=C,+C,+ .” +c t?l’ lability test. The first one guarantees that S(i - 1)
is non-saturated and consequently it admits the
In S(n) there are, therefore, C, unitary tasks incorporation of another task, ri. The second one
of period T,, C, unitary tasks of period T,, . . , Cm guarantees that after the first empty slot in S(i -
unitary tasks of period T,. Since at the beginning l), there are sufficient slots to execute TVbefore
of each slot the RM algorithm is applied and the its deadline. The computational complexity is
slot granted to the higher priority task among O(n * T,).
those pending execution, the execution of the set If any of the two conditions does not hold
of C, unitary tasks that correspond to the original from the jth task on, the system S(j - 1) is the
task rj can be preempted by any task of the set of RM schedulable subsystem with the maximum
C, unitary tasks that correspond to the original number of tasks among those with the higher
task TV,of higher priority. The unitary tasks per- priorities. If what is looked for is the RM schedu-
taining to the original 7j not executed at the time lable subsystem with the maximum number of
of the preemption will resume execution later tasks, no matter what their priorities are, the
according to the RM scheduling. schedulability test must start for the subsystem
Since with the lowest priority, proceeding with the sec-
ond lowest priority and so on. The test is finished
5 l/T, = : C,/T,
when the first non-schedulable subsystem is
i=l i=l found.
With all the above in mind, it is an easy matter
if S(n) is non-saturated, S(m) is also non- to solve typical problems in RM scheduling, as
saturated. Moreover, for instance: Given S(m), non-saturated and RM
schedulable, find out
(i) If S(m + I), obtained by the incorpora-
i=l i=l
tion of a task of known period and run time, is
also RM schedulable.
where w,(t) gives the cumulative demands on (ii) How much the run time of a task belong-
the processor made by the m tasks in 11, tl [51. ing to S(m) can be expanded keeping the system
Therefore, RM schedulable.
(iii) The run time of the task (of period M)
ej(n) = ej(m). (1) that saturates the system (U = 1).
All the above facilitates the schedulability of
With those equivalences in mind, it is easy to mixed synchronous real-time and asynchronous
see how the results found in the field of LANs non-real-time tasks: Provided that real-time tasks
are applied to the field of MTSP systems. To are executed before their deadlines, the exact
begin with, a system S(m) = {(C,, T,), CC,, T,), time of execution is irrelevant. On the other
J. Santos, J. Orozco / Information Processing Letters 48 (1993) 39-45 43

hand, non-real-time tasks have no deadlines but a classes is FRR/RM schedulable iff for j = 2, 3,. . . ,c
better quality of service is associated to shorter
P(j)
delays. According to basic ideas proposed by
minT( j) 2 least t such that t = q(j) + c [t/7;]
Sprunt et al. [lo], delays associated to asyn- i=l
chronous tasks can be diminished if a periodic
(2)
task is created for servicing aperiodic requests.
Setting the period and execution time of this hold.
server is one of the basic problems solved by the
method here presented.
Proof. Tasks belonging to the first class shall be
executed even in case of conflict with tasks be-
4. The granularity of priority levels longing to lower priority classes. In [8] it has been
formally proved that a system is FRR schedulable
Sometimes, the priority mechanisms imple- iff the minimum period is bigger than or equal to
menting the RMS offer a limited number of the number of tasks. Therefore, tasks in the first
priority levels. For instance, in the case of the class are schedulable iff minT(1) > q(l), which
802.5 Token-Ring standard, the number of prior- proves (2) for j = 1.
ity classes is restricted to 8. If the number of Within the minimum period of the second
different periods in the system is bigger than the class, there must be enough slots to serve re-
number of levels, the tasks must be partitioned in quests from its own class and, in addition, allow
priority classes and therefore, no matter how for RM class-preemptions coming from tasks of
different their periods may be, tasks belonging to the first class. Therefore, the second class will be
the same class are not distinguishable. FRR schedulable iff
In order to find the scheduling conditions, let
P(2)
us consider first a simple non-preemptive system
minT(2) 2 least t such that t = q(2) + c [t/7;]
of n unitary tasks. Assume that a partition in c i=l
classes has been made. Since it is a real-time
environment but the RM mechanism can not holds. The iterative reasoning finishes with the
distinguish between tasks belonging to the same class c being schedulable iff
class, the simplest way to schedule tasks within
P(C)
the class is to use a Fair Round-Robin Schedul-
minT(c) aleast t such that t =q(c) + c [t/T.1
ing (FRRS) 181. However, the RMS can be ap- 1=1
plied to tasks belonging to different classes and
this leads to a sort of class preemption. which proves (2) for j = 2, 3,. . . , c.
S(n) = ((1, T,), (1, 7’*),. . . ,(l, 7”)) denotes the The condition of the system being FRR/RM
system of n unitary tasks; q(j) and minT(j) schedulable is obviously dependent on how it is
denote the number of tasks and the minimum partitioned. A procedure that usually provides
period in the j-class, respectively. Obviously, IZ= good results and leads to the minimum c is to
40) + q(2)+ ..*+q(c). maximize q(l), then to maximize q(2), etc. The
p(j)= Ci;:\q(x) is the number of tasks be- basic intuitive reason is that by assigning to each
longing to classes 1, 2,. ..,j - 1. class, from c = 1 on, the maximum number of
A system FRR schedulable for tasks belonging tasks that it can absorb, the number of tasks
to the same class and RM schedulable for tasks pending assignment is minimum, and therefore it
belonging to different classes shall be said to be gives the best chance for the next classes to be
FRR /RM schedulable. FRR schedulable.
The bigger q(l) can easily be determined as
Theorem. A system S(n) = {(l, T,), (1, T,),.. ., q(l) = minT(1) = T,. Then minT(2) = T, +qCl) and
(1, T,)) of n unitary tasks partitioned in c priority tests must be conducted for q(2) = 1, 2,. . . , until
44 J. San&s, .I. Orozco /Information Processing Letters 48 (1993) 39-45

finding the bigger q(2) that satisfies (2). The also be used in optimization techniques to solve
process is repeated until finding q(c). such problem.
For instance, in the system S(5) = ((1, 3), (1, The method improves previous theoretical up-
5), (1, 7X (1, 91, (1, 9)1, 40) =minT(l) = 3; per bounds and schedulability tests and facilitates
m&T(2) = 9 and (2) holds for q(2) = 2 and t = 9. the schedule of mixed tasks by incorporating, as a
The partition (T~T~TJ~~T~) happens to be the real-time task, a server of asynchronous tasks as
only FRR/RM schedulable for c = 2. An proposed by Sprunt et al.
FRR/RM schedulable partition may be subparti- Although not formally proved, a systematic
tioned and finer granularities can then be ob- method is given to partition the set of tasks in
tained. In the previous example, cases of coarse granularities (with less priority
classes than tasks’ priorities). RMS is used to
arbitrate conflicts between tasks belonging to dif-
ferent classes. Tasks within a class are RR sche-
duled. The basic idea is assembling each priority
are some of the finer schedulable partitions.
class with the maximum number of RR schedul-
It must be noted that the logarithmic partition,
able tasks making allowances for preemptions
also reputed to produce good results [4], parti-
coming from higher priority classes. As shown in
tions S(5) in the subsets (T,T~)(T~T~T~), non
the previous example, the method produces good
FRR/RM schedulable.
results where other methods, e.g. the logarithmic
Finally, let us consider, the problem of granu-
partition, fail.
larity in a system S(m) = {CC,, T,), CC,,
Tz), . . . , CC,, TJ} of m tasks with C, 2 1. The
tasks are partitioned in c classes. As before, q(j)
Acknowledgment
and minT( j) denote the number of tasks and the
minimum period in class j. p(j) = C:: q(x) is
The authors wish to thank the anonymous
the number of tasks belonging to classes 1,. . . , j
referees for their comments and suggestions that
- 1. r(j) denotes the sum of all the Cs of tasks
lead to improvements in this paper.
belonging to class j. From (1) and (21, S(m) will
be FRR/RM schedulable iff for j = 2, 3,. . . , c,
m&T(j) 2 least t such that t = r(j) +
References
C[ii’,C,,lt/T,J.

[ll A. Burns, Scheduling hard real-time systems: A review,


Software Engineering .I. 6 (3) (1990) 116-128.
5. Conclusions @I S. Kirkpatrick, C.D. Gelatt and M.P. Vecchi, Optimiza-
tion by simulated annealing, Science 220 (1987) 671-680.
I31 P.A. Laplante, Real Time Systems Design and Analysis
LANs operating in real-time environments and (IEEE Computer Society Press, California, USA, 1992).
multiple tasks-single processor systems are iso- [41 J.P. Lehoczky and L. Sha, Performance of real time bus
morphic under assumptions presented in this pa- scheduling algorithms, ACMPerfortnance Evaluation Rec.
per. Therefore, results obtained in the first field 14 (1) (1986) 44-53.

can be easily translated into the second and pro- [51 J.P. Lehoczky, L. Sha and Y. Ding, The rate monotonic
scheduling algorithm: Exact characterization and average
vide the necessary and sufficient schedulability case behavior, in: Proc. Real-Time Systems Symp. IEEE
conditions, based on the computation of empty CS, Los Alamitos, CA, 1989.
slots. An upper bound to the computational com- 161J.Y.T. Leung and J. Whitehead, On the complexity of
plexity is O(m * T,), where m is the number of fixed-priority scheduling of periodic real-time tasks, Per-
formance Evaluation 2 (4) (1982) 237-250.
tasks and T, is the maximum period of tasks’
171 C.L. Liu and J.W. Layland, Scheduling algorithms for
generation. Although task allocation in multiple multiprogramming in hard real time environment, J. ACM
tasks-multiple processor systems is an NP-hard 20 (1) (1973) 46-61.
problem, the results presented in this paper can Fl J. Santos, M.L. Gastaminza, J. Orozco, D. Picardi and 0.
J. Santos, J. Orozco / Information Processing Letters 48 (1993) 39-45 45

Alimenti, Priorities and protocols in hard real-time LANs, [ll] J.A. Stankovic, A serious problem for next-generation
Comput. Comm. 14 (9) (1991) 507-514. systems, IEEE Cornput. 21 (10) (1988) 10-19.
[9] L. Sha, R. Rajkumar and J.P. Lehoczky, Real-time com- [12] K.W. Tindell, A. Burns and A.J. Wellings, Allocating
puting with IEEE future bus+, IEEE Micro 11 (3) (1991) hard real-time tasks: An NP-hard problem made easy,
30-33, 95-99. Real Time Systems 4 (2) (1992) 145-165.
[lo] B. Sprunt, L. Sha and J. Lehoczky, Aperiodic hard [13] C. Warren, Rate monotonic scheduling, IEEE Micro 11
scheduling for hard real-time systems, Real-Time Systems (3) (1991) 34-38, 102.
1 (1) (1989) 27-60.

You might also like