07-31-2008 10:07 AM - edited 07-31-2008 10:08 AM
07-31-2008 03:06 PM
I won't answer all the question for Damien, but I can answer some of them.
1. Do you create the queue with size=1 originally? If so, does this allow LabVIEW to do some further optimizations?
If you're diligent about the way you implement this (and I believe you have to be for it to work correctly), you don't actually have to set the queue size, but in any case, setting the size on a queue has no optimization value (at least according to the current documentation).
2. How are "writes" handled exactly? I first picture doing a Deque (and discard) followed by an Enqueue of new data. Is this guaranteed to act "atomically"?
That's exactly the concept, and it also has to do with your next question. The idea is that you always set the dequeue timeout to -1 and that you start every operation with a dequeue. That means that if the queue is empty, the entire read-write segment has to wait until the segment which currently has the element puts it back into the queue. This basically guarantees an atomic operation.
Regarding the data copies, I suppose that depends on the exact nature of the diagram. Remember that even if you want to re-enqueue quickly, LabVIEW probably does not "know" that you're using the queue to lock other sections of the code and will probably prefer to optimize the data copies. Of course, that's a guess, but not a wild one.
08-01-2008 08:54 AM
08-02-2008 02:17 PM
As you mentioned, it's meaningless in this case, but: "max queue size only limits the number of elements in the queue. It does not preallocate memory" (from the LabVIEW 8.5 help). It is important in queues which hold more data.
DFGray wrote:Setting the size does give you a bit of an optimization due to all element allocation occurring at queue initialization.
08-05-2008 07:55 AM - edited 08-05-2008 07:56 AM
08-05-2008 10:00 AM
08-05-2008 10:10 AM
08-05-2008 10:42 AM - edited 08-05-2008 10:44 AM
08-06-2008 04:37 PM