0% found this document useful (0 votes)
93 views3 pages

MT1 PDF

The document discusses real-time scheduling of periodic tasks using Rate-Monotonic, Earliest Deadline First, and Deadline-Monotonic scheduling. It analyzes an assembly language program execution and scheduling of 3 tasks with periods of 10ms, 12ms, and 15ms. It is determined that: 1) The assembly program has minimum execution of 0.7us and maximum of 2.0514ms depending on input data. 2) The 3 tasks are schedulable using a cyclic executive method with a frame of 5ms or 6ms. 3) The 3 periodic tasks are schedulable using Rate-Monotonic and Earliest Deadline First scheduling but not Deadline-Mon

Uploaded by

Ahmed Kotb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views3 pages

MT1 PDF

The document discusses real-time scheduling of periodic tasks using Rate-Monotonic, Earliest Deadline First, and Deadline-Monotonic scheduling. It analyzes an assembly language program execution and scheduling of 3 tasks with periods of 10ms, 12ms, and 15ms. It is determined that: 1) The assembly program has minimum execution of 0.7us and maximum of 2.0514ms depending on input data. 2) The 3 tasks are schedulable using a cyclic executive method with a frame of 5ms or 6ms. 3) The 3 periodic tasks are schedulable using Rate-Monotonic and Earliest Deadline First scheduling but not Deadline-Mon

Uploaded by

Ahmed Kotb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

[1] Consider the following assembly-level program:

Load R1 with input port reading


Load R2 with 0
L1: Compare R2 with 10
Jump if equal to L4
Load R3 with input port reading
Compare R1 and R3
Jump if equal to L4
Load R4 with 0
L2: Compare R4 with 500 |
Jump if equal to L3 |
Increment R4 | delay loop
Jump to L2 |
L3: Set R1=R3
Increment R2
Jump to L1
L4:

a) Determine the cases resulting in minimum and maximum execution times.


b) Find minimum and maximum execution times assuming that each instruction takes one clock cycle
and that clock frequency is 10 MHz.
c) Modify the maximum execution time if interrupts can occur with rate up to 50 times per second
and that the interrupt handler time WCET is 40 μs.

a) Program reads data from input port repeatedly, once before a loop and ten times in this
loop. Each iteration of the outer loop includes an inner delay loop. Program jumps out of the
outer loop if two successive readings are equal. Thus minimum time occurs if first two
readings are equal and maximum time occurs when no two successive readings are equal.

b) In the above mentioned case of minimum execution time, 7 instructions are executed and
thus minimum execution time is 0.7 μs.

In the above mentioned case of maximum execution:


Program iterates in the inner delay loop for 500 times, thus this loop takes 500x4+2=2002
clock cycles. Other 9 instructions are executed in the outer loop, so total number of clock
cycles will be:

2+ 10 x (9+2002)+ 2= 20114 clock cycles, and maximum execution time 𝑡𝑚𝑎𝑥 is 2.0114 ms.

c) Using the formula for modified maximum time:


𝑡𝑚𝑎𝑥 2.0114
𝑡𝑚𝑎𝑥 = = = 2.0154 𝑚𝑠
1 − 𝑓𝑚𝑎𝑥 𝑡𝑚𝑎𝑥 (𝐼ℎ) 1 − 50𝑥40𝑥10−6

We modify this result noting that a maximum of one interrupt will take place during
execution, thus maximum execution time will be 2.0514 ms.
[2] A hard real-time system runs three tasks using the cyclic executive method. Tasks have
periods of 10 ms, 12 ms, and 15 ms and execution times per period of 2, 2, and 5 ms
respectively. The deadline of each task is equal to its period.

a) If the deadline of each task is equal to its period, find a suitable frame value then construct
an execution schedule for the tasks if possible.
b) If the deadline of third tasks is 10 ms (with period of 15 ms) is the frame value you obtained
in part (a) still suitable? Is it possible to find an execution schedule?

a) Major cycle length will be the lcm of periods, which is 60 ms. Frame length should be
between 5 and 10 (inclusive) and should divide 60, which leaves the values 5, 6, and 10.

The condition 2𝑓 − 𝑔𝑐𝑑 (𝑓, 𝑇𝑖 ) ≤ 𝑑𝑖 for all tasks will be satisfied by f=5 and 6 only. Taking
f=5, we can construct schedule as shown below:

b) The condition 2𝑓 − 𝑔𝑐𝑑 (𝑓, 𝑇𝑐 ) ≤ 𝑑𝑐 is still valid when 𝑑𝑐 becomes 10.

In the above schedule, third task will miss its new deadline only in the second period (starting
at 15, and C ends at 30, missing its deadline at 25). This can be corrected as shown below.

N.B. If we choose f=6, we can construct a schedule in part (a) as shown below

However, in part (b) we cannot modify the schedule as the complete frame for both A and C
in the first period will be the first frame, and they cannot run together in the same frame.
[3] A real-time system is required to run three periodic tasks with periods of 16, 25, and 30
ms, and execution times of 4, 7, and 9.5 ms respectively.

a) Using Liu and Layland theorems, study the schedulability of these tasks using Rate-
Monotonic scheduling, assuming that the deadline of each task is equal to its period.
b) Repeat part (a) for EDF scheduling.
c) Study the schedulability of the tasks using Deadline Monotonic scheduling assuming that
deadlines are 16, 25, and 20 ms respectively (while periods are still as above).
d) Repeat part (c) if pre-emption has an overhead of 0.1 ms.

a) For these tasks, ∑ 𝑢𝑖 = 0.8467 > 3(21⁄3 − 1). Using the critical instant theorem:

As shown in figure, third task will have enough time to finish before its first deadline, thus
tasks are RM schedulable.

b) Since ∑ 𝑢𝑖 > 1, tasks are EDF schedulable.

c) In this case, priorities will be A then C then B. Using response time analysis:

𝑅𝐴 = 4 < 𝑑𝐴 = 16
𝑅
𝑅𝐶 = 9.5 + ⌈ 𝐶 ⌉ × 4, which converges at 13.5 < 𝑑𝐶 = 20
16

𝑅 𝑅
𝑅𝐵 = 7 + ⌈ 𝐵⌉ × 4 + ⌈ 𝐵⌉ × 9.5, which converges at 24.5 < 𝑑𝐵 = 25
16 30

Thus tasks are DM schedulable.

d) In this case we add 0.2 to the execution times of high priority tasks in the worst case. Then,
for task B:

𝑅 𝑅
𝑅𝐵 = 7 + ⌈ 𝐵⌉ × 4.2 + ⌈ 𝐵⌉ × 9.7, which converges at 25.1 > 𝑑𝐵 = 25
16 30

Thus tasks are not schedulable.

You might also like