Interrupts and power management

In order to help the kernel save power, you can make an interrupt “lazy” by specifying an acceptable latency for it.

Before putting the CPU to sleep, the kernel checks all the interrupt latency values and sees if it can guarantee that another interrupt (e.g., for a timer tick) will occur before the latency period has expired. If it can prove that another interrupt will occur first, the kernel masks the lazy interrupt before going to sleep. When any interrupt is received by the CPU, all the lazily masked interrupts are unmasked.

To specify the interrupt latency, use the InterruptCharacteristic() kernel call:

int InterruptCharacteristic( int type,
                             int id,
                             unsigned *new,
                             unsigned *old );

setting the arguments as follows:

A value returned by InterruptAttach() or InterruptAttachEvent()
A pointer to an unsigned that contains the new latency value for the interrupt, in nanoseconds. The default latency value is zero.
If this is non-NULL, the function fills it with the old latency value for the interrupt.
Note: In order to set a latency, the calling thread must:

You can set the global latency value for the system by specifying an id of -1. If an interrupt attachment doesn't specify a latency value, the kernel uses the global latency number when calculating how deep a sleep state to use. You need to have I/O privileges to set the global latency value.

For more information about power management, see Clocks, timers, and power management in the Tick, Tock: Understanding the Microkernel's Concept of Time chapter in this guide.