Hardware, Processes, and Threads
It is not necessary to understand how hardware works in order to write serial or parallel applications. It is quite permissible to write code while treating the internals of a com-puter as a black box. However, a simple understanding of processor internals will make some of the later topics more obvious. A key difference between serial (or single-threaded) applications and parallel (or multithreaded) applications is that the presence of multiple threads causes more of the attributes of the system to become important to the applica-tion. For example, a single-threaded application does not have multiple threads contend-ing for the same resource, whereas this can be a common occurrence for a multithreaded application. The resource might be space in the caches, memory bandwidth, or even just physical memory. In these instances, the characteristics of the hardware may manifest in changes in the behavior of the application. Some understanding of the way that the hardware works will make it easier to understand, diagnose, and fix any aberrant applica-tion behaviors.