LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dequeue data to multiple while loops

Solved!
Go to solution

Hi,

is there any option to deque data to multiple while loops parallelly without any loss?

 

Multi Queue.png

 

Thanks

Kumaresan

0 Kudos
Message 1 of 23
(532 Views)
Solution
Accepted by Kumaresan.mech

Hi Kumaresan,

 

If you need to broadcast data, you should try using User Event:

PinguX_0-1720175526596.png

 

Message 2 of 23
(525 Views)

Hi Kumaresan,

 


@Kumaresan.mech wrote:

is there any option to deque data to multiple while loops parallelly without any loss?


Please define "without any loss" more precisely!

 

I have done "one producer, multiple consumer" to handle work load items in parallel using a queue: this way you can have "multiple workers" doing work as long as there are items in the queue. There was "no loss" of work items, but they might be executed in a different order than was used when placing them into the queue…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 23
(497 Views)

@Kumaresan.mech  ha scritto:

Hi,

is there any option to deque data to multiple while loops parallelly without any loss?

 

Thanks

Kumaresan


The short answer is no. So you want to process the very same data in two independent loops? If you eplain why, someone could come up with a solution?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 23
(478 Views)

@Kumaresan.mech wrote:

Hi,

is there any option to deque data to multiple while loops parallelly without any loss?

 

Thanks

Kumaresan


If you want to use queues you could use a second queue which forwards the data from consumer 1 to consumer 2.

0 Kudos
Message 5 of 23
(472 Views)

@Kumaresan.mech wrote:

Hi,

is there any option to deque data to multiple while loops parallelly without any loss?

 

Thanks

Kumaresan


It depends how exactly you should process your data.

For example, if you need to handle some data in first loop and some in second, then nothing will wrong with dequeue in both loops from the same queue:

L1.png

No data loss will occur, if one loop is faster than another, then he will process more data than another.

On the other hand, if you need to proceed same data in both loops, then you can use second queue and reinsert data (before or after processing):

L2.png

Also in this case no data loss will occur.

Message 6 of 23
(459 Views)

Supposing you want both consumer loops to get a lossless stream of *all* the data enqueued by the producer...

 

The first response in msg #2 by PinguX is what I would recommend.  It expands to 3rd and 4th consumers more simply and naturally.  I'm just pointing it out again before it gets lost amidst other responses (which are not bad or wrong, just not as straightforward IMO).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 7 of 23
(433 Views)

@Kevin_Price  ha scritto:

Supposing you want both consumer loops to get a lossless stream of *all* the data enqueued by the producer...

 

The first response in msg #2 by PinguX is what I would recommend.  It expands to 3rd and 4th consumers more simply and naturally.  I'm just pointing it out again before it gets lost amidst other responses (which are not bad or wrong, just not as straightforward IMO).

 

 

-Kevin P


What happens if events build up? Are they stacked?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 23
(429 Views)

@pincpanter  a écrit :

@Kevin_Price  ha scritto:

Supposing you want both consumer loops to get a lossless stream of *all* the data enqueued by the producer...

 

The first response in msg #2 by PinguX is what I would recommend.  It expands to 3rd and 4th consumers more simply and naturally.  I'm just pointing it out again before it gets lost amidst other responses (which are not bad or wrong, just not as straightforward IMO).

 

 

-Kevin P


What happens if events build up? Are they stacked?


PinguX_1-1720188472967.png

 

mcduff shared examples of User Events uses recently, here.

0 Kudos
Message 9 of 23
(421 Views)

@pincpanter wrote:


What happens if events build up? Are they stacked?


Events are stored like a queue with a caveat, the mailbox, "the event structure", needs to be registered before any events are sent. If events are sent before the Event Structure is registered for the event, then they are lost. 

Message 10 of 23
(391 Views)