1 / 28

G53SRP: Feasibility analysis

G53SRP: Feasibility analysis. Chris Greenhalgh School of Computer Science. 1. Contents. Introduction Process and scheduling model Utilisation tests Response time analysis Run-time feasibility testing in RTSJ Summary

favian
Télécharger la présentation

G53SRP: Feasibility analysis

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. G53SRP: Feasibility analysis Chris Greenhalgh School of Computer Science 1

  2. Contents • Introduction • Process and scheduling model • Utilisation tests • Response time analysis • Run-time feasibility testing in RTSJ • Summary • Book: Wellings Ch. 10 (part), Burns & Wellings 12.5-12.6; 13.1-13.5, 13.7, 13.9, 13.10 (part) 2

  3. Introduction • Feasibility = whether a set of processes, if scheduled correctly, will meet their deadlines • RTSJ: all active RealtimeThreads and AsyncEventHandlers (i.e. Schedulables) • Also known as “Schedulability” • Can be determined analytically given enough information about the system…

  4. (Simple) Process and scheduling model • Fixed set of processes • Known worst-case execution times • Independent processes • See later notes for some information on dealing with competition between threads • Periodic; known deadlines • Zero time context switch • Correctness = meet deadlines • Priority-based scheduling • Pre-emptive • No timeslicing

  5. Process parameters: • D = deadline (time period) • RTSJ: ReleaseParameters deadline • T = period of periodic process • RTSJ: PeriodicParameters period • Sporadic process minimum interarrival time • RTSJ: SporadicParameters minimumInterarrival • Feasibility analysis not possible for aperiodic processes, i.e. no process set with an aperiodic process is feasible • C = worst case execution time • RTSJ: ReleaseParameters cost

  6. Scheduling approach • Fixed Priority Scheduling (FPS) • RTSJ: PriorityScheduler • Single fixed priority allocated in advance for each process • Runnable processes executed in order of priority • Deadline Monotonic Priority Order (DMPO) • Allocate highest priority to shortest deadline • Provably optimal for FPS • RTSJ: Priorities specified by programmer via SchedulerParameters (PriorityParameters)

  7. Fraction of CPU used by process Total CPU (no. of CPUs) Schedulability (1): Utilisation tests • Is there enough CPU capacity? • Sum(Ci/Ti) <= 1 • But: • Necessary (not sufficient) • D=T only

  8. Process set Proc. T C 1 5 2 2 4 2 Utilization = 2/5+2/4 = 0.85 Might be schedulable :-/ Process set Proc. T C 1 5 3 2 4 2 Utilization = 3/5+2/4 = 1.10 Definitely not schedulable For example:

  9. (consider P1 cost=2.01 => U = 0.852!) 0 1 2 3 4 5 6 Example time-line (first case) Process Process Release Time Process Completion Time Deadline Met 1 2/2 Process Completion Time Deadline Missed Preempted 2 2/2 2/2 Executing Time

  10. 0 1 2 3 4 5 6 Example time-line (second case) Process Process Release Time Process Completion Time Deadline Met 1 2/3 Process Completion Time Deadline Missed Preempted 2 2/2 2/2 Executing Time

  11. Jolly clever formula worked out by Liu & Leylard (see Burns & Wellings) Schedulability (2): Utilisation bound test (Liu & Leyland) • Is there enough CPU capacity? • Sum(Ci/Ti) <= N(2(1/N)-1) • But: • Sufficient (not necessary) • D=T only • 1 CPU

  12. For example: • Process set • Proc. T C • 1 5 2 • 2 4 1 • Utilization = 2/5+1/4 = 0.65 • Bound 2 processes = 0.828 • Schedulable!

  13. 0 1 2 3 4 5 6 Example time-line Process Process Release Time Process Completion Time Deadline Met 1 … 2/2 Process Completion Time Deadline Missed Preempted 2 1/1 1/1 Executing Time

  14. Another example Process Set Process Period ComputationTime Priority Utilization T C P U a 50 12 1 0.24 b 40 10 2 0.25 c 30 10 3 0.33 • The combined utilization is 0.82 (or 82%) • This is above the threshold for three processes (0.78) and, hence, this process set fails the utilization test

  15. 0 10 20 30 40 50 60 Example time-line Process a 10 2 Process Release Time Process Completion Time Deadline Met b 10 10 Process Completion Time Deadline Missed Preempted c 10 10 Executing Time

  16. Example Gantt Chart c b a c b 0 10 20 30 40 50 Time

  17. Schedulability (3): Response time analysis • Consider a worst-case scenario: • Every process is released at the same moment • Will they all meet their deadlines? • i.e. is the worst-case response time (completion time) for each process <= its deadline?

  18. Release of process (nominal start time) Interference from higher priority processes, Ii a With preemptive fixed priority scheduling the only reason we aren’t actually running (given assumptions) b c Time execution time Ci = a + b +c End of process execution -> response time, Ri=Ci+Ii Units of execution Deadline

  19. Response time analysis (1) • Necessary and sufficient • D <= T • (i) Ri = Ci+Ii • Ri = response time • Ci = worst case execution time • Ii = interference • (ii) Ri = Ci+SUMj (ceil(Ri/Tj)*Cj) • where j : Pj>Pi • ceil(Ri/Tj) = max. number of times that process j released in time during i

  20. Response time analysis (2) • Solve by: • wi(0) = Ci • wi(n+1) = Ci +SUM j (ceil(wi(n)/Tj )*Cj) • where j : Pj >Pi • From highest priority to lowest • until converges • Schedulable iff • Ri <= Di

  21. For example: • Process set • Proc. T C D P • 1 5 2 3 1 • 2 4 1 2 2 • Process 2: • w2(0) = C2 = 1 • R2 = w2(0) = 1

  22. R2 < D2 ! • Process 1: • w1(0) = C1 = 2 • w1(1) = C1+ceil(w1(0)/T2)*C2 = 3 • w1(2) = C1+ceil(w1(1)/T2)*C2 = 3 • R1 = w1(2) = 3 • R1 < D1 ! • Schedulable!

  23. Past paper questions • 2004 Q2, 2003 Q2, 2002 Q3, 2001 Q4, 2000 Q2.

  24. Run-time feasibility testing in RTSJ • RTSJ Scheduler may implement run-time feasibility checking • Default PriorityScheduler just assumes any process set without aperiodic processes is feasible • Scheduler manages a “feasibility set” of Schedulables • i.e. RealtimeThreads and AsyncEventHandlers • To which any schedulability analysis is applied • Scheduler abstract class and Schedulable interface include various methods for checking feasibility and conditionally changing parameters…

  25. Now feasible? Scheduler class (part) package javax.realtime; public abstract class Scheduler {` … protected boolean addToFeasibility(Schedulable s); protected boolean removeFromFeasibility(Schedulable s); public boolean isFeasible(); public boolean setIfFeasible(Schedulable s, ReleaseParameter r, MemoryParameters m, ProcessingGroupParameters g); … }

  26. Schedulable class (part) package javax.realtime; public interface Schedulable extends Runnable { … public boolean addIfFeasible(); public boolean addToFeasibility(); public boolean removeFromFeasibility(); public boolean setIfFeasible( SchedulableParameters s, ReleaseParameter r, MemoryParameters m, ProcessingGroupParameters g); public boolean setSchedulingParametersIfFeasible( SchedulableParameters s); … }

  27. Summary (1) • Feasibility = schedulability, i.e. whether a set of processes should meet its deadlines • Typically requires simplifying assumptions • E.g. zero time context switch • Simple tests based on CPU utilisation • Total CPU requirements • Liu & Leyland’s utilisation bound • => necessary or sufficient but not both

  28. Summary (2) • Response time analysis • Models worst case simultaneous release of all processes • Simple case models pre-emption by higher priority processes only • Can be extended to consider process conflict (e.g. resource sharing) • RTSJ provides an API for run-time feasibility testing • In Scheduler & Schedulable • Scheduler maintains feasibility set • “Process” = Schedulable, i.e. RealtimeThread or AsyncEventHandler

More Related