07-21-2010 03:58 AM
I have made a subVI to read the DMM using GPIB plug and play driver. This subVI work satisfactorily. But when this subVI was put inside timed loop the kiethley DMM got hanged up. It carries out multiple read. I have tried different settings of timed loop also. This problem only appears during reading of keithley DMM. This is not a problem with Fulke and Agilent make DMM. Kindly help me for this problem.
07-21-2010 09:37 AM
The GPIB plug and play driver: where do they come from?
You have to know that a timed loop executes the code in it in a single thread. I assume that the plug and play driver must split its execution in several threads which is suppressed by the timed loop. Please note that this is an assumption.
But maybe it is more of interest:
Why do you use the timed loop at all? Timed loops are primary for RT systems. And since GPIB is not deterministic, the timed loop is definetly the last construct i would choose to use GPIB in it......
hope this helps,
Norbert
07-21-2010 11:18 AM
@Norbert B wrote:
You have to know that a timed loop executes the code in it in a single thread. I assume that the plug and play driver must split its execution in several threads which is suppressed by the timed loop. Please note that this is an assumption.
Norbert, your assumption may be in error. Here is some code that has two separate loops running in parallel. I would think that each loop runs in its own thread. The code runs fine without any problems.
Monika: Can you attach your code, or the part that is giving problems?
07-22-2010 02:24 AM - edited 07-22-2010 02:25 AM
I am sorry, tbob, but your code proves nothing.
In fact, i am not assuming that timed structures run in a single thread, i know it 🙂
"Each Timed Loop represents a unique thread, and you can use the Processor Assignment section of the Configure Timed Loop dialog box to designate the thread to run only on a specific processor core, as illustrated in Figure 3 below." (taken from here)
All features the timed structures supply are possible because the structure handles its content in a single thread. Otherwise, the overhead would be so gigantic that you wouldn't ever use timed structures..........
just my 5 cents,
Norbert
PS: If there has been a change in this in one of the past LV versions, there is at least no documentation available about this......and i doubt it seriously.
07-22-2010 10:33 AM
I believe you Norbert, but I'm confused. I thought that if two loops ran in parallel, that each one had its own thread. Is this not true if they are by themselves, without any timed loop? Now if the two parallel loops are put in a timed loop, you say the timed loop runs in one thread. But what about the code inside the timed loop, like the two parallel loops. Aren't they in separate threads? Just trying to get clarification.
07-23-2010 02:29 AM
tbob,
both loops inside the timed structure (so also true for the timed sequence) will be executed in a single thread. If you place those loops into a subvi (without any timed structure) and configure the vi settings to Preferred Execution System to User Interface, both loops will also run in a single thread: The UI thread. So you see that parallel loops do not necessarily create dedicated threads.
In fact, a mechanism called "clumping" is taking place to split the codes execution into different threads. In the example of the parallel loops (no timed loop around), it is most likely that two threads/clumps are created; but we cannot tell for sure. Also note that different clumps can be attached to the same thread, so "clump" is not a synonym for "thread"!
Afaik, clumping is suppressed in timed structures which will result in a single thread handling the timed structure.
hope this helps,
Norbert
07-23-2010 10:34 AM
Thank you for the explanation. I didn't know about clumps. I have always thought that parallel execution meant different threads. It's amazing that after using Labview for over 10 years, I am still learning new things almost daily.