Home > Articles

  • Print
  • + Share This
This chapter is from the book

4.6 Introduction to the Pthread Library

The Pthread library supplies the API to create and manage the threads in your application. The Pthread library is based on a standardized programming interface for the creation and maintenance of threads. The thread interface has been specified by the IEEE standards committee in the POSIX 1003.1c standard. Third-party vendors supply an implementation that adheres to the POSIX standard. Their implementation is referred to as Pthreads or POSIX thread library.

The Pthread library contains over 60 functions that can be classified into the following categories:

  1. Thread Management Functions

    1. Thread configuration

    2. Thread cancellation

    3. Thread scheduling

    4. Thread specific data

    5. Signals

    6. Thread attribute functions

      1. Thread attribute configuration

      2. Thread attribute stack configuration

      3. Thread attribute scheduling configuration

  2. Mutex Functions

    1. Mutex configuration

    2. Priority management

    3. Mutex attribute functions

      1. Mutex attribute configuration

      2. Mutex attribute protocol

      3. Mutex attribute priority management

  3. Condition Variable Functions

    1. Condition variable configuration

    2. Condition variable attribute functions

      1. Condition variable attribute configuration

      2. Condition variable sharing functions

The Pthread library can be implemented in any language but in order to be compliant with the POSIX standard, they must comply to the standardized interface and behave in the manner specified. The Pthread library is not the only thread API implementation. Hardware and third-party vendors have implemented their own proprietary thread APIs. For example, the Sun environment supports the Pthread library and their own Solaris thread library. In this chapter, we discuss some Pthread functions that implement thread management.

  • + Share This
  • 🔖 Save To Your Account