Beruflich Dokumente
Kultur Dokumente
s
1
1
Real-Time Systems (Dr Shamala) 26
3.3 Other Uniprocessor Scheduling Algorithms
Period transformation for transient overload
a modified form of RM scheduling
Dynamic scheduling
earliest deadline first scheduling
least laxity first scheduling
Scheduling of IRIS tasks
imprecise computation
Scheduling of aperiodic tasks
Mode change
Real-Time Systems (Dr Shamala) 27
Period Transformation
Period transformation for transient overload
changes the period to cope with transient overloads
(in terms of RM scheduling)
actually, to cope with semantic criticality in RM
scheduling
example
tasks:
T
1
: T
1
= 12, C
1
= 4, C
1
+ = 7 [C
i
+: worst case]
T
2
: T
2
= 22, C
2
= 10, C
2
+ = 14
utilization rates: average = 0.79, worst case = 1.22
problem: if T
2
is hard rt and T
1
is soft (or not), how can we
guarantee T
2
s deadline in case of transient overload, and
T
1
s deadline in the average case?
Real-Time Systems (Dr Shamala) 28
(continued)
solution: boost priority of T
2
by reducing its period
replace T
2
by T
2
:
T
2
= T
2
/2, C
2
= C
2
/2, C
2
+
= C
2
+
/2
an alternative: lower the priority of T1 by lengthening its
period
in this case, double the value of parameters
the new deadline must be ok
Real-Time Systems (Dr Shamala) 29
Earliest Deadline First Scheduling
Also know as Deadline Monotonic
EDF scheduling
dynamic priority based, deadline monotonic
scheduling
Properties
EDF is optimal for uniprocessors
for periodic tasks with their relative deadline equal to
periods: if the total utilization of the task set is no
greater than 1, the task set can be feasibly scheduled
on a single processor by EDF.
Allows preemptions.
Real-Time Systems (Dr Shamala) 30
Procedure
1. Sort task instances that require execution in time
interval [0, L] in reverse topological order.
2. Initialize the deadline of the kth instance of task T
i
to (k-1)T
i
+ d
i
, if necessary
3. Revise the deadlines in reverse topological order.
4. Select the task with earliest deadline to execute
Real-Time Systems (Dr Shamala) 31
Uniprocessor Scheduling of IRIS Tasks
Introduction
Not necessary to run to completion. Iterative
algorithms.
Task of this type are known as increased reward
with increased service (IRIS)
reward function R(x)
typically
where r(x) is monotonically nondecreasing in x.
m, o : execution time of the mandatory and optional parts,
respectively
+ >
+ s s
<
+
=
m o x if
m o x m if
m x if
m o r
x r x R
) (
) (
0
) (
Real-Time Systems (Dr Shamala) 32
3.4 Task Assignment
Assignment of tasks to processors
use heuristics cannot guarantee that an allocation
will be found that permits all task to be feasibly
scheduled.
consider communication costs precedence of task
completion.
Sometime an allocation algorithm uses
communication costs as part of its allocation criterion.
Real-Time Systems (Dr Shamala) 33
Utilization-balancing algorithm
Objective to balance processor utilization, and proceeds by
allocating the tasks one by one and selecting the least utilized
processor.
Considers running multiple copies for fault-tolerance systems.
for each task T
i
, do
allocate one copy of T
i
to each of the r
i
least utilized
processors
update the processor allocation to account for the
allocation of T
i
end do
Real-Time Systems (Dr Shamala) 34
A Next-fit algorithm for RM scheduling
Used in conjunction with RM
separation of allocation and scheduling
simplifies the scheduler to a local one
allocation: centralized, scheduler: distributed
objectives:
to partition a task set so that each partition is scheduled later
for execution on a processor by RM scheduling
to use as few processors as possible
task characteristics
each task has constant period and deadline constraints
independent, no precedence constraints
Real-Time Systems (Dr Shamala) 35
allocation algorithm
n tasks
u
i
: utilization factor of T
i
P
i,j
: set of tasks assigned to a processor
N
k
: number of class-k processors used so far
tasks are divided into M classes such that
assigns k class-k tasks to each class-k processor, keeping
the utilization factor of the class-M processor less than ln 2
task T class - k if 2 u 2
task T class - M if 0 u 2
where 1 k < M, M > 3
i
1
k+1
1
k
i
1
M
e < s
e s s
s
1 1
1
Real-Time Systems (Dr Shamala) 36
Algorithm Next-Fit-M
for k = 1 to M do set N
k
= 1;
set i = 1;
while i <= n do
if T
i
is a task from class-k, 1 <= k < M, then
assign T
i
to P
k,N
k
;
if P
k,N
k
has currently k tasks assigned to it then
set N
k
= N
k
+1
endif
else (T
i
is a task from class-M)
if the total utilization factors of all the tasks
assigned to P
M,N
M
is greater than ln2-u
i
then
set N
M
= N
M
+ 1
endif
assign T
i
to P
M,N
M
endif
set i = i +1
endwhile
if P
k,N
k
has not task assigned to it then set N
k
= N
k
-1
Real-Time Systems (Dr Shamala) 37
Bin-packing assignment algorithm for EDF
periodic independent preemptible tasks
bin-packing problem: assign tasks such that the sum
of utilization factors does not exceed 1, and minimize
the number of processors needed
first fit decreasing algorithm
Initialize i to 1. Set U(j) = 0, for all j.
(L : a list of tasks with their utilizations sorted in descending
order, n
T
: # tasks )
while i <= n
T
do
Let j = min{k | U(k) + u(i) <= 1}.
Assign the i-th task in L to p
j
Set i = i + 1 .
end while
L- sorted list of t
ask so their utiliz
ation are in n
on-increasing
Real-Time Systems (Dr Shamala) 38
Myopic Offline Scheduling (MOS) Algorithm
Offline Algorithm given in advance arrival times, execution time
and deadline.
Non-pre-emptive task
Not only processor resources but also others resources such as
memory etc.
Schedule Tree
MOS proceeds by building up a schedule tree.
Each node represents an assignment and scheduling of a subset
of the tasks.
The root of the schedule tree is an empty schedule.
Each child of a node consists of a schedule of its parent node,
extended by one task.
A leaf of this tree consist of the schedule of the entire task set.
Real-Time Systems (Dr Shamala) 39
Myopic Offline Scheduling (MOS) Algorithm
algorithm
i) start with an empty partial schedule
ii) determine if the current partial schedule is
strongly feasible
then proceed; else backtrack
iii) extend the current partial schedule by one task
(1) apply the heuristic function to the first N
k
tasks in the
task set
(2) choose the task with the smallest heuristic value to
extend the current schedule
2 Questions w
hich one task &
when to stop
Develop a node if it is strongly feasible.
If not feasible, we backtrack that is we mark that node
as hopeless and then go back to its parents
Real-Time Systems (Dr Shamala) 41
Focused addressing and bidding (FAB)
Introduction
online
distributed environment, loosely coupled
both critical and noncritical tasks
local scheduler: handles (critical) tasks arriving at a
given node
global scheduler: schedules noncritical tasks
across processor boundary
global state
Real-Time Systems (Dr Shamala) 42
FAB cont.
algorithms for global scheduling
to which node the task should be sent
noncooperative algorithm-if enough resources for critical yes;
else no for non-critical.
random scheduling algorithm-if a processor load is exceeding
its threshold then another processor is chosen randomly.
focused addressing algorithm overloaded processor checks
its surplus info. and selects a processor which it feels it is
able to process the task within its deadline. Prob: surplus info
may be outdated.
bidding algorithm simultaneous lightly loaded to bid
(Request For Bids)
flexible algorithm <-- focused addressing + bidding
Real-Time Systems (Dr Shamala) 43
focused addressing algorithm
FAS: focused addressing surplus, tunable
parameter
locally unschedulable tasks sent to the node with
the highest surplus ( > FAS)
if no such node is found, the task is rejected
Real-Time Systems (Dr Shamala) 44
bidding algorithm
first, select k nodes with sufficient surplus
k: chosen to maximize the chances of finding a
node
a request-for-bid(RFB) message is sent to these
nodes
those nodes that receive RFB message
calculate a bid ( = likelihood that the task can
be guaranteed)
send the bid to the bidder node if the bid >
minimum bid reqd
the bidder sends the task to node that offers the
best bid
if no good bid available, reject the task
Real-Time Systems (Dr Shamala) 45
symbols
p
i
: a processor node with a newly arriving task that is not
locally guaranteed
p
s
: a node that is selected by FA algorithm
p
t
: a node that receives RFB message
the flexible algorithm (FAB algorithm)
p
i
selects k nodes with sufficient surplus
if the largest value of the surplus > FAS
the node with that surplus is chosen as focused
node(p
s
)
p
i
sends the task to p
s
immediately
also, p
i
sends in parallel a RFB message to the
remaining k-1 nodes. RFB contains info on p
s
when a node receives the RFB message
it calculates a bid, sends the bid to p
s
if p
s
exists
Real-Time Systems (Dr Shamala) 46
(continued)
when the task reaches p
s
it first invokes the local scheduler and checks the feasibility
if it succeeds, all the bids for the task will be ignored
if it fails, p
s
evaluates the bids, sends the task to the node
responding with the highest bid, and sends this info to p
i
in case there is no focused node, p
i
will handle the bidding
if p
s
cannot guarantee the task and if there is no good bid
available, then corrective actions follow
Real-Time Systems (Dr Shamala) 47
(original node)
p
i
network
p
s
(focused node)
bidding
Real-Time Systems (Dr Shamala) 48
The Buddy Strategy
Same as FAB in the sense that if the processor is overlo
aded it will try to offload some task to lightly loaded p
rocessor.
However, it differs in the manner in which it finds the light
ly loaded tasks:
Each processor has 3 thresholds of loading:
U:Under (T
U
), F: full (T
F
) and T: over (T
V
)
If a processor has a transition from F/T to U it broadcast
an announcement to this effect. This broadcast is not to
all processors but to a subset and this effect is known as
a buddy effect.
Real-Time Systems (Dr Shamala) 49
3.5 Fault-Tolerant Scheduling
Introduction
in case of hardware failure
Systems have sufficient reserve capacity and
sufficiently fast failure-response mechanism.
multiple processors with a set of periodic tasks
multiple copies of each version of a task executed in
parallel
the approach taken : ghost copies of tasks
embedded into the schedule
need not be identical to the primary copies
the tasks concerned are those that were to have been run by
the failing processor
Real-Time Systems (Dr Shamala) 50
Fault-tolerant schedule
should be able to run one or more copies of each
version (or iteration) of a task despite the failure of up
to n
sust
processor
Output of each fault-tolerant processor
has a ghost schedule + 1
+
primary schedules
makes room for ghosts by shifting primary copies.
feasible pair of a ghost schedule and a primary
schedule
if both schedules can be merged/adjusted to be feasible
Real-Time Systems (Dr Shamala) 51
Ghosts
each version of a task must have ghost copies
scheduled on n
sust
distinct processors
ghosts are conditionally transparent, only if
two ghost copies may overlap in the schedule of a processor
if no other processor carries the copies of both tasks (that is,
if the primary copies of both tasks are not assigned to the
same processor)
primary copies may overlap the ghosts only if there is
sufficient slack time in the schedule to continue to meet all
the deadlines
Real-Time Systems (Dr Shamala) 52
Algorithm FA1
H
a
: assignment procedure, H
s
: EDF scheduling procedure
1. Run H
a
to obtain a candidate allocation of copies to
processors.
2. Run H
s
for ghost and primary copies on a processor i.
if the resulting schedule is found infeasible, return to step 1
otherwise, record the position of the ghost copies in ghost
schedule G
i
, and the position of the primary copies in
schedule S
i
. (the primary copies will always be schedule
according to S regardless of any ghost happen or not)
Limitation:
- primary tasks are needlessly delayed when the ghost do not
have to be executed. While all task will meet their deadlines,
it is frequently best to complete execution of the task early to
provide slack time.
Real-Time Systems (Dr Shamala) 53
Algorithm FA2
1. Run H
a
to obtain a candidate allocation of copies to
processors.
2. Run H
s
for ghost and primary copies on a processor i.
if the resulting schedule is found infeasible, return to step 1
otherwise, record the position of the ghost copies in ghost
schedule G
i
. Assign static priorities to the primary tasks in
the order in which they finish executing.
3. Run a static-priority preemptive scheduler for primary
copies with the priorities to obtain S
i
Real-Time Systems (Dr Shamala) 54
Example
ghosts: g4, g5, g6 primaries: h1, h2, h3
h1 h2 h3 g4 g5 g6
release time 2 5 3 0 0 9
execution time 2 2 4 2 2 2
deadline 6 8 15 5 6 12
for the primary copies of g4 and g5
case 1: they are allocated to the same processor
case 2: they are on different processors
Real-Time Systems (Dr Shamala) 55
0 5 10 15
0 5 10 15
0 5 10 15
g4
g6 g4, g5
g5 g6
h1 h3 h2 h3
ghost schedule of p if g4 and g5 cannot overlap
ghost schedule of p if g4 and g5 can overlap
feasible primary schedule of p if g4 and g5 can overlap