LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Race Conditions revealing themselves years later?

Solved!
Go to solution
Solution
Accepted by topic author Broken_Arrow

@Broken_Arrow wrote:

@crossrulz wrote:

Well, I must point out the obvious first...

 

1. Local and/or Global variables - I inherited a test system that used locals to pass data between loops and it worked perfectly...on a P4 processor.  Took it to an Intel Core 2, and only every 5th data point was saved.  I rewrote that code to use queues.

 

2. Functional Global Variables - These are a little less obvious since they immediately look like they are protecting against race conditions, but if they are just "get" and "set", ...

 


The program has tons of Locals

The program has tons of Globals

But moreso, the program has tons of FGs with just Set & Get. It seems this code was written when FGs were all the rage. "Look mom, no Globals". Yeah rite.

The code is full of asynchronous parallel structures, and a complex XControl, which is an asynchronous parallel structure with land mines.


In other words, you got lucky for 10 years and a new (faster/more parallel) computer exposed all of your architectural technical debt.  Start the refactor/rewrite process with a good architecture.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 11 of 14
(557 Views)

I've had issues just from upgrading computers, where the device under test use to wait for the computer but now the computer waits for the DUT and thinks it's not there and throws an error.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 12 of 14
(518 Views)

@Broken_Arrow wrote:

But moreso, the program has tons of FGs with just Set & Get. It seems this code was written when FGs were all the rage. "Look mom, no Globals". Yeah rite.


That's not a "Functional" Global, but simply a LabVIEW 2 style global. In LabVIEW 2 there were no globals and this was the way to make them anyways.

 

A Functional Global has some "function" to it that is supposed to protect all updating accesses. The Set (or better yet Init) method is only supposed to be called during application startup when no tasks (parallel loops) have been started up yet, to define a specific starting value. The Get can be available but all updates to the stored value are supposed to happen as an extra method such as Increment, Add, Subtract, etc, etc. To make them a little more distinguished, many people referred to them rather as IGV (Intelligent Global Variable).

 

The Set/Get FGV is basically adding the worst of two worlds together:

 

The overhead of subVI calls and the race conditions of standard global variables.

Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 14
(464 Views)

@rolfk wrote:

@Broken_Arrow wrote:

But moreso, the program has tons of FGs with just Set & Get. It seems this code was written when FGs were all the rage. "Look mom, no Globals". Yeah rite.


That's not a "Functional" Global, but simply a LabVIEW 2 style global. In LabVIEW 2 there were no globals and this was the way to make them anyways.

 

A Functional Global has some "function" to it that is supposed to protect all updating accesses. The Set (or better yet Init) method is only supposed to be called during application startup when no tasks (parallel loops) have been started up yet, to define a specific starting value. The Get can be available but all updates to the stored value are supposed to happen as an extra method such as Increment, Add, Subtract, etc, etc. To make them a little more distinguished, many people referred to them rather as IGV (Intelligent Global Variable).

 

The Set/Get FGV is basically adding the worst of two worlds together:

 

The overhead of subVI calls and the race conditions of standard global variables.


labview stages.png

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 14 of 14
(454 Views)