0% found this document useful (0 votes)
57 views31 pages

Aperiodic Task Scheduling: Gerhard Fohler Mälardalen University, Sweden Gerhard - Fohler@mdh - Se

The document discusses different approaches for scheduling aperiodic tasks in real-time systems with periodic tasks, including background services, polling servers, total bandwidth servers and constant bandwidth servers. It provides examples and discusses properties of each approach.

Uploaded by

Thirumeni P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views31 pages

Aperiodic Task Scheduling: Gerhard Fohler Mälardalen University, Sweden Gerhard - Fohler@mdh - Se

The document discusses different approaches for scheduling aperiodic tasks in real-time systems with periodic tasks, including background services, polling servers, total bandwidth servers and constant bandwidth servers. It provides examples and discusses properties of each approach.

Uploaded by

Thirumeni P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Aperiodic Task Scheduling

Gerhard Fohler
Mälardalen University, Sweden
[email protected]

Real-Time Systems © Gerhard Fohler 2005 1


Non Periodic Tasks

So far periodic events and tasks


what about others?

• Sporadic (aperiodic, but minimum interarrival time)


– worst case: all sporadic tasks arrive with highest frequency
(with minimum time between arrivals)
– all other arrival patterns less demanding
– if we can schedule worst case, we can schedule all other
– worst case - minimum interarrival time - like periodic task
assume sporadic tasks as periodic for schedulability test

Real-Time Systems © Gerhard Fohler 2005 2


• Aperiodic (no limitations on arrival times known)
• soft: without deadline
not much to do from scheduling view
• firm: with deadline
(worst case execution time needs to be known as well)
usually “all or nothing” semantic:
when we start task, we want that it runs until completion; else
we don’t start

Real-Time Systems © Gerhard Fohler 2005 3


Background Services

Fixed priority scheduling, rate monotonic


What is the minimum we can do for aperiodic tasks in a periodically
scheduled system?
Background service: execute aperiodic tasks when no periodic
ones are executing
– no disturbance of periodic tasks (and their feasibility)
– simple run-time mechanisms
• queue for periodics
• queue for aperiodics - FCFS
– no guarantees

Real-Time Systems © Gerhard Fohler 2005 4


Polling Server
• Background service lives from “left overs” of periodic tasks,
without guarantees
• If enough idle time, ok
• long response times, although faster service possible
• How can we provide that at least a certain amount of processing
goes to aperiodic tasks?

Server task
periodic task, whose purpose is to service aperiodic requests as
soon as possible
– period Ts
– computation time Cs is called capacity of the server

Real-Time Systems © Gerhard Fohler 2005 5


Polling server algorithm
– at periods Ts server becomes active and serves aperiodic
requests with its capacity Cs
– no aperiodic activities - not execute, waits for next period,
capacity lost
– based on rate monotonic
Lehozcky, Sha, Strosnider, Sprunt 1987, 1989

Real-Time Systems © Gerhard Fohler 2005 6


Example Polling Server

• two tasks 1 , 2
Ci Ti
1 1 4
2 2 6

• server
Cs=2
TS=5

Real-Time Systems © Gerhard Fohler 2005 7


server
Cs=2
TS=5

2
c=2 c=1 c=2 c=1
aper. no no
aper
cap

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 time
Cs
2
1

Real-Time Systems © Gerhard Fohler 2005 8


Aperiodic Guarantee

Aperiodic guarantee
hard aperiodic task Ta, Ca, Da
worst case:
– aperiodic request misses the server task
– has to wait until next instance
– if Ca <= Cs, aperiodic request completed within two server
periods (one for waiting, one for executing)
2*Ts <= Da
– arbitrary execution times:
Ts + Ca/Cs Ts <= Da

average response time not very good!


Real-Time Systems © Gerhard Fohler 2005 9
Further FPS Server Algorithms

• Deferrable Server(Lehozcky, Sha, Strosnider 1987, 1995)


– lower bound for periodic tasks
• Priority exchange
– (Lehozcky, Sha, Strosnider 1987)
• Sporadic server
– Sprunt, Sha, Lehozcky 1989
– replenishes capacity only after aperiodic execution
• optimum algorithm
– does not exist!
– Tia, Liu, Shankar 1995
– proof that with static priority assignment, no algorithm exists
to minimize response time

Real-Time Systems © Gerhard Fohler 2005 10


Dynamic Priority Servers

• EDF based
• Dynamic priority exchange server
– Spuri, Buttazzo 1994, 1996
– like rate monotonic priority exchange, but for EDF
• Dynamic sporadic server
– Spuri, Buttazzo 1994, 1996
• Earliest deadline late server
– Chetto, Chetto 1989

Real-Time Systems © Gerhard Fohler 2005 11


Total bandwidth server

• Spuri, Buttazzo 1994, 1996


• response time dependent on server period:
– shorter periods have shorter response times
– but higher overhead
• how else shorter response times?
– change the deadline of the aperiodic to earlier time
(its EDF here, so it will get serviced earlier)
– but make sure that total load of aperiodics does not exceed
maximum value (bandwidth) Us

Real-Time Systems © Gerhard Fohler 2005 12


How can we calculate minimum deadline for US?
assume we have all CPU for us:
dl = C
U
1

C
t t+C
U

1 US
0.5

C
t t+2*C
Real-Time Systems © Gerhard Fohler 2005 13
kth aperiodic request
• arrival time rk
• computation time ck
• deadline dk
• server utilization US

dk = max( rk, dk-1) + Ck/Us


d0 = 0

• uses all bandwidth of server


• very simple run-time mechanism
• no extra server task

schedulability
Up + Us <= 1
Sum of periodic load and bandwidth of server less or equal 1.
Real-Time Systems © Gerhard Fohler 2005 14
Example Total Bandwidth Server
• periodic tasks 1 (3,6), 2 (2,8)
• TBS Us = 1 - Up = 0.25

2 1 dl1= 3+1/0.25=7 1 dl3= max(14,17)+1/0.25=21


2
aper.

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 time
dl2= 9+2/0.25=17
Real-Time Systems © Gerhard Fohler 2005 15
Total Bandwith Server - Comments

• based on
– Us not actual periodic load
– worst case c

Real-Time Systems © Gerhard Fohler 2005 16


Total Bandwith Server - Comments

• TBS assigns deadlines based on maximum Us (not actual load)


dk = max( rk, dk-1) + Ck/Us, d0 = 0

Us=0.125
1

dl1= 6+1/0.125=14
aper.

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 time

Real-Time Systems © Gerhard Fohler 2005 17


TB*

• Buttazzo, Sensini - 1997


• assigns deadlines dk first according to TBS
• then shortens, as much as periodics allow
– new d’k= fk …finishing time according to EDF schedule,
including periodics
– apply recursively
– maintains schedulability, since order maintained
• complexity, many steps

Real-Time Systems © Gerhard Fohler 2005 18


Constant Bandwidth Server

• Abeni and Buttazzo, 1998


• designed for multimedia applications
– sporadic (hard) tasks
– soft tasks: mean execution, interarrival times, not fixed
– periodic tasks
• assign maximum bandwidth of CPU to each soft task
• handles overload of aperiodics
– limited by assigned bandwidth
– might slow down, but not impair effect other tasks
• EDF based

Real-Time Systems © Gerhard Fohler 2005 19


CBS Definitions

• task i
– sequence of jobs Ji,j
– ri,j … request, arrival time of the jth job of task I

• hard task
– (Ci,Ti)
• Ci worst case execution time
• Ti minimum interarrival time
• deadline equal to next period: di,j = ri,j + Ti
• soft task
– (Ci,Ti)
• Ci mean execution time
• Ti desired interarrival time
• soft deadline equal to next period: di,j = ri,j + Ti
Real-Time Systems © Gerhard Fohler 2005 20
• cS … budget
• (QS,TS)
– QS … maximum budget
– TS … period of server
• US = QS/TS … server bandwidth
• dS,k … deadline associated to server
– initial dS,0 =0

• job Ji,j comes in, is served, assigned dynamic deadline di,j equal
to current server deadline dS,k
– job executes, server budget cs decreased

Real-Time Systems © Gerhard Fohler 2005 21


• cS=0:
– budget recharged to maximum QS
– new server deadline: ds,k+1=ds,k+TS

• Ji,j arrives, CBS active (jobs pending): put in queue


• Ji,j arrives, CBS idle:
– cS (ds,k - ri,j)*US:
• new deadline ds,k+1 = ri,j + TS
• cS recharged to QS
– else
• job served with last server deadline ds,k
• job finishes: next job in queue
• at any time, job assigned last deadline generated by server

Real-Time Systems © Gerhard Fohler 2005 22


Example CBS
1 (2,3)
hard

cs (ds,0 - r1)*US:ds,1=r1+TS=9
c1=3 c2=2 cs=1<(23-17)*2/7=12/7 no new deadline
2
server active - queue c3=1
soft

r1 r2 c = 0:d =d +T =16r3
S S,2 s,1 S
cS= 0:dS,3=ds,2+TS=23
CBS
(2,7)

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 time

Real-Time Systems © Gerhard Fohler 2005 23


• limits impact “harm” by ill behaved aperiodics, e.g., exec time
overrun
• various improvements
– several servers
– capacity exchange
– feedback control
– …..

Real-Time Systems © Gerhard Fohler 2005 24


Articles

• TBS:
Spuri, Buttazzo
“Efficient Aperiodic Service under Earliest Deadline Scheduling”
Proceedings of the 15th IEEE Real-Time System Symposium
(RTSS 94), Portorico, pp. 2-21, December 1994
• CBS:
L. Abeni and G. Buttazzo, "Integrating Multimedia Applications in
Hard Real-Time Systems", Proceedings of the IEEE Real-Time
Systems Symposium, Madrid, Spain, pp. 4-13, December 1998.

Real-Time Systems © Gerhard Fohler 2005 25


Schedulability Analysis

First show that aperiodic load executed not exceeds US of server

Lemma: In each interval of time [t1,t2], if Cape is the total execution


time demanded by aperiodic requests arrived at t1 or later and
served with deadlines less than or equal to t2, then
Cape (t2 - t1) US
Proof: by definition:

Cape Ck
t1 rk , d k t 2

Real-Time Systems © Gerhard Fohler 2005 26


• TB* uses periodic interference…can now calculate it

• (formulae for completeness only)


If(t, dks) =
n
d ks next _ ri ( t )
max 0, 1 Ci
i 1 Ti

next_ri(t)…time at which next instance of I after t starts

Real-Time Systems © Gerhard Fohler 2005 27


TBS assigns deadlines in increasing order,
therefore there must exist two aperiodic requests with indeces
k1 and k2 such that k 2

Ck Ck
t 1 rk , d k t 2 k k1
k2 k2
Cape Ck [ dk max( r k , d k 1 )] * U S
k k1 k k1

[d k2 max(rk1 , d k1 1 )] *U S

 (t 2 t1 ) *U S

Real-Time Systems © Gerhard Fohler 2005 28


Proof main result:
Theorem: Given a set of n periodic tasks with processor utilization
Up and a TBS with processor utilization of US, the whole set is
schedulable by EDF if and only if
Up + US 1
Proof: If:
• assume Up + US 1 plus overflow at time t
• overflow preceded by continuous utilization
• from a point t’ on (t’< t), only instances of tasks ready at t’ or later
and having deadlines less than or equal to t are run
• C total execution time demanded by these instances
• since there is overflow at t: t - t’ < C

Real-Time Systems © Gerhard Fohler 2005 29


• we also know that

n
t t'
C * Ci Cape
i 1 Ti
n
t t'
* Ci (t t ' ) * US
i 1 Ti
(t t ' ) * (U p U S )

it follows: Up+US > 1 …# contradiction

Real-Time Systems © Gerhard Fohler 2005 30


• only if:
• assume aperiodic request enters periodically with period TS and
execution time CS=TSUS, then server behaves like periodic task
• total utilization of processor is then Up+US
• if task set schedulable: UP+US 1

Real-Time Systems © Gerhard Fohler 2005 31

You might also like