- By Rod Stephens
This chapter discussed multiprocessing and the ways modern computers provide parallel computing, or at least an illusion of it. All modern computers provide multitasking, quickly switching back and forth among applications to make it seem as if they are all running at the same time.
Some computers have more than one element that can execute instructions, and those computers can perform multiprocessing, truly executing multiple tasks at the same time. Those computers may have multiple processors, or they may have multiple cores within the same processor.
Multi-core systems are becoming increasingly common. To get the best performance from your programs, you need to consider parallel programming issues as you write your programs. If you keep the individual parts of a program as separate as possible, you may be able to execute them on different threads running on separate cores, which will improve performance.
Even if you don’t plan to run a program across multiple threads, keeping the various elements of your programs as separate as possible makes them easier to write and debug.
Chapter 1, “Computer Hardware,” described a range of computer hardware that you might use, such as desktops, laptops, and smartphones. This chapter described topics in parallel programming that you can use to make computer software take advantage of the processors and cores provided by the computer’s hardware. The next chapter bridges the gap between the topics of hardware and software, explaining how programming environments translate the software that you write into commands that the hardware can actually execute.