The most important part of the clock driver is the clock interrupt handler. This is called every time there is a clock interrupt a.k.a clock-tick. All the basic timekeeping work is done here.
Everything done in the interrupt handler is a simple integer operation: arithmetic, comparison, logical AND/OR or assignment. There is no function call to complete the time-keeping work. So these operations are guaranteed to finish predictably and very fast.
One interesting point here is that since interrupts can be disabled by the system, clock-ticks can be lost. In some cases Minix can correct for this effect by maintaining lost clock-ticks in a global variable. Usually, when interrupts are disabled long enough that one or more clock-ticks may be lost the boot monitor is involved in the flow and it can keep track of time with the help of the BIOS. The boot monitor returns the number of ticks lost and this is used for the correction.
Everything done in the interrupt handler is a simple integer operation: arithmetic, comparison, logical AND/OR or assignment. There is no function call to complete the time-keeping work. So these operations are guaranteed to finish predictably and very fast.
One interesting point here is that since interrupts can be disabled by the system, clock-ticks can be lost. In some cases Minix can correct for this effect by maintaining lost clock-ticks in a global variable. Usually, when interrupts are disabled long enough that one or more clock-ticks may be lost the boot monitor is involved in the flow and it can keep track of time with the help of the BIOS. The boot monitor returns the number of ticks lost and this is used for the correction.
No comments:
Post a Comment