Skip to content

Process and Thread Internals

A cross-platform deep dive into process execution, thread synchronization, and operating system execution models across Linux, Windows, and macOS.

Chapters in this path

01

The Anatomy of Execution: Processes, Threads, and Memory Isolation

A conceptual deep dive into what it means for code to execute. We explore the fundamental differences between a process (a resource container) and a thread (an execution unit), and how the OS isolates them.

Read Chapter
02

The Anatomy of Process Creation: fork, exec, clone, and COW

A deep dive into how Linux creates processes. We will explore the mechanics of fork(), the magic of Copy-on-Write (COW), and how clone() powers modern containerization.

Read Chapter
03

The NT Kernel Approach: Understanding Windows Process Creation

A deep dive into the NT Kernel approach to processes. Learn why Windows lacks fork(), the architecture of Windows subsystems like csrss, and how to use CreateProcess in the Win32 API.

Read Chapter
04

macOS Execution: Mach Tasks vs. BSD Processes

A deep dive into the Darwin/XNU kernel. We explore the architectural divide between Mach Tasks and Threads, and how standard BSD POSIX APIs like fork() are illusions layered over Mach primitives.

Read Chapter
05

POSIX Threads and Linux Synchronization: The Magic of Futex

A deep dive into thread creation with pthreads and how Linux avoids system calls in fast path synchronization using futexes.

Read Chapter
06

Windows Threads and Synchronization: Win32 API and NT Primitives

A deep dive into Windows multithreading. Learn how to manage threads with CreateThread, synchronize using SRWLocks, and build high-performance blocking mechanisms with WaitOnAddress (the Windows futex).

Read Chapter
07

POSIX Signal Handling: Asynchronous Contexts and Reentrancy

Unpacking asynchronous execution contexts, async-signal-safe functions, and the hidden dangers of reentrancy that make printf and malloc unsafe inside a signal handler.

Read Chapter