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: 

Tuning of multithreading in a LabVIEW application for Windows

Hello,

I'm developping a multithreaded LabVIEW application for Windows. Typically my application has several threads with a part of them being cyclically called (timed loop with 100 ms or 500ms or 1s period).
One of the cyclical thread which has a time consuming treatment to execute seems to be suspended roughly every 15ms. I supposed this is either a suspension generated by LabVIEW or by the Windows multithreading mechanism.

Can this chareteristic be tuned (either by a parameter in LabVIEW or in Windows) and how ?

Thank you by advance for your answers.

 

--

jihef

Message 1 of 6
(2,593 Views)

I thought I knew how to shut that off in LV 5 but I can't find tht setting anymore. Anyone else know where the "Run with multiple threads" settings is at? 

 

I'd suspect your time consuming operation is allocating memory durring the delays.

 

Try using the profiler to figure out if why it is taking more time than expected.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(2,575 Views)

Hi,

 

Labview is optimised to multithread and hyperthreading. I advise you to read this:

Multitasking, Multithreading, and Multiprocessing

 

Maybe you have to make some optimisation in your code, think to create parallel loop.

 

Cordialement,

Message Edité par ajangot le 03-04-2009 04:40 AM
0 Kudos
Message 3 of 6
(2,556 Views)

Aurelien,

 

Where do I find the set-up page tht used to be called "Performance and Disk" in LV 7.1 and prior but now seems to be missing?

 

Where do we go to shut off multi-threading?

 

I want to know this because I support old apps developed before multi-threading was invented.

 


Ben wrote:

I thought I knew how to shut that off in LV 5 but I can't find tht setting anymore. Anyone else know where the "Run with multiple threads" settings is at? 

 

...

 

Ben


IN LV 7.1 that option is available under Performance and Disks. When set and after closing LV it writes a token to the LV ini file

 

ESys.StdNParallel=0 

 

I'd guess that is something like "ExecutionSystem.StandardNumberofParallel" .

Placing that line in the LV ini file may still work to shut-off multi-threading.

 

Ben

Message Edited by Ben on 03-04-2009 06:04 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 6
(2,544 Views)

Thank you Ben. I have invistigated with the profiler and I'm afraid I have a made "classical" mistake in the design of my application.

 

I'm using an array (1500 elements) of clusters to memorize the caharacteteritics of signals coming from I/O boards or from OPC servers.

In order to be shared by the different threads this array is a global... and it seems to be the main cause of the time consuming operations.

 

To solve this problem, perhaps a good solution would be to replace the use of the global array by a functional global.

 

I you have any advice on the subject you're welcome!

 

Thank you.

 

--

jihef

0 Kudos
Message 5 of 6
(2,527 Views)

jihef wrote:

Thank you Ben. I have invistigated with the profiler and I'm afraid I have a made "classical" mistake in the design of my application.

 

I'm using an array (1500 elements) of clusters to memorize the caharacteteritics of signals coming from I/O boards or from OPC servers.

In order to be shared by the different threads this array is a global... and it seems to be the main cause of the time consuming operations.

 

To solve this problem, perhaps a good solution would be to replace the use of the global array by a functional global.

 

I you have any advice on the subject you're welcome!

 

Thank you.

 

--

jihef


 

I will not (in this thread) state that globals are evil! But I don't like them.

 

I wrote a Nugget on Action Engines (Functional Global) that can be found here.

 

Arrays in LV require contiguous memory blocks. If you have an app that is memory demanding, then passing data using queues may be helpful since each "update" can use a seperate smaller buffer.

 

So depending on what you are doing I think your idea to go with an AE is valid.

 

Have fun,

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 6
(2,515 Views)