简体   繁体   中英

How to program in Windows 7.0 to make it more deterministic?

My understanding is that Windows is non-deterministic and can be trouble when using it for data acquisition. Using a 32bit bus, and dual core, is it possible to use inline asm to work with interrupts in Visual Studio 2005 or at least set some kind of flags to be consistent in time with little jitter?

Going the direction of an RTOS(real time operating system): Windows CE with programming in kernel mode may get too expensive for us.

There are third-party realtime extensions to Windows. See, eg http://msdn.microsoft.com/en-us/library/ms838340(v=winembedded.5).aspx

Real time solutions for Windows such as LabVIEW Real-time or RTX are expensive; a stand-alone RTOS would often be less expensive (or even free ), but if you need Windows functionality as well, you are perhaps no further forward.

If cost is critical, you might run a free or low-cost RTOS in a virtual machine. This can work, though there is no cooperation over hardware access between the RTOS and Windows, and no direct communication mechanism (you could use TCP/IP over a virtual (or real) network I suppose.

Another alternative is to perform the real-time data acquisition on stand-alone hardware (a microcontroller development board or SBC for example) and communicate with Windows via USB or TCP/IP for example. It is possible that way to get timing jitter down to the microsecond level or better.

Windows is not an RTOS, so there is no magic answer. However, there are some things you can do to make the system more "real time friendly".

  1. Disable background processes that can steal system resources from you.
  2. Use a multi-core processor to reduce the impact of context switching
  3. If your program does any disk I/O, move that to its own spindle.
  4. Look into process priority. Make sure your process is running as High or Realtime.
  5. Pay attention to how your program manages memory. Avoid doing thigs that will lead to excessive disk paging.
  6. Consider a real-time extension to Windows (already mentioned).
  7. Consider moving to a real RTOS.
  8. Consider dividing your system into two pieces: (1) real time component running on a microcontroller/DSP/FPGA, and (2) The user interface portion that runs on the Windows PC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM