LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Should Primitive-like Utiltiy VIs be Reentrant

[cross-post]

At OpenG, we've recently discussed the possibility of setting our small primitive-like utility VIs as subroutine. Now, we're discussing whether we should make these VIs reentrant. Ton Plomp asked;

QUOTE
Since we like to view the OpenG VIs as primitive like functions they need to behave like primitives.
One of my 'OpenG VIs I couldn't live without' is Filter Array. A lot of times I use it on several data-sets inside one VI. Since the VI is not reentrant it is called subsequently, this can be overcome by making the VIs reentrant, and allow the clones to be shared to limit the food-print of the VI.

Are there any problems with this view?


Please respond here:

http://forums.openg.org/index.php?showtopic=833
Message 1 of 4
(3,089 Views)

The short answer is yes... most of the time.

Your primary concern with doing this will be memory allocation and use. For instance, if the VI uses a huge block of memory to complete its task, even if the task itself is trivial, reentrant execution would not be a good thing.

Another concern would be whether the VI accesses memory/variables outside of itself, such as globals etc. As long as it does not write to global variables, or the writing is controled with a semaphore or similar, you should be ok.

The way I understand reentrant, the way it handles memory is the main difference between it and a regular vi. They allocate a separate memory space for each execution of the vi, which is why it can execute in parallel.

 

Hope this helps,



Message Edited by cybertazer on 04-02-2008 04:08 PM
CyberTazer
Software Systems Engineer
Message 2 of 4
(3,082 Views)
I am assuming (maybe a faulty assumption) that the default setting in small NI primitives is reentrant. If that were the case I would make OpenG's the same. The only time I think about reentrantcy is if I want to change a VI from the default non-reentrant to reentrant. I don't have to think about it in primitives. Just my $0.02
PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 3 of 4
(3,073 Views)
Cybertazer pointed out some very good points.

Please follow his advice and see if you can turn it into a reentrant vi.

1. Will this vi consume a lot of memory?
2. Will this vi access global variables and cause race condition?
3. Do you mind labVIEW using up more memory due to multiple instances of this vi?
Van L
NI Applications Engineer
0 Kudos
Message 4 of 4
(3,025 Views)