Chapter 1. Introduction
In which we discuss the motivation for creating thread libraries, the advent of shared memory
multiprocessors, and the interactions between threads and SMP machines.
Multithreading (MT) is a technique that allows one program to do multiple tasks concurrently.
The basic concept of multithreaded programming has existed in research and development labs for
several decades. Co-routine systems such as Concurrent Pascal and InterLisp's Spaghetti stacks
were in use in the mid-70s and dealt with many of the same issues. Ada's tasks are a language-
based construct that maps directly onto threads (so directly, in fact, that current Ada compilers
implement tasks with threads). Burroughs shipped a commercial mainframe OS with co-routine-
style threads as early as 1960.
The emergence of this concept in industry as an accepted, standardized programming paradigm is
a phenomenon of the 1990s. As with many other concepts, the research and experimental use of
threads have been widespread in specific industries, universities, and research institutes and are
entering industry as a relatively well-formed whole on all fronts almost simultaneously. In 1991,
no major commercial operating systems contained a robust user-level threads library. In 1999,
every major player in the computer industry has one.
Some of the motivation for this emergence can be ascribed to general good sense and the
recognition of a technology whose time has come. Some can be related to the unification efforts
surrounding UNIX. Probably the greatest push, especially when viewed from the point of view of
the independent software vendor (ISV) and the end user, is the emergence of shared memory
symmetric multiprocessors (SMPs). MT provides exactly the right programming paradigm to
make maximum use of these new machines.
Java was designed from the very beginning with threads in mind, and some of its functionality is
based very directly on having threads. The ability to have applets is based in allowing them to run
in different threads in a browser. Because of Java's high-level approach to programming, it is
much easier to build a threaded program in Java than in POSIX or Win32. At the same time, the
fundamental issues do not change. This may well lure many programmers into writing threaded
programs before they truly understand all of the intricacies. Oh, well.
The threading models we describe are strictly software models that can be implemented on any
general-purpose hardware. Much research is directed toward creating better hardware that would
be uniquely suited for threaded programming. We do not address that aspect in this topic.
To those of us concerned with the theoretical underpinnings of programming paradigms and
language design, the true value of multithreading is significant and obvious. It provides a far
superior paradigm for constructing programs. For those concerned with the practical details of
getting real tasks done using computers, the value is significant and obvious as well.
Multithreading makes it possible to obtain vastly greater performance than was ever before
possible by taking advantage of multiprocessor machines.
At whatever price point, the purchasers of workstations want maximum performance from their
machines. The demands of computationally intensive users are always growing, and they
invariably exceed the provisions of their wallets. They might want a "personal Cray," but they
can't afford one.
One of the solutions to this demand lies in the ever-increasing performance of CPUs. Along with
the obvious technique of increasing the clock speed, a wide range of other methods is used to
increase the performance of individual CPUs. The use of long instruction pipelines or superscalar
techniques has allowed us to produce multiple-instruction-issue machines that can do a lot more in
Search WWH :