08-06-2010 06:16 PM
Hello everyone, great day.
I have what should be a very straightforward question.
I am currently implemented a Producer Consumer-Consumer-Consumer architecture. ( Acquisition loop >> write acquisition to disk >> read data from disk and process data >> display user display based off data.) In plain English I have a loop created data, a loop storing that data, a loop reading from disk, and a loop displaying a user interface. ( This is not meant to be a real-time application and I am aware of the overhead created by writing and reading from the disk.) Just stick with me on this one.
So my problem occurs regarding the second loop. This loop is responsible for writing the queued data (produced in the "Acquisition" loop) to disk. The problem is it also, feeds a queue to the "reading from disk" loop. This setup causes a few obstacles.The main obstacle occurs as a result of the nature of LabVIEW queues. The "write to disk" loop only writes one element from the "Acquisition" queue at a time. This usually is not much of a problem, until you take into the account that this loop also determines the execution of the "reading from disk" loop, with the use of queues. As a consequence this loop determines the rate of the next loop, and therefore has potential to slow down the application, and leave a large number of elements in the queue. Furthermore, you must keep in mind I am only queueing about 7MB of data per element, and my HDD has a average write speed of 60MB with a 64MB cache. As a result, of my setup I can only write one element at a time, consequently causing me to only utilize 7/60MB of the bandwidth of my disk.
My question is; Is there any possible way to have the "write to disk" loop write multiple elements in the queue simultaneously. I'm hoping I can write enough elements simultaneusly that I can utilize my entire 60MB write bandwith and speed up the execution of any sub routines that rely of the data being written to disk.
I know there are probably better architecture for completing this application, but at the moment I am limited to this architecture. If you have suggestions for other architectures I am more than willing to listen, but ultimatley I am looking for a way to improvise the simultaneus queue reads, and then writing them to disk with my current structure.
Thanks everyone, I appreciate the help.
Taylor S. Amarel
Learning is living.
Solved! Go to Solution.
08-06-2010 07:01 PM
You can put your Dequeue Element function in a For Loop and set N to some number so that you get more than one element from the queue at one time. Enable indexing and you will have an array of data. Write the entire array to the disk. This should speed things up quite a bit. Don't forget to use shift registers for the error wires and the queue reference in the For Loop, and also put a small delay in the For Loop to prevent 100% CPU usage.
08-06-2010 07:45 PM
Kudos tbob!!!
That was exactly what I was looking for! Thanks for the quick and straight-to-the-point responce. I very much appreciate it, we need more people like you on these forums.
Cheers, have a great day!
Taylor S. Amarel
Learning is living.