# Linux Kernel Module Cheat
The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>.

#### 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