LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What get a thread?

Hello all, I was just wondering.

To get the best performance from LabView they talk about multi-thread
applications. I was told that putting the program in a separate while
loop and using a timer made that section of code run in a separate
thread so this improved the performance of the rest of the program.
But what about when you make a utility vi ( a subvi ? you know when
you are building a program and the diagram is getting too crowded you
collect up a bunch of stuff and use the Edit->Create Subvi ) does that
also run in a separte thread?
Does that make the overall program faster or more efficient? Which is
better the while loop or the SubVi path.

Thanks for any info about this.

Regards,

Steve Drake
0 Kudos
Message 1 of 2
(2,343 Views)
> To get the best performance from LabView they talk about multi-thread
> applications. I was told that putting the program in a separate while
> loop and using a timer made that section of code run in a separate
> thread so this improved the performance of the rest of the program.
> But what about when you make a utility vi ( a subvi ? you know when
> you are building a program and the diagram is getting too crowded you
> collect up a bunch of stuff and use the Edit->Create Subvi ) does that
> also run in a separte thread?
> Does that make the overall program faster or more efficient? Which is
> better the while loop or the SubVi path.
>

You definitely want to place a delay in loops, parallel or not, so that
they don't run faster than they need to. This delay
can be a wait
function, or it can be a timeout on the I/O, or it can be anything
else that keeps the loop from running millions of times a second.

You also want to create subVIs whenever the diagram is crowded or you
see a piece of code that you want to reuse.

I gave the answers, but haven't addressed the thread issue yet. That
is because you probably shouldn't be worrying about it at all. They
are a pretty advanced feature, and for the most part, if you follow
the first two pieces of advice and look through the performance chapter
in the manual, you will be fine. Threading issues on the LV side mean
that you can use a dual processor computer without changing your
diagram at all and get benefits. They also mean that one node can
interrupt another in order to get work done, and there are ways to
control this through priorities. Again, these are advanced and are
typically not needed.

Greg McKaskle
Message 2 of 2
(2,343 Views)