Overload Scheduling in Real-Time Systems

40
1 edro Mejia Alvarez 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

description

Overload Scheduling in Real-Time Systems. Dr. Pedro Mej í a Alvarez Secci ó n de Computaci ó n. CINVESTAV-IPN, México. Outline. Motivation Related Work Methodology The INCA Server Algorithm The Approximate Algorithm Analysis of the INCA Server Simulation Results. - PowerPoint PPT Presentation

Transcript of Overload Scheduling in Real-Time Systems

Page 1: Overload Scheduling in Real-Time Systems

1

Dr. Pedro Mejia Alvarez 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

Page 2: Overload Scheduling in Real-Time Systems

2

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Outline

• Motivation• Related Work• Methodology• The INCA Server Algorithm• The Approximate Algorithm• Analysis of the INCA Server• Simulation Results

Page 3: Overload Scheduling in Real-Time Systems

3

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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

Page 4: Overload Scheduling in Real-Time Systems

4

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 5: Overload Scheduling in Real-Time Systems

5

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Best effort scheduling algorithm

• Rejection policy for overloaded systems based on removing tasks

with the minimum value density (introduced time valued functions).

(a)

t

U

d

(b)

t

U

d

(c)

t

U

d

Page 6: Overload Scheduling in Real-Time Systems

6

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

• aperiodic tasks in overloaded systems. Combines criticality-based

scheduling and deadline tolerance. Remove the task with least

value on overload.

The RED (Robust Earliest Deadline) algorithm

Planning Ready queue

Reject queue

task

Reclaimingpolicy

Rejection policy

Scheduling policyRUN

Page 7: Overload Scheduling in Real-Time Systems

7

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Imprecise Computation Model

Each Task is composed by a mandatory and an optional part.

Mi: mandatory part of task i

Oi: optional part of task i

Mi precceds in execution to a OiOi could not execute or it may execute partiallyThe deadline of Mi must be guaranteed.The deadline of Oi could be missed if necesarry.Execution of Oi refines the result obtained by MiThe 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

Page 8: Overload Scheduling in Real-Time Systems

8

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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

0.823

Task 3 misses the deadline ofIf optional part on its first Job At time: t = 50

0 20 40 60 80 100 120 140 160

Page 9: Overload Scheduling in Real-Time Systems

9

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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

Page 10: Overload Scheduling in Real-Time Systems

10

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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

Page 11: Overload Scheduling in Real-Time Systems

11

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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]

Ri Timin Ti0 Timax

Ei

Page 12: Overload Scheduling in Real-Time Systems

12

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 13: Overload Scheduling in Real-Time Systems

13

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 14: Overload Scheduling in Real-Time Systems

14

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

M1 M3

M4

M5

M6

M2

O1 O2

O3

O6

O5

O4

Mandatory Parts Optional Parts

OVERLOADED SYSTEM

Page 15: Overload Scheduling in Real-Time Systems

15

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

M1 M3

M4

M5

M6

M2

O1 O2

O3

O6

O5

O4

Mandatory Parts Optional Parts

OVERLOADED SYSTEM

•Optimal Solution•High Complexity

Page 16: Overload Scheduling in Real-Time Systems

16

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

M1 M3

M4

M5

M6

M2

Mandatory Parts Optional Parts

OVERLOADED SYSTEM

•Low Cost•Poor Solution

Page 17: Overload Scheduling in Real-Time Systems

17

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

O1 O2

O3O6O4

•Solution is Refined•Complexity Increases

INCREMENTAL EXECUTION OF ASEQUENCE OF APPROXIMATE ALGORITHMS

O1

O2 O4

[...AP(0)][....................AP(1)] .............. [..........AP(k)]

Solutions

Page 18: Overload Scheduling in Real-Time Systems

18

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

INCREMENTAL EXECUTION OF ASEQUENCE OF APPROXIMATE ALGORITHMS

AP(0)][...............AP(1)][.......................................AP(k)]

U

Slack

0

1

• AP(1) runs on the Slack Time recovered by AP(0)

Overload

Time

Page 19: Overload Scheduling in Real-Time Systems

19

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 20: Overload Scheduling in Real-Time Systems

20

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 21: Overload Scheduling in Real-Time Systems

21

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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• Xi = 1, optional part i is chosen for execution.

Page 22: Overload Scheduling in Real-Time Systems

22

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Objective Functions and Feasibility test

• Objective Functions:

• Utilization: (s) = mi/Ti + xj (pj/Tj)

• Criticality Value: (s) = xi (vi/Ti)

• Feasibility Test (utilization based)

true if (s) <= 1UBT(s) =

false otherwise{

Page 23: Overload Scheduling in Real-Time Systems

23

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

The Optimization Problems

Maximize Utilization Maximize the Value

maximize (s) maximize (s)

Subject to UBT(s) Subject to UBT(s)

Page 24: Overload Scheduling in Real-Time Systems

24

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 25: Overload Scheduling in Real-Time Systems

25

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 26: Overload Scheduling in Real-Time Systems

26

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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

Page 27: Overload Scheduling in Real-Time Systems

27

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 28: Overload Scheduling in Real-Time Systems

28

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 29: Overload Scheduling in Real-Time Systems

29

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 30: Overload Scheduling in Real-Time Systems

30

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.

Page 31: Overload Scheduling in Real-Time Systems

31

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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

Page 32: Overload Scheduling in Real-Time Systems

32

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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: end;

Page 33: Overload Scheduling in Real-Time Systems

33

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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”.

Page 34: Overload Scheduling in Real-Time Systems

34

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Performance of the Approximate Algorithm

Maximize Utilization k 0-0.01% 1-5% 5-10% 10-15% 15-20%

0 617 251 119 13 0

1 662 336 2 0 0

2 951 49 0 0 0

3 999 1 0 0 0

4 1000 0 0 0 0

Maximize Criticality k 0-0.01% 1-5% 5-10% 10-15% 15-20%

0 631 131 62 50 0

1 829 35 54 51 0

2 911 15 25 25 0

3 1000 0 0 0 0

4 1000 0 0 0 0

Number of Solutions

within x percent near

optimal

• 1000 Simulations

• 10 tasks

• U = 120%

Page 35: Overload Scheduling in Real-Time Systems

35

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Analysis of the INCA Server

Results.

1. Using INCA gives better results than using NON-INCA,

when the objective is to maximize (s) (utilization).

Page 36: Overload Scheduling in Real-Time Systems

36

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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)

Page 37: Overload Scheduling in Real-Time Systems

37

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Performance Evaluation: Metrics

Criticality Ratio = CV(I)

Total Criticality

Utilization Ratio = CU(I)

Total Utilization

CU(I) = i ri * pi ri = number of instances of task i

CV(I) = i ri * vi

Page 38: Overload Scheduling in Real-Time Systems

38

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Simulation Results

Utilization Ratio for up to 5 stages

Page 39: Overload Scheduling in Real-Time Systems

39

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

Simulation Results

Criticality Ratio for up to 5 stages

Page 40: Overload Scheduling in Real-Time Systems

40

Dr. Pedro Mejia Alvarez Curso de Sistemas de Tiempo Real

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.