Real-Time FIFO Frequently Asked Questions

Overview

This article answers some frequently asked questions about Real Time FIFOs.

Contents

The Real-Time FIFO code ignores errors. If an error gets passed in, the VI still performs its function. How can I work around this?

For maximum performance, the RT FIFO VIs do not check for existing errors. To prevent execution with an error present:

LabVIEW 8.0 and prior: You can modify the RT FIFO VIs to use a case structure that examines an error input. If an error occurs, then one case can simply pass the error through the case structure without executing any other code. If no error occurs, then the other case can execute your code.


LabVIEW 8.2: RT FIFOs are LabVIEW primitive functions in LabVIEW 8.2 and newer.  Primitives are VIs that have been optimized for performance, and do not have an exposed block diagram. The previous workaround must be implemented in a separate subVI.


LabVIEW 8.6 and later: Real-Time FIFO VIs have been replaced with Real-Time FIFO Functions. Real-Time FIFO Functions do not ignore errors and provide standard error in functionality.

 

For the write operation with an array argument, an array resize is performed. Why does this occur?

If the array is the proper size, then this is similar to no operation. If the array is not the correct size, then memory allocation will occur. To avoid memory manager calls, which introduce jitter, make sure that the arrays passed in are always the proper size.

 

Why does the RT FIFO pre-allocate memory to create a bounded FIFO?

An RT FIFO pre-allocates memory to create bounded FIFOs. This makes for a more stable and deterministic RT system. You can set the size of the FIFO before execution so that data will not be overwritten. The RTFIFOCreate.vi includes a size input. If it is not possible to know how much memory to pre-allocate, then send the data back to a host controller and use an unbounded FIFO on the host or use Real Time Shared Memory VIs.

 

What is the difference between RT FIFOs and Queues?

Functionally, RT FIFOs and LabVIEW Queues are both First-in, First-out buffers. However, the following are the major differences between them:

  • RT FIFOs execute deterministically in time-critical code and LabVIEW Queues do not. This comes from the fact that Queues use blocking calls when reading/writing to the shared resource while RT FIFOs use non-blocking calls.
  • RT FIFOs are fixed size while the queues grow as elements are added to them.
  • RT FIFOs will execute the code even if there are errors at input. They can (and will) produce new errors and propagate existing errors. LabVIEW 8.6 and later: RT FIFO VIs have been replaced with RT FIFO Functions. RT FIFO Functions will not execute normally if an error exists at input. RT FIFO Functions provide standard error in functionality.
  • Queues work with any data type, while the data types that can be used with RT FIFOs are limited. Usually any data type that involves additional memory allocations cannot be used with RT FIFOs in order to preserve determinism.

 

What is the difference between the RT FIFO VIs and Shared Variables with RT FIFO enabled?

Shared Variables with RT FIFO enabled creates an invisible low priority communication thread.  This thread allows the high priority threads to access the shared variables uninterrupted.  When the Real-Time system is free from the high priority thread, it then manages the shared variables. Shared Variables with RT FIFO enabled and RT FIFO VIs differ in the following ways:

  • RT FIFO VIs can programmatically be changed, whereas Shared Variable are statically configured before an application is started.
  • RT FIFO VIs have slightly faster write speeds since they do not need to store timestamps.

The main benefit of Shared Variables with RT FIFO enabled is that they are much easier to configure, and that they avoid cluttering the block diagram with create/destroy Vis and extra wires to pass refnums.  A benefit of using RT FIFO VIs is that they are backwards compatible with LV 7.x and earlier (Shared Variables were added in LabVIEW 8.0).

 

Can I use the functions in the Synchronization Palette in RT?

You can use the LabVIEW synchronization functions in RT. However RT FIFOs were built for RT systems. Using the functions available in the Synchronization palette implies the inclusion of shared resources deliberately. We avoid synchronous behavior in RT because synchronous operations require handshaking. Handshaking is always jittery since it uses an interrupt mechanism, and you can find yourself against a deadlock or a race condition if you are not careful of how you program synchronization.

 

Was this information helpful?

Yes

No