1 / 36

Practical announcements

Practical announcements. Registration at webreg for TDDD07 Follow instructions on the web!. From last lecture. Cyclic scheduling: What is the deadline for each process? How does one know that processes meet their deadlines? What happens if they don’t?. Better methods needed. For:

abeni
Download Presentation

Practical announcements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Practical announcements • Registration at webreg for TDDD07 • Follow instructions on the web!

  2. From last lecture Cyclic scheduling: • What is the deadline for each process? • How does one know that processes meet their deadlines? • What happens if they don’t?

  3. Better methods needed For: • Processes with long WCET • Sporadic events • Processes with long period but short deadline • Process dependence • sharing resources • overruns

  4. Priority-based scheduling • A preemptive method where the priority of the process determines whether it continues to run or it is disrupted ”Most important process first!”

  5. RMS Rate Monotonic Scheduling: • On-line • Preemptive • Priority-based with fixed (static) priorities

  6. Priorities • Each process has a period Tithat is the shortest interval between its release times • Processes are assigned priorities dependent on length of Ti • The shorter Ti the higher the priority

  7. P1 P2 P3 Period (Ti) 20 50 30 WCET (Ci) 10 10 5 Priority high low medium Example (4)

  8. Consider following scenario: arrival time process 0 P1, P2, P3 20 P1 30 P3 40 P1 50 P2 60 P1, P3 ... preemption time 0 10 20 30 40 50 60 80 90

  9. Schedulability test Theorem: (sufficient condition) For n processes, RMS will guarantee their schedulability if the total utilisation U = C1/T1 + ... + Cn/Tn does not exceed the guarantee level G = n (2 1/n -1)

  10. For this example U = 10/20+10/50+5/30 = 0,87 n = 3 Þ G = 3(2 1/3 -1) = 0,78 Schedulability is not guaranteed! (but processes may still meet their deadlines...)

  11. When the test fails • Try with the critical instant: Assume that all processes are released simultaneously at time 0, and then arrive according to their periods • Check whether each process meets its deadline for all releases before the first deadline for the process with lowest priority

  12. For example 4 scenario: arrival time process 0 P1, P2, P3 20 P1 30 P3 40 P1 50 P2 60 P1, P3 ... preemption time 0 10 20 30 40 50 60 80 90

  13. Exact analysis • Mathematical equations for computing worst case response times Ri for each process • Process set schedulable if Ri ≤ Ti for all processes • Assumptions?

  14. Response time analysis • Response time: the time between the release and the completion time • Tasks suffer interference from higher priority tasks • Iterative formula for calculating response time

  15. Not schedulabe task set When response time analysis gives a “no” answer: • Change U by reducing Ci (code optimisation, faster processor, ...) or • Increase Ti for some process (can one do this?)

  16. Theorems • Optimality: RMS is optimal among methods with fixed priority (in what sense?) • Lowest upper bound: For arbitrarily large n, it suffices that processor utilisation is < 0.69 [Nice proofs in Buttazzo book]

  17. What does the test mean? Utilisation based test: G = n ( 2 1/n - 1) For a givenn, the highest ceiling under whichweonly find schedulable task sets (irrespective of release times, with all possible Ci, Ti)

  18. Example (2) P1 P2 P3 Period (Ti) 20 50 30 WCET (Ci) 7 10 5 U = 7/20 + 10/50 + 5/30 = 0,72 >0,69 but... < G = 0,78 The schedulability of this task set is guaranteed!

  19. Dynamic priorities • Allow • processes with long Ti and short deadline • Process dependencies: when processes share resources and must be synchronised • Next scheduling algorithm: change priorities dynamically

  20. Earliest deadline first (EDF) • Online • Preemptive • Dynamic priorities Policy: Always run the process that is closest to its deadline

  21. Process sets • Event that leads to release of process Pi appears with minimum inter-arrival interval Ti • Pi has a max computation time Ci • The process must be finished before its deadline Di£ Ti • Processes are independent (do not share resources) • EDF: The process with nearest absolute deadline (di) will run first

  22. Example (3) Consider following processes: P1 P2 WCET (Ci) 5 10 Deadline (Di = Ti) 20 12 Arrival times (ri) 0, 20,... 0, 12,... ...? 0 10 15 20 25 time

  23. Compare to RMS For same task set: P1 P2 WCET (Ci) 5 10 Deadline (Di = Ti) 20 12 Arrival times (ri) 0, 20,... 0, 12,... Preemption ...? 0 10 15 20 25 time

  24. Theorem A set of periodic tasks P1,...,Pn for which Di = Ti is schedulable with EDF iff U= C1/T1+...+Cn/Tn£ 1 For Example 3: C1/T1 + C2/T2 = 5/20 + 10/12 = 1,08!

  25. Example (4) Consider following task set: P1 P2 WCET (Ci) 2 4 Deadline (Di = Ti) 5 7 Is it schedulable? U = 2/5 + 4/7 = 0,97 Yes!

  26. EDF vs. RMS • EDF gives higher processor utilisation (Example 4 not schedulable with RMS!) • EDF has simpler exact analysis for the mentioned type of task sets • RMS can be implemented to run faster at run-time (if we ignore the time for context switching)

  27. Sharing resources • Assume that processes synchronise using semaphores • We schedule the processes with fixed priorities but relax the independence requirement

  28. Priority Inversion • A low priority process (P1) locks the resource • A high priority process (P2) has to wait on the semaphore (blocked state) • A medium priority process (P3) preempts P1 and runs to completion before P2!

  29. How to avoid it? • When P2 is blocked by P1 one raises the priority of P1 to the same level as P2 temporarily • Afterwards, when the semaphore is released by P1, it goes back to its prior priority level • P3 can not interrupt P1 any more!

  30. Priority inheritance • Is transitive • Guarantees upper bound for blocking time, since high priority process P2 is blocked only under the time that P1 uses the resource But ... Does not avoid deadlock!

  31. S1 S2? S2 S1? Si Example Let P1 have lower priority than P2. Inheritance Blocked Preemption P1 P2 Blocked time 0 Here denotes the process locks semaphore Si.

  32. Terminology Note that: • blocked – when waiting for a resource (other than CPU) • not dispatched or preempted - when waiting for CPU

  33. Ceiling Protocols e.g. Immediate priority CeilingProtocol (ICP): • A process that obtains its first resource inherits the resource’s ceiling priority - the highest priority among all processes that can possibly claim that resource • Dynamic priority for a process is the max of own (fixed) priority and the ceiling values of all resources it has locked • When a resource is released, the process priority returns to the normal level (or to another engaged resource’s ceiling)

  34. Properties • A process is blocked max once by another process with lower priority • The blocking delay is a function of the length of the critical section • Do not even need to use semaphores!

  35. ICP & Deadlock • The ICP prevents deadlocks (How?) • Moreover, it prevents starvation (How?)

More Related