Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx - how does it multithread?

Howdy,

i am using DAQmx in VC++. my question is how does DAQmx run threads? In traditional DAQ, when you perform an acquisition, it runs as a separate parallel process(if i remember right). Is it the same with DAQmx? or does it run tasks as threads within the calling application's process itself?

thanks in advance,

vikram
0 Kudos
Message 1 of 7
(5,798 Views)
Here is some information in the following white paper that I thought would be useful to you.
http://zone.ni.com/devzone/conceptd.nsf/webmain/5df09082448cbcf886256e7c0078ee9c


NI-DAQmx driver software is designed to help you significantly improve performance by exploiting the computer processor power and the memory structure of operating systems. NI-DAQmx driver software uses a multithread application structure to maximize computer processor power and implements memory-mapped registers to produce unprecedented concurrent and single-point I/O performance. As a result, you can experience up to 40 times better performance when you perform a concurrent I/O operation and 20 times faster execution speed when you perform a single-point I/O operation.

NI-DAQmx is an innovative driver software architecture that incorporates multithread technology. With multithreaded DAQ operations, you can perform an I/O operation independently in a separate thread. This guarantees faster execution speeds when you perform concurrent operations. Performing a concurrent operation, such as generating a continuous analog output waveform while acquiring a continuous analog input signal, in a single-threaded environment can be extremely challenging and can yield slow performance unless you employ complicated programming and timing techniques. Because NI-DAQmx driver software is multithreaded, it guarantees the simultaneous operation of analog input acquisition and analog output generation by assigning a separate thread to each operation. This eliminates the need to develop a complicated program to create an optimized concurrent operation. You can implement a multithreaded DAQ operation simply by using the NI-DAQmx Library.

Take an example of a synchronized AI/AO operation example program. You do not have to manually allocate separate threads for each analog input and analog output operation. The NI-DAQmx functions allocate the threads automatically. Therefore, with the NI-DAQmx Library, you can develop a multithreaded DAQ application without spending time implementing the details.

Thank you

Nandini Subramaniam
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(5,788 Views)
Thanks for the info. i looked up the white paper and it doesn't say whether the threads run in a separate process or within the application's (in which the DAQmx calls are made) process.

The reason i ask is i need my program to be really fast and i am experimenting with thread and process priorities. When using traditional DAQ i cannot increase my application's priority above 'above normal'(i get an error). i am guessing it is because the parallel process in which the acquisition runs doesn't get the time it needs to run. will this occur in DAQmx too?

thanks,

vikram
0 Kudos
Message 3 of 7
(5,784 Views)
Hi Vik,

With NI-DAQmx, if you use LabVIEW or a multithreaded C program, multiple threads can access the NI-DAQmx driver at the same time as long as those threads are executing different NI-DAQmx tasks. The driver will create a new thread for each data acqusition task and handle the priority to allow the acquisition to be carried out.

Thanks,
Lesley Y.
Message 4 of 7
(5,767 Views)
and the threads that the driver creates - under which process do they run? a separate 'DAQmx process'or the user's program/application process?

thanks Lesley.

vikram
0 Kudos
Message 5 of 7
(5,761 Views)
The thread belongs to the user's process. You can see the list of the threads in your process if you set a breakpoint in your app, break and open up the "Threads" window (Ctrl-Alt-H)
Bilal Durrani
NI
Message 6 of 7
(5,754 Views)
Thanks.

forgot about that option entirely 🙂

vikram
0 Kudos
Message 7 of 7
(5,750 Views)