Mehdi Akiki
Writing / Through the layers

Following a system through its layers

Source, runtime, protocol, compiler, machine. Each piece follows one behaviour down to the layer that decides it.

Investigations

10 parts

Types under the hood

Ten parts on what a type is and where it goes: sets of values, layouts and padding, erasure and monomorphization, the bits the processor actually sees, and what the checker knows that the binary forgets. Small programs in Rust, C, TypeScript and Python, with one script that reproduces every output.

Evidence: experiments/rust-atlas/types-under-the-hood/

3 parts

Async Rust under the hood

Five async Rust problems reproduced in one small tokio program: an oversized future, a future that is not Send, a blocking call, a select! loop that loses data, and a shutdown that hangs. Then the cost of async fn through dyn Trait, and cleanup when Drop cannot await.

Evidence: experiments/rust-atlas/async-symptoms/

Rust Failure Atlas

Rust failures that are difficult to name and easy to misdiagnose, organized from symptom to mechanism, with a failing and a repaired fixture for most cases.

20 parts

From source to a running process

Twenty parts that follow small C and Rust programs from the linker to the exit of the process: ELF files, relocations, static and dynamic linking, the loader, the PLT and the GOT, LD_PRELOAD, the code before main, the first stack, the memory map, page faults, fork, malloc, system calls, stack overflows and thread-local storage. One script reproduces every output.

Evidence: experiments/from-source-to-process/

10 parts

Following a TCP connection

Ten parts that follow one TCP connection on loopback, from connect() to a connection pool: the handshake, the accept queue, Nagle and delayed ACK, the byte stream, full socket buffers, what close() sends, TIME_WAIT, getaddrinfo and the cost of TLS. Only what ss, the kernel counters, timings and system calls show, with one script that reproduces every output.

Evidence: experiments/following-a-tcp-connection/

Articles

Shorter pieces and reference

Older, introductory or narrower pieces on the same subject.

Browse the full archive →