The Scheduler: Fairness on a Finite Machine
Sixty processes want the CPU. Four cores exist. The scheduler decides who runs, for how long, and what happens when everyone wants more. This post names the invariant it must keep.
Sixty processes want the CPU. Four cores exist. The scheduler decides who runs, for how long, and what happens when everyone wants more. This post names the invariant it must keep.
The OS has a page cache. The database ignores it and builds its own. This post explains why — and how the buffer pool decides what stays in RAM.
A process is not a program. It's the kernel's most fundamental illusion — a private machine that never existed. This post opens the box.
Databases don't read bytes. They read pages — fixed-size blocks that turn random I/O into something the disk can handle. This post explains why.
A database is not a spreadsheet with an API. It's a system that makes promises about your data — and spends extraordinary effort keeping them.
Identifiers inside a macro expansion live in a separate namespace from the caller's code. A macro cannot accidentally shadow, capture, or conflict with variables at its call site. Naming collisions are structurally prevented.
A procedural macro is a function from TokenStream to TokenStream — arbitrary Rust code that runs at compile time. But its output is still bound by every invariant the compiler enforces. Full power, zero privilege.
macro_rules! can only match on the syntactic structure of tokens — it cannot inspect types, evaluate expressions, or make semantic decisions. This constraint keeps macro expansion predictable and bounded.
Rust macros generate code at compile time — but every expansion must pass the same type checking, borrow checking, and lifetime analysis as hand-written code. The macro writes; the compiler judges.
Everything in Rust is private by default. Modules enforce encapsulation at the language level — internal implementation stays internal unless you explicitly expose it. This is how Rust makes invalid states unrepresentable from outside your API.