What is a good way to use the queues for the model of consumers/producers?
I am following the model of consumers/producers to use the queue to synchronize the following process: the producer is a loop to produce a number N, I will put each number generated in a table and after each 5 numbers generated, I put the table in the queue and pass it on to the consumer. I have to wait the use by consumers of the data and it will then remove the item from queue so that producers will have the chance to produce another 5 numbers. As I put the maximum size of the queue one, I expect that the producer and the consumer turns to produce / consume all five numbers and the opportunity to another. Here is my code
When the checkbox is false, the code will be
For the first 5 numbers, product will generate every thing right and put it in the table, and it's going to pass the array to the quere so that the consumer will have the chance to loop through the table. I except the procude loop will continue only when the queue is available (i.e. all items are deleted), but it seems that once the consumer starts the loop loop of the product will continue (if the indicator x + 1 and x 2 will be changed to numbers). But this isn't what I want, I know there must be something wrong, but I can't say it is.
As you say in 1, sequency structure to enforce the order of execution, that's why I put it here, in this example, the simple question, I replace the complete code with increase in the number, in the real case, the first markers + 1 and + 2 must be performed in this order.
1. get rid of all the structures of the sequence. None of them are nothing but apply a work order which would have been the same without them.
So even if you delete the sequence structure, there will be a fixed & defined order and it is because LabVIEW follows the MODEL of FLOW OF DATA.
Data flow model (more precisely in the context of LabVIEW): a block diagram node runs when it receives the required inputs. When a node is running, it produces output data and transmits data to the next node in the path of the data stream. The flow of data on the nodes determines the order of execution of the VIs and functions on the block diagram (click here for reference).
Now in your code, just remove the sequence structure will not make you order will be going to stay the same, but you need to do some very minor changes (as thread of the error in loop, before that he go to the node "Élément Dequeue").
Come to the main point: it's a good way to use the queue for the consumer/pmodel that?
The model you are using (and qualifying as consumer/pmodel) is much too deviated from the original consumer/pmodel which model.
For the second, Yes, it's my fault for delete, though. I'm actually the example of model of producer/consumer design pattern, but I do not pay attention to the while loop in the part of the consumer.
While loops (two producers & consumers) are the essential part of this architecture and cannot be deleted. You can start your code using standard model.
Tags: NI Software
Maybe you are looking for
I have 3 charges on my bank account for $ 14.99, $9.99 and $5.98... and I don't know what they are, please specify Thank you
My iMac 27 "(fin 2014) at work comes without a stand we bought to go straight into the wall, but we're going to have a shuffle of layout and that I could do to get the original media, but I am at a loss for what to look for." Any ideas?
Hello Just moved from a Windows machine to a new MacBook Pro and my old printer do not work as there is no compatible driver. Today I bought a new Canon Maxify MB5350, which I'm having difficulty level upward. Can someone please.
Hi all My DAQ gives me data in the form of a table 1 d or 2D-waverform digital time. How to export the data in an excel file or copy it into a table?
Now I need all the updates, but the computer do not recognized I'm addicted to the internet? I don't know what to do. Please please don't tell not to get SP3, the computer can not get on the internet and this is the first version of XP in 2001 or 200