« Close

Datasheets and User Guides

App Notes

Software & Driver

 

11.4 - Utilizing Multicore Processors

In many places in this guide, we've split apart things that occur at less than 100hz, and those that are faster. This is because Windows needs to have some CPU time to redraw the screen, move the mouse and perform other tasks and thus can't really do things at an interval faster than 100hz.

However, if you have a multicore or multiprocessor computer, you can take advantage of DAQFactory's design and the multiple cores to achieve faster software polled rates than would be possible with a single core. The trick to this is making sure that all your fast processes, i.e. anything faster than 50hz or so, is done in a single thread.

What's a thread? You've seen Windows do multiprocessing before when you are downloading a big file off the internet and you switch to another program to check your email at the same time. A thread is just like different programs that can run simultaneously, but that exist inside of a single program like DAQFactory. DAQFactory is made up of a lot of different threads and so can perform multiple tasks simultaneously. Likewise, it can split these threads across multiple cores or processors for maximum efficiency.

There are basically two ways you can keep things on a single thread in DAQFactory. The first is to put all the tasks in a single sequence. Each sequence is run in its own thread, unless of course it is called as a function from another sequence. This is why you can create multiple sequences to perform different tasks and run them all simultaneously. The other way is to create Channels, and give all the desired high speed channels the same Timing and Offset values. If Channels have different Timing or Offset, then they are put on a different thread.

If you have multiple processors or cores and want to see this in action, just create a few analog input channels and set their Timing to 0.001. This will chew up much of the processor power of one of your cores, but will leave Windows the other core to perform its tasks. In fact, as I am typing this, I have DAQFactory running reading an analog input from a LabJack at full speed, and I see no lag in my typing.

That all said, its important to understand that there is a limit to how fast the LabJack itself can process commands. If you perform the test with a few Channels with Timing = 0.001, and then go to the Table tab of one of the channels, you will see that the data actually comes in about every 4 milliseconds. This is because although DAQFactory is trying to read it at 1 millisecond intervals, the LabJack is taking about 4 milliseconds to actually perform the command.