Outline Processor Utilization Factor Rate Monotonic Scheduling Earliest

  • Slides: 14
Download presentation

Outline • Processor Utilization Factor • Rate Monotonic Scheduling • Earliest Deadline First 2

Outline • Processor Utilization Factor • Rate Monotonic Scheduling • Earliest Deadline First 2 嵌入式即時作業系統

Processor Utilization Factor • Given a set T of n periodic tasks, processor utilization

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 3 嵌入式即時作業系統

Processor Utilization Factor (Cont. ) • For a given algorithm A, the least upper

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 Uub 1 T 1 Uub 2 T 2 Uub 3 T 4 Tm 嵌入式即時作業系統 Uub 4 Uubm 0 Ulub 1 U 4

Processor Utilization Factor (Cont. ) • Ulub(A) defines an important characteristics of a real-time

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 5 嵌入式即時作業系統

Rate Monotonic Scheduling • Task model: – Periodic tasks – Arbitrary arrival times –

Rate Monotonic Scheduling • Task model: – Periodic tasks – Arbitrary arrival times – Different computation time and deadlines – Preemptive 6 嵌入式即時作業系統

Rate Monotonic Scheduling (Cont. ) • Rate Monotonic (RM) – Assign priorities to tasks

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 7 嵌入式即時作業系統

Rate Monotonic Scheduling (Cont. ) • Optimality: RM is optimal among all fixed-priority scheduling

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 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 8 嵌入式即時作業系統

Rate Monotonic Scheduling (Cont. ) • Concluding remarks – The schedulability condition is sufficient

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 9 嵌入式即時作業系統

Earliest Deadline First • Earliest Deadline First (EDF) – Selects tasks according to their

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 10 嵌入式即時作業系統

Earliest Deadline First (Cont. ) • Optimality: – EDF is optimal among all dynamic-priority

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 11 嵌入式即時作業系統

Example • Two tasks: – Task 1: execution time: 2, period: 5 – Task

Example • Two tasks: – 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 12 嵌入式即時作業系統

Example RM T 1 0 5 10 15 time overflow 20 25 30 35

Example RM T 1 0 5 10 15 time overflow 20 25 30 35 T 2 0 7 14 21 28 35 EDF T 1 0 5 10 15 20 25 30 35 T 2 0 7 14 21 28 35 13 嵌入式即時作業系統

Reference • Giorgio C. Buttazzo, “Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications,

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 14 嵌入式即時作業系統