Re: Microsecond delay in Windows




"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




.



Relevant Pages

  • Re: Microsecond delay in Windows?
    ... Windows SDK MVP ... Exit the loop once the counter difference reaches the desired number ... I need to induce a delay in microsecond. ...
    (microsoft.public.win32.programmer.kernel)
  • Microsecond delay in Windows
    ... I need to induce a delay in microsecond. ... Explore real time extensions for Windows to find out the solution. ...
    (microsoft.public.win32.programmer.kernel)
  • Microsecond delay in Windows
    ... I need to induce a delay in microsecond. ... Explore real time extensions for Windows to find out the solution. ...
    (microsoft.public.development.device.drivers)
  • Microsecond delay in Windows?
    ... I need to induce a delay in microsecond. ... Explore real time extensions for Windows to find out the solution. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Kernel mode programming in VC++
    ... I need to induce a delay in microsecond. ... that it is pretty impossible in Windows 'coz of its multi-tasking nature. ... jmp short $+2 ...
    (microsoft.public.vc.mfc)