You are on page 1of 10

Integrating Multimedia Applications in Hard Real-Time Systems

Luca Abeni and Giorgio Buttazzo


Scuola Superiore S. Anna, Pisa
luca@hartik.sssup.it, giorgio@sssup.it

Abstract  When data are received from an external device (for


instance, a communication network) the interarrival
This paper focuses on the problem of providing efficient time of the tasks that process such data may not be
run-time support to multimedia applications in a real-time deterministic, so it may be impossible to determine a
system, where two types of tasks can coexist simultaneously: minimum interarrival time for such tasks. As a conse-
multimedia soft real-time tasks and hard real-time tasks. quence, no a priori guarantee can be performed.
Hard tasks are guaranteed based on worst case execution
times and minimum interarrival times, whereas multimedia  Advanced multimedia systems tend to be more dy-
and soft tasks are served based on mean parameters. The namic than classical real-time systems, so all the
paper describes a server-based mechanism for scheduling scheduling methodologies devised for static real-time
soft and multimedia tasks without jeopardizing the a pri- systems are not suited for CM applications.
ori guarantee of hard real-time activities. The performance
of the proposed method is compared with that of similar For the reasons mentioned above, a large part of the multi-
service mechanisms through extensive simulation experi- media community continues to use classical operating sys-
ments and several multimedia applications have been im- tems, as Unix or Windows, to manage CM. Recently, some
plemented on the HARTIK kernel. scheduling algorithms have been proposed [16, 6] to mix
some form of real-time support with a notion of fairness,
but they do not make use of conventional real-time theory.
Since we are interested in systems based on a conventional
1. Introduction RT scheduler (such as EDF or RM), we do not consider this
kind of solutions.
Continuous Media (CM) activities, such as audio and In [8], Jeffay presents a hard real-time system based on
video streams, need real-time support because of their sen- EDF scheduling to be used as a test bed for video confer-
sitivity to delay and jitter. On the other hand, however, the ence applications; the system can guarantee each task at its
use of a hard real-time system for handling CM applications creation time based on its WCET and its minimum inter-
can be inappropriate for the following reasons: arrival time. While a bound for the WCET can be found,
 If a multimedia task manages compressed frames, the the interarrival time may not have a lower bound, because
of the unpredictability of the network (which may even re-
time for coding/decoding each frame can vary signif-
icantly, hence the worst case execution time (WCET) verse the order of messages at the reception site). For this
of the task can be much bigger than its mean execu- reason, Jeffay in [7] introduces the Rate-Based Execution
tion time. Since hard real-time tasks are guaranteed (RBE) task model, which is independent from the minimum
based on their WCET (and not based on mean execu- interarrival time. Although this kind of task cannot be guar-
tion times), CM applications can cause a waste of the anteed to complete within a given deadline, it is possible
CPU resource. to guarantee that it will not jeopardize the schedulability of
other hard real-time tasks present in the system.
 Providing a precise estimation of WCETs is very diffi- In [12], Mercer, Savage, and Tokuda propose a scheme
cult even for those applications always running on the based on CPU capacity reserves, where a fraction of the
same hardware. This problem is even more critical for CPU bandwidth is reserved to each task. A reserve is a cou-
multimedia applications, which in general can run on ple (Ci ; Ti ) indicating that a task i can execute for at most
a large number of different machines (think of a video Ci units of time in each period Ti . This approach removes
conferencing system running on several different PC the need of knowing the WCET of each task, because it
workstations). fixes the maximum time that each task can execute in its
period. Since the periodic scheduler is based on the Rate parameters, (Ci ; Ti ), where Ci is the WCET of each job
Monotonic algorithm, the classical schedulability analysis and Ti is the minimum interarrival time between successive
can be applied to guarantee hard tasks, if they are present. jobs, so that ri;j +1  ri;j + Ti . The system must provide an
The only problem with this method is that overload situ- a priori guarantee that all jobs of a hard task must complete
ations on multimedia tasks are not handled efficiently. In before a given deadline di;j . In our model, the absolute
fact, if a task instance executes for more than Ci units of deadline of each hard job Ji;j is implicitly set at the value
time, the remaining portion of the instance is scheduled in di;j = ri;j + Ti .
background, prolonging its completion of an unpredictable A soft real-time task is also characterized by the param-
time. eters (Ci ; Ti ), however the timing constraints are more re-
In [9], Kaneko et al. propose a scheme based on a pe- laxed. In particular, for a soft task, Ci represents the mean
riodic process (the multimedia server) dedicated to the ser- execution time of each job, whereas Ti represents the de-
vice of all multimedia requests. This allows to nicely inte- sired activation period between successive jobs. For each
grate multimedia tasks together with hard real-time tasks; soft job Ji;j , a soft deadline is set at time di;j = ri;j + Ti .
however, being the server only one, it is not easy to control Since mean values are used for the computation time and
the QoS of each task. minimum interarrival times are not known, soft tasks can-
In [3], Liu and Deng describe a scheduling hierarchy not be guaranteed a priori. In multimedia applications, soft
which allows hard real-time, soft real-time, and non real- deadline misses may decrease the QoS, but do not cause
time applications to coexist in the same system, and to be critical system faults.
created dynamically. According to this approach, which The objective of the system is to minimize the mean tar-
uses the EDF scheduling algorithm as a low-level scheduler, diness of soft tasks, without jeopardizing the schedulability
each application is handled by a dedicated server, which can of the hard tasks. The tardiness Ei;j of a job Ji;j is defined
be a Constant Utilization Server [4] for tasks that do not use as
nonpreemptable sections or global resources, and a Total Ei;j = maxf0; fi;j , di;j g (1)
where fi;j is the finishing time of job Ji;j .
Bandwidth Server [13, 15] for the other tasks. This solu-
tion can be used to isolate the effects of overloads at the
Finally, a periodic task is a task (hard or soft) in which
application level, rather than at the task level. Moreover,
the interarrival time between successive jobs is exactly
equal to Ti for all jobs (ri;j +1 = ri;j + Ti ). Periodic tasks
the method requires the knowledge of the WCET even for
soft and non real-time tasks.
do not have special treatment in this model.
In this paper, we propose a scheduling methodology
Tasks that manage CM can be modeled as soft real-time
based on reserving a fraction of the processor bandwidth to
tasks, because missing deadlines may decrease the QoS
each task (in a way similar to processor capacity reserves of
without causing catastrophic consequences. Moreover, CM
Mercer et al.[12]). However, to efficiently handle the prob-
activities are typically characterized by highly variable ex-
lem of task overloads, each task is scheduled by a dedicated
ecution times, causing the WCET to be much greater than
server, which does not require the knowledge of the WCET
the mean execution time.
and assigns a suitable deadline to the served task whenever
For the reasons mentioned above, treating CM tasks as
the reserved time is consumed.
hard real-time tasks is not appropriate, firstly because an un-
The rest of the paper is organized as follows: Section
derestimation of the WCET would compromise the guaran-
2 specifies our notation, definitions and basic assumptions;
tee done on the other tasks, and secondly because it would
Section 3 describes our scheduling scheme in detail and
be very inefficient, since trying to guarantee a task with a
its formal properties; Section 4 compares the proposed al-
WCET much greater than its mean execution time would
gorithm with other server mechanisms, and presents some
cause a waste of the CPU resource.
simulation results; Section 5 describes an implementation
This problem can be solved by a bandwidth reservation
of the proposed algorithm on the HARTIK kernel and shows
strategy, which assigns each soft task a maximum band-
some experimental results; and, finally, Section 6 presents
width, calculated using the mean execution time and the
our conclusions and future work.
desired activation period, in order to increase CPU utiliza-
tion. If a task needs more than its reserved bandwidth, it
2. Terminology and assumptions may slow down, but it will not jeopardize the schedulabil-
ity of the hard real-time tasks. By isolating the effects of
We consider a system consisting of three types of tasks: task overloads, hard tasks can be guaranteed using classical
hard, soft, and non real-time tasks. Any task i consists of schedulability analysis [11].
a sequence of jobs Ji;j , where ri;j denotes the arrival time To integrate hard and soft tasks in the same system, hard
(or request time) of the j th job of task i . tasks are scheduled by the EDF algorithm based on their ab-
A hard real-time task is characterized by two additional solute deadlines, whereas each soft task is handled by a ded-
icated server, the Constant Bandwidth Server (CBS), whose d s;k+1 = ri;j + Ts and cs is recharged to the max-

behavior and properties are described in the next section. imum value Qs , otherwise the job is served with the
last server deadline ds;k using the current budget.
3. The Constant Bandwidth Server  When a job finishes, the next pending job, if any, is
served using the current budget and deadline. If there
The service mechanisms that have inspired this work are are no pending jobs, the server becomes idle.
the Dynamic Sporadic Server (DSS) [13, 5] and the Total
Bandwidth Server (TBS) [13, 15]. As the DSS, the CBS
 At any instant, a job is assigned the last deadline gen-
guarantees that, if Us is the fraction of processor time as-
erated by the server.
signed to a server (i.e., its bandwidth), its contribution to Figure 1 illustrates an example in which a hard periodic
the total utilization factor is no greater than Us , even in the task, 1 , is scheduled together with a soft task, 2 , served by
presence of overloads. Notice that this property is not valid a CBS having a budget Qs = 2 and a period Ts = 7. The
for a TBS, nor for a Constant Utilization Server (CUS) [4], first job of 2 arrives at time r1 = 2, when the server is idle.
whose actual contributions are limited by Us only under the Being cs  (ds;0 , r1 )Us , the job is assigned the deadline
assumption that all the served jobs execute no more than ds;1 = r1 + Ts = 9 and cs is recharged at Qs = 2. At time
the declared WCET. With respect to the DSS, however, the t1 = 6, the budget is exhausted, so a new deadline ds;2 =
CBS shows a much better performance, comparable with ds;1 + Ts = 16 is generated and cs is replenished. At time
the one achievable by a TBS. r2 , the second job arrives when the server is active, so the
request is enqueued. When the first job finishes, the second
3.1. Definition of CBS job is served with the actual server deadline (ds;2 = 16).
At time t2 = 12, the server budget is exhausted so a new
The CBS can be defined as follows: server deadline ds;3 = ds;2 + ts = 23 is generated and cs
is replenished to Qs . The third job arrives at time r3 = 17,
 A CBS is characterized by a budget cs and by a ordered when the server is idle and cs = 1 < (ds;3 , r3 )Us =
pair (Qs ; Ts ), where Qs is the maximum budget and (23 , 17) 72 = 1:71, so it is scheduled with the actual server
Ts is the period of the server. The ratio Us = Qs =Ts deadline ds;3 without changing the budget.
is denoted as the server bandwidth. At each instant, a It is worth to notice that under a CBS a job Jj is assigned
fixed deadline ds;k is associated with the server. At the an absolute time-varying deadline dj which can be post-
beginning ds;0 = 0. poned if the task requires more than the reserved bandwidth.
Thus, each job Jj can be thought as consisting of a number
 Each served job Ji;j is assigned a dynamic deadline of chunks Hj;k , each characterized by a release time aj;k
di;j equal to the current server deadline ds;k . and a fixed deadline dj;k . An example of chunks produced
 Whenever a served job executes, the budget c s is de- by a CBS is shown in Figure 2. To simplify the notation, we
creased by the same amount. will indicate all the chunks generated by a server with an in-
creasing index k (in the example of Figure 2, H1;1 = H1 ;
 When cs = 0, the server budget is recharged to the H1;2 = H2 , H2;1 = H3 and so on).
maximum value Qs and a new server deadline is gen- In order to provide a formal definition of the CBS, let ak
erated as ds;k+1 = ds;k + Ts . Notice that there are no and dk be the release time and the deadline of the k th chunk
finite intervals of time in which the budget is equal to generated by the server, and let c and n be the actual server
zero. budget and the number of pending requests in the server

queue (including the request currently being served). These
A CBS is said to be active at time t if there are pending variables are initialized as follows:
jobs (remember the budget cs is always greater than
0); that is, if there exists a served job Ji;j such that d0 = 0 c = 0 n = 0 k = 0
ri;j  t < fi;j . A CBS is said to be idle at time t if it Using this notation, the server behavior can be described
is not active.
by the algorithm shown in Figure 3.
 When a job Ji;j arrives and the server is active the re-
quest is enqueued in a queue of pending jobs according 3.2. CBS properties
to a given (arbitrary) non-preemptive discipline (e.g.,
FIFO). The proposed CBS service mechanism presents some in-
teresting properties that make it suitable for supporting CM
 When a job Ji;j arrives and the server is idle, if cs  applications. The most important one, the isolation prop-
s;k , ri;j )Us the server generates a new deadline
(d erty, is formally expressed by the following theorem.
τ1 (2,3)
HARD
t
c1=3 c2=2 d1 c3=1
τ2
d2 d3

SOFT
r1 r2 r3 t

CBS
(2,7)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t
t1 t2 t3

Figure 1. An example of CBS scheduling.

d1,1 d1,2 =d 2,1 d2,2


H 1,1 H 1,2 H 2,1 H 2,2
a1,1 a1,2 a2,1 a2,2

J1 c=4 J2 c=4

Figure 2. Example of jobs divided to chunks.

Theorem 1 Given a set of n periodic hard tasks with pro- and it is scheduled with a budget Qs  Ci . Moreover,
cessor utilization Up and a CBS with processor utilization since ci;j  Qs , each job finishes no later than the
Us , the whole set is schedulable by EDF if and only if budget is exhausted, hence the deadline assigned to a
job does not change and is exactly the same as the one
U + U  1:
p s used by EDF. 2

Proof.  The CBS automatically reclaims any spare time caused


See [1]. 2 by early completions. This is due to the fact that when-
ever the budget is exhausted, it is always immediately
The isolation property allows us to use a bandwidth replenished at its full value and the server deadline is
reservation strategy to allocate a fraction of the CPU time postponed. In this way, the server remains eligible and
to soft tasks whose computation time cannot be easily the budget can be exploited by the pending requests
bounded. The most important consequence of this result with the current deadline. This is the main difference
is that such tasks can be scheduled together with hard tasks with respect to the processor capacity reserves pro-
without affecting the a priori guarantee, even in the case in posed by Mercer et al. [12].
which soft requests exceed the expected load.
In addition to the isolation property, the CBS has the fol-  Knowing the statistical distribution of the computation
lowing characteristics. time of a task served by a CBS, it is possible to perform
a statistical guarantee, expressed in terms of probabil-
 The CBS behaves as a plain EDF if the served task i ity for each served job to meet its deadline.
has parameters (Ci ; Ti ) such that Ci  Qs and Ti =
Ts . This is formally stated by the following lemma. 3.3. Statistical guarantee

Lemma 1 A hard task i with parameters (Ci ; Ti ) is To perform a statistical guarantee on soft tasks served by
schedulable by a CBS with parameters Qs  Ci and CBS, we can model a CBS as a queue, where each arriving
Ts = Ti if and only if i is schedulable with EDF. job Ji;j can be viewed as a request of ci;j time units. At any
time, the request at the head of the queue is served using the
current server deadline, so that it is guaranteed that Qs units
Proof. of time can be consumed within this deadline.
For any job of a hard task we have that ri;j +1 , ri;j = We analyze the following cases: a) variable computation
Ti and ci;j  Qs . Hence, by definition of the CBS, time and constant inter-arrival time; and b) constant com-
each hard job is assigned a deadline di;j = ri;j + Ti putation time and variable inter-arrival time.
When job Jj arrives at time rj
enqueue the request in the server queue;
n = n + 1;
if (n == 1) /* (the server is idle) */
if (rj + (c / Qs ) * Ts >= dk )
/*---------------Rule 1---------------*/
k = k + 1;
ak = rj ;
dk = ak + Ts ;
c = Qs ;
else
/*---------------Rule 2---------------*/
k = k + 1;
ak = rj ;
dk = dk,1 ;
/* c remains unchanged */
When job Jj terminates
dequeue Jj from the server queue;
n = n - 1;
if (n != 0) serve the next job in the queue with deadline dk ;
When job Jj served by Ss executes for a time unit
c = c - 1;
When (c == 0)
/*---------------Rule 3---------------*/
k = k + 1;
ak = actual time();
dk = dk,1 + Ts ;
c = Qs ;

Figure 3. The CBS algorithm.

Case a. ( ) = P fv = kg = P fmaxfv ,1 , Q; 0g + c = kg
k
j
j j j

If job interarrival times are constant and equal to Ts , and


X
1
( ) =
k
j
P fmaxfv ,1 , Q; 0g + c = k ^ v ,1 = hg:
j j j
job execution times are randomly distributed with a given h= ,1
Being vj greater than 0 by definition, the sum can be calcu-
probability distribution function, the CBS can be modeled
with a DG =D=1 queue: every Ts units of time, a request of
lated for h going from 0 to infinity:
cj units arrives and at most Qs units can be served. We can
define a random process vj as follows: X
1
v ( ) =
j
P fmaxfh , Q; 0g + c = kgP fv ,1 = hg
= c1
k j j

1 h=0

v = maxf0; v ,1 , Q g + c
j j s i;j
X
Q
X
1
where vj indicates the length of the queue (in time units) at = C ( ,1) +
k h
j
P fc = k , h + Qg( ,1)
j h
j

time (j , 1)Ts , that is the unit of times that are still to be h=0 h=Q+1

served when job Ji;j arrives. Hence, since Qs units of time X


Q
X
1
are served every period Ts , the job will finish no later than = C ( ,1) +
j
C, ( ,1) :
j

 
k h k h+Q h

d max = r + Qv T
h=0 h=Q+1
j
j i;j s Hence
s

X Q
X
1
which is also the latest deadline assigned by the server to ( ) =
j
C ( ,1) +
j
C, ( ,1) :
j
(2)
job Ji;j .
k k h k h+Q h
h=0 h=Q+1

If k = P fvj = k g is the state probability of process


(j )

vj and Ch = P fcj = hg is the probability that an arriving Using a matrix notation, equation (2) can be written as
job requires h units of time (since cj is time invariant, Ch
( ) = M ( ,1)
j j
(3)
does not depend on j ), the value of k can be calculated
(j )

as follows: where M and  are described in Figure 4


0 1 0 1
BB zC C }|: : : C { 0 0 : : :
Q+1

CC BB 
(j )
0
CC
M =B CC and  (j )
=B CA
0 0 0

B@ C C : : : C C 0 : : : 1 1 1 0
A
(j )
@
1
(j )
C C : : : C C C 0 : : 2

:
2
:
2
:
2
:
1
:
0
: :

Figure 4. Matrix describing the Markov chain for case a)

X
1
Case b.
= P fa  h + T gP fw ,1 = hg =
j j

,1
h=
In the case in which jobs’ execution times are constant
and equal to Qs (8j; ci;j = Qs ) and jobs’ interarrival times
X
1 X 1
= P fa = rg( ,1) =
j h
j

are distributed according to a given distribution function, h=0 r =h+T


each job is assigned a deadline di;j = maxfri;j ; di;j ,1 g + X
1 X
1
Ts , identical to that assigned by a TBS. In this situation, = A ( ,1)r
j

the CBS can be modeled by a G=D=1 queue: jobs arrive


h
h=0 r =h+T

in the queue with a randomly distributed arrival time and


the server can process a request each Ts time units. If we
define a random process wj as wj = di;j , ri;j , Ts , the 8k > 0;
distribution of the relative deadlines di;j , ri;j of job Ji;j X
1
can be computed from the distribution of wj , because ( ) =
k
j
P fh , a + T = kgP fw ,1 = hg =
j j

h= ,1
d ,r =w +T : X
1
P fa = h , k + T g( ,1) =
i;j i;j i;j s

= j

Since d = maxfr ; d ,1 g + T , we have


j h
i;j i;j i;j s h= ,1
w +1 = d +1 , T , r +1 = X
1
j i;j s i;j
= A , + ( ,1) j

= maxfr +1 ; d g + T , T , r +1 =
h k T h
i;j i;j s s i;j h=0

= maxf0; d , r +1 g = i;j i;j

= maxf0; r + w + T , r +1 g = i;j j s i;j


Thus, matrix M describing the Markov chain is shown in
= maxf0; w , a +1 + T g j j
Figure 5. For a generic queue, it is known that the queue
is stable (i.e., the number of elements in the queue do not
having defined a +1 = r +1 , r . Being a a stochas-
j i;j i;j j
diverge to infinity) if
tic stationary and time invariant process and w a Markov
 = mean interarrival rate
mean service rate < 1:
j

process, the matrix M describing the w Markov chain j

can be found. By defining 


( )
= P fw = kg and j
j

A = P fa = hg, we have
k
Hence, the stability can be achieved under the following
h j

8c
conditions:
( ) = P fw = kg =
k
j
j < i;j < Q s in case a)
= P fmaxf0; w ,1 , a + T g = kg j j s :r ,r > T in case b)
X
i;j +1
1 i;j s

= P fmaxf0; w ,1 , a + T g = k ^ w ,1 = hg In general,
c Q
j j j

,1
,r < T :
h= i;j s

X
1 r i;j +1 i;j s

= P fmaxf0; h , a + T g = kgP fw ,1 = hg j j If this condition is not satisfied the difference between the
,1
h=
deadline di;j assigned by the server to a job Ji;j and the job
In order to simplify the calculus, we distinguish two cases: release time ri;j will increase indefinitely. This means that,
k = 0 and k > 0: for preserving the schedulability of the other tasks, i will
X
1 slow down in an unpredictable manner.
0( ) =
j
P fh , a + T  0gP fw ,1 = hg =
j j
If a queue is stable, a stationary solution of the Markov
,1
h=
chain describing the queue can be found; that is, there exists
0 1 2 : : : : :
: : :
1
BB A 0
A A ,1 : : A0 0 0 : : : CC X
1
M =B CC with 
T +1 T T

B@ AA T +2 A +1
T

A +2
AT

A +1
A ,1 : A1
A
T

: A2
A0 0 0 : :
C1 A0 0 0 : A i =
r =i+T
A:
r

T +3 T T T

: : : : : : : : : :
Figure 5. Matrix describing the Markov chain for case b)

a solution  such that  = limj !1 (j ) , and  = M . to 1 , Uhard. All the soft tasks have the same relative dead-
This solution can be approximated by truncating matrix M line.
(having infinite dimension) to an N  N matrix M 0 and
solving the eigenvector problem 0 = M 0 0 with some nu- The metric used to measure the performance of the ser-
merical calculus technique. vice algorithms is the mean tardiness Ei computed over all
instances of each soft task. The reason for choosing such
The knowledge of the probability distribution function of
a metric is motivated by the fact that, as already mentioned
the relative deadlines before which a multimedia task job is
above, in multimedia applications meeting all soft deadlines
guaranteed to finish is useful for guaranteeing a QoS to each
task and for choosing the right server parameters (Qs ; Ts )
could be impossible or very inefficient. Thus, a more realis-
tic objective is to guarantee all the hard tasks and minimize
for each soft task.
the mean time that soft tasks execute after their deadlines.
Notice that, since all the soft tasks have the same relative
4. Simulation results deadline, the tardiness is not dependent on task’s deadline.
In the first experiment, we compare the mean tardiness
In this section we compare the CBS with other similar experienced by soft tasks when they are served by a CBS,
service mechanisms, namely the Total Bandwidth Server a TBS and a DSS. In this test, the utilization factor of peri-
(TBS) and the Dynamic Sporadic Server (DSS). The Con- odic hard tasks is Uhard = 0:5. The simulation results are
stant Utilization Server (CUS) is not considered in the illustrated in Figure 6, which shows that the performance
graphs because it is very similar to the TBS (indeed, slightly of the DSS is dramatically worse than the one achieved by
worse in performance). the CBS and TBS. This result was expected for the reasons
The main difference between DSS and CBS is visible explained above.
when the budget is exhausted. In fact, while the DSS be-
Figure 7 shows the same results, but without the DSS: the
comes idle until the next replenishing time (that occurs at
only difference is in the scale of the y-axis. In this figure,
the server’s deadline), the CBS remains eligible by increas-
the TBS and CBS curves can be better distinguished, so we
ing its deadline and replenishing the budget immediately.
can see that the tardiness experienced by soft tasks under a
This difference in the replenishing time, causes a big differ-
CBS is slightly higher than that experienced using a TBS.
ence in the performance offered by the two servers to soft
However, the difference is so small that can be neglected for
real-time tasks. The TBS does not suffer from this problem,
any practical purposes.
however its correct behavior relies on the exact knowledge
of job’s WCETs, so it cannot be used for supporting CM ap- Figures 8 and 9 illustrate the results of similar experi-
plications. Moreover, since the CBS automatically reclaims ments repeated with Uhard = 0:7 and Uhard = 0:9 respec-
any available idle time coming from early completions, a re- tively. As we can see, the major difference in the perfor-
claiming mechanism has also been added in the simulation mance between CBS and TBS appears only for heavy hard
of the TBS, as described in [14]. loads. Fortunately, this situation is of little interest for most
All the simulations presented in this section have been practical multimedia applications.
conducted on a hybrid task set consisting of 5 periodic hard
tasks with fixed parameters and 5 soft tasks with variable When WCETi >> ci;j the TBS can cause an under-
execution times and interarrival times. The periods and utilization of the processor. This fact can be observed in
the execution times of the periodic hard tasks are randomly Figure 10, which shows the results of a fourth experiment,
generated in order to achieve a desired processor utilization in which Uhard = 0:6, Usof t = 0:4, the interarrival times
factor Uhard, while their relative deadlines are equal to the are fixed, and the execution times of the soft tasks are uni-
periods. The execution and interarrival times of the soft formly distributed with an increasing variance.

P
tasks are uniformly distributed in order to obtain a mean
soft load Usof t = i r i;j,r with Usof t going from 0
As can be seen from the graph, CBS performs better than
TBS when ci varies a lot among the jobs.
c

i;j+1 i;j
Hard task load = 0.5 Hard task load = 0.7
900 80
DSS CBS
CBS TBS
800 TBS 70

700
60

600
Average soft tardiness

Average soft tardiness


50

500
40
400

30
300

20
200

100 10

0 0
0.46 0.465 0.47 0.475 0.48 0.485 0.49 0.495 0.5 0.28 0.282 0.284 0.286 0.288 0.29 0.292 0.294 0.296 0.298 0.3
Average soft load Average soft load

Figure 6. First experiment (TBS, CBS and Figure 8. Second experiment.


DSS). Hard task load = 0.9
300

CBS
TBS
Hard task load = 0.5
30 250

CBS
TBS
25
Average soft tardiness 200

20 150
Average soft tardiness

15 100

10 50

5 0
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
Average soft load

0
0.48 0.485 0.49
Average soft load
0.495 0.5
Figure 9. Third experiment.

Figure 7. First experiment (TBS and CBS).


When 2 terminates, 1 increases its frame rate to its maxi-
mum value (23; 8Fps, that corresponds to a period of about
5. Implementation and experimental results 42ms, which is the mean execution time for 1 ). After this
transient interval, 1 returns to execute at 8Fps.
The proposed CBS mechanism has been implemented on Figure 12 shows the number of decoded frames as a
the HARTIK kernel [2, 10], to support some sample multi- function of time, when the same periodic tasks are sched-
media applications (see [1] for implementation details). uled by two CBSs with parameters (Q1 ; T1 ) = (42; 125)
For example, an MPEG player has been executed using and (Q2 ; T2 ) = (19; 30). Being 42=125 + 19=30 =
EDF, with and without CBS. The application consists of 0:969 < 1, the two servers are schedulable, and being
two periodic tasks: task 1 with a period T1 = 125ms, Q1 = 42 ' c1 , 1 will execute at a frame rate near to the
corresponding to 8 frames per second (Fps), and task 2 required one.
with a period T2 = 30ms (33 Fps). Figure 11 reports From the figure we can see that the frame rate of 1 is
the number of decoded frames as a function of time, when about constant except for two little variations corresponding
the two periodic tasks are scheduled by EDF, activating to the activation and the termination of 2 (remember that
2 at t = 2000. Since C1 = 49ms, C2 = 53ms and Q = c is a limit condition). This is obtained by slowing
49=125 + 53=30 = 2:158 > 1, when 2 is activated the down the frame rate of 2 to 14:2 Fps: this task is clearly
system becomes overloaded. In fact, when 1 is the only overloaded (T2 < c2 ), so it is penalized by the CBS.
task in the system, it runs at the required frame rate (8 Notice that the proposed mechanism automatically ar-
Fps), but when at time t = 2000 2 is activated, 1 slows range the task periods without using a-priori knowledge
down to 4:4Fps, while 2 begins to execute at 17:96Fps. about the tasks’ execution times. The only information used
Hard task load = 0.6 CBS Scheduler
1600 200

TBS
CBS 180 Task 1
1400 Task 2

160
1200
140
Average soft tardiness

1000
120

frame number
8 Fps

800 100

80
600

60
400
40

200
20 14.2 Fps

0 0
0 20 40 60 80 100 120 140 160 180 200 0 5000 10000 15000 20000 25000
Computation times variance Time (ms)

Figure 10. Fourth experiment. Figure 12. Two MPEG players scheduled by
EDF Scheduler
CBS.
200

180 Task 1
Task 2 EDF with skip
200
160
180 Task 1
Task 2
140
160
8 Fps
120
frame number

140
100
8 Fps
120
frame number

80
100
60 23.8 Fps
17.96 Fps 80
40
60
4.44 Fps 15 Fps
20
8 Fps 40
0
0 5000 10000 15000 20000 25000 4.51 Fps
Time (ms) 20
8 Fps
0
0 5000 10000 15000 20000 25000 30000
Time (ms)
Figure 11. Two MPEG players scheduled by
EDF.
Figure 13. Two MPEG players scheduled by
EDF with skip.

by the CBS is the couple (Qi ; Ti ) and the estimation of task


execution time given by the budget.
Figure 11 shows another undesirable effect: when 2 ter-
In fact, if
minates, the frame rate of 1 increases to its maximum value
U =r c1 c
,r + r ,r =1
;j 2;j
sof t
(more than the required rate), in order to terminate in the 1;j +1 1;j 2;j +1 2;j
same time instant in which it would terminate if 2 was not
activated. This phenomenon causes an acceleration of the then Usof t = C 1 + C2 > 1.
T1 T2

movie that appears unnatural and unpleasant. This prob- Serving the two tasks by two identical CBSs with param-
lem can be solved using a skip strategy to serve soft tasks: eters Qs = c1;j = c2;j and Ts = 2Qs , they proceed at the
when a job finishes after its absolute deadline, the next job same rate (tasks’ parameters are equal because the two tasks
is skipped. play the same video).
As shown in Figure 13, a skip strategy eliminates ac-
celerations in the movie, but it introduces another problem, 6. Conclusions
which is presented in the next experiment, where the same
movie is decoded by two identical tasks, with Usof t = 1. In this paper, we presented a novel service mechanism,
From Figure 14 it is easy to see that, although the two the Constant Bandwidth Server, for integrating hard real-
tasks have the same period, they proceed with different time and soft multimedia computing in a single system, un-
speed. This is due to the fact that the system is overloaded. der the EDF scheduling algorithm. The server has been
EDF with skip
200 [6] P. Goyal, X. Guo, and H. M. Vin. A hierarchical cpu sched-
180 Task 1 uler for multimedia operating systems. In 2nd OSDI Sympo-
Task 2

160
sium, October 1996.
[7] K. Jeffay and D. Bennet. A rate-based execution abstrac-
140
tion for multimedia computing. In Network and Operating
System Support for Digital Audio and Video, 1995.
Decoded frames

120

100
[8] K. Jeffay, D. L. Stone, and F. D. Smith. Kernel support for
live digital audio and video. Computer Communications,
80
15(6), 1992.
60 [9] H. Kaneko, J. A. Stankovic, S. Sen, and K. Ramamritham.
40 Integrated scheduling of multimedia and hard real-time
20
tasks. In IEEE Real Time System Symposium, December
1996.
0
0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 [10] G. Lamastra, G. Lipari, G. Buttazzo, A. Casile, and F. Conti-
Time (ms)
celli. Hartik 3.0: A portable system for developing real-time
applications. In Real-Time Computing Systems and Appli-
Figure 14. Two identical MPEG players sched- cations, October 1997.
uled by EDF with skip. [11] C. L. Liu and J. Layland. Scheduling alghorithms for mul-
tiprogramming in a hard real-time environment. Journal of
the ACM, 20(1), 1973.
[12] C. W. Mercer, S. Savage, and H. Tokuda. Processor capac-
formally analyzed and compared with other known servers, ity reserves for multimedia operating systems. Technical
obtaining very interesting results. The proposed model has Report CMU-CS-93-157, Carnegie Mellon University, Pitts-
also been implemented on the HARTIK kernel and used to burg, May 1993.
support typical multimedia applications. [13] M. Spuri and G. Buttazzo. Scheduling aperiodic tasks in
dynamic priority systems. Real-Time Systems, 10(2), 1996.
As a future work, in order to extend the proposed model
[14] M. Spuri, G. Buttazzo, and F. Sensini. Robust aperiodic
to more general situations, the following issues need to be scheduling under dynamic priority systems. In IEEE Real-
investigated. A concurrency control protocol needs to be Time Systems Symposium, December 1995.
integrated with the method to avoid priority inversion when [15] M. Spuri and G. C. Buttazzo. Efficient aperiodic service
accessing shared resources. The difference between the first under the earliest deadline scheduling. In IEEE Real-Time
and the current CBS deadline can be used as a kind of feed- Systems Symposium, December 1994.
back for evaluating the request in excess and react accord- [16] I. Stoica, H. Abdel-Wahab, K. Jeffay, S. K. Baruah, J. E.
ingly adjusting the QoS in overload conditions. The CBS Gehrke, and C. G. Plaxton. A proportional share resource
mechanism can be used to safely partition the CPU band- allocation algorithm for real-time, time-shared systems. In
width among different applications that could coexist in the IEEE Real Time System Symposium, December 1996.
same system, as shown in [4]. A task can be used as a QoS
manager to dynamically change the bandwidth reserved to
each multimedia task. The strategies for changing the pa-
rameters of each CBS still have to be investigated.

References

[1] L. Abeni. Server mechanisms for multimedia applica-


tions. Technical Report RETIS TR98-01, Scuola Superiore
S. Anna, 1998.
[2] G. C. Buttazzo. Hartik: A real-time kernel for robotics appli-
cations. In IEEE Real-Time Systems Symposium, December
1993.
[3] Z. Deng and J. W. S. Liu. Scheduling real-time applications
in open envirovment. In IEEE Real-Time Systems Sympo-
sium, December 1997.
[4] Z. Deng, J. W. S. Liu, and J. Sun. A scheme for scheduling
hard real-time applications in open system environment. In
Ninth Euromicro Workshop on Real-Time Systems, 1997.
[5] T. M. Ghazalie and T. Baker. Aperiodic servers in a deadline
scheduling environment. Real-Time Systems, 9, 1995.

You might also like