LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what is the purpose of queue functions?

well what is the relation of queue functions of Labview
and queuing theory, like MM1 system MD1 system etc.
thanks
0 Kudos
Message 1 of 8
(4,207 Views)
A queue in LV isn't very fancy. It's simply a FIFO (first-in, first-out) stack. What you build on top of that is up to you.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(4,207 Views)
"fais" wrote in message
news:5065000000080000007C7D0000-1042324653000@exchange.ni.com...
> well what is the relation of queue functions of Labview
> and queuing theory, like MM1 system MD1 system etc.
> thanks

It's been a little while for me, but I can attempt to explain if others are
curious.

LV provides you with an atomic FIFO/LIFO. The MM1, MD1 notation (I had to
look it up to refresh, it's called Kendall Notation) is used to describe the
queue. Other people pointed out the basic FIFO behavior, but you also have
parameters which describe the queue.

You want to determine "will this queue explode, or will it be stable", and
you want to be able to determine things like waiting time, queue length,
server load, etc. The question becomes, is the arri
val time and processing
time constant or is it a function of length?

In these kinds of queue analysis, I thought you typically analyze the
behavior of your own waiting/processing code. In terms of the raw LV queue
functions, I haven't seen this described anywhere. Maybe somebody from NI
could jump in.

-joey
Message 3 of 8
(4,207 Views)

I have been teaching LabVIEW to myself for a while now, and just came to a new topic that I cant seem to figure out : Queues.

I understand, conceptually, the function of queues, but could someone please give me an example of when this would be neccessary?

It almost seems you could replicate this FIFO behavior with some simple array functions.
I guess I am just not understanding it.

Cory K
0 Kudos
Message 4 of 8
(3,747 Views)

Others may have a better explanation and example, but I have found that queues in LabView are very useful when you need to transfer a lot of information quickly and want to make sure you don't overflow or drop elements. They are better at this than using variables because the writer can keep writing whether or not the reader has read the last element. 

 

For instance, recently we were trying to record data on a cRIO device and get the fastest rates possible. We were recieving data from the FPGA FIFO and writing directly to file. When you try to record 32 channels of 32 bits/element at 1 kHz you begin to test the limits of your write to file function. Queues worked better than variables for this because every so many cycles the write function would sort of hiccup and pause, causing the elements in the queue to increase (backup). If we were using regular variables we would have had to wait for the recording to catch up before we could continue reading data. This would mean we would be overflowing the FIFO or missing data points. However, with a queue, elements could back up a little and then the record function would catch up. (As a side note, write to binary file worked faster than TDMS in these benchmark experiments.)

 

Can anyone explain it better?

---------------------------------
[will work for kudos]
Message 5 of 8
(3,736 Views)

There are a few good benefits to queues that are quick to memory. 

 

Queues break dataflow, a named queue is the same queue anywhere in an application. 

This is great for multi-loop applications (See Producer-Consumer architecture in the help). 

 I use it most here with a gui loop to handle user events and queue up operations to happen in another loop. 

0 Kudos
Message 6 of 8
(3,733 Views)
I had a hard time trying to figure out the usefulness of queues myself at first. But over the years I've come to appreciate them and use them quite often. They are perfect in a producer/consumer design pattern where the producing and consuming occur at different rates. And I also like to use them in queued state machines.
PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 7 of 8
(3,727 Views)
One of the advantages of a queue over an array is that code can wait for data from a queue without polling.  If you transfer data between two loops using an array in a functional global, one loop constantly needs to poll to see if there's new data available.  With a queue the code can just wait until the data appears.  If the queue is long enough it can guarantee that new data won't be lost even if it arrives while the previous data is still being processed.
0 Kudos
Message 8 of 8
(3,712 Views)