{"id":200,"date":"2011-08-19T15:31:17","date_gmt":"2011-08-19T20:31:17","guid":{"rendered":"http:\/\/labviewjournal.com\/?p=200"},"modified":"2019-07-30T18:02:37","modified_gmt":"2019-07-30T23:02:37","slug":"race-conditions-and-functional-global-variables-in-labview","status":"publish","type":"post","link":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/","title":{"rendered":"Race Conditions and Functional Global Variables in LabVIEW"},"content":{"rendered":"<p>Do you know the party game, \u201ctelephone\u201d?\u00a0 It\u2019s where a group gets in a circle, and someone whispers a statement to the person next to them, who in turn whispers it to the person next to them, until the message gets all the way around the circle.\u00a0 Invariably, the message gets corrupted along the way, and the statement at the end has lost all of its original meaning.\u00a0 I find it both funny and sad.<\/p>\n<p>The same thing seems to have happened with some information on race conditions and functional global variables in LabVIEW, so I want to try to clear it up.<\/p>\n<p>It started earlier this week when I found an NI-internal document that\u2019s used for code reviews, which said\u2026<\/p>\n<blockquote>\n<h5>Functional Global Variables<\/h5>\n<p>A way to avoid race conditions associated with local and global variables is to use functional global variables. Functional global variables are VIs that use loops with uninitialized shift registers to hold global data.<\/p>\n<p>\u00b7 \u2026<\/p>\n<p>\u00b7 The FGV eliminates race conditions<\/p><\/blockquote>\n<p>Whoa!\u00a0 Given no context, that last statement is just plain wrong.<\/p>\n<p>An internal document is one thing, but I\u2019ve also heard this echoed by at least one customer in the past month, and also in an informal conversation here at NI.<\/p>\n<p>What\u2019s going on???\u00a0 I decided to find out.\u00a0 Keep reading to understand more about race conditions and how this game of \u201ctelephone\u201d progressed to where we are today.<\/p>\n<p><!--more--><\/p>\n<h1>The LabVIEW Style Checklist<\/h1>\n<p>It gets worse.\u00a0 Here\u2019s a snippet from NI\u2019s \u201cLabVIEW Style Checklist\u201d in the LabVIEW 2011 Help, where I\u2019ve bolded part of the last, disturbing paragraph\u2026<\/p>\n<blockquote><p><a name=\"avoid_local_variables\"><\/a>Avoid using local variables when you can use a wire to transfer data. Every local variable that reads the data makes a copy of the data. Use global and local variables as sparingly as possible.<\/p>\n<p>Details<\/p>\n<p>You can use global and local variables to write VIs efficiently, but use global and local variables as sparingly as possible. If you misuse or abuse global and local variables, particularly with array data types, the memory usage of the VI increases and the performance is affected.<\/p>\n<p>You can encounter race conditions when reading from and writing to local or global variables in the same application. Race conditions are difficult to debug because there is no data dependency between different instances of the same local or global variable on the block diagram.<\/p>\n<p><strong>Consider using functional global variables instead of global variables.<\/strong> Functional global variables do not create extra copies of data and allow certain actions, such as initialize, read, write, and empty. <strong>They also eliminate race conditions.<\/strong><\/p><\/blockquote>\n<p>Really?\u00a0 <em>Really?<\/em>\u00a0 FGV\u2019s magically eliminate race conditions?\u00a0 I\u2019m starting to get upset.<\/p>\n<p>With the help of Steve K., an NI AE Specialist, I started working my way upstream to find the source of this misinformation.\u00a0 Steve pointed me to some NI training course material and some of the LabVIEW help.\u00a0 I\u2019ve started working my backwards through the circle to find out what was originally said, and how it got misinterpreted along the way.<\/p>\n<h1>LabVIEW Core 1 Training Course<\/h1>\n<p>Here, I think, is the ultimate source\u2026\u00a0 It\u2019s our LabVIEW Core 1 training course.<\/p>\n<p>The good news is that the material in the training class is written well and accurately; it\u2019s at the beginning of the circle, before the message got corrupted.<\/p>\n<p>I\u2019m going to borrow some of the Core 1 content to explain some of the concepts and issues.\u00a0 Lesson 9 is about using local and global variables to communicate information between parallel loops. It then covers the concept of race conditions, and uses an example like this\u2026<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/08\/Core-1-Example.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-198 size-full\" src=\"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/08\/Core-1-Example.png?resize=286%2C313&#038;ssl=1\" alt=\"\" width=\"286\" height=\"313\" srcset=\"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/08\/Core-1-Example.png?w=286&amp;ssl=1 286w, https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/08\/Core-1-Example.png?resize=274%2C300&amp;ssl=1 274w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/a><\/p>\n<blockquote><p>Consider what happens if the loop operations happen in the following order:<\/p>\n<ol>\n<li>Loop 1 reads the global variable.<\/li>\n<li>Loop 2 reads the global variable.<\/li>\n<li>Loop 1 increments the value it read.<\/li>\n<li>Loop 2 increments the value it read.<\/li>\n<li>Loop 1 writes the incremented value to the global variable.<\/li>\n<li>Loop 2 writes the incremented value to the global variable.<\/li>\n<\/ol>\n<\/blockquote>\n<p>In this case, the count variable gets incremented by one, even though it was accessed twice.\u00a0 Just to be clear, LabVIEW could also choose to execute the same VI like this\u2026<\/p>\n<ol>\n<li>Loop 1 reads the global variable.<\/li>\n<li>Loop 1 increments the value it read.<\/li>\n<li>Loop 1 writes the incremented value to the global variable.<\/li>\n<li>Loop 2 reads the global variable.<\/li>\n<li>Loop 2 increments the value it read.<\/li>\n<li>Loop 2 writes the incremented value to the global variable.<\/li>\n<\/ol>\n<p>And since this is all happening in parallel threads, possibly on two separate cores, the exact interaction between loops 1 and 2 can vary from iteration to iteration of each loop.<\/p>\n<p>This is \u201ccorrect\u201d behavior from LabVIEW\u2019s perspective; the diagram doesn\u2019t specify any order dependency between the two loops, so it doesn\u2019t impose any.<\/p>\n<p>But probably, you want the \u201cread, increment, write\u201d to happen atomically\u2014as if it were a single operation that could never be interrupted.\u00a0 This is such a common thing to need to do that CPUs actually have this built in as a machine instruction.\u00a0 It\u2019s very important for avoiding race conditions across multiple CPUs in a system.<\/p>\n<h1>Critical Sections<\/h1>\n<p>LabVIEW Core 1 introduces the concept of <em>critical sections<\/em>. A critical section is a piece of code that accesses a shared resource that must not be concurrently accessed by more than one thread of execution.<\/p>\n<p>The \u201cread, increment, write\u201d, then, is a critical section.\u00a0 You want to ensure that those three things happen atomically\u2014without interruption.\u00a0 Continuing with the material from Core 1\u2026<\/p>\n<blockquote><p><span style=\"color: #444444;\">One way to protect critical sections is to place them in subVIs. You can only call a non-reentrant subVI from one location at a time. Therefore, placing critical code in a non-reentrant subVI keeps the code from being interrupted by other processes calling the subVI. Using the functional global variable architecture to protect critical sections is particularly effective, because shift registers can replace less protected storage methods like global or single-process shared variables. Functional global variables also encourage the creation of multi-functional subVIs that handle all tasks associated with a particular resource.<\/span><\/p><\/blockquote>\n<p>Great.\u00a0 FGVs are a good way to protect a critical section, which in turn can eliminate race conditions.<\/p>\n<h1>Action Engines<\/h1>\n<p>I want to be especially clear that the FGV must contain the critical section for it to eliminate race conditions.\u00a0 In our example above, the critical section was \u201cread, increment, write\u201d.\u00a0 If you had an FGV that just did \u201cread\u201d and \u201cwrite\u201d, it wouldn\u2019t protect the critical section.<\/p>\n<p>Action engine is a term that was created to describe a special kind of FGV where it does more than just read and write to data storage.\u00a0 An \u201caction\u201d can be anything.\u00a0 In our example, it\u2019s \u201cread, increment, write\u201d.\u00a0 We could have other actions, such as modifying a file, updating a database, performing I\/O; anything we wanted to protect from executing in multiple threads at the same time.<\/p>\n<p>So unlike simple variables, which can just read and write, an action engine can perform a more meaningful action which includes the entire critical section that you want to protect.<\/p>\n<p>We cover this in the LabVIEW 2011 Help, in a section on \u201cUsing Local and Global Variables\u201d in a discussion about \u201cread, modify, write\u201d\u2026<\/p>\n<blockquote><p>Race conditions also occur when two operations are trying to update a global variable in parallel. In order to update the global variable, an operation reads the value, modifies it, and writes it back to the location. When the first operation performs the read-modify-write action and the second operation follows after, the outcome is correct and predictable. When the first operation reads and then the second operation reads, both operations modify and write a value. This action causes the read-modify-write race condition and produces invalid or missing values.<\/p>\n<p>You can avoid race conditions associated with global variables by using functional global variables. Functional global variables are VIs that use loops with uninitialized shift registers to hold global data. A functional global variable usually has an <strong>action<\/strong> input parameter that specifies which task the VI performs. The VI uses an uninitialized shift register in a While Loop to hold the result of the operation. Using one functional global variable instead of multiple local or global variables ensures that only one operation executes at a time, so you never perform conflicting operations or assign conflicting values to stored data.<\/p><\/blockquote>\n<p>Here, the word \u201coperation\u201d is more or less a critical section\u2014a \u201cread, modify, write\u201d action.\u00a0 I am a little troubled by the first sentence of that second paragraph just above\u2026<\/p>\n<blockquote><p>You can avoid race conditions associated with global variables by using functional global variables.<\/p><\/blockquote>\n<p>If you remove the context of a \u201cread, modify, write\u201d critical section, it will be misinterpreted.\u00a0 Here\u2019s an example\u2026<\/p>\n<h1>LabVIEW Core 3 Training Course<\/h1>\n<p>As we sometimes do in our training material, we revisit earlier topics when they\u2019re relevant to new material.\u00a0 The LabVIEW Core 3 class includes this paragraph in a discussion about Information Hiding\u2026 [emphasis is mine]<\/p>\n<blockquote>\n<h5>Functional Global Variables<\/h5>\n<p>You can use uninitialized shift registers in For or While Loops to hold data as long as the VI never goes out of memory. The shift register holds the last state of the shift register. A loop with an uninitialized shift register is known as a functional global variable. The advantage of a functional global variable over a global variable is that you can control access to the data in the shift register. Also, <strong>the functional global variable eliminates the possibility of race conditions<\/strong> because only one instance of a functional global variable can be loaded into memory at a time.<\/p><\/blockquote>\n<p>Oops, we misplaced a bunch of context about critical sections and actions.\u00a0 FGVs can protect critical sections, but they do not inherently eliminate race conditions.<\/p>\n<h1>Summary<\/h1>\n<p>I might summarize like this\u2026<\/p>\n<blockquote><p><em><strong>If you have an FGV which is an action engine which protects a critical section, you eliminate race conditions associated with that critical section.<\/strong><\/em><\/p><\/blockquote>\n<p>I might also simplify it to this&#8230;<\/p>\n<blockquote><p><em><strong>Functional Global Variables are a good way to protect critical sections.<\/strong><\/em><\/p><\/blockquote>\n<p>I suppose I should have started with a discussion about whether you even <em>need<\/em> to use global or local variables.\u00a0 If you don\u2019t have information that needs to be shared across threads, you probably shouldn\u2019t be using them.\u00a0 All of this is discussed better in our Core 1 training material.<\/p>\n<p>Speaking of which, I like to think that someone who had gone through our training courses would have known the caveats that go along with the statements above that talk about how FGV\u2019s eliminate race conditions.\u00a0 If you haven\u2019t taken our training, I encourage you to visit <a href=\"http:\/\/www.ni.com\/training\/\">http:\/\/www.ni.com\/training\/<\/a>, and I bet you\u2019ll find some courses that will be valuable.<\/p>\n<p>Thanks for reading this far.\u00a0 I\u2019d be curious, if you\u2019re willing to confess in the comments section below, if my information about FGVs, race conditions, and action engines is new to you and if it\u2019s helpful, or if you think there\u2019s anything unclear or something I\u2019ve forgotten to cover.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you know the party game, \u201ctelephone\u201d?\u00a0 It\u2019s where a group gets in a circle, and someone whispers a statement to the person next to them, who in turn whispers it to the person next to them, until the message gets all the way around the circle.\u00a0 Invariably, the message gets corrupted along the way, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":128,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_post_was_ever_published":false},"categories":[4],"tags":[10,24,34,36,58,68],"class_list":["post-200","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","tag-action-engine","tag-critical-sections","tag-fgv","tag-global","tag-race-conditions","tag-variables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Race Conditions and Functional Global Variables in LabVIEW - LabVIEW Field Journal Archives<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Race Conditions and Functional Global Variables in LabVIEW - LabVIEW Field Journal Archives\" \/>\n<meta property=\"og:description\" content=\"Do you know the party game, \u201ctelephone\u201d?\u00a0 It\u2019s where a group gets in a circle, and someone whispers a statement to the person next to them, who in turn whispers it to the person next to them, until the message gets all the way around the circle.\u00a0 Invariably, the message gets corrupted along the way, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/\" \/>\n<meta property=\"og:site_name\" content=\"LabVIEW Field Journal Archives\" \/>\n<meta property=\"article:published_time\" content=\"2011-08-19T20:31:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-30T23:02:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"100\" \/>\n\t<meta property=\"og:image:height\" content=\"100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Brian\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brian\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/\"},\"author\":{\"name\":\"Brian\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#\\\/schema\\\/person\\\/5a7979adfffe497f72353515e7e4698b\"},\"headline\":\"Race Conditions and Functional Global Variables in LabVIEW\",\"datePublished\":\"2011-08-19T20:31:17+00:00\",\"dateModified\":\"2019-07-30T23:02:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/\"},\"wordCount\":1829,\"commentCount\":25,\"publisher\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/stravaro.com\\\/lvjournal\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2011\\\/07\\\/brian_square.png?fit=100%2C100&ssl=1\",\"keywords\":[\"action engine\",\"critical sections\",\"FGV\",\"global\",\"race conditions\",\"variables\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/\",\"url\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/\",\"name\":\"Race Conditions and Functional Global Variables in LabVIEW - LabVIEW Field Journal Archives\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/stravaro.com\\\/lvjournal\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2011\\\/07\\\/brian_square.png?fit=100%2C100&ssl=1\",\"datePublished\":\"2011-08-19T20:31:17+00:00\",\"dateModified\":\"2019-07-30T23:02:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/stravaro.com\\\/lvjournal\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2011\\\/07\\\/brian_square.png?fit=100%2C100&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/stravaro.com\\\/lvjournal\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2011\\\/07\\\/brian_square.png?fit=100%2C100&ssl=1\",\"width\":100,\"height\":100,\"caption\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/2011\\\/08\\\/race-conditions-and-functional-global-variables-in-labview\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Race Conditions and Functional Global Variables in LabVIEW\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#website\",\"url\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/\",\"name\":\"LabVIEW Field Journal Archives\",\"description\":\"Advanced LabVIEW with the NI Field Architects\",\"publisher\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#organization\",\"name\":\"Stravaro, LLC\",\"url\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/stravaro.com\\\/lvjournal\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2014\\\/10\\\/Twitter_Logo_512-54543176_site_icon.png?fit=512%2C512&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/stravaro.com\\\/lvjournal\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2014\\\/10\\\/Twitter_Logo_512-54543176_site_icon.png?fit=512%2C512&ssl=1\",\"width\":512,\"height\":512,\"caption\":\"Stravaro, LLC\"},\"image\":{\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/#\\\/schema\\\/person\\\/5a7979adfffe497f72353515e7e4698b\",\"name\":\"Brian\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1b65e73e808770fb97191694e008a472c044ef97914aa71f86b7ce1987dd0bf3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1b65e73e808770fb97191694e008a472c044ef97914aa71f86b7ce1987dd0bf3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1b65e73e808770fb97191694e008a472c044ef97914aa71f86b7ce1987dd0bf3?s=96&d=mm&r=g\",\"caption\":\"Brian\"},\"sameAs\":[\"https:\\\/\\\/stravaro.com\\\/\"],\"url\":\"https:\\\/\\\/stravaro.com\\\/lvjournal\\\/author\\\/brian\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Race Conditions and Functional Global Variables in LabVIEW - LabVIEW Field Journal Archives","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/","og_locale":"en_US","og_type":"article","og_title":"Race Conditions and Functional Global Variables in LabVIEW - LabVIEW Field Journal Archives","og_description":"Do you know the party game, \u201ctelephone\u201d?\u00a0 It\u2019s where a group gets in a circle, and someone whispers a statement to the person next to them, who in turn whispers it to the person next to them, until the message gets all the way around the circle.\u00a0 Invariably, the message gets corrupted along the way, [&hellip;]","og_url":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/","og_site_name":"LabVIEW Field Journal Archives","article_published_time":"2011-08-19T20:31:17+00:00","article_modified_time":"2019-07-30T23:02:37+00:00","og_image":[{"width":100,"height":100,"url":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1","type":"image\/png"}],"author":"Brian","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Brian","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#article","isPartOf":{"@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/"},"author":{"name":"Brian","@id":"https:\/\/stravaro.com\/lvjournal\/#\/schema\/person\/5a7979adfffe497f72353515e7e4698b"},"headline":"Race Conditions and Functional Global Variables in LabVIEW","datePublished":"2011-08-19T20:31:17+00:00","dateModified":"2019-07-30T23:02:37+00:00","mainEntityOfPage":{"@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/"},"wordCount":1829,"commentCount":25,"publisher":{"@id":"https:\/\/stravaro.com\/lvjournal\/#organization"},"image":{"@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1","keywords":["action engine","critical sections","FGV","global","race conditions","variables"],"articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/","url":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/","name":"Race Conditions and Functional Global Variables in LabVIEW - LabVIEW Field Journal Archives","isPartOf":{"@id":"https:\/\/stravaro.com\/lvjournal\/#website"},"primaryImageOfPage":{"@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#primaryimage"},"image":{"@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1","datePublished":"2011-08-19T20:31:17+00:00","dateModified":"2019-07-30T23:02:37+00:00","breadcrumb":{"@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#primaryimage","url":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1","contentUrl":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1","width":100,"height":100,"caption":""},{"@type":"BreadcrumbList","@id":"https:\/\/stravaro.com\/lvjournal\/2011\/08\/race-conditions-and-functional-global-variables-in-labview\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/stravaro.com\/lvjournal\/"},{"@type":"ListItem","position":2,"name":"Race Conditions and Functional Global Variables in LabVIEW"}]},{"@type":"WebSite","@id":"https:\/\/stravaro.com\/lvjournal\/#website","url":"https:\/\/stravaro.com\/lvjournal\/","name":"LabVIEW Field Journal Archives","description":"Advanced LabVIEW with the NI Field Architects","publisher":{"@id":"https:\/\/stravaro.com\/lvjournal\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/stravaro.com\/lvjournal\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/stravaro.com\/lvjournal\/#organization","name":"Stravaro, LLC","url":"https:\/\/stravaro.com\/lvjournal\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stravaro.com\/lvjournal\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2014\/10\/Twitter_Logo_512-54543176_site_icon.png?fit=512%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2014\/10\/Twitter_Logo_512-54543176_site_icon.png?fit=512%2C512&ssl=1","width":512,"height":512,"caption":"Stravaro, LLC"},"image":{"@id":"https:\/\/stravaro.com\/lvjournal\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/stravaro.com\/lvjournal\/#\/schema\/person\/5a7979adfffe497f72353515e7e4698b","name":"Brian","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1b65e73e808770fb97191694e008a472c044ef97914aa71f86b7ce1987dd0bf3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1b65e73e808770fb97191694e008a472c044ef97914aa71f86b7ce1987dd0bf3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b65e73e808770fb97191694e008a472c044ef97914aa71f86b7ce1987dd0bf3?s=96&d=mm&r=g","caption":"Brian"},"sameAs":["https:\/\/stravaro.com\/"],"url":"https:\/\/stravaro.com\/lvjournal\/author\/brian\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/stravaro.com\/lvjournal\/wp-content\/uploads\/sites\/2\/2011\/07\/brian_square.png?fit=100%2C100&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":1,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/posts\/200\/revisions\/651"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/media\/128"}],"wp:attachment":[{"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stravaro.com\/lvjournal\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}