aperiodic task scheduling
play

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


  1. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Aperiodic Task Scheduling Radek Pel´ anek

  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

  3. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Example Solve the example (manually). 1 Try to find out a scheduling algorithm. 2

  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.

  5. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First Example – EDF Schedule

  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.

  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

  8. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First Proof of Horn’s Theorem (cont.)

  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 ( a i = 0) – schedulability guaranteed by conditions: ∀ i : Σ i k =1 C k ≤ d i asynchronous activation: “dynamical version” of the previous test

  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

  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

  12. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Earliest Deadline First EDF with More Processors J 1 J 2 J 3 a i 0 0 0 2 Processors 1 1 5 C i 1 2 5 d i Schedulable, but EDF schedule misses deadline for J 3 .

  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 d i − C i ) among all the ready tasks. LST is also optimal.

  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.

  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

  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.

  17. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary EDF Non-optimality of EDF

  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

  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 J 1 ?) off-line: non-preemptive scheduling is NP-complete branch-and-bound (backtracking) algorithms, worst case complexity O ( n · n !)

  20. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force Search Tree

  21. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force Reminder: Backtracking, n Queen Problem

  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

  23. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force Pruning: Example

  24. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Brute Force Example J 1 J 2 J 3 J 4 0 4 2 6 a i C i 6 2 4 2 d i 18 8 9 10 Draw the search tree (with pruning).

  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

  26. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First Precedence Constraints: Problem 1 1 processor precedence constraints synchronous activation ( ∀ i : a i = 0) (preemption does not matter) performance measure: maximum lateness

  27. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First Example solve the example (manually) 1 construct the EDF schedule 2 try to find out an optimal scheduling algorithm 3

  28. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First Latest Deadline First Algorithm one 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

  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.

  30. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Latest Deadline First LDF: example

  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

  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 0 2 5 4 1 2 3 2 2 3 1 3 C d 8 8 13 10 5 14

  33. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF Basic Idea transform set J of dependent tasks into set J ∗ of 1 independent tasks apply EDF to set J ∗ 2 transformation done by modification of arrival times and deadline times

  34. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF Modification of Arrival Times If J Y → J X then: s X ≥ a X J X cannot start earlier than its activation time s X ≥ a Y + C Y J X cannot start earliear than the minimum finishing time of J Y

  35. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF Modification of Arrival Times (cont.) new arrival time: a X ∗ = max ( a X , max ( a Y + C Y , J Y → J X )) modified arrival time must be computed in the correct order (given by precedence constraints)

  36. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF Modification of Deadlines If J X → J Y then: f X ≤ d X J X must finish within its deadline f X ≤ d Y − C Y J X must finish not later than the maximum starting time of J Y

  37. Preemptive Scheduling Non-preemptive Scheduling Precedence Constraints Summary Modified EDF Modification of Deadlines (cont.) new deadline: d X ∗ = min ( d X , min ( d Y − C Y , J X → J Y )) modified deadline times must be computed in the correct order (given by precedence constraints)

  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.

Recommend


More recommend