1 / 21

CprE 458/558: Real-Time Systems

CprE 458/558: Real-Time Systems. Combined Scheduling of Periodic and Aperiodic Tasks. Assumptions & Issues. RMS scheduling algorithm used All periodic tasks start at time t=0 (same as before) Periodic tasks relative deadlines are equal to end of period

taariq
Download Presentation

CprE 458/558: Real-Time Systems

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. CprE 458/558: Real-Time Systems Combined Scheduling of Periodic and Aperiodic Tasks CprE 458/558: Real-Time Systems (G. Manimaran)

  2. Assumptions & Issues • RMS scheduling algorithm used • All periodic tasks start at time t=0 (same as before) • Periodic tasks relative deadlines are equal to end of period • Arrival times of aperiodic tasks unknown • Schedulability of periodic tasks • Response time for aperiodic tasks • Implementation considerations CprE 458/558: Real-Time Systems (G. Manimaran)

  3. Background Scheduling Algorithm • No server is created. • Aperiodic tasks are executed when there is no periodic task to execute. • Simple, but no guarantee on aperiodic schedulability Periodic tasks RMS CPU High priority Queue Aperiodic tasks FIFO/EDF… Low priority Queue CprE 458/558: Real-Time Systems (G. Manimaran)

  4. Normal RMS schedule: Notice the holes Task set: Ti = (ci, pi) T1 = (2,6) and T2 = (4,10) Schedulability check: 2/6 + 4/10 = 0.33 + 0.40 = 0.73 ≤ 2(√2 -1) = 0. 82 Background scheduling: basic idea -- Scheduling aperiodic tasks in holes like this T1 T11 T12 Hole 0 2 6 8 10 T2 T21 T22 6 0 2 10 Schedule continues CprE 458/558: Real-Time Systems (G. Manimaran)

  5. 1 unit 1 2 Background Scheduling: Example T1 Hole1 2 units Hole2 2 units T13 T14 T11 T12 18 0 2 6 8 10 T2 T21 T22 T22 14 16 18 6 0 2 10 12 Aperiodic tasks A1 A2 14 16 18 6 0 2 10 12 RMS Periodic tasks CPU High priority Queue FIFO Aperiodic tasks Low priority Queue CprE 458/558: Real-Time Systems (G. Manimaran)

  6. Combined Scheduling • Creating a periodic server Ts=(Cs, Ps) for processing aperiodic workload. Create one or more server tasks. • Aperiodic tasks are scheduled in the periodic server’s time slots. This policy could be based on deadline, arrival time, or computation time. • Algorithms – all algorithms behave the same manner when there are enough aperiodic tasks to execute - Polling Server (bandwidth non-preserving) - Deferrable Server (bandwidth preserving) - Priority Exchange Server (bandwidth preserving) - Sporadic Server (bandwidth preserving) CprE 458/558: Real-Time Systems (G. Manimaran)

  7. Polling Server • A periodic server is created. • If there are no aperiodic tasks at an invocation of the server (as per RMS), the server suspends itself during its current period and gets invoked again at its next period. • If there are enough aperiodic tasks in an invocation, it serves up to Cs capacity. • The computation time allowance for the server is replenished at the start of its period • Include Ts in the task set and do schedulability test • Poor response time for aperiodic tasks CprE 458/558: Real-Time Systems (G. Manimaran)

  8. Ts should be scheduled here as per RMS. However, as there is no aperiodic task to schedule, Ts suspends itself and is again available only at time = 5 2 2 1 Polling server: Example This aperiodic task cannot be scheduled now as there is no server available till time = 5 Task set: Ti = (ci, pi) T1 = (1,4) , T2 = (2,6) and Ts = (2,5) Task set: Ti = (ci, pi) T1 = (1,4) , T2 = (2,6) and Ts = (2,5) T1 8 12 16 24 0 4 20 Server becomes available and schedules aperiodic task A1 for 2 units Server becomes available and can schedule for 2 units. However, aperiodic task A2 needs only 1 T2 1 3 6 7 Waits till time = 10 10 12 13 Waits till time = 15 15 18 20 24 Preempted by T1 Aperiodic tasks A1 A2 A3 A3 2 8 10 13 15 16 17 18 24 5 0 CprE 458/558: Real-Time Systems (G. Manimaran)

  9. 2 2 1 Polling server: Example (no animations) Task set: Ti = (ci, pi) T1 = (1,4) , T2 = (2,6) and Ts = (2,5) T1 8 12 16 24 0 4 20 T2 1 3 6 7 10 12 13 15 18 20 24 Aperiodic tasks A1 A2 A3 A3 2 8 10 13 15 16 17 18 24 5 0 CprE 458/558: Real-Time Systems (G. Manimaran)

  10. Polling server: Schedulability Analysis • Schedulability analysis involves • Schedulability of periodic tasks • Schedulability of Aperiodic tasks • Schedulability of periodic tasks can be evaluated by introducing a periodic task equivalent to the server. Therefore, the schedulability test is: ∑i=1 to n (Ci / Pi) + (Cs / Ps) ≤ (n+1)[2 1/(n+1) -1] CprE 458/558: Real-Time Systems (G. Manimaran)

  11. Polling server: Schedulability Analysis • Aperiodic task guarantees: • Consider a single aperiodic task Ai, arrived at ra, with computation time Ca and deadline Da. Since an aperiodic task can wait at most for one period before receiving service, if Ca≤ Cs the request is certainly completed within two server periods. Thus it is guaranteed if 2Ps≤ Da Ca Cs Ps Ps da 0 ra Da > Ps CprE 458/558: Real-Time Systems (G. Manimaran)

  12. Polling server: Schedulability Analysis • Aperiodic task guarantees: • For arbitrary computation times, the aperiodic task is certainly completed in ceil(Ca/Cs) server periods; hence it is guaranteed if • Ps + ceil(Ca/Cs) * Ps ≤ Da CprE 458/558: Real-Time Systems (G. Manimaran)

  13. Deferrable Server • A periodic server task is created. • When the server is invoked with no outstanding aperiodic tasks, the server does not execute but defers its assigned time slot. • When an aperiodic task arrives, the server is invoked (as per RMS) to execute aperiodic tasks and maintains its priority. CprE 458/558: Real-Time Systems (G. Manimaran)

  14. Deferrable Server (Contd.) • The computation time allowance for the server is replenished at the start of its period. • Provides better response time for aperiodic tasks than Polling server • Under overload, deadlines are missed predictably. • Similar schedulability test like polling server CprE 458/558: Real-Time Systems (G. Manimaran)

  15. Server defers its capacity to handle any future aperiodic task 2 1 Deferrable Server: Example Task set: Ti = (ci, pi) T1 = (1,4) , T2 = (2,6) and Ts = (2,5) T1 8 12 16 24 0 4 20 Why is A2 not scheduled at time = 8 itself??? T2 Don’t need to wait till time = 10 Don’t need to wait till time = 5 1 3 6 8 10 12 13 15 18 20 24 T1 runs from 8 to 9 and hence Ts a lower priority task cannot run till 9 Aperiodic tasks A1 A2 4 9 2 8 24 0 CprE 458/558: Real-Time Systems (G. Manimaran)

  16. Priority Exchange Server • A periodic server task is created. • When the server invoked, the server runs if there are any outstanding aperiodic tasks. • If no aperiodic task exists, the high priority server exchanges its priority with a lower priority periodic task for a duration of Cs’, where Cs’ is the remaining computation time of the server. CprE 458/558: Real-Time Systems (G. Manimaran)

  17. Priority Exchange Server (Contd.) • In this way, the priority of the server decreases, but its computation time is maintained. • The computation time allowance for the server is replenished at the start of its period. • As a consequence, the aperiodic tasks get low preference for execution. Offers worse response time compared to Deferrable Server. • Better schedulability bound for periodic task set compared to Deferrable Server. CprE 458/558: Real-Time Systems (G. Manimaran)

  18. TH e Cs - e TS Tf Cs - e TL Priority Exchange server: example Aperiodic task exists to utilize the server capacity TH Cs TS Tf TL No more Aperiodic tasks to utilize the server capacity Server executing at TL’s priority when there are aperiodic tasks to serve TL executing at the server’s priority TL executing at its own priority CprE 458/558: Real-Time Systems (G. Manimaran)

  19. Sporadic Server • This algorithm allows to enhance the average response time for aperiodic tasks without degrading the utilization bound for periodic task set • This is achieved by varying the points at which the computation time of the server is replenished, rather than merely at the start of each server period. • In other words, any spare capacity (i.e., not being used by periodic tasks) is available for an aperiodic task on its arrival. CprE 458/558: Real-Time Systems (G. Manimaran)

  20. Since no aperiodic task is there, the server defers its capacity 2 1 Sporadic server: example Server has the highest priority Task set: Ti = (ci, pi) T1 = (3,10) , T2 = (4,15) and Ts = (2,8) And, replenishes its capacity at time = current_time + period T1 10 12 15 16 24 2 0 4 20 Server has capacity to schedule A2 T2 Server schedules the aperiodic task right away with its capacity Server has no capacity to handle 5 9 15 18 20 24 Aperiodic tasks A2 A1 7 12 2 10 24 0 4 CprE 458/558: Real-Time Systems (G. Manimaran)

  21. Priority-driven preemptive scheduling- summary • Scheduling algorithms • RMS & EDF utilization test • RMS & DMS Exact analysis • Combined Scheduling • Polling, Deferrable, PE, Sporadic servers • Resource Access Control • Priority Inversion • Priority Inheritance & Pri. Ceiling Protocols • Schedulability tests accounting Blocking CprE 458/558: Real-Time Systems (G. Manimaran)

More Related