Aperiodic Task Scheduling Radek Pel anek Preemptive Scheduling - - PowerPoint PPT Presentation

aperiodic task scheduling
SMART_READER_LITE
LIVE PREVIEW

Aperiodic Task Scheduling Radek Pel anek Preemptive Scheduling - - PowerPoint PPT Presentation

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Aperiodic Task Scheduling Radek Pel anek Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Preemptive Scheduling: The Problem 1


slide-1
SLIDE 1

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Aperiodic Task Scheduling

Radek Pel´ anek

slide-2
SLIDE 2

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Preemptive Scheduling: The Problem

1 processor arbitrary arrival times of tasks preemption performance measure: maximum lateness no resources, no precedence constraints

slide-3
SLIDE 3

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Example

1

Solve the example (manually).

2

Try to find out a scheduling algorithm.

slide-4
SLIDE 4

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

Earliest Deadline First Algorithm

EDF At any instant execute the task with the earliest absolute deadline among all the ready tasks.

slide-5
SLIDE 5

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

Example – EDF Schedule

slide-6
SLIDE 6

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

Optimality of EDF

Theorem (Horn) Given a set of n independent tasks with arbitrary arrival times, the EDF algorithm is optimal with respect to minimazing the maximum lateness.

slide-7
SLIDE 7

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

Proof of Horn’s Theorem

Basic idea of the proof: let σ be optimal schedule; we transform it into EDF schedule σEDF without increasing maximum lateness schedule is divided into time slices of 1 unit transformation: interchange 1 appropriate time slice

slide-8
SLIDE 8

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

Proof of Horn’s Theorem (cont.)

slide-9
SLIDE 9

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

Guarantee Test

is the set of tasks schedulable? sort tasks by increasing deadlines synchronous activation (ai = 0) – schedulability guaranteed by conditions:

∀i : Σi

k=1Ck ≤ di asynchronous activation: “dynamical version” of the previous test

slide-10
SLIDE 10

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

EDF is Fine ...

EDF: is optimal works on-line easy to implement simple guarantee test

slide-11
SLIDE 11

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

... but Not a Silver Bullet

EDF is not optimal with more than 1 processor Try to find a specific set of tasks:

the set is schedulable on 2 processor EDF schedule misses some deadline

slide-12
SLIDE 12

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First

EDF with More Processors

2 Processors J1 J2 J3 ai Ci 1 1 5 di 1 2 5 Schedulable, but EDF schedule misses deadline for J3.

slide-13
SLIDE 13

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Least Slack Time

Least Slack Time Algorithm

LST At any instant execute the task with the least slack time (that is di − Ci) among all the ready tasks. LST is also optimal.

slide-14
SLIDE 14

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Least Slack Time

Example

Find a set of task such that EDF and LST produce different schedules.

slide-15
SLIDE 15

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Non-preemptive Scheduling: The Problem

1 processor arbitrary arrival times of tasks preemption not allowed performance measure: maximum lateness no resources, no precedence constraints

slide-16
SLIDE 16

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary EDF

Non-optimality of EDF

EDF is not optimal for non-preemptive scheduling. Find a set of task such that EDF does not produce optimal schedule.

slide-17
SLIDE 17

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary EDF

Non-optimality of EDF

slide-18
SLIDE 18

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary EDF

EDF and Non-idle Schedules

non-idle algorithm - does not permit the processor to be idle when there are active jobs restriction to non-idle algorithms ⇒ EDF is optimal

slide-19
SLIDE 19

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force

Optimal Scheduling

no on-line algorithm can generate optimal schedule (example above: time 0, stay idle or start J1?)

  • ff-line: non-preemptive scheduling is NP-complete

branch-and-bound (backtracking) algorithms, worst case complexity O(n · n!)

slide-20
SLIDE 20

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force

Search Tree

slide-21
SLIDE 21

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force

Reminder: Backtracking, n Queen Problem

slide-22
SLIDE 22

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force

Pruning

branch is abandoned when:

the addition of any node to the current path causes a missed deadline a feasible schedule is found at the current path

size of the search tree is exponential in the worst case significant pruning in the average case

slide-23
SLIDE 23

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force

Pruning: Example

slide-24
SLIDE 24

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force

Example

J1 J2 J3 J4 ai 4 2 6 Ci 6 2 4 2 di 18 8 9 10 Draw the search tree (with pruning).

slide-25
SLIDE 25

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Scheduling with Precedence Constraints

generally NP-complete we consider two special cases, polynomial algorithms remark on heuristical approach

slide-26
SLIDE 26

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First

Precedence Constraints: Problem 1

1 processor precedence constraints synchronous activation (∀i : ai = 0) (preemption does not matter) performance measure: maximum lateness

slide-27
SLIDE 27

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First

Example

1

solve the example (manually)

2

construct the EDF schedule

3

try to find out an optimal scheduling algorithm

slide-28
SLIDE 28

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First

Latest Deadline First Algorithm

  • ne possible solution: latest deadline first (LDF)

note: different interpretations

EDF algorithm = earliest deadline job is scheduled to run first LDF algorithm = latest deadline job is put into schedule first

slide-29
SLIDE 29

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First

Latest Deadline First Algorithm

LDF among tasks without successors select the task with the latest deadline remove this task from the precedence graph and put it into a stack repeat until all tasks are in the stack the stack represents the order in which tasks should be scheduled LDF is optimal.

slide-30
SLIDE 30

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First

LDF: example

slide-31
SLIDE 31

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Precedence Constraints: Problem 2

1 processor precedence constraints arbitrary arrival times of tasks preemption performance measure: maximum lateness

slide-32
SLIDE 32

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Example

Precedence constraints: A → C; A → D; B → D, B → E; E → D; C → F; D → F A B C D E F a 2 5 4 1 2 C 3 2 2 3 1 3 d 8 8 13 10 5 14

slide-33
SLIDE 33

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Basic Idea

1

transform set J of dependent tasks into set J∗ of independent tasks

2

apply EDF to set J∗ transformation done by modification of arrival times and deadline times

slide-34
SLIDE 34

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Modification of Arrival Times

If JY → JX then: sX ≥ aX JX cannot start earlier than its activation time sX ≥ aY + CY JX cannot start earliear than the minimum finishing time

  • f JY
slide-35
SLIDE 35

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Modification of Arrival Times (cont.)

new arrival time: aX∗ = max(aX, max(aY + CY , JY → JX)) modified arrival time must be computed in the correct order (given by precedence constraints)

slide-36
SLIDE 36

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Modification of Deadlines

If JX → JY then: fX ≤ dX JX must finish within its deadline fX ≤ dY − CY JX must finish not later than the maximum starting time

  • f JY
slide-37
SLIDE 37

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Modification of Deadlines (cont.)

new deadline: dX∗ = min(dX, min(dY − CY , JX → JY )) modified deadline times must be computed in the correct order (given by precedence constraints)

slide-38
SLIDE 38

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Optimality

Theorem There exists feasible schedule for the modified task set J∗ under EDF if and only if the original task set is schedulable.

slide-39
SLIDE 39

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Example

Precedence constraints: A → C; A → D; B → D, B → E; E → D; C → F; D → F A B C D E F a 2 5 4 1 2 C 3 2 2 3 1 3 d 8 8 13 10 5 14 a∗ 2 5 5 4 8 d∗ 7 4 11 10 5 14

slide-40
SLIDE 40

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF

Example

precedence constraints: A → C, B → C, C → E, D → F, B → D, C → F, D → G all tasks: ai = 0, Di = 25, computation times: 2, 3, 3, 5, 1, 2, 5 compute modified arrival times and deadlines compute schedule according to EDF

slide-41
SLIDE 41

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Heuristical algorithms

Heuristical search

more complicated problems (e.g., non-preemptive, precedence constraints) NP-complete brute-force search (with pruning) heuristical search

  • nly some schedules are considered

no guarantee of optimality

note: general computer science approach

slide-42
SLIDE 42

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Heuristical algorithms

Heuristical search

constructs partial schedules (like brute-force search) considers only one (or few) tasks for extension of a schedule selection based on heuristic function H

slide-43
SLIDE 43

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Heuristical algorithms

Heuristic function

H(i) = ai first come first serve H(i) = Ci shortest job first H(i) = di earliest deadline first more complicated parameters (taking into account precedence relations, resources, ...) weighted combinations of different parameters

slide-44
SLIDE 44

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Overview of Problems and Algorithms

  • sync. act.

preemptive

  • async. act.

non- preemptive

  • async. act.

independent EDF, O(n log n) EDF, LST, O(n2) tree search, O(n · n!) precedence LDF, O(n2) modified EDF, O(n2) heuristic search

slide-45
SLIDE 45

Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary

Summary

aperiodic task scheduling (arbitrary arrival times) 1 processor, no resources precedence constraints: yes/no preemption: yes/no performance measure: maximum lateness algorithms: earliest deadline first (EDF), least slack time (LST), branch and bound, latest deadline first (LDF), transformations