CITS2002 Systems Programming  
prev
next CITS2002 CITS2002 schedule  

POSIX threads and the pthreads library

As with many early concepts in computing, historically, different hardware vendors implemented their own proprietary versions of threads. These implementations differed substantially from each other making it difficult for programmers to develop portable threaded applications.

In order to take full advantage of the capabilities provided by threads, a standardized programming interface was required.

For UNIX-based systems, this interface has been specified by the IEEE POSIX 1003.1c standard (1995). Implementations conforming to this standard are referred to as POSIX threads, or pthreads. Most operating system vendors now offer pthreads in addition to their proprietary APIs.

pthreads are defined as a set of C language datatypes and function calls, declared with a <pthread.h> header file and defined in a thread library
(requested with -lpthread) -
although this library may be embedded in another library, such as libc, on some platforms (in the same way that Apple includes the maths library in its libc).

Some useful references:

 


CITS2002 Systems Programming, Lecture 20, p6, 9th October 2023.