Tutorials
MPI
POSIX
Home
/ POSIX Threads Programming
POSIX Threads Programming
Author: Blaise Barney, Lawrence Livermore National Laboratory, UCRL-MI-133316
Note: This tutorial is no longer supported. It remains for archival purposes.
Table of Contents
Abstract
Pthreads Overview
What is a Thread?
What are Pthreads?
Why Pthreads?
Designing Threaded Programs
The Pthreads API
Compiling Threaded Programs
Thread Management
Creating and Terminating Threads
Passing Arguments to Threads
Joining and Detaching Threads
Stack Management
Miscellaneous Routines
Exercise 1
Mutex Variables
Mutex Variables Overview
Creating and Destroying Mutexes
Locking and Unlocking Mutexes
Example: Using Mutexes
Condition Variables
Condition Variables Overview
Creating and Destroying Condition Variables
Waiting and Signaling on Condition Variables
Example: Using Condition Variables
Monitoring, Debugging and Performance Analysis for Pthreads
LLNL Specific Information and Recommendations
Topics Not Covered
Exercise 2
References and More Information
Appendix A: Pthread Library Routines Reference