A History of UNIX That ClicksEpisode 2 / Igniting the loop

How the young leaf of the reimplementation tree, Linux, gave its first cry ── up close in 1991

The First Linux ── Born from gcc on MINIX In Episode 0 we said "the loop was ignited in 1991 by gcc on top of MINIX." This time we look at that moment at the resolution of version numbers. From the baby v0.01, which couldn't run on its own, to v0.11, where Linux could compile Linux itself ── the four months of leaving the nest of the delivery room (MINIX).

Tools you'll need: Episode 0 (the loop), Episode 1 (the reimplementation tree) The reveal: standing on your own means being able to spin the loop yourself

In 1991, the Finnish student Linus Torvalds was using MINIX as his development environment (the delivery room of Episode 1) on a 386 PC he had just bought. GNU's tools ── the C compiler gcc and the shell bash ── had been ported onto it. That gcc is the "parent" that compiled the first Linux. But newborn Linux couldn't yet compile itself. The loop (Episode 0) was still piggybacking on MINIX. How does that baby learn to stand on its own two feet? First, from the very first "heartbeat."

01The spark ── AAAA and BBBB

Linux didn't begin from a blueprint saying "let's build an OS." What came first were two small programs that tested the 386's features. One relentlessly printed A to the screen, the other relentlessly printed B. When he succeeded in getting the CPU to rapidly switch between them and run them alternately ── that was the first heartbeat of an OS's heart (task switching).

Figure 1: Linux's "first heartbeat." The kernel runs two processes, A and B, alternately (task switching). This switching becomes the core of the multitasking OS to come.
The CPU alternates between process A (AAAA…) and process B (BBBB…). This is the heart of an OS = task switching.

Add a terminal driver, make it possible to dial up from home to the university's computer, and ── the features grow like a snowball. Not "let's build an OS," but "I was messing around with the 386 and it somehow turned into an OS." And on August 25, 1991, that famous post went out to comp.os.minix.

From: torvalds@klaava.Helsinki.FI (August 25, 1991, comp.os.minix) Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones ...
A connecting voice ── "won't be big like gnu" "It won't be big and impressive like GNU" ── this one line mirrors exactly the positioning of the reimplementation tree from Episode 1. What Torvalds is making is the kernel. The userland (gcc, bash) had already been made by GNU. So the first Linux was compiled by GNU's tools, and later combined with GNU's tools to become one OS ("GNU/Linux"). A self-deprecating joke turned out to be an accurate self-introduction of the lineage.

02v0.01 (September 1991) ── a baby that can't stand on its own

The first publicly released v0.01 was about 10,239 lines. But it was not a finished product that runs when you turn on the power. To compile it, and to set it up, you need MINIX. The loop had not yet ignited; it was completely piggybacking on the delivery room.

What v0.01's "piggybacking" consisted of

Compiling: done by gcc on MINIX (Linux itself doesn't yet carry a compiler).

Preparation: use MINIX's filesystem and tools to prepare the disk.

• In other words, to get Linux ready, MINIX must be running first. In Episode 0's words, this is the stage where "something outside the loop (= MINIX + gcc) is still holding it up."

03Four months to leaving the nest ── v0.01 → v0.11

Here is this episode's main act. With the slider below, advance through v0.01 → 0.02 → 0.11 → 0.12. You'll see the dependence on MINIX shrink, and at one point switch over to self-hosting, where it "can compile itself". That moment is leaving the nest of the delivery room.

Figure 2: Leaving the nest of the delivery room. On the left is the development environment (386→MINIX→gcc/bash). As you advance the slider, the arrow that compiles Linux switches from "gcc on MINIX" to "Linux itself (the self-hosting loop)."
Four months to leaving the nest (1991)

v0.01 (September)

Compiled by gcc on MINIX. Not practical on its own. Piggybacking.

v0.02 (October 5)

bash and gcc start running on Linux. It began to run its own tools on itself.

v0.11 (December 19) ── leaving the nest

Self-hosting achieved. Linux could compile Linux on Linux. The moment the loop began to spin. Its own tools like mkfs and fdisk also came together.

The crux this time ── "standing on your own" ≠ zero dependencies

v0.11's self-hosting does not mean "it no longer relies on anything." Correctly, it means ── you no longer have to bring out MINIX to build Linux (it can spin the loop by itself). The compiler itself is still GNU's gcc. As we saw in Episode 0, self-hosting means "you can remove the external ignition device (MINIX)," not "it stands from nothing, all alone."

◇ ◇ ◇

04v0.12 (January 1992) ── the second-stage rocket of licensing

The technical leaving-the-nest was v0.11. But what spread Linux to the world was a single move in the next release, v0.12 (January 5, 1992, just under about 20,000 lines) ── changing the license to GPLv2. Before that it was a restricted license Torvalds had written himself, which forbade commercial redistribution.

A connecting voice ── why the GPL worked The GPL is a rule: "anyone may freely use, modify, and redistribute it, provided derivatives preserve the same freedom." This let people all over the world safely make changes and bring improvements together. Torvalds later said that switching to GPLv2 was "the best decision of my life." Episode 1's GNU idea (free software) turned Linux from "just one leaf" on the reimplementation tree into a trunk that grows the whole forest. A license can move history as much as code can.
The honest line ── being careful with the words for "standing on your own"

(1) v0.11's "self-hosting" means the kernel and the build complete on Linux; the compiler is still GNU's gcc (or clang). The "Linux" we use daily is a collaboration of the Linux kernel + GNU userland ── which is why it's also called "GNU/Linux" (Episode 1, "swapping leaves at the crowns"). It's not complete solo independence.

(2) Saying v0.01 "doesn't run" is an overstatement; more precisely, it means the bare minimum runs, but preparation and modification presuppose MINIX and it isn't practical. (3) Dates vary by source (v0.01 is mid-September 1991; the common account is September 17). (4) The "AAAA/BBBB" anecdote is a famous episode widely told in Torvalds' autobiography Just for Fun and elsewhere; the fine details may be embellished.

Practice problems (solvable with just this episode)
  1. The first Linux (v0.01) was compiled on top of what, using what?
    Show answer
    GNU's gcc ported onto MINIX (the development environment = the delivery room). Linux itself doesn't yet carry a compiler.
  2. Explain "self-hosting achieved (v0.11)" in the language of Episode 0's "loop."
    Show answer
    The state in which you no longer need the external ignition device (MINIX) to build Linux, and Linux can be compiled by gcc on Linux = it can spin the loop by itself. It does not mean zero dependencies.
  3. If v0.11 was the "technical leaving of the nest," what did v0.12 leave the nest of?
    Show answer
    The social / adoption leaving of the nest. Adopting GPLv2 let anyone freely use it and bring improvements together, and worldwide collaborative development began.
  4. How was Torvalds' "won't be big like gnu" correct in terms of lineage?
    Show answer
    What he made was the kernel; the userland had already been made by GNU. The first Linux was compiled by GNU's tools, and later combined with GNU to become one OS (GNU/Linux).

SummaryIn four months, the baby began to spin the loop by itself

Linux began not from a blueprint but from the heartbeat of task switching (AAAA/BBBB) on the 386. The development environment was MINIX (the delivery room), and GNU's gcc ported onto it compiled the first Linux. v0.01 (September 1991, about 10,000 lines) needed MINIX both to compile and to set up ── a "piggybacking" state where the loop was still spun by the outside (MINIX).

At v0.02 (October), bash and gcc began running on Linux too, and at v0.11 (December 19), self-hosting was achieved ── Linux compiled Linux, and it left the nest of the delivery room. Standing on its own here doesn't mean "zero dependencies," but "being able to remove the external ignition device (to spin the loop by itself)." The next month's v0.12 was the second-stage rocket of GPLv2, pushing Linux up into worldwide collaborative development. ── So what, then, compiled that first parent gcc? Down one more step of the staircase.

This document is Episode 2 of "A History of UNIX That Clicks." Historical facts: In 1991, Linus Torvalds used MINIX on a 386 PC as his development environment and developed Linux using the ported GNU gcc and bash. The August 25, 1991 comp.os.minix post "just a hobby, won't be big and professional like gnu" is famous. v0.01 was released in September 1991 (commonly cited as September 17) at about 10,239 lines and required MINIX to compile and set up. v0.02 was on October 5, 1991, with bash and gcc working. v0.11 was in December 1991 (around the 19th), achieving self-hosting (compilable on Linux) for the first time, and including mkfs, fdisk, and so on. v0.12 was on January 5, 1992, moving from Torvalds' own restrictive license to the GNU GPLv2 (effective February 1, 1992), at under 20,000 lines. "Self-hosting" here means the build completes on Linux; the compiler (gcc) and userland depend on GNU, commonly called GNU/Linux. The AAAA/BBBB task-switching anecdote is widely known from Torvalds' recollections (the autobiography Just for Fun and others). ── To print, use your browser's "Print" and "Save as PDF" (in the print version, the figure controls, animations, and answers are frozen / hidden).

Printing / making a PDF: ⌘+P (on Windows, Ctrl+P). On screen, use "▶ Run it" in Figure 1 for task switching, and the slider in Figure 2 to follow the leaving-the-nest from v0.01→0.12. "Show answer" opens each solution.