01-12-2012 07:24 PM
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
Solved! Go to Solution.
01-12-2012 07:29 PM - edited 01-12-2012 07:30 PM
Reentrant execution. VI Properties>>Execution tab. Are you asking how to make a VI reentrant?
01-12-2012 07:36 PM
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
01-13-2012 05:01 AM
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
01-13-2012 07:17 AM
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
01-16-2012 07:30 AM
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.
01-16-2012 09:55 AM - edited 01-16-2012 10:01 AM
@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....
01-16-2012 01:27 PM
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.
01-16-2012 03:37 PM
@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.
01-17-2012 07:01 AM
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."