Wednesday, October 28, 2009

What is Multi-threading

Author: Leif Cage
When symmetric multiprocessing (SMP) first became cheap enough to come within reach of the average PC user, many hardware enthusiasts eager to get in on the SMP craze were asking what exactly (besides winning them the admiration and envy of their peers) a dual-processing rig could do for them. It was in this context that the PC crowd started seriously talking about the advantages of multi threading. Years later when Apple brought dual-processing to its PowerMac line, SMP was officially mainstream, and with it multi threading became a concern for the mainstream user as the ensuing round of benchmarks brought out the fact you really needed multi threaded applications to get the full benefits of two processors.

Even though the PC enthusiast SMP craze has long since died down and, in an odd twist of fate, Mac users are now many times more likely to be sporting an SMP rig than their x86-using peers, multi threading is once again about to increase in importance for PC users. Intel’s next major IA-32 processor release, codenamed Prescott, will include a feature called simultaneous multi threading (SMT), also known as hyper-threading. To take full advantage of SMT, applications will need to be multi threaded; and just like with SMP, the higher the degree of multi threading the more performance an application can wring out of Prescott’s hardware.

Intel actually already uses SMT in a shipping design: the Pentium 4 Xeon. Near the end of this article we’ll take a look at the way the Xeon implements hyper-threading; this analysis should give us a pretty good idea of what’s in store for Prescott. Also, it’s rumored that the current crop of Pentium 4’s actually has SMT hardware built-in, it’s just disabled. (If you add this to the rumor about x86-64 support being present but disabled as well, then you can get some idea of just how cautious Intel is when it comes to introducing new features. I’d kill to get my hands on a 2.8 GHz P4 with both SMT and x86-64 support turned on.)

SMT, in a nutshell, allows the CPU to do what most users think it’s doing anyway: run more than one program at the same time. This might sound odd, so in order to understand how it works this article will first look at how the current crop of CPUs handles multitasking. Then, we’ll discuss a technique called super threading before finally moving on to explain hyper-threading in the last section. So if you’re looking to understand more about multi threading, symmetric multiprocessing systems, and hyper-threading then this article is for you.

As always, if you’ve read some of my previous tech articles you’ll be well equipped to understand the discussion that follows. From here on out, I’ll assume you know the basics of pipelined execution and are familiar with the general architectural division between a processor’s front end and its execution core.

No comments:

Post a Comment