Errors happen in a parallel program when two tasks that are executing simultaneously contain operations that access the same memory location. If one of them writes to the location and the other one reads from it, then the result of the read depends on whether it happens before or after the write. If they both write to the location, then the final value in the location depends on which write happens last.
In About Understanding Data Sharing Problems, you learned about the kinds of problems that can occur when tasks access the same memory locations. Two common strategies are used to deal with the following sharing problems:
You can enable multiple functions to run in parallel as two or more tasks. The statements to run in parallel are not limited to function calls (see the help topic Data and Task Parallelism).
When the outermost statements in the annotation site have been placed into tasks, as shown in the following serial example, it is easy to execute them in parallel.
This row shows a source location where memory is being allocated using a non-standard or user-defined memory deallocation. The Correctness tool uses this as a hint about the lifetime of memory accesses, so memory that is allocated will not cause conflicts to be reported if the non-standard or user-defined memory allocation occurs with the span this annotation's execution.