Thread Pools Explained
Creating a thread costs microseconds of kernel work; creating one per request costs your latency budget. A thread pool is the standard answer: a fixed set of workers that pull units of work from a queue. This video shows the mechanics — the queue, the workers, the wakeups — and why pool sizing is a queuing-theory problem, not a guess.
Topics covered:
- What thread creation costs: clone, stack, TLS, and scheduler entry
- The work queue: how tasks are enqueued and how workers claim them
- Blocking vs. non-blocking workers and why a blocked worker is a wasted slot
- Pool sizing: CPU-bound vs. I/O-bound workloads and Little's law
- The thundering herd when a task lands on an idle pool
- Bounded queues and rejection policies: when work exceeds capacity
- How Go's scheduler and async runtimes solve the same problem differently
Related articles
Context Switch Costs, Measured
What a context switch actually costs: register saves, TLB flushes, and cache pollution — and why a 2µs switch at 100k switches per second burns 20% of a core.
Process vs Thread: What's Actually Different
Why fork and clone are the same syscall, why threads are 5-10x cheaper to create than processes, and what you give up in isolation when you share an address space.
How an Operating System Schedules a Thread
Between your code and the CPU sits a scheduler making decisions every millisecond: priorities, context switches, and the physics of 'the thread was runnable but the OS said no'.
More in Operating Systems
Virtual Memory in One Diagram
Page tables, TLB, demand paging, and copy-on-write — how your 16GB laptop 'has' 128GB of addressable memory.
WatchContainer Isolation in Linux
What Docker and Kubernetes containers actually are — namespaces, cgroups, and the syscalls that make isolated processes without a VM.
DetailsSignals and Interrupts
Hardware interrupts and Unix signals — the two asynchronous mechanisms that interrupt your program, and what the kernel does between the wire and your handler.
DetailsLocks and Synchronization Primitives
Mutexes, spinlocks, semaphores, and condition variables — how they map to hardware atomics and futexes, and when each one is the right tool.
DetailsMemory-Mapped Files
How mmap() maps a file into your address space — demand paging from disk, the page cache, and why mapped I/O beats read() and write().
DetailsFile Systems Explained
How a file system stores your data — inodes, directory entries, extents, and journaling — and what actually happens on read and write.
DetailsSyscalls Under the Hood
What actually happens when your program calls read(), open(), or fork() — the trap, the kernel mode switch, and the return path.
DetailsVirtual Memory Explained
Address translation, page tables, and the TLB — the full path from a virtual address to the physical RAM cell, including why the translation is cached.
DetailsProcess Scheduling, Visualized
How the Linux scheduler picks the next runnable process — time slices, priorities, CFS virtual runtime, and why your busy server still feels responsive.
DetailsDepth, delivered weekly
One technical dispatch a week — articles and episode notes before they go public.
One technical dispatch per week. No noise.