1 / 19

Real Time Operating Systems

Real Time Operating Systems. Asynchronous Events Course originally developed by Maj Ron Smith. Outline. Aperiodic versus Sporadic Tasks Approaches to Scheduling Asynchronous Tasks Background Scheduling Interrupt Driven Slack Stealing Polling Bandwidth Servers Deferrable Servers

taylor
Download Presentation

Real Time Operating 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. Real Time Operating Systems Asynchronous Events Course originally developed by Maj Ron Smith

  2. Outline • Aperiodic versus Sporadic Tasks • Approaches to Scheduling Asynchronous Tasks • Background Scheduling • Interrupt Driven • Slack Stealing • Polling • Bandwidth Servers • Deferrable Servers • Sporadic Servers Dr. Alain Beaulieu

  3. Asynchronous Events • Recall that aperiodic and sporadic tasks model events which arrive (release) unpredictably; ie, asynchronously • Aperiodic tasks have jobs with soft or no deadlines • In scheduling these jobs we attempt to minimize their response time, without jeopardizing any “hard” deadlines • Sporadic tasks have jobs with hard deadlines • In scheduling these jobs we only accept them if their deadlines are guaranteed to be met, otherwise we reject the job. • This implies a requirement for handling “rejected” jobs In this course we will not be covering specific techniques for accepting / rejecting sporadic jobs Dr. Alain Beaulieu

  4. Approaches to Scheduling Asynchronous • In a system based on preemptive, fixed-priority scheduling, the scheduler’s role is to ensure that the highest priority “ready” task is always “running” How is the system made aware of the asynchronous events? … and how are they scheduled? Dr. Alain Beaulieu

  5. T1 1 1 1 T2 1 1 1 Ax 0 2 4 6 8 Simple Approaches – Background Execution • Asynchronous tasks are scheduled and executed only during processor idle times • Simple & does not affect periodic schedulability • However, asynchronous response times are poor Dr. Alain Beaulieu

  6. T1 1 1 1 T2 1/2 x 1 1 Ax 0 2 4 6 8 Simple Approaches – Interrupt Driven Execution • Scheduling and execution of asynchronous jobs is interrupt driven (with priority) • Simple & yields best asynchronous response times • However, periodic tasks may no longer be schedulable Dr. Alain Beaulieu

  7. T1 1 1 1 T2 1 1 Ax 0 2 4 6 8 Simple Approaches – Slack Stealing • Each periodic task is postponed such that it is still schedulable but they free up slack time • Provides good asynchronous response times and maintains periodic task schedulability • But this requires high overhead and is complex Dr. Alain Beaulieu

  8. Polling Servers • Another simple approach is to employ a poller or polling server to handle asynchronoustasks • At predefined periods, ps, polls the system to determine if the asynchronousjob queue is non-empty • essentially a periodic server: (ps, es) • Thebudget of the server is es which is replenished at the beginning of each period, ps • The server is backlogged when the asynchronousqueue is nonempty and idle otherwise Dr. Alain Beaulieu

  9. Tpoller 1/2 1/4 T1 1 1 1 T2 1 1 1 0 2 4 6 8 Polling Servers • For the system below we see the main disadvantage of this approach • if an asynchronous job arrives after the polling, it must wait until the next period to be scheduled and the budget is lost (wasted) Tpoller = (2, 0.5), A1 = (0.1, 0.75) Dr. Alain Beaulieu

  10. Bandwidth Preserving Servers (BPS) • Algorithms which preserve the budget of the polling server, thus allowing it to be consumed later in the period if an asynchronous job arrives, are known as bandwidth preserving servers • Bandwidth preserving servers are defined by: • consumption rules – the conditions under which execution budgets are preserved and consumed, • replenishment rules – the time in which a budget is replenished and by what amount Dr. Alain Beaulieu

  11. Deferrable Servers • Adeferrable server is a bandwidth preserving server with period ps and execution budget es which • preserves its budget if idle, and • replenishes its budget fully every period • Budgets are not allowed to accumulate from period to period • Since the deferrable server is purely periodic, it can be assigned priority along with all other periodic tasks • However, for reasons that will be explained later, we must ensure that the priority of the deferrable server is higher than all other periodic tasks Dr. Alain Beaulieu

  12. Deferrable Servers - Example • Draw the schedule for the system below: T= {(2, 3.5, 1.5, 3), (6, 0.5) } TDS = (3,1) A1 = (2.5, 2) Note: Ti = (i, pi, ei, Di) - standard 4-tuple periodic task Ti = (pi, ei) - standard 2-tuple periodic task Ai = (ri, ei) - standard 2-tuple aperiodic task Si = (ri, ei, di) - standard 3-tuple sporadic task Dr. Alain Beaulieu

  13. TDS 1/2 1 1/2 T1 1/2 1 1/2 1 T2 1/2 1/2 2.5 5.5 0 2 4 6 8 Deferrable Servers –Solution • The schedule for this system is given below: T= {(2, 3.5, 1.5, 3.5), (6, 0.5) } TDS = (3,1) A1 = (2.5, 2) Note:  = {TDS, T1, T2} Dr. Alain Beaulieu

  14. Sporadic Servers • Sporadic servers are a class of bandwidth preserving servers that are designed to deal with the disadvantage just seen with deferrable servers • As with a deferrable server, a sporadic sever preserves its budget, only consuming it when an actual aperiodic event occurs • However the replenishment period shifts so as to be in phase with the start of each actual asynchronous sequence or to align with a new busy interval • ps can shift forward when the asynchronous queue is empty • and shift backward when the system periodic tasks are idle The specifics of these consumption and replenishment rules define the variants of sporadic servers Dr. Alain Beaulieu

  15. Sporadic Server – Illustrative Example 1 • Note 1: the tasks and the server in this system are RM scheduled and  TSS has a priority of 2 • Note 2: the replenishment period, ps , phase shifts forward at time 0.5 when A1 releases (!book) T = {(3,1), (5,1.5)}, TSS = (4,1), A = {(0.5,1.5), (3,1)} T1 1 1 1 A1 A2 A1 A2 TSS 0.5 0.5 1 0.5 T2 1 0.5 0.5 1 0 2 4 6 8 ps1 ps2 ps0 Dr. Alain Beaulieu

  16. Sporadic Server – Illustrative Example 2 • Note 1: periodic task T2 has been modified such that its period is now 7 instead of 5 • Note 2: the period ps phase shifts backward at time 5.5 when the periodic system is idle T = {(3,1), (7,1.5)}, TSS = (4,1), A = {(0.5,1.5), (3,1)} T1 1 1 1 A2 A1 A1 A2 TSS 0.5 0.5 0.5 1 T2 1 0.5 1.5 0 2 4 6 8 ps1 ps2 Dr. Alain Beaulieu

  17. Schedulability & Sporadic Servers • When assigning priorities (as we saw in the previous example), we treat the sporadic server as any other periodic task • and because the sporadic server can never delay a lower priority task any more than a normal periodic task with similar parameters, we can determine system schedulability in the exact same manner as if the system were just a set of periodic tasks • Note that the deadline of the sporadic server is only relevant in the context that the server gets a full budget each cycle if needed (as if someone were leaning on the keyboard) Dr. Alain Beaulieu

  18. Exercise • Draw the RM schedule for the system below • (go out far enough in time to include as a minimum the completion of the first job in each periodic task and all aperiodic jobs) • Use the rules used in class not the ones in the book. • Determine the response time of A1 and A2 • Is the system schedulable? • T={ (4, 1), (7, 2) } • TSS = ( 5, 1) , A = {(0.5, 2.5), (2.5, 0.25)} How does the answer change if e2 = 1.9? Dr. Alain Beaulieu

  19. References [1] Liu, J.W.S., “Real-Time Systems”, Prentice-Hall, 2000. [2] Labrosse, J.J., “MicroC/OS-II” 1st and 2nd Editions (1999, 2002) Dr. Alain Beaulieu

More Related