Professional Documents
Culture Documents
92120004
92120004
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
J1 c=4 J2 c=4
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
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 ;
Case a. ( ) = P fv = kg = P fmaxfv ,1 , Q; 0g + c = kg
k
j
j 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
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
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 )
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
: :
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
h= ,1
d ,r =w +T : X
1
P fa = h , k + T g( ,1) =
i;j i;j i;j s
= j
= maxfr +1 ; d g + T , T , r +1 =
h k T h
i;j i;j s s i;j h=0
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
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
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.
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.
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