tags:

views:

273

answers:

1

Suppose the hardware interval timer only counts down to zero before signaling an interrupt. How could an OS use the interval timer to keep track of the time of day?

+1  A: 

The hardware interval timer counts to zero, fires and interrupt, and resets to a specific value (set by the OS).

Since the timer frequency is known, and the starting value is settable, and it resets automatically, then the OS can set it up to fire an interrupt 18 times a second, for instance, and then use counters to keep time.

Modern machines typically use a real time clock (RTC) chip backed by a little battery on the motherboard - this eliminates errors caused when the computer is unpowered, and is actually quite accurate. These RTC's often have alarms that can be set in BIOS to turn the computer on as well, for various purposes.

Adam Davis