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:
Incidental sharing: If a memory location is shared, but it is not used to communicate data between tasks, then you can eliminate the sharing by giving each task its own copy of the shared memory. This rarely causes significant increases in execution time or memory consumption. See About Eliminating Incidental Sharing.
Independent updates: If the reads and writes of the memory location occur in updates which can be done in any order, then you can add synchronization code to guarantee that the updates and related code in different tasks cannot be intermingled. This can increase execution time because only one task at a time can be accessing the shared memory location. This limits parallel execution. See About Synchronizing Independent Updates.
If neither of these applies, you might be able to restructure your program to avoid the sharing problem; otherwise you may have to change your task structure. See Difficult Problems: Choosing a Different Set of Tasks.