Well, what you wrote is expected and seems logical but unfortunately,
the reality is different. The thread can wait LESS than specified time
in some cases. Specifically, in the case when the current thread already
consumed part of its quantum and the remaining time is shorter than
specified wait time modulo quantum length. I presume it is because the
quantum length is substracted from wait time on its end and negative
results are taken as zero (haven’t checked).
For example, if you call Sleep(10) and the thread already consumed 14 ms
of current quantum, the real sleep time can be 2 ms. Works equally in
both kernel and user mode and is rather easy to test from a simple app.
I presume some of you may want to test it as it seems unbelievable 
In turn, if something really depends on “at least” waiting, it is
necessary to add quantum length to wait time. That’s exactly what for
example OS USB drivers do to conform with USB specification where are
mandatory delays. As an unwanted side effect USB wakeup is much longer
than necessary in most times…
Best regards,
Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Tuesday, August 10, 2010 1:25 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Some doubts about
KeStallExecutionProcessor and KeDelayExecutionThread
There is some documentation on this matter, in “Windows
Internals 5th or 6th Edition”, the matter Anton mention about
the resolution of the timer, that the thread will wait AT
LEAST the time mentioned in the LARGE_INTEGER structure, and
that time is rounded up actually by the system to a system
granularity of some sort. Taking into consideration hardware
interrupts, and DPC’s and other software interrupts now you
can see how that time period can be bigger.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online
at http://www.osronline.com/page.cfm?name=ListServer