09-27-2006 11:23 AM
09-27-2006 11:33 AM
09-27-2006 02:08 PM
I know in multi-thread algorithm the OS alternatively processes different threads for a slice of time. I want to know how fast the OS can switch between two different threads? From my understanding, the windows based OS has 10 mS i.e. 100 Hz swithching frequecy. If that's ture, does that mean the minimum process time for each thread is 10 mS? Thus, windows based OS cannot handle higher frequency (>100 Hz) thread. Is that right? Thanks.
09-27-2006 04:47 PM
The 10mS number is a bit of a rule of thumb thing. The actual value varies considerably based on the hardware itself, the configuration of the OS etc. Take a look at this forum thread, particularly the last post by menchar:
http://forums.ni.com/ni/board/message?board.id=180&message.id=23030&query.id=24323#M23030
Coding up some test cases and evaluating the results are about all you can do in some cases. The trick of course is to know what your conditions are for your worst case testing. The issue you will have when dealing with very short time to service periods is not just the resource time allocated to your process, but the time it takes for the OS to switch things in and out to enable your thread. There are so many variables that getting "determinant performance" where you really know what is happening down to the mS level is difficult. That is why a realtime OS exists, it is tailored to prioritizing tasks on specific intervals and with very low latency when switching between tasks
09-28-2006 08:23 AM
One of the basic problems with a normal PC OS is that it can always be blocked by some set of conditions the operator finds. It is very hard to make them bullet proof. I don't know what your absolute timing requirements are for your hardware control (average response time, worst case maximum), maybe you would like to post them here, but while we are covering the subject of realtime performance there are a couple of other options for getting deterministic hardware performance while still using a conventional windows OS and CVI.
One route is to use CompactRIO or CompactFieldpoint hardware. You can setup a control application within the intelligent hardware controller of these systems that will respond in the microsecond range or better. You stream the acquired data for storage, post processing or display out of the hardware acquisition device to the PC, but all time critical decisions are made on the hardware itself. If you have a situation where that kind of performance is required, this is a excelent solution, the tradeoff being higher hardware cost and the need to invest some time learning the LabView Realtime software used with these type of controllers. You have not described anything that would require anywhere near the power or flexibility of CompactDAQ, but it is a option in these type of designs.
The R Series Intelligent DAQ Cards provide similar capability but a step down from CompactDAQ and CompactFieldpoint. These cards use an on board FPGA that can be programmed to execute functions based on input conditions to the hardware. For these cards you have to learn the LabView FPGA software, but they again provide the capability to react to events at the hardware level with microsecond resolution.
Yet another option is to look beyond the integrated NI solutions and use an embedded controller card to offload some of the hardware control. This is similar in nature to the design structure of CompactDAQ but you would get something along the lines of a PC104 embedded controller card. Actually PC104 is a form factor, there are other embedded form factors such as EPIC and EBX. These are basically little stand alone CPUs with some basic I/O and an expansion bus that uses plug on adapter cards to add additional features. The CPU cards support numerous Operating Systems and are programable in a number of languages . One of the simplest to get running is of all things DOS. DOS makes a pretty decent hardware control OS for a embedded controller. There are special flavors of DOS available for almost all the PC104 type embedded systems. There are of course others OS's like PharLap, Windows CE, Embedded Linux, etc. You write a control program to run on the embedded card that handles your I/O control just as you would any other system. Again you stream the data from the card back to the PC for display or data storage. An embedded controller that includes a winsock interface to connect it over an ethernet port to the PC is an excelent way of implementing this. These systems have a lower hardware cost than some of the other integrated solutions and a lot of vendors, but you are going to expend more labor getting things setup and running unless you already have some experience using embedded systems.
Again I am not suggesting you go this route, but if the timing requirements you have are just too much to implement with conventional PC hardware these options split the task up so that the timing/control functions move to hardware with better realtime capability.
09-28-2006 08:51 AM