Tutorial Set 5 - July 14, 2008

advertisement
ECE 493T9
Real Time Embedded System
Tutorial Set 5
July 14, Spring 2008
Clock-Driven Scheduling
• Two Main Techniques:
– Table-Driven Scheduling
• Input:
• Output:
• Method:
Periodic Tasks
Valid Schedule with Specific Release Time for EVERY Time Slice
EDF (or others)
– Frame-Based Scheduling
• Input:
• Output:
• Method:
Periodic Tasks
Valid Schedule with Specific Release Time for EVERY Frame
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
f  max(ci )
1 i  n
2.
Major Frame Size must divide the Hyperperiod. (To maintain its predictability)
pi / f  pi / f  0
3.
for at least one pi
Release Time and Deadline must be separated with at least One Major Frame
2 f  gcd( pi , f )  Di
Frame-Based Scheduling
•
Example 1: Determining Frame Size
Given J1(1,15,14), J2 (2, 20, 26), and J3 (3, 22, 22)
By constraint one, we know that
Notation: J(c, p, D)
f  max(1, 2,3)  3
By constraint two, we know that the possible frame sizes are:
f  3, 4,5,10,11,15, 20, or 22
Finally, by constraint three, we can narrow down our selection of frame size down to
the following:
f  3, 4,5
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:
Constraint 3:
f 3
f  3,5,15
(Hyperperiod = LCM (5, 15) = 15)
f  3,5
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:
Computer Slice Length:
LCM (pi, i = 1..4) = LCM (5,10,15,30) = 30
GCD (ci, i = 1..4) = GCD(2, 2, 5, 2) = 1
We will use EDF to schedule the 4 tasks in this single frame.
A
B
C
D
5
10
15
30
Based on EDF, J1 must be scheduled as the first one.
Frame-Based Scheduling
•
Example 3: Frame-Based Scheduling
Continue…
A
Table: J1 J1
B
10
C
15
D
30
A
Table: J1 J1 J2 J2
B
C
15
D
30
A
B
Table: J1 J1 J2 J2 J3 J1 J1
5
C
D
15
30
Frame-Based Scheduling
•
Example 3: Frame-Based Scheduling
Continue…
A
B
5
Table:
J1 J1 J2 J2 J3 J1
J1 J3 J3 J3 J1 J1
J3 J2 J2
Table:
J1 J1 J2 J2 J3 J1
J1 J3 J3 J3 J1 J1
J3 J2 J2 J1 J1 J3
J3 J3 J1 J1 J3 J3
J4
C
15
D
30
A
B
5
C
D
15
30
Frame-Based Scheduling
•
Example 3: Frame-Based Scheduling
Continue…
Finally, we will arrive at this Table-Driven Schedule for this single frame:
A
B
5
C
D
30
Table:
J1 J1 J2 J2 J3
J1 J1 J3 J2 J2
J1 J1 J3 J3 J4
J1 J1 J3 J3 J3
J1 J1 J3 J3 J3
J1 J1 J4 J2 J2
Questions?
Questions?
Questions?
Project Topic Sign Up!!
Midterm Questions
Download