Solved

Windows application resolution (task switching)

Posted on 2011-02-16
12
804 Views
Last Modified: 2012-05-11
I need to send some signals to a device via USB port. The signal needs to switch from 1 to 0 every 45ms or so (the logic of the signal is a bit more complex, but we can simplify it and say that we only send 1 and 0 at every ~45ms).

As Windows is non-real time multitasking, my application will not run all the time (even if I set it as 'real time' priority) so it may not be active when the time lapses and needs to send the signal. I cannot accept a delay higher than 0.5ms. What kind of delay (jitter) I can expect from Windows?

Ignore the delay added by the USB interface/controller which is always the same. I am interested only in the delay caused by multitasking switching.
0
Comment
Question by:cubic77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 3

Expert Comment

by:dmitry_n
ID: 34907016
Expect nothing.  Windows is non-real time OS. Period.
0
 

Author Comment

by:cubic77
ID: 34907076
What about the mouse driver which is pretty accurate and seems to work at milisecond precision?
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 34908439

As much as we bash Windows, it should be accurate with a figure like 45ms. (Its not like we are looking at microseconds). Unless your signalling code itself is taking more than 45ms. Even in that case, just have a timing thread that posts a message to your system to reset the signal
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cubic77
ID: 34908703
What about 'real time' priority?
0
 
LVL 3

Expert Comment

by:dmitry_n
ID: 34909822
cubic77, it seems. Load Windows with lots of stuff and you will see how mouse behaves.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 34910378
if you want real-time (or as close as) then you need to set the level of your thread to real-time priority
and use QueryPerfomanceCounter or WaitForSingleObject or something like that for the trigger

the mouse is set in a high priority thread, that's why it responds so fast
0
 

Author Comment

by:cubic77
ID: 34910420
@Geert_Gruwez
Thanks Geert.
So it can be done.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 34910432
you can get close, but probably no garantee
you need a plc for something very accurate
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 34910436
something like a anti-virus can really mess up such a system
0
 

Author Comment

by:cubic77
ID: 34910458
>you need a plc for something very accurate
Ya, I imagined that. I was thinking actually to a small board with a microcontroller. I just wanted to know what I can expect from a Windows app.
0
 

Expert Comment

by:SleekProductions
ID: 34924377
Like Geert_Gruwez says thread handling is probably needed. I curious as to whether one would gain anything by writing a service (and then optionally communicating with the service if an GUI is needed).
0
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 34924412
most of this is explained here:
http://en.wikipedia.org/wiki/Real-time_operating_system

lately most windows like xp are preemptive scheduling

differences can be found here :
http://en.wikipedia.org/wiki/Co-operative_multitasking

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
File Downloader in Multi threading , Measure Download Speed and progress 9 43
Browsing a TTreeView in Delphi 5 46
Using MMsystem To change audio input 1 37
Ruby or Python 7 126
A short article about a problem I had getting the GPS LocationListener working.
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question