Title: Inside LabVIEW
1Inside LabVIEW
- Steve Rogers
- Chief Architect, LabVIEW RD
- Wed Aug 16
- 1015-1130 a.m., 145-300 p.m.
- Ash (10A)
2Inside LabVIEW Topics
- Virtual Instrument organization
- How VIs are compiled
- LabVIEW execution system
- Single threaded LabVIEW
- Multi-threaded LabVIEW
- LabVIEW RT remote execution system
- What happens when indicators display
- What happens when you call a subVI
3The Parts of a VI
Loaded when used
Always present in memory
VI
Front panel
Block diagram
Data space
Compiled code
4How VIs Are Compiled
5How VIs Are Compiled Clumps
Clump 1
Top For Loop Indicator is updated Clump 0
Scheduled Sleep...
Clump 0
Clump 2
Start of diagram Reads controls and constants,
then schedules Clumps 1 and 2 (for loops). Then
sleeps...
Bottom For Loop Indicator is updated Clump 0
Scheduled Sleep...
Completion of diagram Divide nodes, display of
indicators, then VI exit.
6The Execution System
RunQ head tail
curElem
prioritized
ebp (ds register)
VI code
VI data space
instruction instruction instruction
7Exec() is a Loop
Sleeps on runQ when multi-threaded or if in .dll
entry point if top VI not finished
curElem Dequeue(runQ) ebp curElem DS res
call curElem PC if(res) curElem PC
res Enqueue(runQ, curElem) curElem NULL
rotates the runQ cooperative multi-tasking
Cooperatively returns when in UI thread (at top
level)
8Single Threaded LabVIEW
Computer
Thread
Co-routines
User interface loop
Exec( )
9Multi-Threaded LabVIEW
Computer
Messages
Thread
UI Loop Co-routines Exec()
10LabVIEW RT Target System
RT computer
Messages
Thread
Communication Loop Co-routines Exec()
TCP/IP
11LabVIEW RT Development System
Host LabVIEW RT computer
LabVIEW RT Target computer
TCP/IP
Thread
Thread User Interface Loop Communication to
target possibly Exec()
-shared memory -Ethernet -other
Communi-cation to host or client Exec()
12LabVIEW RT Deployed System
Client LabVIEW computer
LabVIEW RT Target computer
TCP/IP
Thread
Thread
Commun-ication to host or client Exec()
UI Loop and Commun-ications Exec()
-shared memory -Ethernet -other
13LVRT.dll runs VIs as .dll procs
Computer
Messages
Client program
Vi()
LVRT.dll
Thread
Exec( )
LoadLibrary(vilibname.dll) vi
GetProcAddress(viname) (vi)(arg1,arg2,arg3)
UI Thread Exec()
14Display to an indicator (single thread)
Operate/display data
Execution data
Running code copies execution data to the
operate/display, and calls the display function
for the indicator
15Display to an Indicator (multi-thread)
UI thread
Execution thread
Operate/display data
Execution data
Running code acquires mutex, copies execution
data to transfer data, releases mutex and posts
message to UI thread.
UI thread receives message, acquires mutex,
copies transfer data to operate/display data,
releases mutex and displays indicator
Transfer data Mutex X dirty flag X update
flag
Message queue
16SubVI Calls (SubVI Not Busy)
Caller data space
Callee data space
Mutex curCaller NULL waitQ empty
Execution system curElem
17SubVI Calls (SubVI Running Caller)
Caller data space
Callee data space
Mutex curCaller waitQ empty
Execution system curElem
18SubVI Calls (SubVI Is Busy)
Caller data space
Callee data space
other caller
Mutex curCaller waitQ
Execution system curElem
19SubVI Runs
Caller data space
Callee data space
other caller(s)
Mutex curCaller waitQ
Execution system curElem
20SubVI Returns (No Waiting Second Caller)
Caller data space
Callee data space
Mutex curCaller NULL waitQ empty
Execution system curElem
21SubVI Returns (With Waiting Second Caller)
Caller data space
Callee data space
Mutex curCaller waitQ
next caller
Execution system curElem