EE4673/5673 - Embedded Systems Assignment #5 - KEY Problem 1 See handouts Problem 2 Given the following set of tasks: Tasks T1 T2 T3 T4

WCET 1ms 1ms 2ms 1ms

Period 3ms 7ms 20ms 9ms

Deadline 3ms 5ms 19ms 7ms

(a) Given Earliest Deadline First (EDF) scheduling, is this set of tasks schedulable? Show your work. Tasks

WCET

T1 T2 T3 T4

1ms 1ms 2ms 1ms

Period/Deadline (shortest) 3ms 5ms 19ms 7ms

c/p 1/3 1/5 2/19 1/7

For EDF to be schedulable, the total utilization should be smaller than 1 for a single processor system.

U=∑

ci 1 1 2 1 = + + + ≈ 0.782 < 1 pi 3 5 19 7

And, thus, it is schedulable. (b) If schedulable, show a schedule that achieves this.

1

(c) Given RMS/deadline monotonic scheduling, is this set of tasks schedulable? Show your work. For RMS we need to check the Utilization Bound (slide 37) for n = 4, or:

B(n = 4) = n ( 21/n − 1) = 0.7568 The utilization as calculated under (a) is larger than this bound. This means that these tasks may be schedulable. (d) Turn the above tasks into harmonic RMS/deadline monotonic scheduling. Show your work. Tasks

WCET

T1 T2 T3 T4

1ms 1ms 2ms 1ms

Period/Deadline (shortest) 3ms 3ms 18ms 6ms

c/p 1/3 1/3 2/18 1/6

(e) For your new task periods and deadlines, show if this new set is schedulable or not. Now, we can just check, again, if the utilization is smaller than “1”.

U=∑

ci 1 1 2 1 = + + + ≈ 0.994 < 1 pi 3 3 18 6

So, even though the utilization is much larger, the processes are surely schedulable. Problem 3 Given the following low-level requirement:

2

LL10.3 IF( ((numberOfSatellites < 4) AND ( receiverFlag = TRUE)) || ((numberOfSatellites >= 4) AND (receiverFlag = FALSE)) ) WriteErrorMessage() ELSE IF( timeOfWeek > 0) ComputePosition() ENDIF (a) Derive a set of test cases for this low-level requirement based on the discussion in the last set of slides in the notes on software (notes #14). Use slides 52 through 60 to come up with these test cases. Look at first IF statement: it is of the form: (NOT A AND B) OR (A AND NOT B) = A XOR B where A = (numberOfSatellites >= 4) B = (receiverFlag = TRUE) C = (timeOfWeek > 0) so we can use slide 56 to get the test cases (for example A=F,B=F and A=F,B=T and A=T,B=F): test case 1, 2 and 3 in the table below. Furthermore, include the robustness test case (see slide 57) by setting numberOfSatellites equal to 4 exactly (test case 4 in the table below). Now consider the ELSE IF statement; this statement is only considered when the first IF statement does not hold (A=F, B=F); in that case you only have to test for C being true (test case 5) or false (test case 1) following slide 60. Additionally, you should include the robustness test case (test case 6). Test case 1 2 3 4 5 6

A F F T Robustness F F

B F T F F F F

Which, using actual values, results in:

3

C F T T T T Robustness

Test case 1 2 3 4 5 6

numberOfSatellites 2 2 8 4 2 2

receiverFlag FALSE TRUE FALSE FALSE FALSE FALSE

timeOfWeek -1 1 1 1 1 0

(b) Given the following implementation of this requirement in C, how do your test cases “find” the error in this code. if(

( (numberOfSatellites = 4) && (receiverFlag == FALSE) )

)

{ WriteErrorMessage(); } else if (timeOfWeek > 0) { ComputePosition(); } The error is in the statement (numberOfSatellites