Greg McKaskle wrote in message news:<3D7372B8.2020309@austin.rr.com>...
> > I have LV DLL based driver, every function in this driver is
> > reentrant, every DLL call is reentrant.
> > I want to communicate with number if instruments via this driver.
> > So I programatically clone the VI which communicates with instrument.
> >
> > When I run all cloned VIs in parallel to communicate with all
> > instruments, the DLL calls are executed sequentialy.
> >
> > Why there are not able to dynamically generate new threads ?
>
> It sounds like you have most of the correct settings, but let me review
> them anyway. First, make sure that threading is on in the
> Tools>>Options on the Execution page. It defaults to on, but sometimes
> gets turned off for compatibility with ActiveX or other nonthread
> friendly programs.
>
> Second, you say that your DLL calls are reentrant. If that means that
> the Call Library Function nodes have their checkbox set to show that the
> call can be made reentrantly, and making their color yellow instead of
> orange, then step two is taken care of. Otherwise make this change.
> You also mention that you cloned VIs. If you are using the same VI in
> more than one place on the diagram, they default to making a critical
> section -- allowing only one caller at a time. If you want to allow
> reentrant execution, this is set in VI Properties.
>
> Third, which I think is what is going wrong in your case, you need to
> have enough threads or execution systems to run your VI. You ask why LV
> doesn't generate dynamic threads. The answer is that LV preallocates
> threads that the VI needs to run and schedules nodes on those threads
> according to dataflow. Creating and destroying threads is actually
> quite expensive on most OSes, so that is not the mechanism LV uses.
>
> Here are several solutions for your system. Each VI and subVI can be
> set to run in a particular execution system and at a particular priority
> using the VI Properties>>Execution page. On a single processor computer
> each execution system priority cell defaults to having one thread. On a
> dual processor it defaults to having two, a quad defaults to four. In
> most cases this ends up being sufficient to keep the processors busy
> without causing excessive thread swaps.
>
> In the case where your threads are being consumed by a DLL call and
> therefore cannot multitask with the other dataflow nodes, you can either
> set your VIs to run in the different execution systems, or you can make
> the Standard execution system have more threads.
>
> To set the execution system of a VI, use the VI Properties. To change
> the threads per execution system, open the
> vi.lib/utilities/sysinfo.llb/threadcfg.vi or something very close to
> that name. This VI shows the threads allocated per cell, and hitting
> the config button at the bottom lets you change it. Note that as of LV6
> these numbers are the maximum limit allocated by LV and it doesn't
> allocate the threads in an execution cell until a VI is loaded that
> needs that system/priority.
>
> Now that I've told you how to do it, I'd recommend doing a very quick
> experiment with the execution system settings to see if there is any
> advantage to having multiple threads active. If the various threads are
> sleeping/waiting for hardware, this may indeed allow other threads to
> make progress, but if they are doing a spin-lock or heavy computation,
> there really isn't any benefit.
>
> Greg McKaskle
Dear Greg,
Thank you for your answer. I checked all the setting and I am sure
that I have these settings correct as you wrote. I tried the VI for
changing allocation of the threads, but the number of threads is too
small for me.
If I am right LV maximum thread number is number of preffered
execution system multiplied available priorities (App.Note 114), what
happened and how in threadconfig.vi is clear for you only (this vi is
locked, by the way number of locked vi's increases with LV version
number 😞 - why this? )
I have from 50 to 200 points with same instrument on every point. So I
need up to 200 parallely running tasks for communicate with these
instruments via DLL based instrument driver, in every parallel task is
unique instrument session, but calling different functions from the
same DLL. Now I am not able to do it in LabView, only way is to use
LabVIEW native driver, but in this case I loose advantages of IVI
driver. Do you have any idea how to use IVI driver in 200 parallel
tasks?
Best regards
Jiri