The computing counterpart to the physics series ── this time we descend, one step at a time, into "the origin of software"
gcc (or clang) running on Linux. So what about that gcc? ── The previous gcc compiled it. And the one before that? Where, exactly, did this "endlessly spinning loop" begin?
When you build the Linux kernel, you use a C compiler called gcc. Since gcc itself is also a program written in C, to run it you need a gcc that someone has compiled. So what compiled that gcc? ── Again, gcc. Then what made the very first gcc, in a world where not a single compiler yet existed? This is the chicken-and-egg problem. This series traces that loop backwards through time, descending into the birth of the C language, the first UNIX, and finally the "first byte."
"Compiling a compiler" makes your head spin when you write it out like this.
An active compiler is usually written in its own language and built by its own past self. This is called self-hosting. A new gcc is made by an old gcc, which was made by an even older gcc, and so on… the loop keeps spinning round and round. Try spinning that loop in the figure below.
The self-hosting loop cannot start itself. It needs "the previous version of itself," yet at the very beginning there is no "previous version." So the loop must always be ignited once by something outside the loop. The word bootstrap originally comes from the physically impossible tall tale of "pulling yourself up by your own bootstraps." In the world of software, too, only the very first time is an "outside hand" needed to lift it.
Let's rewind time. Today's Linux can be built on Linux, but the first Linux of 1991 couldn't be built on Linux, because Linux didn't exist yet. So where, then? ── The answer is on top of another Unix-like OS called MINIX. Linus Torvalds, then a student in Finland, developed on a 386 PC running MINIX. He ported GNU's gcc and bash to MINIX and compiled Linux with that gcc.
v0.01 (September 1991)
It couldn't even boot on its own, and without MINIX it could neither be compiled nor tested. The loop wasn't spinning yet ── it was piggybacking on another OS, MINIX.
v0.11 (December 1991)
Here, for the first time, Linux could compile Linux itself (self-hosting achieved). The moment the loop began to spin. For the roughly thirty-plus years since, that loop has kept turning.
So the "ignition" of the Linux loop was gcc on top of MINIX. The next question, then, is obvious ── what made that gcc? What made MINIX? Even once you step outside the loop, another "what made this?" is waiting. Repeating that question is the backbone of this series.
clang (LLVM), but that only became mainstream in the late 2010s, a latecomer; almost the entire history is the story of gcc. And clang itself is a program written in C++, so it too lives inside a self-hosting loop built by another compiler. Whether the tool is gcc or clang changes nothing about the chicken-and-egg structure.
Repeat "what made this?" and you keep walking down a staircase, step by step. This staircase is exactly the table of contents of this series. Move the slider in the figure below to go back in time, and at each step check "what made what." At the very bottom lies the answer to the chicken-and-egg riddle.
Today's loop (gcc/clang) → the first Linux (1991) was gcc on MINIX → gcc was ignited by an existing cc → MINIX was ACK → the first C compiler was grown from B until it self-hosted → B is a child of BCPL → the first Unix (1969) was PDP-7 assembly → that assembler was a cross-assembler on another machine + paper tape → the very first was a human entering it by hand with switches → the bottom is wired-up hardware.
Let me get ahead of things and stamp out one trap that beginners always fall into. The lineage (bloodline) story ── "Linux came from MINIX, MINIX came from BSD…" ── and the what compiled what story we've been looking at are two different things.
① Code lineage: did it inherit the actual source code? A family tree in which genes (code) flow, like Unix → BSD → NetBSD/FreeBSD…
② Toolchain bootstrap: what compiled what. The chicken-and-egg loop this series follows. Neither Linux nor MINIX is actually a child that inherited someone's blood; each is a clean-slate reimplementation that "behaves like Unix" (so neither appears on ①'s lineage). We'll dissect this in Episode 1.
Mix these two up and you get misunderstandings like "Linux is MINIX's child." Correctly: Linux merely borrowed MINIX as a delivery room (development environment) to grow up in; there is no blood tie. We'll do that satisfying reveal at the very start of the next episode.
The series' watchword, "the first egg was carved by hand," sounds like a poetic metaphor, but on the bottom step it is very nearly literal fact (Episode 9). On early computers, humans read the instruction table, worked out the machine-code numbers by hand, and entered them into memory one word at a time with toggle switches. On the other hand, claims at each step like "the first Linux was compiled by gcc on top of MINIX" are historical facts sourceable down to the dates and the people. We carefully separate these two kinds ── verifiable history and turns of phrase for understanding ── in each episode's footnotes.
Likewise, points that get prickly if spoken carelessly ── such as where to draw the line between v0.01 and v0.11 (from where do we call it "self-hosting"), or "gcc vs clang" ── are distinguished with care each time.
The gcc that compiles Linux was made by a previous gcc ── a compiler lives inside the self-hosting loop, written in its own language and built by its own past self. But the loop can't start on its own, because at the beginning there is no "previous self." The Linux loop was ignited in 1991 by gcc on top of MINIX (v0.01), and it stood on its own at v0.11.
Repeat "what made this?" and you walk down the staircase: gcc → existing cc → C → B → BCPL → assembly → cross-assembler → hand entry → hardware. At the bottom lie a human hand and a wired-up machine that lifted the loop just once from outside. That is the shape of this series' answer ── the first egg was carved by hand. Note that "what compiled it (the bootstrap)" and "whose genes it carries (the lineage)" are separate questions, and must not be mixed. Next time, we begin with exactly that dissection.
Printing / making a PDF: ⌘+P (on Windows, Ctrl+P). On screen, use "▶ Spin the loop" in Figure 1 to turn the self-hosting loop, and the slider in Figure 2 to trace back through time. "Show answer" opens each solution.