Skip to content
Nicola Sabaini

Writing

A constraint is a specification

The cover of 512 KILOBYTE shows 512 memory cells, eighteen of them still free. It is not a metaphor. It is a readout.

3 min read Project: 512 KILOBYTE

Along the top of the cover of 512 KILOBYTE there is a line set in monospace:

-- pre-httpd free=18432 largest=31744
-> httpd started

Eighteen thousand four hundred and thirty-two bytes. Eighteen kilobytes exactly, measured with the right ruler, the one that counts in 1024s. Below it, a grid: five hundred and twelve cells, one per kilobyte, eighteen of them lit in gold. The caption says it plainly: 512 cells, one kilobyte each. In gold, the 18 that stay free.

And immediately after that, the HTTP server starts.

What that line is saying

A readout like this is not artwork. It is the exact moment someone looked at how much memory was left and decided to start another service anyway. Three and a half per cent of the total. Inside that has to fit the network stack, the connection buffers, and whatever the service allocates while it serves a page.

Anyone who has never worked under that ceiling reads “eighteen kilobytes free” as an emergency. Anyone who has reads it as a budget.

That is what the book is about: the subtitle says history and rules. Rules, not anecdotes. A hard limit is not a setback that happens partway through a project. It is an input, exactly like the shape of the screen or the CPU’s instruction set. It changes what is possible, and so it changes what should be designed, not how fast you write the same code you would have written anyway.

This is not archaeology

It is tempting to read half a megabyte as a piece of nineteen-eighties history. It is not.

NucleoOS runs on an M5Stack Cardputer: an ESP32-S3, a microcontroller that fits in one hand. On top of it sit native firmware, a shell that behaves like a desktop, and ANIMA, an assistant that answers with no network, because the model runs right there. Every single one of those things is a negotiation with memory.

NucleoOS-P4 changes the chip and does not change the problem: more power, a seven-inch screen, and straight away applications compiled to WebAssembly so they can be added without rebuilding the firmware. That choice is not about elegance. It is about the fact that rebuilding and reflashing firmware for every app costs, and the memory to hold two copies of everything is not there.

Even this website is the same argument one floor up. It sits on a machine that also hosts the ExaWar multiplayer lobby, and that machine has half a gigabyte of RAM: one careless operation does not slow the site down, it drops the games in progress. So the site has no engine running on it. Pages are built elsewhere and the server only reads files from disk, which is the one thing it can afford to do.

Rules have a price

The part a cover cannot fit into one line is the cost.

When you take away memory, you do not painlessly take away features. You take away generalisations. You take away the buffer that covered the edge case, the structure that was roomy but convenient, the layer of abstraction that kept the code readable for whoever arrives next. Every kilobyte reclaimed is a piece of flexibility converted into space, and that conversion does not run backwards.

Eighteen gold cells out of five hundred and twelve make a good image. They are also the margin that has to hold everything you did not see coming.


512 KILOBYTE. Storia e regole di un sistema operativo impossibile, by Nicola Sabaini. Written in Italian. On Amazon.it.

All writing