Topics / systems

Systems and hardware

The machine under all the software: how a processor executes instructions, what memory really is, and how a GPU keeps thousands of threads busy.

Dives
6
Levels
50
Notes
4
Reading
4.6h
Start with Microprocessor
How to read thisEvery line is a diveEach tick is one level, drawn at the layer of the stack it explains. Longer lines go further down, from why a thing exists to the silicon that runs it.6 dives · 50 levels

The path

Read in this order and each dive leans on the ones before it. Every dive also stands on its own.

  1. 01

    How a microprocessor works

    From a line of C to the transistor: the instruction set contract, a RISC-V CPU you can clock by hand, the datapath, pipelines and caches, adders built from logic gates, and the switch at the bottom of it all.

    Idea to Silicon

    50 min9 levels

  2. 02

    Memory, from malloc to a DRAM cell

    Follow one malloc(64) all the way down: the allocator's free lists, virtual addresses and page faults, the page-table walk and the TLB, cache lines, DRAM banks, and the leaking capacitor that finally holds your bit.

    Idea to Silicon

    50 min9 levels

  3. 03

    From gcc main.c to main()

    A call begins as five bytes with a hole. Follow a tiny C program through ELF objects, symbol resolution, relocation, the PLT and GOT, and the loader that makes those bytes runnable.

    Idea to Machine

    42 min7 levels

  4. 04

    Atomics, from a log queue to a store buffer

    Two threads write, then read. Both can read the old value. Follow a log record through a lock-free queue to understand the language contract, compiler instructions, store buffers, and the cache lines moving between cores.

    Idea to Silicon

    42 min8 levels

  5. 05

    What a single read() costs

    Follow one HTTP request through a privilege boundary, a sleeping thread, epoll’s ready list and io_uring’s shared rings. Three ways to serve 10,000 connections, down to registers and the packet that wakes a core.

    Idea to Silicon

    38 min8 levels

  6. 06

    How a GPU runs a kernel, from threadIdx to DRAM

    Follow a CUDA thread into a warp and onto an SM. Make branches diverge, scatter a memory request across sectors, and fix a transpose one bank conflict at a time.

    Idea to Silicon

    42 min9 levels

Notes

Practical answers in systems and hardware.

  1. Note3 min read

    Cross-compile C and Zig with Zig 0.17.1

    Select the target explicitly with zig cc -target or a build script using standardTargetOptions. Verify the file format separately from whether the artifact runs on the target.

  2. Note3 min read

    Detect false sharing with a runnable C benchmark

    Compare adjacent atomic counters with cache-line-separated counters, then use perf c2c to locate contended lines when PMU access is available.

  3. Note3 min read

    Why ldd is unsafe on untrusted binaries

    Inspect ELF dependency metadata with readelf or objdump instead of invoking the loader. Use LD_DEBUG only when you intentionally execute a trusted program.

  4. Note3 min read

    Find what a process is waiting on with strace

    Trace the blocked syscall, follow its file descriptor and identify the thread or peer that must wake it. Use syscall duration rather than summary CPU time to measure waiting.