User Guide

Contents

Synchronizing
Independent Updates

In the independent update pattern, both of the following occur:
  • Two tasks contain regions of code that update the same memory locations.
  • It does not matter what order the code regions execute in, as long as the regions do not execute in parallel.
For example, suppose that multiple tasks call
do_something()
:
void do_something() {     static bool initialized = false;     if (!initialized) {         do_the_initialization();         initialized = true;     }     do_the_real_work(); }
The function
do_something()
updates the variable
initialized
as well as the initialized memory locations. The function
do_the_real_work()
will never be called before the initialization happens; and the initialization will only happen once, regardless of which task calls
do_something()
first, as long as two tasks do not try to execute the
if
statement at the same time. If two tasks do try to execute the
if
statement at the same time, they could both see that
initialized
is false and both try to do the initialization.
The following sections describe several aspects of synchronizing independent updates, including explicit locking, assigning locks, and potential problems of using synchronization.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804