LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subroutine Priority number of calls

Solved!
Go to solution

Subroutine Priority number of calls

 

A normal VI can be only called ones at the same time. Is this by a VI with the settings Subroutine (Priority) the same?

And by Multithreading ?

(VI Properties --> Priority  --> Subroutine )

 

Thanks

Urs Mueller

0 Kudos
Message 1 of 10
(3,440 Views)

Reentrant execution.  VI Properties>>Execution tab.  Are you asking how to make a VI reentrant?

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 2 of 10
(3,438 Views)

If memory serves me...

 

Even if you mark a sub-VI as re-entrant and as sub-routine, there will be two insances that are copmutable but once one starts to execute it does not give up the CPU...

 

but now that we have multiple CPUs, I'm curious.

 

ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 10
(3,433 Views)

Thanks Kudos

 

I have a normal VI with use a VI as sub-routine. If I call this sub-routine VI from different place (VI’s), could it be that I get Race Condition?

The sub-routine is a Functional Global Variable.

 

Thanks

Urs Müller

0 Kudos
Message 4 of 10
(3,415 Views)

OK you  are NOT talking about a re-entrant VI.

 

YEs sub-routine priority for an Action Engine is just fine and if you step into the way-back-machine the NI RT course used to teach us to use an AE to interact with the time Critical loops since the sub-routine priority enabeld the "Skip If Busy" option  (and also here )for our sub-VI calls.

 

The Skip If BUsy option was an early exception to the standrad data flow rule that the output from a sub-VI was required to progress beyonf that sub-VI.

 

WHen that option is set (right-click the sub-VI to configure the call) LV would first check to see if that sub-VI was busy before attempting to call it. If it was busy the sub_VI would not be called and the wires coming from that sub-VI would contain the default-default of the data types.

 

I use these often but in TC loops they are great since I can use a boolean returned by the sub-VI to tell me the call executed or not. Typicially the AE would provide the USer set-points or options (recieved from a GUI somewhere). If the Boolean was true, the sub-VI executed adn I should use its data. If it was false the sub_VI was skipped and I ignored the data from the AE.

 

Works great last a long time.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 10
(3,408 Views)
Solution
Accepted by UrsMueller

Subroutine priority does enforce single use of a VI, but it also imposes fairly severe time penalties for trying to do it.  Due to to the way subroutine priority is implemented, it uses a polling method to see if the VI is available for execution before running it.  If available, it is very fast (essentially no calling overhead).  If it is not available, I believe you get a 1ms wait before the next try.  Take home message - they are not a good choice for action engines or any application which depends on the blocking behavior of non-reentrant VIs.

 

Note that the new inline feature of the LabVIEW compiler is making this particular feature essentially obsolete.  It is not quite there yet, but is close.

0 Kudos
Message 6 of 10
(3,367 Views)

@DFGray wrote:

Subroutine priority does enforce single use of a VI, but it also imposes fairly severe time penalties for trying to do it.  Due to to the way subroutine priority is implemented, it uses a polling method to see if the VI is available for execution before running it.  If available, it is very fast (essentially no calling overhead).  If it is not available, I believe you get a 1ms wait before the next try.  Take home message - they are not a good choice for action engines or any application which depends on the blocking behavior of non-reentrant VIs.

 

Note that the new inline feature of the LabVIEW compiler is making this particular feature essentially obsolete.  It is not quite there yet, but is close.


 

Tha fly in the face of the official recomendation from NI in version LV 6i RT.

 

When did htat change?

 

Ben

 

PS in a Windows environment I could understand the issue since the scheduler may only run at 1 ms reates but in RT....

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 10
(3,357 Views)

My comments apply only to the Windows version.  I have little real experience with anything else.  If you are interested, I can find out.  The answer may be different for the different RT platforms (x86 and PowerPC), as well.

Message 8 of 10
(3,347 Views)

@DFGray wrote:

My comments apply only to the Windows version.  I have little real experience with anything else.  If you are interested, I can find out.  The answer may be different for the different RT platforms (x86 and PowerPC), as well.


If you would Please,

With new features comes new performance tradeoffs and we can never have enough of that type on information.  I'll keep my head-wrapping duct-tape roll handy.


"Should be" isn't "Is" -Jay
Message 9 of 10
(3,337 Views)

The RT behavior of subroutine priority subVIs is the same as Windows.  When waiting for execution, they use an ~1ms polling loop.  As such, they are not recommended when you expect them to be used "simultaneously."

Message 10 of 10
(3,320 Views)