Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Posix thread tutorial [closed]

I'm looking for a comprehensive pthread tutorial. I considered buying Programming with posix threads but this book seems is bit dated. Other online tutorials like this are very basic. Can someone please suggest a good and complete pthread tutorial.

like image 595
nik Avatar asked Aug 14 '11 18:08

nik


People also ask

Why we use pthreads?

Why is Pthreads used? The fundamental purpose for adopting Pthreads is to improve programme performance. When compared to the expense of starting and administering a process, a thread requires far less operating system overhead. Thread management takes fewer system resources than process management.

Can pthread_create fail?

The pthread_create() function will fail if: [EAGAIN] The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process PTHREAD_THREADS_MAX would be exceeded.

How do POSIX threads work?

The POSIX thread libraries are a standards based thread API for C/C++. It allows one to spawn a new concurrent process flow. It is most effective on multi-processor or multi-core systems where the process flow can be scheduled to run on another processor thus gaining speed through parallel or distributed processing.

Does C++ use pthreads?

In a Unix/Linux operating system, the C/C++ languages provide the POSIX thread(pthread) standard API(Application program Interface) for all thread related functions. It allows us to create multiple threads for concurrent process flow.


1 Answers

Lawrence Livermore National Laboratory has an excellent tutorial at:

https://computing.llnl.gov/tutorials/pthreads/

like image 126
Branko Dimitrijevic Avatar answered Oct 15 '22 01:10

Branko Dimitrijevic