Getting Started with the Parallel World
If you are reading this book from start to finish, without skipping chapters, you’ve been through quite a lot. I’ve discussed algorithms, optimization techniques, memory management, and more, but I’ve quite pointedly stayed away from parallel programming (or multithreading, as it is also called).
I had a very good reason for that. Parallel programming is hard. It doesn’t matter if you are an excellent programmer. It doesn’t matter how good the supporting tools are. Parallel programming gives you plenty of opportunities to introduce weird errors into the program: errors that are hard to repeat and even harder to find. That’s why I wanted you to explore other options first.
If you can make your program fast enough without going the parallel way, then make it so! Classical non-parallel (single-threaded) code will always contain fewer bugs and hidden traps than parallel code.
Sometimes this is not...