Re: Microsecond delay in Windows
- From: "Gary Chanson" <gchanson@xxxxxxxxxxxxxxxx>
- Date: Tue, 11 Jul 2006 14:00:47 -0400
"Arun" <arunkumar.v2@xxxxxxxxxxxx> wrote in message
news:e8vnq4$i45$2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello Experts,
In my Win32 application, I need to induce a delay in microsecond. I knew
that it is pretty impossible in Windows 'coz of its multi-tasking nature.
My application's requirement is like this
Pesudocode TransmitMessageThread:
While(n times) {
1. Pick a message from TransmitMessageQueue.
2. Send the Message onto the custom N/W (N/W speed is 10MBps)
3. Provide a microsecond delay
n--;
}
After some exploration, I got the following (sloppy) solutions.
1. Set the priority of the process to "REALTIME_PRIORITY_CLASS" using
SetPriorityClass.
2. Write a driver routine which will simply induce the required delay in
microseconds.
3. Explore real time extensions for Windows to find out the solution.
I knew that solution #1 simply wont work 'coz the process will be in User
space and time required to do anything in user space is completely
unpredictable hence solution no#1 is ruled out.
I have absolutely no idea about the feasibility of solutions #2 & #3.
"it is only barely possible to have a device driver defeat the scheduler,
and it can do
this only while in the driver, and for a period not exceeding 25us" .even
this statement from an expert vapourises even the last hope I have.
I am literally aware that I'm asking the impossible..Still, Is there any
way
out there???
Is there any way I can induce microsecond delay in my Windows application?
It's acceptible for me that to obtain the delay in microsecond the
multi-tasking ability of the Windows needs to be disabled!!! for some
definite interval of time.
Eagerly awaiting for a very positive response :))
If your delay is very short and you can stand an occasional error,
solution #1 may be practical, except that you want to set the thread
priority to maximum instead of changing the priority class of the process
(although you might need to do that as well).
--
- Gary Chanson (Windows SDK MVP)
- Abolish Public Schools
.
- References:
- Microsecond delay in Windows
- From: Arun
- Microsecond delay in Windows
- Prev by Date: Re: TreeView_GetImageList and TreeView_SetImageList
- Next by Date: Re: MmGetSystemAddressForMdlSafe
- Previous by thread: Re: Microsecond delay in Windows
- Next by thread: Microsecond delay in Windows?
- Index(es):
Relevant Pages
|