Introduction to Processing Techniques
Most CPU manufacturers try to achieve high CPU performance by increasing clock speed and cache sizes but that still does not let full potential utilization of CPU power. To make more efficient use of CPU power, multiple enhancements have been made over a period in CPU processing techniques to increase the processing power and optimize the utilisation of CPU / processors.
Today, we look at two techniques related to processing – Hyper Threading and Multi-Threading, and understand the key differences between them, their limitations, advantages, usage etc.
Hyper Threading technology allows a single processor to operate into two separate processors for the operating system, the applications and the programs using it. The physical processor is divided into two logical or virtual processors. The Hyper Threading technology was designed to enhance the performance of CPU. The amount of work performed by a CPU within a unit of time , core is the execution unit of CPU and Hyper Threading allows multiple threads to run on each core of CPU. More and more cores were added to CPU by manufactures to increase instructions executed by the CPU at a time.
Each physical core is recognized as two virtual or logical cores by operating system. A single processor runs two threads. Cores are increased virtually or logically, and they work independently. A Hyper Threading enabled CPU has 2 set of general-purpose registers, control registers, architecture components and they share same cache, bus, and execution units.
Origin of Hyper-Threading
Hyper threading technology was developed by Intel. It is the marketing name which is around since x86 realm. The idea behind this Simultaneous Multi-Threading (SMT) was that the single physical CPU appears to the Operating system as two virtual or logical processors. Hyper threading was officially announced at the Intel developer Forum and it was demonstrated on a Xeon processor. The test demonstrated that Single Xeon with Hyper threading enablement was 30% faster than normal Xeon processor.
How Hyper-Threading works?
Hyper Threading provides Thread level parallelism (TLP) for each processor to provide increased utilization of processor and resources.
Single processor is represented as two virtual or logical processors to the operating system. The processor works on two set of tasks simultaneously and utilizes resources which otherwise would be idle and helps to get more work done in same time window.
Multithreaded software divides workloads into processes and threads which can be independently executed, dispatched, and scheduled.
Hyper Threading allows a single Pentium 4 processor to function as two virtual or logical processors.
Multithreading allows to create multiple threads within a single process to enhance throughput of computing. When processes are created for each task, it is resource consuming and intensive so Multi-Threading technology allows to divide a single process into multiple sub-processes and assign tasks to each sub-process or thread. Each thread is a lightweight process. There are two types of threads – Kernel thread and User thread.
- Kernel level threads are easy to manage but slower to create, Operating system supports creating of kernel threads. They are specific to operating system and Kernel level routine can be multi-threaded.
- User threads are easier to manage and create. They are implemented by a thread library at user level, is generic and can run on any operating system. They can’t take advantage of multiprocessing.
Different Models of Multi-Threading
There are many models of multi-threading : –
- Many to one model – Several user threads map to single kernel thread.
- One to one model – A single user thread is managed by each kernel thread.
- Many to many models – Several user threads are mapped to similar or small amount of kernel threads.
Origin of Multi-Threading
Multi-threading was first originated in 1950, however simultaneous multi-threading was part of IBM ACS-360 project in 1968. The first major processor was developed using SMT known as Alpha 21464(EV8).
How Multi-Threading works?
A Thread is a sequence of statements which are executed as part of program. Each program has one thread for execution. Multithread programs simultaneously execute two or more threads. The operating system provides multithreading support and quickly switches the CPU system between running threads. The operating system which assigns thread to CPU is called a ‘Scheduler’.
Execution of thread can be Concurrent and Parallel.
- In Concurrent execution, a Single processor switches execution processes between threads in a multi-threaded process.
- In Parallel execution, each threat in a process can run on a separate processor.
Hyper-Threading vs Multi-Threading
Below table summarizes the differences between the two technologies:
|Hyper Threading technology allows a single processor to operate into two separate processors for the operating system, the applications and the programs using it.
|Multi-threading allows to create multiple threads within a single process to enhance throughput of computing.
|The physical processor is divided into two logical or virtual processors. Hyper Threading allows multiple threads to run on each core of CPU.
|Execution of multiple threads in a process are executed concurrently as CPU switches between multiple threats.
|Physical processor is divided into two or more logical processors.
|A process is divided into multiple threads.
|Threads are light weight, threads can share same set of open files, multiple threads use fewer resources, thread switching need not interact with the operating system, improves performance , improved throughput, Shared resource conflicts.
|Thread creation is function based and optimized, Identical process threads share the same memory and resources, there is no division in categories , optimized system and less expensive.
|IBM, Sun, Compaq.
|Video editing, 3D rendering.
|Desktop applications, web browsers, web servers etc.
Download the comparison table: Hyper-Threading vs Multi-Threading