01-02-2007 11:57 AM
01-02-2007 12:58 PM
You might consider a queued state machine with a common case to determine timeout conditions or you can do a producer (DAQ read) multiple consumer loops. The first architecture is easy to implement and scale but can cause buffer overruns in the DAQ state) the second will let you balance the processor demand and have better timing through multithreading but is a little more difficult to grasp conceptually.
Paul F.
01-02-2007 02:28 PM
01-02-2007 02:31 PM
I would lean toward the single producer/multiple consumer.
Use a seperate queue for each consumer.
Ben
01-02-2007 03:24 PM
01-02-2007 03:41 PM - edited 01-02-2007 03:41 PM
"wouldn't I be duplicating the data needlessly?" (emphesis added)
The answer depends on how you define "needlessly".
I once wrote dual ported round robin buffer that used a single buffer to store data going to multiple consumers. Worked great and I re-used it multiple time.
Boy was that baby complicated!
It was only dual ported.
In the end I still had to move tht data out of the buffer into wires in the consumers.
But that was before polymorhic queues were available. Queues are not only very fast but efficient as well. Dpending on how you code your VI, LV can actually use the buffer that stores the queue element when you use the data. It can do this because when you dequeue an element, LV knows the queue will not use that buffer anymore.
So yes if you are counting bytes, the queue approach is "wasteful".
If you are counting how long it takes for you to move onto the next feature, then worrying about bytes may be a needless concern.
Ben
Message Edited by Ben on 01-02-2007 03:42 PM
01-03-2007 08:08 AM
Other thoughts;
Another advantage of the multiple queue approach helps when the dat set becomes very large. LV want to use contiguous blocks of memory for its buffers. This will be come an issue if I use a single buffer to store the data for the slowest process since the slowest process will dicatate the size of the buffer.
On the other hand...
Using queues the update each get stored in multiple smaller buffers so the demand for large contiguous block of memory is reduced.
Now the other ideas:
The Queued state machine may not work due to the fact that the slowest process will effectively hang the other processess if it take more time to complete than is allowed for the fastest process.
Furthermore:
If after all of the above you do not want to use the queues and want to develop a multiported round-robbin buffer...
Then I'll be happy to offer what ever help I can.
Ben
01-03-2007 09:38 AM
01-03-2007 09:39 AM