0% found this document useful (0 votes)
187 views

Answers To SE630 HW2

The document contains answers to homework questions about real-time scheduling algorithms. For one question, the tasks (5,1), (8,2), (14,4) are shown to be schedulable by Rate Monotonic scheduling using time demand analysis, with a maximum non-preemptible portion of x=1 time units for the (8,2) task before the system becomes unschedulable. The time demand functions are checked at time points up to the deadline of each task to verify the functions never exceed the time points.

Uploaded by

GebBerhe
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views

Answers To SE630 HW2

The document contains answers to homework questions about real-time scheduling algorithms. For one question, the tasks (5,1), (8,2), (14,4) are shown to be schedulable by Rate Monotonic scheduling using time demand analysis, with a maximum non-preemptible portion of x=1 time units for the (8,2) task before the system becomes unschedulable. The time demand functions are checked at time points up to the deadline of each task to verify the functions never exceed the time points.

Uploaded by

GebBerhe
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Answers to SE630 HW2

1. A schedule can be constructed using methods like rate monotonic scheduling


and earliest deadline first. Indicate whether the following statements are true
and explain your answer briefly.
a. (0.5) With EDF a higher utilization is possible than with RMS.
Answer. EDF has a maximum utilization of 100%; for RMS there are task
sets with a lower utilization that are not feasible. Hence, the statement is
true, though the actual utilization depends on the task set. The argument
that RMS has a lower utilization bound is not acceptable as such, since this
bound is a pessimistic one.
b. (0.5) RMS is more efficient than EDF.
Answer. Efficiency has many dimensions. Good arguments are:
• When used on-line, EDF needs more advanced data structures
(logarithmic access). RMS is then more efficient.
• EDF assigns different priorities to jobs and therefore needs dynamic
priority assignment which is generally more costly. Again, RMS is
then more efficient.
• EDF can have a higher utilization. It makes more efficient use of the
resources.
c. (0.5) RMS is more general than EDF (i.e., applicable in more situations).
Answer.
• RMS admits to separate importance and schedulability in a
systematic way.
• RMS performs more predictable under overload conditions.
An argument against it would be to refer to the utilization once again.
d. (0.5) explain the difference between deadline monotonic scheduling and
earliest deadline first.
Answer.
 The first is a fixed priority policy that refers to the relative deadline.
 The second is a dynamic priority policy that refers to the absolute
deadline.

2. A system T contains four periodic tasks:

Page 1 of 7
T1(8,1) T2(15,3) T3(20,4) T4(22,6)
Construct the initial segment in the time interval (0, 50) of a RM schedule of the
system
RM  Priority: T1, T2, T3, T4
For initial time interval (0, 50)

T1 T2 T3 T1 T4 T2 T1 T2 T3
0 1 4 8 9 15 17 19 20 22

T3 T1 T4 T2 T1 T2 T4 T1 T3
22 24 30 32 34 40 44

T3 T2 T1 T4 ….
44 45 48 50

3. Which of the following systems of periodic tasks are schedulable by the RM


algorithm? By the EDF algorithm?

b) T = {(8, 4), (12, 4), (20, 4)}


The total utilization of tasks = 4/8 + 4/12 + 4/20 = 1.033
According to Theorem 1: A system of independent, preemptable tasks with
relative deadlines equal to their periods is schedulable if and only if their total
utilization is less than or equal to 1. Therefore, T is not schedulable by RM or
EDF.
Use TDA:
Check t= 8, 12, 16, 20
Wi(t) <= t
W1(t) = 4 < = t, t = 8, 12, 16, 20  Schedulable
W2(t) = 4 + t/8 * 4
W2(8) = 4 + 4 = 8 <= 8  Schedulable
W3(t) = 4 + t/8 * 4 + t/12 * 4
W3(8) = 4 + 4 + 4 = 12
W3(12) = 4 + 8 + 4 = 16
W3(16) = 4 + 8 + 8 = 20
W3(20) = 4 + 12 + 8 = 24  Not schdulable by RM
Schedulability test of EDF algorithm: Since Dk = Pk, U = 1.033 >1 therefore, it is
not schedulable by EDF.

c) T = {(8, 4), (10, 2), (12, 3)}

Page 2 of 7
The total utilization of tasks = 4/8 + 2/10 + 3/12 = 0.95

For RM:
These are not simply periodic tasks, so Theorem 3 does not apply. Exam by using
sufficient schedulability: The tasks are schedulable if the total utilization of tasks,
U, is less or equal to n(2^(1/n)-1), where n is the number of tasks.
Urm = n(2^(1/n)-1) = 3(2^(1/3)-1) = 0.78 < U = 0.95
 No conclusion.

Use TDA:
Check t = 8, 10, 12
Wi(t) <= t
W1(t) = 4 < = t, t =8, 10, 12  Schedulable
W2(t) = 2 + t/84
W2(8) = 2 + 4 = 6 <= 8  Schedulable
W3(t) = 3 + t/84 + t/102
W3(8) = 3 + 4 + 2 = 9
W3(10) = 3 + 8 + 2 = 13
W3(12) = 3 + 8 + 4 = 15  Not schedulable
Try to plot:

T1 T2 T3 T1
2 4 6 8 10 12 14

Therefore, it is not schedulable by using RM. T3 misses its


deadline
For EDF:
According to the schedulability Test for EDF algorithm:


n
e / min( Dk , pk )  1
k 1 k

In the case that Dk = Pk, the expression represents the total utilization of the
tasks, which we have calculated. U = 0.95 less than one. Therefore, the periodic
tasks are schedulable by EDF algorithm.

Page 3 of 7
4. Periodic Tasks: (3,1), (4,2), (6,1) are scheduled by RM algorithm
a) Draw Time Demand Function of the tasks
w3(t)
w(t)
w2(t)

w1(t)

2 4 6 8 10 12 14 t
b) Are the tasks schedulable?
No. Based on the Time Demand Function graph, Task 3 did not touch or
go below the dash line by its deadline at time 6. In another word, it can not
meet its deadline and therefore not schedulable.

c) Can this graph be used to determine whether the tasks are schedulable
according to an arbitrary priority-driven algorithm?
No. This graph is fundamentally based on fixed priority driven algorithm
which assigns the same priority to all jobs in each task. In the graph, T2 is
built on top of T1 since all jobs in T1 have a higher priority than all jobs in
T2. T3 is built on top of T1 and T2since all jobs in T1 and T2 have a
higher priority than all jobs in T3. This graph does not depict dynamic
priority driven algorithm, such as earliest deadline first (EDF). In EDF,
any job in a task can have a higher priority at a specific moment
depending on its deadline compared to the jobs of other tasks. Therefore,
this graph cannot be used to determine the schedulability of an arbitrary
priority-driven algorithm.

Page 4 of 7
5. Which of the following fixed-priority task is not schedulable?
T1(5,1) T2(3,1) T3(7,2.5) T4(16,1)

t 
i1
wi (t )  ei    ek
k 1  pk 
If Wi(t) <= t, the task is schedulable.

Assume RM/DM scheduling algorithm is used. Priority: T2>T1>T3>T4


Index, i, is assigned to each task according to its priority.
T2: i = 1, T1: i = 2, T3: i = 3., T4: i = 4
Check: t = 3, 5, 6, 7, 9, 10, 12, 14, 15, 16

W1(t) = 1 < t, t= 3, 5, 6, 7, 9, 10, 12, 14, 15, 16  Schedulable


W2(t) = 1 + t/3
W2(3) = 1+1 = 2 <=3  Schedulable
W3(t) = 2.5 + t/3 + t/5 (check: 2.5+1+1=4.5 min t =5)
W3(5) = 2.5+2+1 = 5.5
W3(6) = 2.5+2+2 = 6.5
W3(7) = 2.5+3+2 = 7.5  Miss its deadline, 7, so Not Schedulable
W4(t) = 1 + t/3 + t/5 + 2.5t/7 (check: 1+1+1+2.5=5.5 min t =6)
W4(6) = 1+2+2+2.5 = 7.5
W4(7) = 1+3+2+2.5 = 8.5
W4(9) = 1+3+2+5 = 11
W4(10) = 1+4+2+5 = 12
W4(12) = 1+4+3+5 = 13
W4(14) = 1+5+3+5 = 14 <= 14  Schedulable
T3 is not a schedulable task

Page 5 of 7
6.
(A) Use the time-demand analysis method to show that the set of periodic tasks {(5,1),
(8,2),(14,4)} is schedulable according to the RM algorithm.

t i1
wi (t )  ei    ek
k 1  pk 
Check: t = 5, 8, 10, 14
W1(t) = 1 <= t, for t = 5, 8, 10, 14  Schedulable
W2(t) = 2 + t/5
W2(5) = 2+1 =3 <= 5  Schedulable
W3(t) = 4 + t/5 + 2t/8 (check: min t = 4+1+2=7)
W3(8) = 4+2+2 = 8 <= 8  Schedulable

(B) Suppose that we want to make the first x units of each request in the task (8,2)
nonpreemptable. What is the maximum value of x so that the system remains
schedulable according to the rate-monotonic algorithm?

Answer 1:

T={(5,1)(8,2)(14,4)}

T1=(5,1) T2=(8,2) T3=(14,4) (in order of priority, T1 being highest)

T1 T2 T3 T1 T3 T2 T1 T3 T1 T2 T3 T1 T3 T2

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

T2 T1 T3 T1 T3 T2 T3 T1 T1 T2 T3 T1 T3 T2

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

T1 has a higher priority than T2 but a higher priority job that becomes ready when a
nonpreemptable lower-priority jobs is executing is blocked until the nonpreemptable portion of
the lower priority job completes. Therefore T1 will be blocked until T2 completes.

T2 (8, 2) can be made nonpreemptable for the first 2 time units (its entire
duration) and still allow the system to be scheduled on time.

Page 6 of 7
Answer 2:

If we make the first x units of Task (8, 2) nonpreemptable: T3 is unaffected by this


change since T2 is a higher priority task anyway. T2 is also unaffected. Its response
time will not be affected by the change (if anything it would improve)
W1= x+1 <=5, x<=4
x can be at most 4 time units. But since Task 2 (8, 2), only has an execution time of 2
time units, x can be 2 time units.

Page 7 of 7

You might also like