Re: [ntdev] Delay in kernel for a few microseconds without using kestallexecutionprocessor

Think about your question. You are asking 'can I increase the scheduler granularity without changing the scheduler granularity’.

The only way two ways to wait are to spin (busy loop) or to interact with the scheduler. The scheduler is the part of the OS that handles thread scheduling, and spinning just relies on hardware. You have to pick one or the other.

Rather that looking at how you might wait without spinning, if you are really concerned about CPU usage, you should look at why you need to wait in the first place and try to eliminate it by changing to an async model (which may not be possible depending on your hardware)

Sent from Surface Pro

From: xxxxx@gmail.com
Sent: ‎Saturday‎, ‎December‎ ‎13‎, ‎2014 ‎1‎:‎52‎ ‎PM
To: Windows System Software Devs Interest List

Many would have asked this question already in this forum. But I just wanted to check one last time before answering to my client about this.

I want to add delay in my driver for a few microseconds with out busy looping on the CPU (thus not using kestallexecutionprocessor) since this is increasing the CPU utilisation when all of the hardware devices are in use simultaneously.

I cannot use kedelayexecutionthread since It puts the the current thread to sleep which gets woken up only after 15 milliseconds or so due inherent limitation of windows thread dispatchers scheduling granularity ( appreciate any corrections to this statement in case it is not proper).

Without changing the clock related setting on my system (so that dispatcher gets invoked more frequently) is there any way I can put a kernel thread to sleep only for a few microseconds but not more than that?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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

Again, correct hardware design can obviate issues with OS timing; the reverse is not true

Sent from Surface Pro

From: xxxxx@resplendence.com
Sent: ‎Sunday‎, ‎December‎ ‎14‎, ‎2014 ‎2‎:‎36‎ ‎AM
To: Windows System Software Devs Interest List

“Skywing” wrote in message news:xxxxx@ntdev…
There is a high resolution timer facility available starting with Windows
8.1. (
http://msdn.microsoft.com/en-\>us/library/windows/hardware/dn265247(v=vs.85).aspx
)
Please use sparingly.

That doesn’t schedule an interrupt but only causes the system clock to run
at its maximum rate before the timers expire. So while it may defeat the
“dynamic clock tick” latency on Windows 8, it won’t give you a granularity
higher than 500us, or anything more accurate than was available on Windows
7.

Why Windows doesn’t offer an interface over one of the many hardware timers
that we all have on board such as the HPET ones ?

//Daniel


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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