next up previous
Next: About this document Up: No Title Previous: Routines

Threads

A thread is a "lightweight process" (in contrast to Unix "heavyweight" processes with their own memory allocation, variiables, etc.). A thread may share memory and variables, and executes part of a larger process. Threads can be created in a code to handle parts of the computation, and the return. In Pthreads, the main program is itself a thread. One must take care that several threads executing concurrently work on different parts of the data, so that order of execution doesn't matter. Some library routines (e.g., IO) are designed to be thread safe. Other times, a lock is created to ensure a critical section is accessed by a single thread.

OpenMP is a portable SMP programming system that uses threads to produce parallel codes. OpenMP directives are compiler directives, specifying parallel sections of a code. Look at www.openmp.org. The location www.openmp.org/specs contains html and postscript versions of the specifications, and details all the directives.



E. Bruce Pitman
Mon Oct 2 10:36:05 EDT 2000