Chapter 13. Programming for Multiple Cores
WHAT YOU WILL LEARN IN THIS CHAPTER:
The principle features of the Parallel Patterns Library
How to execute loop iterations in parallel
How to execute two or more tasks concurrently
How to manage shared resources in parallel operations
How to indicate and manage sections in your parallel code that must not be executed by multiple processors
If your PC or laptop is relatively new, in all probability it has a processor chip with two or more cores. If it doesn't, you can skip this chapter and move on to the next chapter. Each core in a multi-core processor chip is an independent processing unit, so your computer can be executing code from more than one application at any given time. However, it is not limited to that. Having multiple cores or multiple processors provides you with the possibility of overlapping computations within a single application by having each processor handling a separate piece of the calculations required in parallel. Because at least some of the calculations in your application are overlapped, your application should execute faster.
This chapter will show you how you can use multiple cores within a single application. You will also get to use what you learned about the Windows API in the previous chapter in a significant parallel computation.
PARALLEL PROCESSING BASICS
Programming an application to use multiple cores or processors requires that you organize the computation differently from what you have been used to with serial ...