What Is a Queue in LabVIEW?

Updated Jul 30, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • What is a queue and how do I use it?
  • How can I pass data from one loop into another loop running in parallel?

Solution

A queue is a buffered list that maintains a first in/first out (FIFO) order of data items. A queue in LabVIEW can be used when communicating between processes within a program. You can create a queue using Queue Operations VIs n LabVIEW.

A common example of using a queue is in producer/consumer situations, where one portion of code is creating (or producing) data to be processed (or consumed) by another portion. The advantage of using a queue is that the producer and consumer will run as parallel processes and their rates do not have to be identical.

Figure 1: The VIs on the Queue palette (Programming » Synchronization » Queue Operations)

Additional Information

Unlike an array, it is not possible to randomly access elements in a queue. It is strictly a buffer that provides you the ability to enqueue (add/insert) and dequeue (subtract/remove) elements. The only way to view all the elements in a queue is to dequeue them one by one. You cannot perform data manipulation to all the elements in a queue.

Look for example programs in the LabVIEW shipping examples. Open the LabVIEW Example Finder by selecting Help » Find Examples and then search for Queue in the search tab.

For information on other types of data transfer, see Data Communication Methods in LabVIEW - LabVIEW Help .