Task Interactions and Suitability

If your tasks access the same memory locations, then, left to themselves, they will tend to trip over each other. You can solve this by adding synchronization code to make sure the tasks are well-behaved when they access shared memory locations, but synchronization code can be tedious to add and hard to get right, and it is easy to end up with tasks that spend more time doing synchronization than doing work.

You can use the Suitability tool to provide performance data that helps you choose your tasks wisely.

It is better to minimize data access conflicts in the first place by choosing your tasks wisely. It can be hard to tell, just by looking at your code, where all the sharing problems will be, which is why you will learn how to automate the process by using the Dependencies tool.

However, you can make a good guess whether two proposed tasks are mostly independent of each other or are completely intertwined.

For more complete information about compiler optimizations, see our Optimization Notice.