Curso de Sistemas de Tiempo Real
Download
Report
Transcript Curso de Sistemas de Tiempo Real
Overload Scheduling in Real-Time Systems
Dr. Pedro Mejía Alvarez
Sección de Computación.
CINVESTAV-IPN, México
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
1
Outline
•
•
•
•
•
•
•
Motivation
Related Work
Methodology
The INCA Server Algorithm
The Approximate Algorithm
Analysis of the INCA Server
Simulation Results
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
2
Motivation
Many systems are provisioned incorrectly
Correctly provisioned systems have:
Changes in the environment,
Many arrivals of asynchronous events or
Faults of peripheral devices.
Overloads occur when safety is at stake
need efficient algorithm
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
3
Related Work
• Best effort scheduling algorithm (Locke and Jensen):
• The RED (Robust Earliest Deadline) algorithm (Buttazzo):
• Imprecise Computations
• Skip Model
• The (m,k) Model
• The Elastic Task Model
• The Incremental Server Model.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
4
Best effort scheduling algorithm
• Rejection policy for overloaded systems based on removing tasks
with the minimum value density (introduced time valued functions).
U
U
U
(b)
(c)
(a)
d
Dr. Pedro Mejia Alvarez
t
d
t
d
t
Curso de Sistemas de Tiempo Real
5
The RED (Robust Earliest Deadline) algorithm
• aperiodic tasks in overloaded systems. Combines criticality-based
scheduling and deadline tolerance. Remove the task with least
value on overload.
task
Planning
Scheduling policy
Reclaiming
policy
Ready queue
RUN
Rejection
policy
Reject queue
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
6
Imprecise Computation Model
Each Task is composed by a mandatory and an optional part.
Mi:
Oi:
mandatory part of task i
optional part of task i
Mi precceds in execution to a Oi
Oi could not execute or it may execute partially
The deadline of Mi must be guaranteed.
The deadline of Oi could be missed if necesarry.
Execution of Oi refines the result obtained by Mi
The goal in the scheduling of imprecise tasks is to execute the most
possible number of optional parts such that:
•No deadline of mandatory parts is missed
•The error is minimized. Error is greater when more optional parts are
not executed
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
7
Example of Execution of Imprecise Tasks
Task
T
M
O
P
U
1
30
5
5
3
0.333
2
40
5
5
2
0.250
3
50
10
2
1
0.240
Task 3 misses the deadline of
If optional part on its first Job
At time: t = 50
0.823
0
20
40
Dr. Pedro Mejia Alvarez
60
80
100
120
Curso de Sistemas de Tiempo Real
140
160
8
The Skip Model
•Some Jobs can be skipped, ocassionally
•On-line guarantee
•A job is either executed within its deadline or it is rejected.
•Each Task is characterized by (Ci,Ti,Di,Si)
•Si is the minimum number of Jobs that must be executed
between two consecutive skips
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
9
The Skip Model (Example)
0
1
2
3
4
5
6
7
8
9
10
11 12 13 14 15
16
C1 = 1, T1 = 3; C2 = 2, T2 = 4, Si = 2
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
10
The Elastic Tasks Model
•The idea is to control the processor load by tuning the task
periods
•Task utilization are variable with given elastic coefficients
•A periodic task is characterized by: (Cu, Ti0, Timin, Timax, Ei)
•The actual period Ti Є [Timin,Timax]
Ei
Ri
Dr. Pedro Mejia Alvarez
Timin
Ti0
Timax
Curso de Sistemas de Tiempo Real
11
Problems with Related Work
• Criteria for rejection = discard the lesser-valued tasks.
• The time valued functions:
• difficult to obtain
• performance may be degraded if the system designers
are not familiar with these functions.
• How far from optimal is the performance of the algorithms?
• Discarding “less critical” tasks during overload requires:
• exploration of a large search space (combination of
tasks) to discard solution not practical.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
12
Incremental Server for Scheduling
Overloads
Goal: Selecting Optional Parts to schedule in real-time
systems under overloads.
Problem: Selection while maximizing system value requires
the exploration of a large number of combinations.
Approach: Adjust the system workload by executing a
sequence of approximate algorithms in incremental steps.
• At every phase, load is adjusted and solution is refined.
• Property: The most critical tasks in the systems are
always scheduled and the total value is maximized.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
13
OVERLOADED SYSTEM
M1
M3
M2
M4
M5
O1
O4
O3
O5
M6
Mandatory Parts
Dr. Pedro Mejia Alvarez
O2
O6
Optional Parts
Curso de Sistemas de Tiempo Real
14
OVERLOADED SYSTEM
M1
M3
M2
M4
M5
O1
O3
M6
O2
O4
O5
O6
•Optimal Solution
•High Complexity
Dr. Pedro Mejia Alvarez
Real
Mandatory Parts Curso de Sistemas de TiempoOptional
Parts
15
OVERLOADED SYSTEM
M1
M3
M2
M4
M5
M6
•Low Cost
•Poor Solution
Dr. Pedro Mejia Alvarez
Real
Mandatory Parts Curso de Sistemas de TiempoOptional
Parts
16
INCREMENTAL EXECUTION OF A
SEQUENCE OF APPROXIMATE ALGORITHMS
Solutions
O1
O1
O2
O3
O2
O4
O6
O4
[...AP(0)][....................AP(1)] .............. [..........AP(k)]
•Solution is Refined
•Complexity Increases
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
17
INCREMENTAL EXECUTION OF A
SEQUENCE OF APPROXIMATE ALGORITHMS
Overload
1
Slack
U
0
Time
AP(0)][...............AP(1)][.......................................AP(k)]
• AP(1) runs on the Slack Time recovered by AP(0)
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
18
Task Model
• Imprecise periodic tasks: 0/1 constraints
• The arrival of each task is aperiodic (ri instances per task).
• Overload is caused by optional parts.
• Overloads only due to new task arrivals (comp times are fixed)
• Optional parts may be discarded under overloaded conditions.
• Each task has an associated criticality value vi.
• Earliest Deadline First (EDF) dispatching.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
19
Methodology Proposed
1.
Define the search space and the objective functions,
2.
Define the conditions for the feasibility of a solution,
3.
Find a feasible element within the search space that
satisfies an optimality criteria.
4.
Execute the Approximate Algorithms in an incremental
fashion, during system idle times.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
20
Search Space
Set
Search Space
S4
{1,1,1,1}
S3
{1,1,1,0} {1,1,0,1} {1,0,1,1} {0,1,1,1}
S2
{1,1,0,0} {1,0,1,0} {1,0,0,1} {0,1,1,0} {0,1,0,1} {0,0,1,1}
S1
{1,0,0,0} {0,1,0,0} {0,0,1,0} {0,0,0,1}
S0
{0,0,0,0}
• Each element in S denotes either a Feasible or Non-Feasible Solution
• Dr.XiPedro
= 1,
optional
part i is chosen
for execution.
Mejia
Alvarez
Curso de Sistemas
de Tiempo Real
21
Objective Functions and Feasibility test
• Objective Functions:
• Utilization:
(s) = mi/Ti + xj (pj/Tj)
• Criticality Value:
(s) = xi (vi/Ti)
• Feasibility Test (utilization based)
UBT(s) =
Dr. Pedro Mejia Alvarez
{
true
if (s) <= 1
false
otherwise
Curso de Sistemas de Tiempo Real
22
The Optimization Problems
Maximize Utilization
maximize (s)
Subject to UBT(s)
Dr. Pedro Mejia Alvarez
Maximize the Value
maximize (s)
Subject to UBT(s)
Curso de Sistemas de Tiempo Real
23
Formulation for Maximizing Utilization
Problem: If an arriving task I causes an overload:
1.
Decide whether to accept the new task.
2.
Determine the time for the scheduling of the new task.
3.
Determine the optional parts to shed.
4.
Maximize the usage of the resources at a low cost.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
24
Incremental Scheduling Server
• Adjust the workload in response to transient overload requests.
• Executes a sequence of Approximate Algorithms
AP(0), ..., AP(n) during idle time.
• At each level k, AP(k) determines which optional parts to shed
to satisfy optimality criteria
• AP(k) obtains a solution closer to optimal than AP(k-1) but with
longer execution time.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
25
Incremental Scheduling Server
Metodology for Handling Overload
1. Activating the Incremental Server
2. Execution of AP(0): Overload Removal
3. Scheduling the New Task.
4. Execution of AP(1),..., AP(n)
5. Stopping the execution of the Server
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
26
Incremental Scheduling Server
Triggers for activating the INCA Server:
1.
A new task arrives and causes an overload: UBT Test
2.
A task leaves the system.
•
While waiting for new tasks, the INCA server do not cause
overhead in the system.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
27
Incremental Scheduling Server
Execution of AP(0) yields Overload Removal:
“shed the less critical optional parts”
•AP(0) is a greedy algorithm O(n) finds a sub-optimal solution.
•If overload persists after AP(0) the new task is rejected.
•Optional Tasks are temporarily suspended, not discarded.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
28
Incremental Scheduling Server
Scheduling the New Task occurs only at the end of the
longest period of all preempted tasks.
• The resulting utilization can not be immediately subtracted.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
29
Incremental Scheduling Server
Incremental Execution of AP(1), ..., AP(n)
• AP(1) runs on the slack time recovered by AP(0).
• Similarly, slack from AP(1) is used to run AP(2), ... And so on...
• INCA server will execute as many AP(k)’s as possible
• AP(i) solution better than AP(i-1)
• AP(i) runtime longer than AP(i-1)
• Results from AP(i) may increase the utilization, reducing the
amount of available slack.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
30
Incremental Scheduling Server
Triggers for stopping the execution of the INCA Server
• There is no slack in the schedule to execute AP(k) stop server
• AP(k) gives a solution no better than AP(k-1) stop server
• After AP(n) is executed stop server
• Another task arrives in the system stop and re-start server
• A Task leaves the system stop and re-start server
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
31
Incremental Scheduling Server
INCA Server:
input: Set of tasks, including the newly arrived task
1: Execute AP(0);
2: if the system is still overloaded then exit;
3: Compute the start time of the new task;
4: Schedule the new task at its start time;
5: k=1;
6: while (there is slack in the schedule) do
7:
Execute AP(k) (during slack time)
8:
if the result (utilization) from AP(k) is better than AP(k-1)
9:
then Adjust the workload (remove optional parts)
10:
else
exit;
11:
k = k+ 1;
12: Alvarez
end;
Dr. Pedro Mejia
Curso de Sistemas de Tiempo Real
32
Each Approximate Algorithm
•
Greedy algorithm to select optional parts for execution.
• AP(k) considers all possible (feasible) subsets in the
search space with al least k optional parts.
• Characteristics:
• The time complexity of AP(k) is: O(nk+1)
• The worst-case performance ratio is: k/(k+1)
• For a small value of k, AP(k) give a solution “close to
optimal”.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
33
Performance of the Approximate Algorithm
Maximize Utilization
k
0
1
2
3
4
0-0.01%
1-5%
5-10%
10-15%
15-20%
617
251
119
13
0
662
336
2
0
0
951
49
0
0
0
999
1
0
0
0
1000
0
0
0
0
Number of Solutions
within x percent near
optimal
Maximize Criticality
0-0.01% 1-5%
k
631
131
0
829
35
1
911
15
2
1000
0
3
0
4Dr. Pedro1000
Mejia Alvarez
5-10%
10-15%
15-20%
62
50
0
54
51
0
•
1000 Simulations
25
25
0
•
10 tasks
0
0
0
•
U = 120%
0Curso de Sistemas
0 de Tiempo Real
0
34
Analysis of the INCA Server
Results.
1. Using INCA gives better results than using NON-INCA,
when the objective is to maximize (s) (utilization).
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
35
Simulation Experiments: setup
1. Measure the quality of results over a set of dynamic tasks.
2. Measure and compare the performance among several stages
of our different optimality criteria
•
100 independent simulations (first 5 stages of AP(k))
•
5,000 tasks (life time of each task: 400-600 instances)
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
36
Performance Evaluation: Metrics
Utilization Ratio =
CU(I)
Total Utilization
Criticality Ratio =
CV(I)
Total Criticality
CU(I) =
i
CV(I) =
i ri * vi
Dr. Pedro Mejia Alvarez
ri * pi
ri = number of instances of task i
Curso de Sistemas de Tiempo Real
37
Simulation Results
Utilization Ratio for up to 5 stages
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
38
Simulation Results
Criticality Ratio for up to 5 stages
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
39
Conclusion on the INCA Server
•
Only few stages of the INCA server are necessary for
achieving near-optimal results.
•
INCA Algorithm is easy to implement.
•
Performance metrics (utilization and criticality) are easy
to obtain for system designers.
Dr. Pedro Mejia Alvarez
Curso de Sistemas de Tiempo Real
40