Institute for Advanced Professional Studies

Intel's Hyper-Threading Technology: A Programmer's Perspective

Multithreaded Programming:

Many applications juggle multiple chores at once. Server applications handle concurrent clients; interactive applications often deal with user input while processing background computations; computationally intensive applications harness the power of multiple processors. The common theme is the use of multiple threads of control to provide contexts for dealing with concurrent activities, whether multiplexed on one processor or executed in parallel on multiple processors.

Intel's Hyper-Threading Technology:

Hyper-Threading Technology enhances Intel's line of Pentium 4 microprocessors. Hyper-Threading (HT) is a means for improving processor performance by supporting the execution of multiple threads (two is the current limit) on the same processor at once: the threads share the various on-chip execution units. From a processor's point of view, there is better utilization of these units since, for any one execution unit, there is not just one but multiple threads that might be using it. From a thread's point of view, threads are running independently as if each were on a separate processor, but if one thread requires use of an execution unit being used by another, it must wait (and thus it runs more slowly than it would on a "real" multiprocessor, though often faster than it would on a traditional uniprocessor). You can think of Hyper-Threading Technology as either a poor man's multiprocessor or a rich man's uniprocessor.

From a programmer's point of view, a hyper-threaded processor is a multiprocessor. It is supported by Windows XP and many Linux distributions, and thus is transparently accessible to the programmer. One takes advantage of it either by multitasking (running a number of different applications at once) or by multithreading (having multiple threads of control within an application). Multi-tasking is commonplace on desktop platforms. Constructing logically correct multithreaded programs on hyper-threaded processors is no different from constructing them on uniprocessors or multiprocessors. Where things are different is in the area of performance: if multiple threads are all simultaneously trying to use the same execution unit on a hyper-threaded processor, performance will be no better than if they were running on a uniprocessor. However, while all are using different execution units, the performance can be as good as that achieved on a multiprocessor.

Programming Strategy:

A reasonable strategy is to employ sufficient threads in an application so that all execution units are in use most of the time, without bogging the system down with too many threads (though "too many threads" is probably a greater number than many realize). Thus designing an application to take full advantage of a hyper-threaded processor is similar to doing so for a multiprocessor system. The difference is that the potential speed increase is not as great, but then the cost of the processor is not as great either.

On-Site Threads Programming Courses:

Multithreaded programming design considerations and performance enhancement techniques for Hyper-Threading Technology are discussed in our hands-on C and C++ Multithreaded Programming training courses conducted by Dr. Thomas W. Doeppner. We offer separate Multithreaded Programming courses for Linux, UNIX (POSIX), Windows (Win32), and Solaris and tailor the workshop examples to emphasize specific applications such as servers or embedded systems. IAPS can combine coverage of these and other threads packages and further customize each version of our on-site courses to achieve your organization's training objectives.

© Copyright 2003-2015 Institute for Advanced Professional Studies (IAPS)