Skip to content

Lab 2 check ​

Run the focused timer tests before using the timer from a larger program. They verify divisor arithmetic, status reads, interrupt subscription, and tick accounting. Then run a small headless example to confirm behavior in a loop.

sh
lcom-ng test timer
lcom-ng run --headless -- build/examples/timer_int 3

Discussion prompts ​

  • Why does the timer API expose timer_ticks() instead of sleeping directly?
  • What changes if the game updates at 60 Hz but the timer fires faster?
  • Which timing values should be constants, and which should a final project configure?

External reading ​

The LCOM chapters on the timer controller, interrupts, and timer libraries are useful companions. For background, read OSDev on the Programmable Interval Timer and interrupts. The GNU C notes on integer types help when divisor arithmetic behaves unexpectedly.

Course/docs licensed CC BY 4.0. Code licensed MIT.