Why Parallel Programming is Important

Until a few years ago, the clock speed of the CPU was just increasing and increasing. This meant algorithms just using one core would run faster without being modified. In the last years, we have been adding more and more processor cores. This allowed us to do more things at the same time. However, it introduced a problem to the sequential code everyone had been writing the last few years. They did not get any faster with newer processors because they ran on only one thread on one core.

Parallel programming is nothing new in computer programming. Computer scientists have used this technique to distribute workload over processors or computers in super-computers. It has also been available for the regular developer, but in a restricted degree. Many programmers also have bad memories from when they was working with parallel programming where they had a weird bug they could not explain or the program became unresponsive. 

The reason why, is because of synchronization. When two threads are trying to do operations with the same piece of memory, it is called a data race. The data race results in an unexpected behavior in the program. In order to avoid this, we lock the data using a mutex. However, locking data can also be bad. It is considered as a bad technique in parallel programming and shall be avoided when necessary. Think of it as this: Two sisters have to share a toy in the kindergarten. Only one can play with it at a time. And it only gets worse as they grow up.

Parallel programming has been more and more discussed the last years. Mainly because we get more computer power because of multiple cores and not through higher clock frequencies on our processors. We don't only have multi-core CPUs in our PCs, we are seeing it in smartphones and gaming consoles as well. Because of the wide area of available multi-core systems, developers wants to make programs such as games, simulation programs and heavy calculation programs take advantage of these systems. However, in order to master the parallel programming technique, a lot of knowledge about how it works is required. When we first learn to program, we learn how to write sequential code. Parallel programming is all about doing more things at the same time. It is the transition between writing sequential and modifying it to be able to do more things at the same time which is difficult for programmers.