860 likes | 888 Views
Learn about strategies for managing aperiodic and sporadic jobs, ensuring timely execution while preserving CPU power for other tasks. Various approaches like background, interrupt-driven, slack stealing, and bandwidth-preserving servers are discussed. Terminologies, server design, and server types are covered for optimal job scheduling efficiency in real-time systems.
E N D
Aperiodic Job Scheduling Real-Time Computing 羅習五 本份投影片大量參考交通大學張立平教授的投影片
rejection Acceptance Test Sporadic Jobs Job-basis rejection Processor Acceptance Test Periodic Task Task-basis Aperiodic Jobs
Aperiodic and Sporadic Jobs • Definition • Jobs of apreiodic and sporadic tasks • Inter-arrival times are arbitrary • Aperiodic Jobs • Assigned to either no deadlines or soft deadlines • Sporadic Jobs • Assigned to hard deadlines
Aperiodic and Sporadic Jobs • Handling of jobs • Apreiodic jobs • In a best-effort fashion • Accept anyway • Sporadic jobs • Accept jobs if deadline satisfaction is guaranteed • Otherwise, reject jobs
Aperiodic and Sporadic Jobs • Correctness • All accepted sporadic jobs and periodic jobs meet their respective deadlines
Aperiodic and Sporadic Jobs • Optimality • Apreiodic jobs • Minimizing the average response time of jobs • Sporadic jobs • Accept jobs if and only if they can be scheduled by some means
Aperiodic and Sporadic Jobs • What we are going to talk about are… • How to handle aperiodic jobs • Reserve a portion of CPU power for aperiodic jobs in fixed-priority and deadline-driven systems • Try to deliver high responsiveness • Schedulability of periodic tasks must not be affected • How to handle sporadic jobs • Employ mechanism proposed for the above • Test whether deadlines of sporadic jobs can be met
Handling Aperiodic Jobs • Approaches • Background execution • Improvement: slack stealing • Interrupt-driven execution • Improvement: slack stealing • Polled execution • Improvement: Bandwidth-preserving servers
Handling Aperiodic Jobs • Terminology (1/3) • Periodic jobs • Jobs of periodic tasks • Server • A task servicing sporadic jobs • Can be either periodic servers or sporadic servers • Characterized by (c,p) • Don’t confuse with a periodic task, a server does not stands for a periodic task • cbudget, c/pserver size
Handling Aperiodic Jobs • Terminology (2/3) • Backlogged • A server is backlogged if there are some ready jobs in its queue • Eligible • A server is eligible if it has budget and is backlogged
Handling Aperiodic Jobs • Terminology (3/3) • Budget consumption rules • Define how budget is consumed when servicing jobs • Budget replenishment rules • Define how budget is replenished • Server execution • When a server is eligible, it is scheduled with other periodic tasks as if it were a periodic task • When budget is exhausted, the server is suspended immediately
Part A: Server Design & the handling of aperiodic jobs
Handling Aperiodic Jobs • Background execution • Handle aperiodic jobs whenever there is no periodic jobs to execute • Extremely simple • Always produce correct schedule • Poor response time
Background Execution 0.8 0.1 Response time=7.7
Handling Aperiodic Jobs • Interrupt execution • An obvious extension to background execution • On arrivals, aperiodic jobs immediately interrupts the currently running periodic job • Fastest response time • Schedulability of periodic jobs can be damaged
Interrupt Execution * Execution time=2.1
Handling Aperiodic Jobs • Slack stealing • To postpone periodic jobs when it is safe to do so • Algorithmically simple, but hard to implement
Handling Aperiodic Jobs • Polled execution • A purely periodic task (polling server) to serve a queue of aperiodic jobs • When the polling server gains control of the CPU, it services aperiodic jobs in the queue • If the queue becomes empty, the polling server suspends immediately • The queue is not checked until the next polling period
The polling server loses all its budget at time 0, since there is no ready aperiodic jobs 0 0.5 0.3 (0.5,2.5) RMS Aperiodic job A arrives at time 0.1
Handling Aperiodic Jobs • Polling servers are easy to implement and are analytically simple • However, a polling server loses all its budget once the queue is empty • If we can preserve the residual budget, aperiodic jobs can be serviced and their response time can be shortened
Handling Aperiodic Jobs • Bandwidth-preserving servers • Deferrable servers • Sporadic servers • Constant utilization servers, total bandwidth servers, weighted fair-queuing servers • These servers aim at improving responsiveness by means of: • Preserving budget whenever possible • Aggressively replenish
Deferrable Servers • Let a deferrable server be denoted by (cs,ps) • Consumption rules: • Budget is consumed at rate of 1 whenever the server services aperiodic jobs • Replenishment rules: • Budget is set to cs at k*ps, for k=0,1,2,…
Deferrable Servers (1,3) (1.5,3.5) (0.5,6.5) Preserving budget Fixed-priority: priority TDST1T2
Deferrable Servers (1,3) (1.5,3.5) (0.5,6.5) Preserving budget Deadline-driven: the deadline of a server job is the next replenishment time
Deferrable Servers • Because budget is preserved, aperiodic jobs can conflict with any periodic jobs at any time • Differently, jobs of a purely periodic task only arrive at the beginning of every period • Does critical instants for tasks of a fixed-priority system in which there is a deferrable server exists?
cS cS pS pS Deferrable Servers • The below figure shows a scenario in which a deferrable server interferes low-priority tasks most (aka double hit) DS becomes backlogged budget
Deferrable Servers • Theorem: Critical instant of task Ti(Let the deferrable server TDS have the highest priority)
Deferrable Servers • Response time analysis • For each i, task Ti is schedulable if Ri,j converges no later than Pi
Deferrable Servers • Response time analysis is accurate, but can we have a polynomial time test like the utilization-bound test? • Bad news: • There is no know utilization bound if a deferrable server is of an arbitrary priority • Good news (not so good): • Consider a system of n independent, preemptible periodic tasks and ps<p1<…<pn<2ps and pn>ps+cs [Lehoczky87]
Ouch, it is quite low… Utilization bound when Us = 1/3
Deferrable Servers • Yet another good news: • We can still make use of the Liu-and-Layland utilization bound if some conservative considerations are taken
pS pS pi ci Deferrable Server • If the deferrable server TDS is of an arbitrary priority, it may impose up to one additional Cs on feasible intervals of jobs of some low-priority task Ti cS cS cS ……
Deferrable Server • Task set {T1,…,Tm,TDS,Tm+2,…Tn} • {T1,…,Tm} is schedulable if ∑ci/pi≦U(m) • For i=(m+1)…n, the reminder of the task set is schedulable if • Let’s try T1=(0.6,3), TDS=(0.8,4), T3=(0.5,5), T4=(1.4,7)
Deferrable Servers • Why can we treat the additional cs as “extra blocking time” of Ti? ?? TDS TDS Ti Ti Schedulable schedulable
Deferrable Servers • Schedulability of a deadline-driven system with a deferrable server • Consider task set {T1,…, Tn}U{(cs,ps)} • Let t be the deadline of a job of a periodic task • Let t- (<t) be the latest time instant when the CPU is idle or is executing jobs with deadline later than t • Consider time interval (t-,t], we are interested in the maximum computation time demand from periodic tasks and the deferrable server
Deferrable Servers • Deadline-driven systems • The maximum CPU time demanded by the deferrable server in time interval (t-,t] is The last job of es does not affect jobs of deadline no later then t due to EDF discipline Cs? The maximum occurs when the term inside the floor function is an integer
Deferrable Servers • Deadline-driven systems • The maximum CPU time demanded by periodic jobs is Similarly, the maximum happens when the term inside the floor function is a integer
Deferrable Servers • If the total CPU time demanded by periodic jobs and apreiodic jobs exceeds t-t-, the taskset is unschedulable! • Diving both sides of the inequality and then Invert the above statement, we have the theorem:
Deferrable Servers • A deadline-driven system with a deferrable server is schedulable if [Ghazalie95]
Bandwidth-Preserving Servers • Deferrable servers • Sporadic servers • Priority-exchange servers • Constant utilization servers and total bandwidth server
Sporadic Servers • Deferrable servers have simple rules for budget consumption and replenishment, but they impose extra delays on periodic tasks • Double hit exists both in priority-driven and deadline-driven scheduling • Schedulability tests for periodic systems with deferrable servers are quite complicated
Sporadic Servers • Sporadic servers are designed to improve over deferrable servers • Schedulability test for periodic systems with sporadic servers is very simple • However, nothing always wins. Sporadic servers have complicated consumption and replenishment rules.
Sporadic Servers • Design guideline: a sporadic server never demand processor time more than a periodic task (c,p) does in any time interval • Sporadic servers can be replaced with corresponding periodic tasks for schedulability test
Sporadic Servers • A sporadic server can be characterized by (c,p) • Note again that a sporadic server is not a periodic task! • Different designs of sporadic servers exist, aiming at • preserving server budget as long as possible, and • replenishing server budget as early as possible
Sporadic Servers • Simple sporadic servers in fixed-priority systems
Sporadic Servers • Consumption rules
Sporadic Servers • Fact A: if a periodic task is schedulable in a fixed-priority system, then all its jobs are schedulable if their inter-arrival times are not shorter than its task period • Based on this fact, budget can be preserved for a long period of time D D D D
H H L L H L H L Sporadic Servers • Fact B: when a low-priority job is delayed by a high-priority job, the produced schedule is the same as that produced by the two jobs arriving at the same time • Based on this fact, budget can be replenished more aggressively
(0.5,3) (1.0,4) (1.5,5) (4.5,19) FA FA