LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

some questions about multithread in labview

when I read "Using LabVIEW to Create Multithreaded VIs for Maximum Performance and Reliability" ,I am wondered by
the following questions:
1. what's the relationship among execution system ,vi priorities and os threads?
2. How many threads in one execution system ?
3. Is an execution system contain some sub-execuiton system by the vi's priorities?
4. In multithread application,the User Interface System has it's own thread,why other execution system will block
the UI Event?
5. The differences of the multithread mechanism from LabVIEW 5.1 to LabVIEW 7.1?
7. when I read another article named "Inside LabVIEW" on NI websit,I got some different informations to this article.That's is "every execution is running in one thread in operate system". why?
6.At last ,how to understand the following words in the article?
"Each of the execution systems has a separate execution system for each priority level, not including the Subroutinepriority level nor the User Interface execution system. Each of these prioritized execution systems has its own queue and two threads devoted to handling block diagrams on that queue."
"The operating system assigns operating system priority levels to the threads for each of these execution systems basedon the classification. Therefore, in typical execution, higher priority tasks get more time than lower priority tasks. Justas with priorities in the User Interface execution system, lower priority tasks do not run unless the higher priority task periodically waits."
0 Kudos
Message 1 of 2
(2,650 Views)
The best one answering your question will be Greg McKaskle. I have read a lot of answers from him regarding multi threading, execution system and the relation between front panel and block diagram. I do this from my mind and if one of the other enthusiasts think my mind is wrong please correct me.

1. Execution system is LV internal mechanism to provide multithreading in nonmultithreading OSes. Execpt the UI Thread the execution systems are the same and the naming of them is just for convention. To allow different VIs have the chance to run before other VIs you use priorities. VIs with higher priority will run before other VIs. On multithreaded OSes this is mapped to OS threads. So DAQ Priority High will be mapped to a OS thread and DAQ Prioity Normal will be mapped to another OS thread.

2. One execution system has a maximum of 10 threads. It has 5 priority levels and each level has two threads. The number of threads depends from the number of priority levels which are used.

3. Maybe you can think of a execution system having 5 sub-execution system in one foe each priority level. But I think that's not the way it's implemented. I think each priority level is divided into 5 parts one for each execution system.

4. Th UI thread uses the Normal priority. It is only blocked if a VI is running with higher priority and only when it does not try to display something.

5. I don't think they are different in the way to use it. As I remember in LV 5.1 only a limited number of execution systems and threads are created at LV startup. You could set some setting in LabVIEW.ini and there was a VI to do it to activate the others.

6. Subroutine priority isn't really a priority. VIs not having Subroutine are compiled in a way that at each node the VI is requeue into the queue of it execution system and priority. This is done to allow other VIs to run and is the mechanism to provide multithreading in nonmultithreading OSes. A VI with subroutine priority is compiled in a way not to requeue at each node. This VI will complete its execution before allowing other VIs to run. This is a critical point when running on nonmultithreading OSes. From the sight of the execution system a subroutine VI has the priority of its caller. The User Interface thread has to deal with the GDI which draws on the screen, mouse and keyboard. It is much easier to implement a multi threading system with only one thread for such a task. And I'm not sure if each GDI is implemented reentrant on each platform LV will run.
Priotires within LV are mapped to priorities of the OS. If you open the task manager in W2k or XP go to the processes tab and select from View>Select Columns Base Priority you can see the priorites assign to the processes. Unfortunatly you cannot see the priorites assigned to the thread. You need something like Spy++ from the MS Visual Studio. The OS will run threads with higher higher priority first until there is no thread which want's to execute. Thats the reason you need to implement a wait in high priority VIs.

7. This article refers to LV 6i and the App Note to LV 7.1. I think the diference comes from a decision to change the implementation. The reason are blocking nodes like a CIN. Two threads for each will execution system and thread will allow to call a CIN and to run another VI in parallel.
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 2
(2,634 Views)