pthreads_test


pthreads_test C codes which call pthreads(), which is the POSIX thread library, for parallel programming.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

pthreads_test is available in a C version and a C++ version.

Related Data and Programs:

mpi_test, C codes which illustrate the use of a parallel programming interface for distributed memory systems.

openmp, C codes which illustrate the use of the OpenMP application program interface for carrying out parallel computatioins in a shared memory environment.

Reference:

  1. David Butenhof,
    Programming with POSIX Threads,
    Addison Wesley, 1997,
    ISBN: 0201633922,
    LC: QA76.76.T55.B88.
  2. Barbara Chapman, Gabriele Jost, Ruud vanderPas, David Kuck,
    Using OpenMP: Portable Shared Memory Parallel Processing,
    MIT Press, 2007,
    ISBN13: 978-0262533027,
    LC: QA76.642.C49.
  3. Bradford Nichols, Dick Buttlar, Jacqueline Proulx Farrell,
    Pthreads Programming: A POSIX Standard for Better Multiprocessing,
    O'Reilly, 1996,
    ISBN: 1-56592-115-1.

Examples and Tests:

COND1 demonstrates the use of a condition variable which can cause a process to wait and then resume execution.

DOT_PRODUCT is an extensive example which shows how the dot product of two vectors could be computed.

JOIN1 shows how a thread can wait for other threads to finish.

MUTEX1 shows how a mutex can be used to control the access by different threads to a single data itme.

PTHREAD1 is a simple example which shows how threads are created and terminated.


Last revised on 14 April 2008.