Delaying Execution in Kernel Agents



Regarding DaSetPeriodicTimer, the documentation says different things about the unit that the interval should be specified in. Is it 1 millisecond or is it 10 milliseconds? What is the granularity of the timer?

If the answer to the above question is 10 ms, is it possible to fix an interval timer with 1 ms by using DaDelayMicroseconds? The doc says

that caution should be observed when using this function in Kernal Agents as misuse may prevent the system from preforming critical

tasks. Can you be a bit more specific about that?


DaSetPeriodicTimer has the default granularity of the OS. It is not guarenteed to be any finer than 10 milliseconds.

The warning given in the help on DaDelayMicroseconds should be adhered to.  The underlying kernel API used for DaDelayMicroseconds is KeStallExecutionProcessor() as of DriverAgent 1.51.  As it's name implies, this completely stalls the processor from doing anything at all (other than possibly handling interrupts). Microsoft describes this as being "a processor-dependent routine that busy-waits for at least the specified number of microseconds, but not significantly longer."  They go onto to warn that "Drivers that call this routine should minimize the number of microseconds they specify (no more than 50). If a driver must wait for a longer interval, it should use another synchronization mechanism."

Old KB# 12013
Comment List
Related Discussions