Multi-Core Programming: Increasing Performance through Software Multithreading

The concepts of threading from a software perspective were covered in previous chapters. Chapter 2 also touched briefly on threading inside hardware and Chapter 9 covered the concepts of single-core processors. This chapter describes in more detail what threading inside hardware really means, specifically inside the processor. Understanding hardware threading is important for those developers whose software implementation closely interacts with hardware and who have control over the execution flow of the underlying instructions. The degree to which a developer must understand hardware details varies. This chapter covers the details of the multi-core architecture on Intel processors for software developers, providing the details of hardware internals from a threading point of view.
Chapter 9 describes the basics of the single-core processor. In most cases, threaded applications use this single-core multiple-issue superscalar processor. The "threading illusion" materializes from the processor and that is called instruction level parallelism (ILP). This is done through a context-switch operation. The operational overhead of context switching should be limited to a few processor cycles. To perform a context switch operation, the processor must preserve the current processor state of the current instruction before switching to other instruction. A processor keeps ongoing operational information mainly in registers and a policy dictates this context switch operation.
The simplest class of processor is single-issue, single-thread (SIST) or single-threaded scalar-based processor. For SIST, the OS handles multiple threads. In terms of hardware resource sharing and the level of granularity of resource hold time, there are two types of...