Example Code

Horse Race Conditions - Local Race Conditions example using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
Horse Race Conditions is the exciting game of which loop will come in first!

Place your bets and watch as your four parallel loops battle it out in an all-out race to the local variable.

 


Description
This demonstrates the dangers of using local variables and provides a visual aid to understanding how a race condition produces unpredictable behavior.


Requirements

Software:

LabVIEW 2014(or compatible)

 

Steps to Implement or Execute Code

  1. Download the .zip file
  2. Set your desired configuration (a, x1, x2, degrees, etc)
  3. Run the VI

 

Additional Information or References
VI Block Diagram

1.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.