LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel loops in multicore system, any guaranteed/dedicated core execution possible?

My Labview program consists of two loops, one is an initialization loop, the other is a time critical output loop, and I setup up them in parallel. I have a Core Duo (2 Cores) PC with Windows 7 Professional and LV 2012. The problem is, I want the time critical output loop to be as little distrurbed as possible, so that execution of other loops when time critical output is enabled.  

 

My question is : 1) Is it better to put two loops in one Labview program, or separate them (they have no data dependency)? The initialization loop should remain because I need to change parameters in the run.

                          2) Is there anyway to ensure that the time critical loop always get an idle core to run? If not possible, what can be done to improve the probability that the time critical task running on an idle, dedicated core?

 

Attached is a simplification of my real program, with only the initialization loop and time critical output loop.

 

0 Kudos
Message 1 of 6
(3,086 Views)

Is the time critical loop the Output Loop, or the For loop inside of it? You should look in to Timed Loops. These have all the inputs your could want to help ensure the time critical loops don't miss a beat.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 6
(3,076 Views)

It is the for loop inside it, which is time critical. The execution of the code is calibrated so it is stable if no other program interfere. I just want to reduce the chance that other programs/threads get in the way of execution so it gets unexpected delays.

0 Kudos
Message 3 of 6
(3,069 Views)

If you are running on a Windows PC then it is not possible to have a 'time critical loop' - at any point your PC could start a virus scan or respond to mouse movements and starve your time critical loop of resources. Timed loops on Windows cannot offer any sort of determinism.

 

If your code is truely 'time-critical' then the the only way to do it is to run a Real-Time OS (e.g. LabVIEW Real-Time). If you can't dedicate an RT PC/cRIO/PXI for this you may be able to do something clever with Virtual Machines - take a look at the NI Real-Time Hypervisor (although that only runs on PXIs, apparently).

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 6
(3,063 Views)

What you are trying to do is not really reasonable on a multipurpose OS such as Windows 7.

 

Yes, a timed loop lets you assign CPU cores, but that still does not prevent the OS from scheduling other things occasionally. Still, a timed loop tries to be more precise and it even reports to you if a time target is missed.

 

What is that loop actually doing? What is your definition of "time critical"? What kind of "output" does it produce? Are there any shared resources involved? What is the desired loop rate? Your example shows a 200ms loop time, is that typical? This is nearly infinitely slow for a computer! 😉 How long does the loop code take to execute?

0 Kudos
Message 5 of 6
(3,055 Views)

plarq wrote:

My question is : 1) Is it better to put two loops in one Labview program, or separate them (they have no data dependency)? The initialization loop should remain because I need to change parameters in the run.

                          2) Is there anyway to ensure that the time critical loop always get an idle core to run? If not possible, what can be done to improve the probability that the time critical task running on an idle, dedicated core?


1. Just leave them together.  No need to make a seperate program, assuming you are running both on the same machine.

2. You can use a Timed Loop to force the code to run on a specific core.

 

But as other have said, Windows is not for "time critical" code.  I could suggest an RT or FPGA.  What exactly is that loop supposed to be accomplishing?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(3,043 Views)