The program you can query
Farid Zakaria rebuilt the format Linux uses for compiled programs so the file itself is a working database: it runs as a program and answers SQL questions about its own insides.
Ask a Linux system what kind of file hello is and it answers: a SQLite database. Run it and it prints "Hello, world!". Both answers are true. Zakaria, a Nix contributor whose doctoral work was on how programs get loaded into memory, threw out ELF, the layout every compiled Linux program has been stored in for three decades, and rebuilt it as database rows the kernel knows how to execute.
His thesis reviewers found the idea unmotivating. Strangers on Hacker News voted it to the front page in a day.
A program's internal bookkeeping then turns into ordinary SQL. Removing debug information from a binary, normally the job of a dedicated tool, becomes DELETE FROM sections followed by VACUUM. Asking which libraries a program needs becomes a SELECT. He packed 723 programs and 400 libraries from a working Linux system into a single 612 MB file that is at once the software and a searchable index of it: 1,123 objects, 346,386 named functions and 3,808 dependency links, all of it queryable. Because it is one transactional database, he notes, switching a debugging library on across an entire system becomes a single commit.
It is slower, and the reason is memory sharing. A normal program is memory-mapped: the operating system points every running copy at the same physical pages of the file on disk. Code stored in database rows has to be copied out instead, so nothing is shared between processes and every launch pays a fixed few milliseconds to open the database first. This is a prototype, and the measurements are the author's own, published a day ago and not yet reproduced by anyone else.
Most of what makes the old format baroque turns out to be a hand-rolled database engine: its lookup tables, its pools of names and its versioning rules all collapse into a schema and an index. What refuses to collapse is the memory sharing, and that is what ELF was quietly buying all along.
Point the repo's elf2self converter at any Linux binary and you get one of these database-files back; the NixOS virtual-machine demo boots a whole userland on the format if you want the full thing.
Open the repo at fzakaria.com →The lenses
The facts
Concepts
How this connects
Tap a node to open it