execution - 我是否应该将预分配VI中的子VI也设置为在LabVIEW中预分配?

标签 execution labview reentrancy

我有一个VI,其执行类型设置为预分配克隆可重入。 在 VI 中,我有几个子 VI。我应该将子VI的执行类型设置为与主VI相同吗? enter image description here

谢谢

最佳答案

将 VI 设置为可重入不会自动使其子 VI 可重入 - 如果这样做,这将破坏不可重入 VI 的一些用例,例如序列化对单个资源的访问或在调用之间维护存储的状态数据。因此,要决定子VI是否需要可重入,您只需考虑与决定父VI是否需要可重入时相同的问题。

我在 this post by GregR on the LAVA forum 中找到了有关注意事项的很好的总结。 ,据我所知,这仍然成立(完全可重入是预分配克隆可重入的旧 LabVIEW 术语):

  • 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.
  • [...] 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.

关于execution - 我是否应该将预分配VI中的子VI也设置为在LabVIEW中预分配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50288953/

相关文章:

labview - LabVIEW 初学者任务

cDAQ 的 LabView 许可建议 : NI9426 Open Connector Pulse and NI9213 Temperature Alarm

c - 是否可以从 Bison 语法操作更改弹性状态?

java - 通过 ReentrantLock 访问的字段是否需要 volatile 关键字?

linux - strace 'open' 在可执行文件的库中调用

perl - 使用 perl 的 `system`

带 GUI 的 Python 执行顺序

linux - 从 Linux 机器发送信号/文本到窗口中的 Labview

c - srandom_r 处的段错误

c - 如何在 Windows 上使用 MPI 和 OpenMP 编译和执行 C 程序