img
. .
Chapter 3. Foundations
·
Implementation vs. Specification
·
Thread Libraries
·
The Process Structure
·
Lightweight Processes
·
The POSIX Multithreaded Model
·
System Calls
·
Signals
In which we introduce the reader to the underlying structures upon which threads are built, the
construction of the thread itself, and the operating system support that allows efficient
implementation.
Implementation vs. Specification
When writing a topic of this nature, the authors are often faced with a difficult decision: How
much should they restrict themselves to the pure specifications, and how much in the way of
implementation should they allow to show through? By talking only about the specifications, the
reader is given a pure rendition of what the library should do and is not misled into thinking that
because a particular implementation did things one way, they all have to be like that. [1]
[1]
A specification is a description of what a program is supposed to do. An implementation is an
actual program, which hopefully does what the spec says it should. The U.S. Constitution is a
specification for a country. The United States is an implementation.
Unfortunately, describing only the specification is rather akin to teaching the concepts of
mathematics without ever mentioning the existence of numbers.[2] It's clean and pure, but terribly
difficult to comprehend fully. So we have chosen to bring in implementation details when we
think they will aid in comprehension. The implementation we refer to most is the Solaris
implementation, largely because we know it best.
[2]
Yes, we are members of the "New Math" generation.
Please keep in mind that these implementation details are included for your edification, but you
should never write programs that depend upon them. They can change at any time, with no
notification. Learn from the implementation; write to the specification.
Thread Libraries
There are two fundamentally different ways of implementing threads. The first is to write a user-
level library that is substantially self-contained. It will make calls to system routines, and it may
depend upon the existence of certain kernel features, but it is fundamentally a user-level library
and contains no "magic" hooks into secret kernel routines. All of the defining structures and code
for the library will be in user space. The vast majority of the library calls will execute entirely in
user space and make no more use of system routines than does any other user-level library.
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home