120 likes | 262 Views
Multithreaded Processors. Multithreading: What is a thread?. A thread is the smallest unit execution a piece of code. A process consists of one or more threads. Processes own system resources, e.g. memory, files etc. Threads share system resources of their process.
E N D
Multithreading: What is a thread? • A thread is the smallest unit execution a piece of code. • A process consists of one or more threads. Processes own system resources, e.g. memory, files etc. • Threads share system resources of their process. • Threads have their own stack. • Usage • Programming of concurrent activities, e.g. internet browser uses threads to load of pages and handle user input. • Parallel computing
Multithreading in a Processor • The processors supports multiple threads in hardware. • Enabling fast thread switches • Advantage • Latency hiding: While a load is serviced from main memory, another thread can fill the pipeline. • Improved utilization of functional units • Required architectural support • Multiple register files • Bookeeping hardware for threads
Multithreading Approaches • Cycle-by-cycle Interleaving • Processor executes a number of threads • It switches in each cycle to another thread. • The next instructions of that thread are started. • Block Interleaving • Instructions of a thread are executed until a long latency instruction is executed. • Then, the processor provisionally switches to an other thread.
Multithreading Approaches • Simultaneous Multithreading (SMT) • The issue unit starts instructions of multiple threads in a single cycle. • Each thread has its own register file. • Beispiele: • Intel Hyperthreading • IBM Power processors
Evaluation for Scalar Processor • Single-Threaded scalar • Stall cycles can only be hidden by out-of-order execution. • Cycle-by-cycle • Requirement: Processors supports as many threads as pipeline stages. • Advanatage: all instructions are indepent. • Block-Interleaving • Switch happens only for long latency instructions. • Advantage: reduced number of stall cycles • Common to all variants • Dependences within a thread are respected.
Evaluation for Superscalar Processors • Single Threaded • Stall cycles and unused functional units due to a lack of independent instructions. • Cycle-by-Cycle and block interleaving • Stall cycles can be eliminated. Functional units might be empty. • Simultaneous Multithreading • Threads are executed in parallel. • More insructions to fill the functional units • Common • A single thread will not be faster. • Increased throughput
Intel Hyperthreading • Simultaneous multhreading • Minimal hardware extensions to improve utilization of processor hardware. • Advantageous only for throughput loads or parallel applications.