for (;;) { if( c1 ) a1(); if( c2 ) a2(); ... }⇒worst-case latency: sum of all actions
for (;;) { if( c1 ) a1(); if( c2 ) a2(); if( c1 ) a1(); if( c3 ) a3(); ... }⇒worst-case latency: maximum of all actions
for (;;) { if( c1 ) a1(); if( c2 ) { a2.1(); a2half = true; } if( c1 ) a1(); if( a2half ) { a2.2(); a2half = false; } ... }
0x2000000 | high end of 32 MB RAM |
0x0218000 | historic Linux load/start address |
0x0100000 | suggested load address |
0x0044F88 | lowest possible load address |
0x0000000 | low end of RAM |
for (;;) { op1(); wait(40ms); }→ compounding error ⇒ slow! proper approach:
t = 0; for (;;) { op1(); t += 40ms; wait( t - now() ); }→ everything takes time, so late, but not slow!