

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















And solutions
Answers a question we commonly ask:^ •^ At most long can this code take to run?
Worst-case message times Holistic scheduling Holistic scheduling
True
Number of executions
WCETestimate True WCET LongestobservedET #
Execution time Number of executions
LongestobservedET #
≤^ true WCET
≤^ WCET estimate
int foo1 (int a, int b){ int c = b + 31a;int e = 120 - c - a;return e;}*^ link
a6,# link^
a6,# move.l
8(a6),d moveq
#-32,d muls.l
d1,d sub.l
12(a6),d addi.l
#120,d unlk^
a rts What does it take to estimate WCET of this code?
void^ foo
(int^
a)^ { if^ (a)
{ x += 3a; }*^ else
{ y -= x-a; }} link^
a6,# move.l
8(a6),d tst.l^
d tst.l^
d beq.s^
*+ moveq^
#3,d muls.l
d0,d add.l^
d2,_x bra.s^
*+ move.l
_x,d sub.l^
d2,d move.l
_y,d sub.l^
d1,d move.l
d0,_y unlk^
a rts
Not very fun Doesn’t work well for library code However, could argue that in critical software programmershould always know the loop bounds
Doesn’t always work Derived bound might be too high
foo4 if y == 0
max(7,13) + 2 = 15 15+3 = 18
*x++; } else {x = 1;} } else {x = 3;} }
if x> x++^
x = 1
x=
Return Return
Return
3
3
3
3+2 = 5
3+1 = 4
3+10 = 13
max(5,4) + 2 = 7
Even if lots of other stuff is going over the bus