LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Visit our LabVIEW Wiki External Code Portal.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> Calling Multiple (and parallel) ActiveX instances
Ami
post May 12 2008, 08:00 AM
Post #1


Active
*

Member
Posts: 20
Joined: 16-June 06
From: Houston, TX
Member No.: 5335
Using LabVIEW Since:2004
LV:8.5.1 ,7.1.1 ,.
United States Israel Nothing Selected


I'm having a problem of running multiple activeX instances using LabVIEW (apparently the problem occurs with more than 4 instances). This problem doesn't happen when I do the same thing in C (Visual Studio). I can create as many instances as I wish, but when I run methods that hang or run for a long period of time, only 4 are able to run at each moment. If I stop any one of the methods, the next one starts running. I attached an example (in LabVIEW 8.5.1) of using the excel activeX automation, but it happens with all of the activeX's I tried so far. It even happens when using several different activeXs. Please notice, that the problem is not with creating the instances, but when running methods of the activeX in parallel at the same time (If you run short methods that finish executing fast, you won't notice the problem).

[cross post]

Thanks,

Ami
Attached File(s)
Attached File  Instances_of_Excel1.vi ( 22.51K ) Number of downloads: 79
 


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post May 12 2008, 08:00 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
rolfk
post May 13 2008, 11:27 AM
Post #2


<customize this text>
*****

Premium Member
Posts: 1012
Joined: 9-April 04
From: Rotterdam
Member No.: 349
Using LabVIEW Since:1992
LV:8.5.1 ,8.2.1 ,7.1.1
Netherlands Switzerland Nothing Selected


QUOTE (Ami @ May 12 2008, 04:00 AM) *
I'm having a problem of running multiple activeX instances using LabVIEW (apparently the problem occurs with more than 4 instances). This problem doesn't happen when I do the same thing in C (Visual Studio). I can create as many instances as I wish, but when I run methods that hang or run for a long period of time, only 4 are able to run at each moment. If I stop any one of the methods, the next one starts running. I attached an example (in LabVIEW 8.5.1) of using the excel activeX automation, but it happens with all of the activeX's I tried so far. It even happens when using several different activeXs. Please notice, that the problem is not with creating the instances, but when running methods of the activeX in parallel at the same time (If you run short methods that finish executing fast, you won't notice the problem).

[cross post]


You are likely running into threading limitations. LabVIEW allocates by default 4 threads per execution system and for version 8.5 per CPU core and when executing external code that suspends execution the calling thread is blocked until the external code returns. As long as you stay in LabVIEW altogether LabVIEW will attempt to schedule multiple code sequences to run in parallel even if the 4 threads do not satisfy the need of LabVIEW directly but once in external code LabVIEW has no way of gaining control back from that thread to keep your program working among multiple external calls.

Solution would be to avoid blocking calls to external code altogether, or disperse the different calls into different subVIs and assign them to different execution systems, or increase the number of allocated threads to your execution system in threadconfig.vi. These recommendations are in declining order of receommendation as they will be more complicated to setup and maintain in the long run and the last one will eventually burdon the system with a load that may bring it to a halt.

Rolf Kalbermatter


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 2nd December 2008 - 04:41 AM