HyperThreading
If you are wondering what HyperThreading is actually all about, the simple
answer is that it creates two ‘virtual’ CPUs out of one.
If we think about a multi-processor machine, it will have two physical CPU's
that can handle multiple tasks or multiple threads of a single application,
spreading the load between the two processors. Many of the benefits from
multi-processing can be squeezed into one CPU though.
A processor has a fixed number of instructions it can execute per pipeline, and
under ideal circumstances it would always be calculating something in each and every
part of the pipeline, every clock cycle. The reality is very far from that ideal
case,
though, and much of the available processing time goes unused because the
processor is often waiting for other things, such as an unforeseen branch in the program
requiring the CPU to fetch different instructions. If there was a way of
utilising the wasted processing time on something else then, in theory, more
could be done on a single CPU in the same space of time - this is what
HyperThreading attempts to achieve.
 |
 |
| HyperThreading |
The first of the two diagrams above shows the difference between normal CPUs
and those that are HyperThreading enabled. Normally a CPU will have an
Architectural State engine that controls what it being executed on the pipeline
- with a multiprocessor system each CPU has its own Architectural State engine
which means that each one can be working on different applications, or different
thread of the same application. With a HyperThreaded CPU there are two
Architectural State engines controlling what is being executed on the CPU, by
which the state of two applications or threads are controlled. The theory
is that the two tasks are controlled effectively enough so that the 'gaps'
in processing that normally occur in a single threaded CPU are 'filled' with
processes from the other thread with as little contention between the two as
possible.
 |
| Windows XP Device
Manager - Two CPU's or One? |
The above image shows that despite there actually only being one physical CPU
the Windows XP OS (SP1) recognises it as being two separate processors. The Windows NT Kernel has
been multiprocessor aware from its Workstation and Server background and is
capable of some task and thread allocation. Despite there actually only being a single
physical CPU present it still needs to be detected as two such that it will be
'aware' that it is able to treat this as a multi-processor machine and therefore
share tasks between the Architectural State engines.
HyperThreading is not actually new, since this has been in server CPUs for a
while, but this is the first time that its been brought to the desktop space --
possibly partly because it wasn't until Windows XP that the mass
desktop/consumer OS was multi-processor aware. However, this can operate in
multi-processor environments as well, such that if you are utilising two
HyperThreaded CPUs you'll have two physical CPUs, but the system will recognise four
virtual CPUs.
|