Pthreads - POSIX standard threads
Pthreads - POSIX standard threads
This page is only a rudimentary outline of ideas and basic functions for Pthreads.
- Basics
- Threads versus processes: When to use threads.
- Creating, joining, and killing pthreads (but not cancel!).
- pthread_create()
- pthread_join()
- pthread_exit()
- Thread identification.
- pthread_t handles
- pthread_self()
- pthread_equal()
- File locking.
- flockfile
- ftrylockfile
- funlockfile
- Interthread sychronization and communication
- Mutex variables.
- pthread_mutex_t data type
- pthread_mutex_init() and use of pthread_once().
- pthread_mutex_lock(), pthread_mutex_unlock(),
pthread_mutex_trylock()
- priority inversion problems.
- Scheduling
- scheduling scope
- policies: SCHED_FIFO, SCHED_RR, SCHED_OTHER
- mutex-based scheduling: PTHREAD_PRIO_PROTECT,
PTHREAD_PRIO_INHERIT.
- Condition variables.
- pthread_cond_t data type
- static and dynamic initialization of condition variables
- pthread_cond_signal() and pthread_cond_wait()
- pthread_cond_timedwait(), pthread_cond_broadcast()
- Building common synchronization systems.
- Thread system models
- Master/slave systems.
- Peer thread systems.
- Producer/consumer systems.
- Pool of threads systems.
- Advanced pthreads
- Keys and thread private copies of shared data.
- Thread attributes.
- detached pthreads
- stack size
- Cancellation of pthreads.
- disabling cancellation
- deferred and asynchronous cancellation
- cleanup stack.
- Vendor implementations of pthreads.
- Kernel, user, and two-level threads.
- SGI sprocs.
- Interaction between threads and processes:
signal handling, fork() and exec(), pthread_atfork