> I wasnt sure I thought a VI that was made reentrant actually would
> with every instance will have its own copies of all the subVIs in it
> which it would not share with anything else.
>
As others have pointed out, the reentrant option doesn't automatically
apply to subVIs. A reentrant VI can allow all callers to start
executing, without having to wait for the current one to finish before
another can begin. This means that the built-in nodes, and in
particular, the generated code for the VI will allow for this. If the
VI calls a subVI, this subVI may be reentrant, in which case the same
rules apply, or it might not be. If it is not, then the callers will
take turns in the subVI. There are also some built-in objects such as
property nodes to the UI, that are not reentrant and must take turns
making OS calls for UI.
So, as you have stated, you may want to make some of your subVIs
reentrant too. If you are doing this to speed up your application's
execution, then here are a few things to keep in mind. Reentrancy
speeds things up because the VIs waiting for VIs weren't queued up for
execution. If nothing is queued up, then when the CPU goes idle, it
really goes idle since there are no other tasks to swap to while
waiting. Making reentrant VIs means that while one task waits on I/O or
another resource other than the CPU, the CPU can get to work on the other.
There is of course a limit to how much this helps, and if you look at
the task manager and see that the CPU usage is low, reentrancy may allow
it to go higher by listing other things the CPU can do while waiting.
When it pegs, your CPU is no longer waiting for things to do, and giving
it more tasks won't speed things up, it will just mean that instead of
finishing something and starting another, the CPU will swap back and
forth making progress in little steps.
So, my rule of thumb is, if your app has low CPU usage and you want to
speed it up, look to see if you have a VI used multiple places in your
app that can be made reentrant.
Also, keep in mind that some VIs are meant to serialize things.
Instruments and other devices can get confused if multiple commands are
being sent for multiple tasks. LV2 style globals are another case where
it makes no sense to make them reentrant.
Greg McKaskle