Information Technology Reference
In-Depth Information
Figure4.1: In the Earth Visualizer example, two threads each draw part of the scene, a third thread
manages the user interface widgets, and a fourth thread fetches new data from a remote server.
SatelliteImageCredit:NASAEarthObservatory.
The programs can then create however many threads they need without worry-
ing about the exact number of physical processors, and each thread runs on its
own virtual processor.
Of course, the physical reality is that a given system only has so many pro-
cessors. The operating system's job is to multiplex all of the system's threads
on the actual physical processor present in the system. It does this by transpar-
ently suspending and resuming threads so that at any given time only a subset
of the threads are actively running.
Multi-threaded programs. The intuition for using the thread abstraction
is simple: in a program, we can represent each concurrent task as a thread.
Each thread provides the abstraction of a sequential execution similar to the
traditional programming model. In fact, we can think of a traditional program
as single-threaded with one logical sequence of steps as each instruction follows
the previous one. The program executes statements, iterates through loops, and
Search WWH ::




Custom Search