Share via


Parallel Programming - Using POSIX Threads

Parallel Programming - Using POSIX Threads

Pthreads (a.k.a POSIX Threads), is another parallel programming model over Shared Memory Computers, which is categorized to Threads Based Model (the other is message passing based model).

Pthreads provides Threads by means of pure C style APIs, while OpenMP does it through language compiler directives.

As
the Process/Thread concepts are very popular and well understood in
today's developing community, I will ignore the basic explanation.

Pthreads APIs can be divided into the following categories:
- Thread Management (Create, Destroy, Join, Cancellation, Scheduling, Thread Specific Data and all related attributes)
- Thread Synchronization (Mutex, Conditional Variable, Barrier, Reader Writer Lock, Spin Lock and all related attributes)

Pthreads is an international standard
and is well supported in *nix world. Microsoft Windows has its own
threading interface. But there is a famous open source project Pthreads-Win32, which targets a Pthreads implementation over Windows Platform.

Multithreading
Programming is a very broad topic, this post just aims to give very
simple introduction. [3] and [5] are very good hands on tutorials about
Pthreads programming.

[Reference]
[1] https://en.wikipedia.org/wiki/POSIX_Threads
[2] https://sourceware.org/pthreads-win32/

[3] Pthreads Tutorial by LLNL
[4] Pthreads Tutorial by IBM
[5] Pthreads Hands-On Tutorial
[6] Pthreads Tutorial for Linux Platform
[7] Pthreads Info Center