Race condition: Difference between revisions
Added "External Links">>Race Condition (Wikipedia Definition) |
m Race Condition moved to Race condition: renaming to conform to style guidelines |
(No difference)
|
Revision as of 18:07, 22 June 2007
A race condition in LabVIEW occurs when two or more sections of code attempt to update a common variable. This often occurs when local or global variables are overused.
Before

The first 16 bytes of the file will be read by the left instance of Read Characters From File.vi. Offset will be set to 16, BUT the loop at the right may start and read 22 bytes from the default value of Offset rather than the expected 16.
After

Data flow will ensure that this VI reads 16 bytes from the beginning of the file, then 22 bytes at a time for 16 iterations.
Summary
Local and global variables can break the data flow model. If Read and Write instances of local or global variables exist on a single block diagram, they are often part of a loop structure. Variable instances should be replaced with a shift register and data written directly to the control.
External Links
- Race Condition (Wikipedia Definition)