Jump to content

Data flow: Difference between revisions

From LabVIEW Wiki
No edit summary
Rewrite article
Line 1: Line 1:
Dataflow is the fundamental concept under which the LabVIEW execution system executes code written in G (the graphical language used in LabVIEW). The basic philosophy is that the passage of data through nodes within the program determines the order of execution of the functions of the program. LabVIEW nodes (functions, structures, and subVIs) have inputs, process data and produce outputs. Whenever all of a node's inputs contain valid data, that node will be scheduled for execution by the LabVIEW execution engine.  As soon as a processor becomes available (subject to available CPUs and the completion of previously scheduled nodes), the node will be executed.  
[[Wikipedia:Dataflow programming|Dataflow programming]] is a [[Wikipedia:Programming paradigm|programming paradigm]] where the execution of functions is determined by their data dependencies. This is fundamentally different from traditional programming paradigms that execute functions in sequence as they appear in the source code.


After a node executes, values on its output wires become valid and "flow" to the next nodes with those wires connected as inputs. By chaining together nodes that have compatible inputs and outputs, the programmer controls the order in which the nodes execute. Often a single input is used as a common "thread" running through several VI's and the program to force the order of operations, whether or not each node has any need to modify the data passing through it. Examples include the error cluster or a refnum data type.
== LabVIEW dataflow model ==


An example of how dataflow works and how LabVIEW differs from textual languages is given in [http://www.cs.rpi.edu/research/pdf/99-5.pdf] this PDF titled ''LabVIEW and G as a Computing Language Course''.  
LabVIEW uses the graphical programming language [[G|G Dataflow]], which utilizes wires to represent data dependencies between functions (''nodes'' in LabVIEW terminology).


== External links  ==
A node without input wires can execute immediately, while a node with input wires must wait until the previous node has finished execution.


*[http://en.wikipedia.org/wiki/Dataflow Dataflow] (Wikipedia Definition)
{|
*[http://en.wikipedia.org/wiki/Dataflow_language Dataflow langauge] (Wikipedia Definition)
| [[File:Dataflow - Node without input wires.gif|thumb|left|A node without input wires executes immediately.]]
| [[File:Dataflow - Node with input wires.gif|thumb|left|A node with input wires waits for the previous node to finish execution.]]
|}


[[Category:LabVIEW_fundamentals]]
It is also possible to execute multiple nodes in parallel, as long as they have no data dependencies between each other. However, the total number of nodes that can execute in parallel is limited by the [[LabVIEW Execution System|execution system]].
 
{|
| [[File:Dataflow - Nodes execute in parallel.gif|thumb|left|Nodes without data dependencies execute in parallel. (Note: [[#Visualizing dataflow in LabVIEW|Execution highlighting]] forces the code to run in a single thread which is why they appear to execute sequentially).]]
|}
 
== Visualizing dataflow in LabVIEW ==
 
The [[Debugging|debugging]] option "''Execution Highlighting''" [[File:Execution Highlighting On.png|border|Execution Highlighting enabled|link=Debugging]] will visualize the flow of data while executing a [[VI]] in LabVIEW.
 
This, however, forces the code to run in a single thread, which causes nodes to execute sequentially<ref>[https://forums.ni.com/t5/LabVIEW/Execution-Order/m-p/2655447/highlight/true#M791922 Execution Order] (National Instruments Forums)</ref>.
 
== See also ==
 
* [[G|G Dataflow]]
* [[Debugging]]
* [[LabVIEW Execution System]]
 
== External links ==
 
* [[Wikipedia:Dataflow Dataflow]] (Wikipedia)
* [http://www.ni.com/getting-started/labview-basics/dataflow Dataflow Programming Basics] (National Instruments)
 
== References ==
<references />
 
[[Category:LabVIEW fundamentals]]
[[Category:Dataflow]]

Revision as of 07:12, 28 August 2019

Dataflow programming is a programming paradigm where the execution of functions is determined by their data dependencies. This is fundamentally different from traditional programming paradigms that execute functions in sequence as they appear in the source code.

LabVIEW dataflow model

LabVIEW uses the graphical programming language G Dataflow, which utilizes wires to represent data dependencies between functions (nodes in LabVIEW terminology).

A node without input wires can execute immediately, while a node with input wires must wait until the previous node has finished execution.

A node without input wires executes immediately.
A node with input wires waits for the previous node to finish execution.

It is also possible to execute multiple nodes in parallel, as long as they have no data dependencies between each other. However, the total number of nodes that can execute in parallel is limited by the execution system.

Nodes without data dependencies execute in parallel. (Note: Execution highlighting forces the code to run in a single thread which is why they appear to execute sequentially).

Visualizing dataflow in LabVIEW

The debugging option "Execution Highlighting" Execution Highlighting enabled will visualize the flow of data while executing a VI in LabVIEW.

This, however, forces the code to run in a single thread, which causes nodes to execute sequentially[1].

See also

External links

References

  1. Execution Order (National Instruments Forums)