# Linux Kernel Module Cheat

#### 27.4.4. pthreads

POSIX' multithreading API. Contrast with fork which is for processes.

This was for a looong time the only "portable" multithreading alternative, until C++11 finally added threads, thus also extending the portability to Windows.

- userland/posix/pthread_self.c: the simplest example possible

- userland/posix/pthread_count.c: count an atomic varible across threads

- userland/posix/pthread_deadlock.c: purposefully create a deadlock to see what it looks like

- userland/posix/pthread_barrier.c: related: https://stackoverflow.com/questions/28663622/understanding-posix-barrier-mechanism

- pthread_mutex