Page 120 - Computer_Science_F5
P. 120
By employing threads and processes, features like out-of-order execution and
we achieve a form of parallelism where register renaming, alongside dedicated
instructions from different streams can resources per thread:
execute simultaneously. (a) Register file per thread: SMT assigns
a dedicated register file to each active
FOR ONLINE READING ONLY
Software-based multithreading thread, avoiding conflicts and enabling Chapter Two: Performance and optimisation of computer processor
(Multitasking): The operating system true parallel execution.
manages multiple processes, allowing
them to share CPU resources. It switches (b) Program Counter (PC) per thread:
rapidly between processes, giving the Each thread maintains its own PC to
appearance of simultaneous execution. track its current execution position,
However, this is technically one instruction facilitating quick thread switching and
stream executed in short bursts across seamless execution resumption.
different processes.
Figure 2.13 illustrates three types of
Hardware-based multithreading hardware multithreading for a single
(SMT): This method extends threads to CPU core: coarse-grained, fine-grained,
the hardware level. A single CPU core and simultaneous multithreading.
can appear as multiple logical cores to (a) Coarse-Grained Multithreading
the OS, enabling true parallel execution (CMT): Switches between threads
of instructions from different threads only when encountering expensive
within the same process. If a CPU stalls (such as, waiting for data
supports “n” simultaneous threads, the from memory). This minimizes
OS views them as “n” processors and context switching overhead, the
distributes workloads accordingly to cost of saving the state of one thread
maximize resource use. and restoring the state of another.
However, if a thread encounters a
Traditional processors exploit Instruction- short stall (for example, waiting for
Level Parallelism (ILP) by executing a few clock cycles), CMT cannot
multiple instructions from a single utilize another thread to keep the
thread concurrently. In contrast, Thread- processing resources busy. This can
Level Parallelism (TLP) focuses on lead to wasted cycles in the pipeline.
executing instructions from different (b) Fine-Grained Multithreading
threads concurrently. Simultaneous (FMT): Switches between threads
Multithreading (SMT) bridges these after every instruction. This provides
approaches, converting TLP into a form the potential for higher parallelism
of ILP within a single core. Modern but introduces more context
processors support SMT with hardware switching overhead.
111
Student’s Book Form Five
Computer Science Form 5.indd 111 23/07/2024 12:33