lotus



previous page: 2.3. Acknowledgments and caveats (comp.programming.threads)
  
page up: Threads Programming FAQ
  
next page: 3.1. Why are threads interesting? (Programming)

3. What are threads? (Programming)




Description

This article is from the Threads Programming FAQ, by Bryan O'Sullivan bos@serpentine.com with numerous contributions by others.

3. What are threads? (Programming)

A thread is an encapsulation of the flow of control in a program. Most
people are used to writing single-threaded programs - that is,
programs that only execute one path through their code "at a time".
Multithreaded programs may have several threads running through
different code paths "simultaneously".

Why are some phrases above in quotes? In a typical process in which
multiple threads exist, zero or more threads may actually be running
at any one time. This depends on the number of CPUs the computer on
which the process is running, and also on how the threads system is
implemented. A machine with "n" CPUs can, intuitively enough, run no
more than "n" threads in parallel, but it may give the appearance of
running many more than "n" "simultaneously", by sharing the CPUs among
threads.

 

Continue to:













TOP
previous page: 2.3. Acknowledgments and caveats (comp.programming.threads)
  
page up: Threads Programming FAQ
  
next page: 3.1. Why are threads interesting? (Programming)