Using Local Variables, Queues, and Notifiers to Synchronize Data with Parallel Loops
This example demonstrates different architectures you can use to transfer or synchronize data from multiple parallel loops in LabVIEW. This VI compares three types of structures, local variables, queues, and notifiers, and demonstrates the advantages and disadvantages of each structure.
When the primary and secondary loops in the example are executing at the same rate, all loops pass the data without losing or duplicating data. When the secondary loops execute faster or slower, the following issues occur:
With variables, the secondary loop loses data or duplicates data. This example uses local variables, but this problem occurs with all types of variables (local, global and single-process shared variables). There is no workaround for this issue. However, you can use a network-published shared variable with buffering enabled instead.
If the secondary loop executes faster than the primary loop while using a notifier, the notifier waits until the next notification and does not duplicate data.
However, if the secondary loop executes much slower than the primary loop, the notifier might miss the notification and lose the associated data.
With queues, the secondary loop does not lose data if it executes slower or faster than the primary loop. However, if the secondary loop executes significantly slower than the primary loop, the data accumulates in the queue, and you must process this data to avoid losing the accumulated data.
Back to Top