Jump to content

SubVIs calling subVIs that need to be reentrant - what level needs to be reentrant?


Recommended Posts

My understanding is that for true parallelism all of the subVIs should be reentrant. If you have VIs that are really short/fast, you could possibly get away with not making them reentrant to save a little memory. I will throw out the warning to be careful about VIs that need to maintain state (FGVs, Action Engines, whatever you want to call them) and reentrancy.

  • Like 2
Link to comment

There are a lot of considerations when deciding which VIs to make reentrant. Its about finding a balance between maximum performance and minimum memory usage.

  • Any VI that maintains state needs to be either non-reentrant or fully reentrant depending on its requirements for that state.
  • If there are any VIs that truly can't be called at the same time, those should stay non-reentrant. This could be things like configuration dialogs or file modification. Non-reentrant VIs are one of the easiest ways to serialize access to single instance resources.
  • Any VI that is part of a performance critical code path probably should be made fully reentrant. This avoids synchronization points between multiple parallel instances of performance critical code or non-performance critical code getting in the way of performance critical code.
  • Beyond that you can start to favor non-reentrant or shared reentrant to reduce memory usage.
  • As crossrulz said, VIs that always execute quickly can be considered for leaving as non-reentrant. Keep in mind that there is a difference between a VI that always executes quickly and one that typically executes quickly. Anything that does asynchronous communication (networking, queues, ...) should be considered slow, because it could take longer than expected.
  • Making VIs that are called from a lot of places shared reentrant instead of fully reentrant will slightly increase execution time but can greatly reduce the number of instances required and thus memory usage.

  • Like 2
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.