LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Non-Reentrant VI executing in different Process Stacks

I am creating a DLL which can be called by several different processes on a machine at the same time. If I have a non-reentrant VI in the API, do the same restrictions apply between processes as if they were in the same process? For example, if I call "Get Shorty.vi" which is a non-reentrant VI from 2 places in the same process, at the same time, the first call will start executing, and the second call will wait till the first call is done. When called from 2 different process stacks, there is supposed to be total seperation of memory windows, so logic tells me that this restriction would not apply if that same VI were called from 2 different processes.
 
The catch is that the VI Library installed by the run-time engine is used by both processes as well. Would this, in effect, cause the same behavior between 2 calls to the same VI both in process and out?
 
Thanks for any help you can provide. This is not a easy to describe concept, so feel free to ask for clarification if needed.
 
 
 
 
CyberTazer
Software Systems Engineer
0 Kudos
Message 1 of 5
(3,785 Views)

I beleive the bottom line aswer to your Q depends on the DLL and how you have configured your dll call.

If the dll is thread-safe

AND

the call is configure to NOT run in the UI thread (yellow not orange)

THEN you should be able to make two simultaneous calls

I hope that helps,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 5
(3,783 Views)

Ben, you should note that these are different processes calling a LV DLL, not calls from within LabVIEW.

Cybertazer, different LV instances definitely have separate memory spaces, even if they call the same VIs. I assume this should be the same with calling a DLL (Windows probably loads a new instance of the RTE to run the DLL), but you can do a simple check by creating a simple LV2-style global in the DLL and calling it twice. For example, it can simply increment a counter. If both processes load into the same memory space, you will see it immediately, but I doubt that's the case.


___________________
Try to take over the world!
0 Kudos
Message 3 of 5
(3,766 Views)

I understand that the memory spaces are supposed to be completly seperate. The question is that if 2 processes call the same function in the same dll at the same time... will one process have to wait on the other process to finish before being allowed to execute? My feeling on this is no, it would not have to wait, but I am hoping that someone out there has a more difinitive answer.

There is no shared memory mechanisms set up in this vi.. ie for persistant data between execution processes. I am not even sure if this is possible with LV dll's, but I thought I would throw that in there since I know it is possible in general.

 

Thanks again for your help guys... keep em comming. Hopefully this will help clear up other peoples perceptions on how dll execution is handled in LV if we can nail this down a bit more.

 

 

CyberTazer
Software Systems Engineer
0 Kudos
Message 4 of 5
(3,762 Views)

I don't have any experience with LV DLLs, but the way I understand it, they are supposed to behave the same as executables and executables do load the VIs into memory, so that running a VI in one instance is completely separate from the other instance. That allows you to run the same VI at the same time from two different processes.

If you want to test this, place a long wait (e.g. 10 seconds) inside the VI in question and then call it twice. By seeing when the second call ends you will have an answer. As I said, I'm guessing they will be loaded into two separate RTE instances and so will run concurrently.


___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(3,753 Views)