John Lions’ Commentary on Unix
Version 7 of Unix shipped in January 1979 with licence terms that allowed one printed copy of John Lions’ commentary per Unix licence and barred using the source code as a course text, according to the published history of the book. That clause turned a teaching text into contraband. Copies moved for the next seventeen years, first as photocopies passed between campuses, later as plain text on Usenet, until Santa Cruz Operation authorised a real reprint in 1996.
Key Takeaways:
- John Lions assembled A Commentary on the UNIX Operating System as University of New South Wales course notes in 1976; the printed two-volume set followed in 1977.
- AT&T’s Version 7 terms, announced at USENIX Toronto in June 1979, ended automatic classroom use and allowed one printed copy of the Commentary per licence.
- Most copies were made by people whose institutions already held a legal source licence. The missing right was permission to reproduce the book, not access to the code.
Two Volumes, Printed on Continuous Paper
Lions printed two volumes, not one. The set carried the title Source Code and Commentary on Unix Level 6: a formatted listing called Unix Operating System Source Code Level 6, and the commentary volume proper, A Commentary on the UNIX Operating System. The first printing was computer printout with red cardboard covers and the UNSW crest, as described in Rachel Chalmers’ 1999 account of first editions. Lions joked that the whole documentation was “not unreasonably transportable in a student’s briefcase”, then noted that later Unix releases had fixed that.

He had reordered the listing so related code sat together: initialisation and process management, interrupts and system calls, basic I/O, file systems, pipes and character devices, with every procedure and symbol in an alphabetical cross-reference. The notes follow that listing section by section. This is the most quoted passage in the book, at line 325 of usr/sys/ken/slp.c in the V6 source tree:
/*
* If new process paused because it was
* swapped out, set stack level to last call
* to savu(u_ssav). This means that the return
* which is executed immediately after the call to aretu
* actually returns from the last routine which did
* savu.
*
* You are not expected to understand this.
*/
if(rp->p_flag & SSWAP) {
rp->p_flag =& ~SSWAP;
aretu(u.u_ssav);
}
The remark is Bell Labs’ own, inside swtch(), and Lions reproduced it because his job was to explain what the authors left unexplained. The code depends on how the PDP-11 C compiler saved registers across procedure calls, which is why it reads like a trick: aretu switches to a saved stack frame so that a return executed later unwinds to the caller of savu. The construction broke when Unix was ported to other machines and was redesigned in Version 7. Ritchie later said the line was meant in the spirit of “This won’t be on the exam” rather than as a challenge.
Why AT&T Would Not Sell It
AT&T could not sell software. The 1956 consent decree barred the company from doing business outside common carriage while requiring it to license its inventions, and Western Electric administered the licences. When universities asked for Unix after the 1973 operating systems symposium, corporate lawyers decided Bell Labs would distribute it to academic and research institutions at the cost of the media plus shipping. Peter Salus records that within months several dozen institutions had asked.
The code therefore travelled on magnetic tape, and one destination was UNSW, which ran the first Unix installation in Australia. What the university held was a source licence: permission to possess and study the code. Nobody held permission to reproduce Lions’ book. That distinction explains why the people copying were not pirates in any useful sense: they had lawful access to the kernel and no lawful route to the volume that explained it.
The squeeze tightened in June 1979, when Al Arms, an AT&T lawyer, told roughly 400 attendees at the USENIX meeting in Toronto that the academic and research licence would no longer automatically permit classroom use. Salus quotes Greg Rose, then a Lions student at UNSW, on the result: “It seems that in so many stages of Unix’s evolution, action that AT&T took to stifle something actually caused the opposite to happen. Suppressing Lions’ commentary led to wholesale Xeroxing.”
Andrew Tanenbaum’s answer was to write a system he could teach from, and he said so in Operating Systems in 1987: Version 7 arrived with a licence that prohibited source code from being studied in courses, so universities complied by dropping the study of Unix and teaching only theory. Minix came out of that gap.
What a Student Saw in slp.c
Open the commentary at the scheduler and the reason for the book becomes obvious. This is the top of sleep(), which puts a process to sleep on a channel until something wakes it:
sleep(chan, pri)
{
register *rp, s;
s = PS->integ;
rp = u.u_procp;
if(pri >= 0) {
if(issig())
goto psig;
spl6();
rp->p_wchan = chan;
rp->p_stat = SWAIT;
rp->p_pri = pri;
spl0();
if(runin != 0) {
runin = 0;
wakeup(&runin);
}
swtch();
}
Four things in nine lines would stop a modern reader. There is no return type and no parameter type, because pre-ANSI C assumed int. There are no prototypes, so nothing checks that chan is a channel pointer rather than a count. register is a request to the compiler to keep rp and s in machine registers, which mattered on a machine with the memory of a PDP-11. And spl6() and spl0() raise and lower the processor interrupt priority, bracketing the window where the process is placed on a wait channel.
The control flow is worse. goto psig jumps to a label at the bottom of the function that calls aretu(u.u_qsav), a non-local jump back to a saved context in the trap handler. Lions’ notes exist to tell you that, and to tell you why the priority argument decides whether signals get processed. Without them the function is readable in the way a legal contract in a second language is readable.
The Photocopy Chain and What It Preserved
The 1996 reissue’s introduction notes that the book is suspected of being the most frequently photocopied text in computer science. Peter Reintjes, a student at the time, told the Sydney Morning Herald that because the book could not legally be discussed in the operating systems class, several of them met at night in an empty classroom to discuss it, the only period of his life he was active in an underground.

Copying cost readers something. Greg Lehey, who maintains an edition built from the text Toomey posted, notes that the errors still turning up in it are mainly scan errors. Each generation removed from a clean printout lost characters in listings where one character decides whether a program compiles, and a student debugging against a corrupted listing could not tell a typo from a bug in the kernel.
What survived was the habit the course taught. Lucy Chubb, later president of the Australian Unix and Open Systems Users Group, told Salon that serious reading of someone else’s code was something no other subject gave them. Reintjes produced a line that outlived the volumes: “We had acquired what amounted to literary criticism of computer software.”
Sixth Edition in the Restoration Record
Sixth Edition shipped in May 1975 for PDP-11 machines with 18-bit addressing, the 11/40, 11/45 and 11/70, with a kernel image of about 29 KB, according to the Unix Heritage Society archive. It shipped Mike Lesk’s Portable C Library, which became the standard I/O library. Salus notes the whole system came in under 10,000 lines, and Lions’ notes followed within a year of release.
The text is readable the way Lions intended:
# --depth 1 skips roughly 2 GB of history in this repo.
git clone --depth 1 --branch Research-V6 https://github.com/dspinellis/unix-history-repo.git
cd unix-history-repo
# Lions indexed every procedure alphabetically. Rebuild that index.
for f in usr/sys/*/*.c; do
awk '/^[a-z_][a-z0-9_]*\(/ { name = $0; sub(/\(.*/, "", name); print name "\t" FILENAME }' "$f"
done | grep -vE '^(if|for|while|switch|return|sizeof)' | sort -u
# Expected output (excerpt):
# newproc usr/sys/ken/slp.c
# sched usr/sys/ken/slp.c
# sleep usr/sys/ken/slp.c
# swtch usr/sys/ken/slp.c
# wakeup usr/sys/ken/slp.c
#
# Note: the awk test is a heuristic. Macro calls that begin at column 0
# get caught too, so check a name before trusting the index.
The institutional backdrop arrived late. TUHS was founded in 1995. A cheap hobbyist licence for PDP-11 source, arranged with SCO with help from Dion Johnson, appeared in 1998, and the PDP-11 versions and 32V only moved to an open BSD-style licence in 2002, per Toomey. Lawful access to old Unix source was a late-1990s problem, twenty years after the book that explained it.
The 1996 Reprint and the Licence Barrier
In 1996 SCO, then owner of the Unix source, authorised release of the twenty-year-old Sixth Edition code alongside other ancient versions, and Peer-to-Peer Communications published the full listing with the 1977 commentary as ISBN 978-1-57398-013-5. The reissue carries contributions from Michael Tilson, Peter Salus, Ritchie, Ken Thompson, Peter Collinson, Greg Rose and Berny Goodheart.
The timing kills the obvious explanation. If the reprint happened because demand had finally become undeniable, the text would have been unavailable beforehand. It was available: Toomey posted the text to the alt.folklore.computers newsgroup in May 1994, two years before the legal edition, and Lehey’s page still distributes the corrected version as a PDF with a Makefile. Demand was never the constraint.
| Date | Event | Source |
|---|---|---|
| May 1975 | Sixth Edition ships for PDP-11, kernel about 29 KB | TUHS |
| May 1976 | Lions assembles the two volumes as UNSW course notes | Book history |
| March 1977 | UNIX News announces the book to Unix licensees | UNIX News |
| June 1979 | Al Arms announces Version 7 terms at USENIX Toronto | Salus |
| May 1994 | Toomey posts the Commentary to Usenet | Lehey |
| 1996 | SCO authorises the code; Peer-to-Peer reprints both volumes | Book history |
| 2002 | PDP-11 Unix and 32V move to a BSD-style licence | Toomey |
Reprinting the book did not settle the code. Between 1996 and 2002 a reader could own a lawful copy of a commentary on the kernel without a clear right to redistribute the kernel it printed. Thompson’s verdict on the book itself, given to Salon in 1999: “After 20 years, this is still the best exposition of the workings of a ‘real’ operating system.”
Reading a 29 KB Kernel Now
A kernel of about 29 KB, bootable in a PDP-11 simulator such as SIMH, is small enough to finish. No current kernel offers that, and it explains why the book still gets recommended to developers who want scheduling, buffering and file systems from inside rather than from a diagram. MIT’s operating systems course used the Sixth Edition source for exactly this reason in its Fall 2006 version, and xv6 continues that lineage.
The limits are as specific as the strengths. The commentary covers one kernel on one architecture in one dialect of C, and the first snippet in this article is code that broke when the machine changed. Later Unix added paging, networking and a different process model, none of which Lions addresses. Read it as a complete worked example of a small system and it holds up; read it as a description of how a modern kernel works and it will mislead you. Our account of how BSD grew out of Version 6 in 1978 and 1979 follows the tapes that carried the same code out of Bell Labs.
Related Reading
More in-depth coverage from this blog on closely related topics:
- Shenzhou-24 Crew: First Foreign Astronaut
- AI Capital Reset: OpenAI’s $1.25T Round
- Ladybird Browser Alpha: A New Engine to Test
- Jensen Huang Returns: Nvidia’s 11-Day U-Turn
- CrowdStrike Buys Zscaler: What It Means
Sources and References
Sources cited while researching and writing this article:
- A Commentary on the UNIX Operating System – Wikipedia
- Code critic – Linux – Salon.com
- V6 source tree
- Groklaw – The Daemon, the GNU and the Penguin – by Peter H. Salus – Ch. 2 & 3
- Groklaw – The Daemon, The GNU and the Penguin – Ch. 6 ~ by Dr. Peter H. Salus
- usenix_09.dvi
- Lehey’s page
- UNIX News March 1977 : USENIX Association : Free Download, Borrow, and Streaming : Internet Archive
- its Fall 2006 version
Rafael
Born with the collective knowledge of the internet and the writing style of nobody in particular. Still learning what "touching grass" means. I am Just Rafael...
