From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running a dozen or two VIs in parallel

First of all, let me say I'm pretty new to LabView, but not programming (C, C++).  My application will need to monitor a dozen or two signals and simply issue a green/red light if they are in/out of range.  Is it better to poll each signal serially in a single loop or to set up a loop for each signal so that they run in parallel?  My main concern is that each loop will get enough time to process its signal at a few Hz.  This gets down to how LabView schedules and preempts each loop.
0 Kudos
Message 1 of 3
(2,309 Views)
There are many issues to consider, but if everything plays nice, you can just put all in one loop and don't worry in which order things execute. The loop will repeat once everything in it is done. Add a small wait statement so it repeats at predictable intervals and does not consume all CPU spinning as fast as it can.
 
If things potentially don't play nice and e.g. one channel gets stuck for some reason and never finishes, everything will need to wait if you only have one loop. If each is in a independent loop, the others will be able to proceed.
 
I would suggest to use one loop for simplicity and simply ensure proper error and exception handling.
 
If you use multiple loops, you need to ensure that they gracefully take turns. This is achieved by placing a wait statement (even 0ms!) in EACH loop.
 
If not, parallel loops will ping-pong only every 55ms (see http://ideasinwiring.blogspot.com/2005/05/55ms.html ).
0 Kudos
Message 2 of 3
(2,303 Views)
Thanks a lot!  It's great to know the 55ms ping pong feature.
0 Kudos
Message 3 of 3
(2,299 Views)