LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can a single-process shared variable be both FIFO and single element?

Solved!
Go to solution

How can a single-process shared variable be both FIFO and single element at the same time?

 

I'm reading the NI recommended practices for communicating between a deterministic loop and a non-deterministic loop.  It says to use a Single-Process Shared Variable that is both FIFO and single element.  Ok I must not be getting something... because in my mind these two things should be mutually exclusive.  How do you have the 1st of only one element?

 

inter-prosses communication.png

0 Kudos
Message 1 of 4
(3,115 Views)
Solution
Accepted by Chon.Mech

What "RT FIFO Enabled" means is that when you use the shared variables in a Timed Loop it actually is writing to an automatically created RT FIFO.

 

The key here is that typically shared variables are shared resources and can add jitter to deterministic tasks if another loop is using the variable at the same time as your deterministic loop.

 

So here's the takeaways, when using Shared Variables with RT FIFO Enabled:

  • Normal loops read and write the shared variable in the same manner as they always do.
  • Timed Loops read and write an RT FIFO instead
    • The data is passed between the RT FIFOs and the shared variable in a non deterministic loop automatically

RT FIFOs exist because their architecture designates them as non blocking so that when the timed loop tries to access them it is guaranteed immediate access to a memory space.

 

Does this answer your question?

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
Message 2 of 4
(3,080 Views)

Ah, Ok this is starting to make sense now.  

 

If I use global variables, to communicate between two loops, I can create jitter because both can not access the same variable at the same time.  But the RT FIFO will create sort of a "micro queue" that exist just long enough to prevent that.  Did I get that right?

0 Kudos
Message 3 of 4
(3,040 Views)

The micro queue is not dynamically created and destroyed, it exists the whole time, otherwise yes you got it exactly!

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
Message 4 of 4
(3,028 Views)