Search code examples
multithreadingmultiprocessinglabview

How Does LabVIEW Handle Multiprocessing and Multithreading?


INTRO

multiprocessing = using multiple CPU cores to complete a task (each core has separate memory, thus requires pipes and data structures for each core to "talk" to each other")

multithreading = using multiple threads (that are on a single CPU core) with a task scheduler to complete a task (all threads share same memory on CPU core)

  • static (temporal) multithreading - take advantage of idle I/O time by scheduling tasks to occur sequentially without pause during cache misses (i.e. waiting to read/write to an I/O device); used for I/O-bound tasks

  • dynamic (simultaneous) multithreading - take advantage of instructions that can happen at the same time (on Intel chips, this is called "Hyperthreading"); used for CPU-bound tasks

    • e.g.
a = b*c //Task 1
d = e*f //Task 2
g = a*d //Task 3

// Task 1 and 2 don't depend on each other, and hence can be run in parallel

QUESTION

Given the above, how can I control in LabVIEW which cores I use to multiprocess a task (not multithread)?


Solution

  • As of NI LabVIEW version 8.5 the Timed Loop and Timed Sequence structures include a Processor input that allows you to manually assign available processors to handle the execution of the structures. You can configure the processor assignment by wiring an input to the Processor input of the Input Node for the structure or for frames of the structure.

    http://www.ni.com/product-documentation/6400/en/