Getting started with the parallel world
I mentioned multithreaded programming a lot in the previous chapter, so it is not hard to guess where that path is taking me next. Multithreaded programming, or multithreading, is the art of running multiple parts of your program at the same time. In Chapter 7, Getting Started with the Parallel World, we took the first steps into the dangerous world of multithreading.
Multithreading is definitely not my first choice for improving existing code. It is hard to write multithreaded programs and very simple to introduce problems, which are then hard to find. Multithreaded programs are also very hard to debug.
To understand multithreading, we should first learn about the processes and threads. In general terms, a process equates to a running program. A process encompasses application code, loaded in memory, and all the resources (memory, files, windows, and so on) used by the program.
A thread, on the other hand, represents the state of the...