By Andrew BinstockHyper-Threading Technology is Intel's new technology for running two separate threads on the same processor. It is available today in Intel® Xeon® processors, and Intel has announced it will be available for desktop platforms in late 2002. This transition, I contend, will signal the start of a new era in software development in which desktop applications will be written as multithreaded applications, joining their server-side counterparts in this performance-oriented design.
Transitioning client-side applications from the established single-threaded model to a multithreaded design, however, requires several skills: a new way of looking at program construction and data, as well as familiarity with techniques of multithreaded programming.
In my
last installment, I presented an overview of rethinking program design for multithreading. This change, frequently referred to as functional decomposition, requires not only new ways of assembling the building blocks, but also building blocks that are themselves different. I also examined data decomposition. This technique facilitates multithreaded design by placing emphasis on processing distinct blocks of data separately, so that they can run simultaneously on separate threads. I emphasized the importance of minimizing the dependence between blocks of data. And I articulated the essential rule of program and data design for multithreaded applications: minimize interactions and dependencies between threads.
In this installment, I discuss the types of problems and issues that occur when threads interact and how to handle some of them (not all situations can be handled perfectly). The type of interaction, the number of threads looking to share one resource, and the number of threads that can execute at once, are all factors that affect both the problem and its optimal solution. This article presents the predictable situations and recommendations for solution, as well as details specific to Hyper-Threading Technology. The goal is to design applications for Hyper-Threading Technology that immediately realize the performance advantages of the technology.