Presentation on theme: "ECE 493T9 Real Time Embedded System Tutorial Set 5 July 14, Spring 2008."— Presentation transcript:
ECE 493T9 Real Time Embedded System Tutorial Set 5 July 14, Spring 2008
Clock-Driven Scheduling Two Main Techniques: –Table-Driven Scheduling Input: Periodic Tasks Output:Valid Schedule with Specific Release Time for EVERY Time Slice Method:EDF (or others) –Frame-Based Scheduling Input:Periodic Tasks Output:Valid Schedule with Specific Release Time for EVERY Frame Method:EDF (or others) Requirement / Assumptions: –Periodic Tasks (or converted to periodic with worst-case estimations) –Number of tasks is constant throughout the operation of the system –Schedule flexibility is not a major concern
Table-Driven Scheduling High Predictability, Low Flexibility All the input tasks must be periodic, or made periodic by worst-case estimation (or other techniques). Example: Given J1 (1, 2, 2), J2 (2, 6, 6), J3 (2, 12, 12). Construct a Table-Driven Schedule. Since all three jobs are periodic, their schedulibility can be verified with table-driven scheduling technique. In this example we will use EDF as the scheduling method. First, determine the Hyperperiod and Utilization Ratio: Hyperperiod = LCM(Di, i = 1..3) = LCM (4, 6, 12) = 12 Utilization Ratio = 2 / 4 + 2 / 6 + 2 / 12 = 1 After Table-Driven Scheduling, we have the following result: Table: J1 J2 J1 J2 J1 J3 J1 J2 J1 J2 J1 J3
Frame-Based Scheduling Set the Scheduler to schedule tasks at periodic time spots rather than at the end of every time slot. Enable completion of a set of highly related tasks without interruption due to task preemption. Reduce the complexity of scheduling process and improve the flexibility of Table-Driven Scheduling technique. Fundamentals: –Based on Table-Driven Scheduling Techniques –During each frame all the included tasks are equally prioritized, and will NOT be preempted by other tasks –Three main frame-size constraints Major Frame Size must be larger or equal to the process time of every task. Major Frame Size must divide the Hyperperiod. (To maintain its predictability) Release Time and Deadline must be separated with at least One Major Frame.
Frame-Based Scheduling Mathematical Representation of the 3 Frame Size Constraints: 1.Major Frame Size must be larger or equal to the process time of every task 2.Major Frame Size must divide the Hyperperiod. (To maintain its predictability) for at least one p i 3.Release Time and Deadline must be separated with at least One Major Frame
Frame-Based Scheduling Example 1: Determining Frame Size Given J1(1,15,14), J2 (2, 20, 26), and J3 (3, 22, 22) Notation: J(c, p, D) By constraint one, we know that By constraint two, we know that the possible frame sizes are: Finally, by constraint three, we can narrow down our selection of frame size down to the following:
Frame-Based Scheduling Example 2: Constructing Frames Given J1(1, 5, 5), J2 (1, 5, 5), J3 (2, 15, 15), J4 (3, 15, 15), and J5 (1, ≥5, ≥5) Please construct a set of frames for scheduling these tasks. Constraint 1: Constraint 2:(Hyperperiod = LCM (5, 15) = 15) Constraint 3: Since both frame sizes are feasible, we will randomly pick f = 5 for demonstration. You can try f = 3 at home.
Frame-Based Scheduling Example 2: Constructing Frames Given J1(1, 5, 5), J2 (1, 5, 5), J3 (2, 15, 15), J4 (3, 15, 15), and J5 (1, ≥5, ≥5) Please construct a set of frames for scheduling these tasks. Continue… Frame 1: J1 || J2 || J3 (1) || J4 (1) || J5 (upon event, else pause) Frame 2: J1 || J2 || J3 (2) || J4 (2) || J5 (upon event, else pause) Frame 3: J1 || J2 || J4 (3) || J5 (upon event, else pause) || pause Since no precedence is given in this question, the valid schedule of these three frames is: Frame 1 || Frame 2 || Frame 3 (Hyperperiod = 15, f = 5)
Frame-Based Scheduling Example 3: Frame-Based Scheduling Given J1 (2, 5, 5), J2 (2,10,10), J3 (5, 15, 15), and J4 (2, 30, 30) as the four jobs in one frame. Please compute a scheduling table for this single frame. Compute Major Frame Length: LCM (p i, i = 1..4) = LCM (5,10,15,30) = 30 Computer Slice Length:GCD (c i, i = 1..4) = GCD(2, 2, 5, 2) = 1 We will use EDF to schedule the 4 tasks in this single frame. Based on EDF, J1 must be scheduled as the first one.