Download presentation
1
Periodic Task Scheduling
張軒彬助理教授 中興大學資訊科學系 In this chapter, we introduce the periodic task scheduling. Periodic activities represent the major computational demand in most real-time systems. For example, sensory data acquisition, control loops, system monitoring are all periodic tasks.
2
Outline Processor Utilization Factor Rate Monotonic Scheduling
Earliest Deadline First In this chapter, we first introduce the processor utilization factor. Then, three periodic tasks scheduling algorithms, Rate Monotonic and Earliest Deadline First, are described sequentially.
3
Processor Utilization Factor
Given a set T of n periodic tasks, processor utilization factor U is the fraction of processor time spent in the execution of a task set There exists a maximum value of U below which T is schedulable and above with T is not schedulable Depend on the task set and used scheduling algorithm Let Uub(T, A) denote the upper bound of the processor utilization factor for a task set T under a give algorithm A If U = Uub(T, A), the set T is said to fully utilize the processor Definition: Processor Utilization Factor Given a set T of n periodic tasks, processor utilization factor U is the fraction of processor time spent in the execution of a task set Where Ci is task i’s computation time and Ti is its period. From the definition, processor utilization factor provides a measure of the CPU’s computational load due to the periodic task set. Depend on the task set and applied scheduling algorithm, there exists a maximum value of U which task set T is schedulable and above with T is not schedulable.
4
Processor Utilization Factor (Cont.)
For a given algorithm A, the least upper bound Ulub(A) of the processor utilization factor is the minimum of the utilization factors over all task sets that fully utilize the processor Uub1 T1 Uub2 The definitions of upper bound and the lease upper bound of the processor utilization factor are shown in the slides. Example: as shown in the figure, each task set Ti differ in the number of tasks and their periods. Each task set may have different upper bound and the minimum one of is the least upper bound. T2 Uub3 T3 Uub4 T4 Uubm Tm U 1 Ulub
5
Processor Utilization Factor (Cont.)
Ulub(A) defines an important characteristics of a real-time scheduling algorithm. It allow to easily verify the schedulability of a task set. If a task set whose processor utilization factor is below Ulub(A), then it is schedulable by the algorithm A. In contrast, if a task set’s processor utilization factor is above Ulub(A), it may or may not be schedulable by the algorithm A
6
Rate Monotonic Scheduling
Task model: Periodic tasks Arbitrary arrival times Different computation time and deadlines Preemptive This slide shows the task model of Rate Monotonic.
7
Rate Monotonic Scheduling (Cont.)
Rate Monotonic (RM) Assign priorities to tasks according to their request rates Tasks with higher request rates, i.e., shorter periods, have higher priorities Fixed-priority scheduling algorithm Priority are assigned to tasks before execution and do not change over time Intrinsically preemptive The currently executing task is preempted by a newly arrived task with shorter period
8
Rate Monotonic Scheduling (Cont.)
Optimality: RM is optimal among all fixed-priority scheduling algorithms No other fixed-priority algorithm can schedule a task set that cannot be scheduled by RM Schedulability condition: given n tasks, the least upper bound of the processor utilization factor under RM is In 1973, Liu and Layland showed that RM is optimal among all fixed-priority scheduling algorithms since no other fixed-priority algorithm can schedule a task set that cannot be scheduled by RM. The least upper bound of the processor utilization factor in RM is n 1 2 3 4 5 6 7 8 9 10 Ulub 1.000 0.828 0.780 0.757 0.743 0.735 0.729 0.724 0.721 0.718
9
Rate Monotonic Scheduling (Cont.)
Concluding remarks The schedulability condition is sufficient to guarantee the feasibility of any task set, but it is not necessary Thus, if a task set has an utilization factor greater than Ulub and less than one, nothing can be said on the feasibility of the task set
10
Earliest Deadline First
Earliest Deadline First (EDF) Selects tasks according to their (absolute) deadlines Tasks with earlier deadlines will be executed at higher priority Dynamic scheduling algorithm The absolute deadline of a periodic task depends on the current ith instances Thus, EDF is a dynamic priority assignment Intrinsically preemptive The current executing task is preempted whenever another periodic instance with earlier deadline become active
11
Earliest Deadline First (Cont.)
Optimality: EDF is optimal among all dynamic-priority scheduling algorithms Schedulability analysis A set of periodic tasks is schedulable with EDF if and only if
12
Example Two tasks: Processor utilization factor
Task 1: execution time: 2, period: 5 Task 2: execution time: 4, period: 7 Processor utilization factor U = 2/5 + 4/7 = 0.97 U > Ulcb of RM RM cannot guarantee schedulability U < Ulcb(=1) of EDF EDP thus guarantee schedulability
13
Example RM T1 5 10 15 20 25 30 35 time overflow T2 7 14 21 28 35 EDF Example, a task set whose processor utilization factor is 2/5 + 4/7 = 34/35 ~ 0.97. Thus, the CPU spends its 97% of time in executing periodic tasks with 3% of time idle. Since U > ln2, thus, the task set’s schedulability is not guaranteed in RM. Indeed, RM results in a miss deadline at t = 7. In contrast, U < 1, thus the task set is schedulable under EDF. T1 5 10 15 20 25 30 35 T2 7 14 21 28 35
14
Reference Giorgio C. Buttazzo, “Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications,” Kluwer Academic Publishers, 1997 Jane W. S. Liu, “Real-Time Systems,” Prentice Hall, 2002
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.