Real-Time Systems Design

embedded.seoultech.ac.kr

Seoul National Univ. of Science and Technology Dept. of Electrical and Information Engineering Prof. Choi, Byoung- Wook http:/ / embedded.seoultech.ac.kr @bwchoi2, bwchoi@seoultech.ac.kr

EVERY COMPUTER WILL BE EMBEDDED

Uniprocessor Scheduling

Week # 6

embedded.seoultech.ac.kr

Every Computer will be Embedded Everywhere

Outline

• • Earliest Deadline First Scheduling Rate-Monotonic Scheduling – Worst Arrival Phasings – Least Upper Scheduling Bound

•

Summary

3 / 23

Every Computer will be Embedded Everywhere

Dynamic job scheduling

• • Fixed job scheduling

– All jobs that have same tasks have the same fixed priority

Dynamic job scheduling

– Different jobs of the same task cab have different priority

τ1 τ2

4 / 23

Every Computer will be Embedded Everywhere

Earliest Deadline First (EDF) Scheduling

• • Can be used to schedule periodic tasks Uses dynamic priorities and preemptive scheduling – Higher priority to task with earlier deadline

•

Example: 2- task set where each task is (C, T=D)

{ (2, 4), (3, 7)} 50%

τ1 τ2

43% • Utilization U of task set { ti} for i = 1, …, n:

C Ui = i Ti

5 / 23 i =1

U = ∑U i = ∑

n

Ci i =1 Ti

n

Every Computer will be Embedded Everywhere

EDF Schedulability Condition

Theorem: A task set is schedulable under EDF if and only if U ≤ 1. Proof:

t1

• •

t2

Assume that “ overflow” occurs at time t2. Let t1 be the latest time before t2 such that – the processor is fully utilized in the interval [ t1 , t2] – only instances with deadlines before t2 executes in [ t1 , t2]

• •

If such a t1 cannot be found, then set t1 = 0. Let Cd be the computational demand in [ t1 , t2] n t 2 − t1 t 2 − t1 Cd = ∑ * ci = (t 2 − t1 )U * ci ≤ ∑ Ti Ti ri ≥ t1 , d1 ≤t 2 i =1

•

But an overflow implies that Cd > ( t2 - t1) : a contradiction if U ≤ 1.

Every Computer will be Embedded Everywhere

Points to Note

• • If deadlines are shorter than periods, the necessary condition for schedulability under EDF is an open problem. If U > 1, which task will first miss its deadline is unpredictable.

•

Paper Reading Assignment #1

– Scheduling algorithms for multiprogramming in a hard real-time environment", Journal of the ACM 20 (1): 46–61 by Liu and Layland - Raymod – An analysis of EDF schedulability on a Multiprocessor by T.P. Baker - Batha – Rate Monotonic Analysis for Real-time Systems by Lui Sha, Mark H. Klein and John B. Goodenoug in Technical Report on CMU – Gil Jin – Designing concurrent, distributed, and real-time applications with UML by Hassan Gomman - Vince

7 / 23

Every Computer will be Embedded Everywhere

Rate- Monotonic Scheduling (RMS)

• Higher (fixed) priority to higher frequency task

– i.e. higher priority to task with shorter period

• Example: 2-task set where each task is (C, T=D)

{(2, 4), (3, 7)}

τ1 τ2

Liu and Layland proved that RMS leads to a feasible schedule if U ≤ n (21/ n - 1) • If C2 = 3.1, then C2 will miss its deadline although the utilization is (2/4)+(3.1/7) = 0.5+0.443=0.943, which is < 1. • The above bound is sufficient but not necessary • RMS is an optimum fixed priority assignment algorithm – if a task set cannot be scheduled by RMS, all other fixed-priority schedules will also be unschedulable. 8 / 23

Every Computer will be Embedded Everywhere

More on RMS Bound

• • • The RMS bound is a sufficient condition, not a necessary condition Occurs only under mathematically extreme conditions In practice – Many task sets are harmonic • Each period is an integral multiple (or sub-multiple) of all other periods in the task set – For harmonic task sets, RMS is schedulable if U ≤ 1. – Or nearly harmonic • Schedulable utilization is about 0.92

n 1 2 3 4 5 6 7 8 9 10 … ∞

n ( 21/n – 1) 1 0.828 0.780 0.757 0.743 0.735 0.729...