xxxxx@Rediffmail.com wrote:
First of all, Thanks a lot for the reply!
I am working on serial port based device (which is interfaced with PC via USB hub), where I want to achieve response targets of 5 - 7 ms. For this purpose, I am planning to use standard usbser.sys driver.
What, exactly, do you mean by “response targets of 5 - 7 ms”? Do you
mean that you want an application to be running within 5 ms of the
receipt of a character?
Have you tried any of this yet? Do you even know if you have a
problem? If not, why are you exploring these strange options?
… Of course, dynamic priority boosting that scheduler does upon completion of an I/O request might help, but to achieve ‘guarenteed’ latency I was planning to experiment with adjusting the ‘base priorities’ of usb drivers at kernel level.
Drivers do not have base priorities. What you are saying is akin to
saying “I’d like my DLL to have a higher priority”. It doesn’t make
sense. Processes and threads have priorities. Drivers respond to
events. Those events occur on whatever thread happened to be running
when the event occurred.
The USB host controller will fire an interrupt when a frame is completed
(every millisecond). The host controller driver will notice that the
usbser.sys transfer has been completed, and will complete its IRP.
Usbser.sys will then complete the user-mode request that triggered the
read. That changes the user mode thread from blocked to ready-to-run.
However, the thread still has to be chosen for scheduling.
Also, you seem to be under the common but mistaken impression that
increasing a thread’s priority makes it run faster. The higher the
priority, the faster it runs. That, of course, just silly.
Does this seem feasible at all?
Not as you have described it. USB serial ports are even LESS real-time
than traditional wired serial ports, because you have the added overhead
of USB involved.
Windows does not guarantee latency and response time under AND
circumstances. If equipment damage or personal injury results from
missing your response time goals, then in all seriousness you need to
abandon Windows right now and go find a real-time operating system.
However, it’s quite likely that you’ll achieve your targets most of the
time without too much difficulty.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.