Lions' Commentary on Unix: Why It Was Secretly Copied for 20 Years

246 points by joonehur 15 hours ago on hackernews | 51 comments

turtleyacht | 14 hours ago

Programmers know the value of books.

sirtaj | 14 hours ago

Interestingly, Plan 9 was already being distributed as books with source at the same time. So Thompson, Pike et al were already on board with this idea.

Have to appreciate the little irony of SCO being the first to allow publishing of the book.

EdwardDiego | 13 hours ago

That irony regarding SCO struck me too. "Wait, SCO? That SCO? Huh."

tankenmate | 13 hours ago

I'm pretty sure that it was "Santa Crus Operation" (i.e. "Good SCO") that gave permission for the book to be published (Unix Support Group (USG) was sold to Novell and then to "Good SCO"). "Bad SCO" was "SCO Group" (Darl McBride, et al) which was ex Caldera.

And I just looked up his name because I had forgotten it, Peter Salus (Unix historian) along with Dennis Ritchie and Berny Goodheart (author of "The Magic Garden Explained", SVR4 kernel primer) who pushed for "Good SCO" to publish the Commentary.

sirtaj | 12 hours ago

I thought so too, but by 1996 Novell had already sold (some subset of, as we found out) Unix to "Bad SCO"... or what eventually became ex-Caldera Bad SCO.

That whole story is such a shame. I recall pining for Xenix as a young geek.

tankenmate | 5 hours ago

Novell bought USL from AT&T in 1993, Novell sold USL (minus USG) to Santa Cruz Operation 1995, Santa Cruz Operation sold their server and profession services divisions to Caldera (After that SCO renamed themselves to Tarantella Inc), in 2002 Caldera changed its name to "The SCO Group". Darl McBride was appointed CEO after Caldera acquired the Unix assets from "old SCO". And of course McBride was the one who lead the SCO vs IBM lawsuit.

jibalt | 11 hours ago

Santa Cruz (a city in California).

I worked for a competitor, Interactive Systems Corporation, so for us they were always "bad".

jeffrallen | 13 hours ago

"You are not expected to understand this."

:)

jibalt | 11 hours ago

For good reason -- it was buggy! It used the wrong stack. They fixed it in V7.

I was a UNIX kernel hacker working for Interactive Systems Corporation. I studied and hand simulated that code, understood it, and saw that it was buggy, but I don't remember whether that was before or after I saw the fix in the V7 kernel code.

Taniwha | 9 hours ago

Not really, they just didn't have setjmp/longjmp yet, they used something else. The real thing you weren't meant to understand was why a routine that was never called returning a value and mostly didn't return a value had to return "1" at that particular point

https://www.taniwha.com/~paul/not.html

(I worked for another competitor, UniSoft, SCO ripped us off too, on the 286 port)

mesrik | 8 hours ago

And the comment was as Wikipedia page explains, just a Lions note his students not to worry being asked in exam.

https://en.wikipedia.org/wiki/A_Commentary_on_the_UNIX_Opera...

No, the comment wasn't Lions', it was in UNIX.

mesrik | 5 hours ago

Yes, you are correct. It was Richie who wrote it. My bad. But Richie intention was same, viewing from Lions point it was perhaps same. He didn't expect his students to understand that part.

ajasmin | 12 hours ago

Is there a good modern reprint of Lions` book?

QuantumNomad_ | 11 hours ago

They link to Amazon from the OP:

Lions' Commentary on Unix, https://www.amazon.com/Lions-Commentary-Unix-John/dp/1573980...

Or did you mean a version of the book written for a later version of Unix?

hidroto | 12 hours ago

shermantanktop | 10 hours ago

That Wikipedia page is wild. I never knew the detailed history. It explains why the Real Book has so many Steve Swallow tunes!

analog31 | 6 hours ago

>>> The other big problem with these fake books at this point was that the music inside felt really out of date. The fake books hadn’t changed since the mid-40s, but jazz had.

Amusingly, the "contemporary" tunes in the Real Book are now 50+ years old.

I got a Real Book around 1982, and it was revelatory. Of course I was picking up tunes by ear before that, as a bassist, and I still do today. But the RB made some of the more "weird" tunes approachable, and allowed bands to form for gigs even if we didn't all know 4 hours of material.

scarecrowbob | 2 hours ago

I play a lot of low-rent jazz, and I like mostly early jazz, so a weird-to-me thing is that much of the real book is newer than the music that I generally enjoy playing with jazz bands.

I of course play all kinds of stuff (pedal steel and bass in country bands, keys in rock bands), but the jazz I enjoy is mostly pre-1955ish. I've gotten a lot more miliage out the the blue book and the django book, but the Bb real books made getting into clarinet performance much, much easier. I'm almost done weaning myself off written music for the clarinet.

lelandfe | 4 hours ago

I remember being deeply confused seeing a “Fake Books” section in Powell’s in Portland, and it all being music.

mkarliner | 11 hours ago

I still have my bootlegged photocopy from around 1985
Me too. Two ‘volumes’, one for the source and one for the commentary, to have them open side by side.

(I spent so much on the departmental copier as a bored intern.)

emmelaich | 3 hours ago

I have my older brother's original copy; he did the Lions course at UNSW in 1978 or '79.

I probably should wrap it in plastic to preserve it ...

jibalt | 11 hours ago

I got my hands on the Lions book at some point, but I worked for Interactive Systems Corporation, a UNIX development shop, and had already seen the code.

pjmlp | 11 hours ago

Yes, many forget that books like the Lions' Commentary on Unix, or later Andrew Tanenbaum on Minix, are the reason UNIX alongside C, won over the big bucks alternatives universities had to pay for.

Had UNIX been a commercial product from the start, history would have taken a quite different timeline for both of them.

intrasight | 8 hours ago

> Had UNIX been a commercial product

I'm confused. Was't UNIX a commercial product?

No. AT&T was not allowed to sell software due to their phone monopoly

AlecSchueler | 7 hours ago

That's also why they had to put so much time and money into research in the first place.

ndiddy | 6 hours ago

Unix was commercialized in the sense that AT&T sold source code licenses to universities and companies through its existing IP licensing organization. These licenses were quite expensive (~$20,000). They just couldn't run a traditional software business where they would directly sell Unix to end users and provide support. Unix was never public-domain or freely redistributable.

pjmlp | 6 hours ago

UNIX source tapes were available already for $200 for universities, which was kind of pennies when compared to anything coming from IBM, DEC, GE and co, and basically the cost to copy and send the tapes.

The price that you mention was only for commercial entities.

FLeXMurphy | 3 hours ago

I went through the MINIX book not too long ago. To me there is a notable difference in style and where the attention is given, mostly because Tanenbaum was the author of MINIX and the author of the book. The "three main" pillars or whatever he called them are covered carefully. UNIX commentary is a commentary on something someone else did; it's like an archeological dig of sorts. "You are not expected to understand this" is not part of a kernel developers repertoire.

My only gripe is we are unlikely to see a new MINIX book and I do not foresee something of the sort with xv6; the appetite isn't there likely in the age of AI, and anyone pursing it would be doing so a kind of "work of art", perhaps as a flex against AI, not sure.

ferguess_k | 2 hours ago

I found this for Linux 0.12:

https://download.oldlinux.org/ECLK-5.0-WithCover.pdf

xv6 also has two books: one for the explanation and one for the full source code. I kinda prefer books with full list of source code over Lion's book or the Minix book.

The Linux one above is my fav. It contains both explanation and source code.

pjmlp | an hour ago

Yeah, there was the re-edition for MINIX 3, the microkernel rewrite with NetBSD userland, and that was it, nothing has happened since 2016, apparently.

pessimizer | an hour ago

If AI stops sucking, it could write the new MINIX book. Humans still have to understand how stuff works in order to steer stupid AIs. I'll believe we don't once somebody uses vibe-coding to finish and ship HERD.
Is there a definitive equivalent about Linux?

FLeXMurphy | 4 hours ago

There is this: https://lwn.net/Reviews/LinuxCoreKernel.php3. Though it is outdated.

And then FreeBSD has a handful of these books. Some are printed others are PDF-only. For example "Design and Implementation of the FreeBSD Operating System". Which is a tad more up to date.

JdeBP | 7 hours ago

By the time I got hold of a copy when the book came out, the Deitel and Kogan book on OS/2 had been out for 2 years, as had the Goodheart+Cox Magic Garden book, the Leffler+McKusic+Karels+Quarterman book on 4.3BSD had been out for 7 years, the Bach book had been out for 10 years, and the Xinu books had been out for 12 years.

The Lions book wasn't really very useful by 1996.

Whereas Vahalia's and Pate's books on Unix, which also came out in 1996 but covered things that had happened in the intervening decades, were a lot more useful.

pjmlp | 5 hours ago

The usefulness of the book was helping to widespread UNIX on university campus during its early days, afterwards, just like the K&R C first edition, it became an historical artifact.

kragen | 2 hours ago

The Lions book wasn't useful as a guide to the kernel of your operating system anymore in 01996, but it was very useful in understanding why C and Unix were the way they were. A lot of Unix's Chesterton's Gates are justified in it, which is what you need to tear them down. And it was also very useful for writing a new operating system, because it includes enough source code to compile into a pretty complete multiprocess timesharing operating system supporting multiple terminals, multiple user accounts, a hierarchical filesystem, and the still-familiar Unix system call interface.

I don't think any of those other excellent books are really an adequate replacement. Deitel and Kogan obviously don't include the OS/2 source code; Bach https://abhyass.wordpress.com/wp-content/uploads/2016/09/the... and Goodheart & Cox are mostly pseudocode, with no kernel source code; the Devil Book is almost but not completely devoid of kernel source code; the Xinu book https://willendless.github.io/assets/os_arm_doc/Operating%20... is great (and clearly owes a lot to Sixth Edition Unix), but Xinu lacks, for example, users and subdirectories.

Most of these, though not the Xinu book, cover operating systems that are much too big and complicated to explain fully in a single book, so they confine themselves to conceptual overviews. In my view, this reinforces the syndrome Comer critiques in the preface to the Xinu book:

> Students form the impression that an operating system is a black box, and textbooks reinforce the misimpression by explaining operating system features and focusing on how to use operating system facilities. More important, because they only learn how an operating system appears from the outside, students are left with the feeling that an operating system consists of a set of interface functions that are connected by a morass of mysterious code containing many machine-dependent tricks.

By contrast, in the Lions book's commentary volume https://cs3210.cc.gatech.edu/r/unix6.pdf (note, this PDF doesn't include the source-code volume!) we find line-by-line commentaries like:

> It is now time to take a good look at the procedure which creates new processes as (almost exact) replicas of their creators.

> 1841: “mpid” is an integer which is stepped through the values 0 to 32767. As each new process is created, a new value for “mpid” is created to provide a unique distinguishing number for the process. Since the cycle of values may eventually repeat, a check is made that the number is not still in use; if so a new value is tried;

> 1846: A search is made through the “proc” array for a null “proc” structure (indicated by “p stat” having a null value); 1860: At this point, the address of the new entry in the “proc” array is stored as both “p” and “rpp”, and the address of “proc” entry for the current process is stored both as “up” and “rip”; [...]

Even the Xinu book doesn't go into that level of detail. It is, in my view anyway, much less accessible than Lions, requiring a great deal more previous knowledge of programming.

If a relatively new programmer felt that a kernel was "a morass of mysterious code containing many machine-dependent tricks", I don't think they could retain that feeling after working through the Lions book, although it does contain some machine-dependent tricks.

I have the strong impression that all of Bach, Goodheart & Cox, and the Devil Book authors wanted to include the kernel source code they were commenting on, because in many cases they discuss specific functions, struct fields, and variables, and then, in most cases, describe algorithms in pseudocode. My inference is that they were forced into this exigency by legal threats from the Death Star, not that they thought the pseudocode was actually didactically superior to the actual source code. Comer didn't have this problem because Xinu didn't include any Unix source code and wasn't even Unix-compatible at the system call level.

What was an adequate replacement in 01996 was Linux, which came with full source code and a mailing list full of people who were eager to discuss it.

But, even then, Linux was not ideal as a teaching system. Which is why, in 02006, the PDOS folks rewrote Sixth Edition Unix in ANSI C and have been using it for teaching ever since: https://github.com/mit-pdos/xv6-riscv

acomjean | 7 hours ago

I took the Linux Kernel Internals class at redhat as my company was switching from HPUX and Solaris. HPUX had some great tools for semi real time and we needed OS info. They gave us a tome that was really useful, but slowly went out of date….

Thankfully Linux has no such restrictions.

markus_zhang | 4 hours ago

I just checked and they don’t offer RHD236 anymore.

Would you say that internal class had in-depth information, or was it more like a general Linux kernel overview class?

ferguess_k | 6 hours ago

Recommending the same treatise on Linux 0.12 (The authors meticulously translated everything into English a few years ago):

https://download.oldlinux.org/ECLK-5.0-WithCover.pdf

The whole website is dedicated to old Linux. (https://oldlinux.org/)

mapcars | 5 hours ago

One more reason to acknowledge the internet and sharing of knowledge it brought.

dboreham | 4 hours ago

Lucky to have an original copy. Since nobody in my family understands it's significance, I've attached a postit "Valuable, do not throw out" for when the grim reaper arrives.

ferguess_k | 4 hours ago

Or maybe "Check thiftbooks and ebay for estate price", something like that.

knorker | 4 hours ago

This article is like the hospital reception scene in Idiocracy.

It makes me sad. This is what we've come to, in order for people to be able to read?

pessimizer | an hour ago

Yours is a bizarre sentiment. This is what we have come out of. It should cheer you up. This once holy grail is now a throwaway link at the bottom of a comic describing how it was once the holy grail.

When I was a kid, I would spend years looking for particular books in order to own them, and have to use interlibrary loans that might take weeks just to read things. If anybody should be nostalgic, it's the people remembering when knowledge used to be difficult to find and exclusionary, and you were motivated to read things because you knew that no one else would have gone through to work to be able to read them. Back in the day, you had to find and borrow a copy of one of the ten copies in existence, then commission a scribe and buy the skin of a bunch of dead goats to have it copied. They would think we were horribly spoiled to have had photocopiers, mimeograph machines, and thin, white paper made from trees.

Now everything is accessible to everyone anytime, anywhere, and the only people who don't read are the people who don't bother to read. It's a good time.

Ericson2314 | 4 hours ago

Ugh, have mixed feelings about this one, because Unix was far from the best design deserving to win.

fortran77 | 3 hours ago

Deserving has nothing to do with it. You could photocopy the whole kernel and read it on the train. Try that with Multics.

CalChris | 2 hours ago

Lions Commentary was used as evidence in the USL vs BSDI lawsuit to undermine USL’s claims of trade secret misappropriation and unrestricted publication without copyright notice.

It was my licensed original copy which I bought from Western (!) Electric. Technically, it was part of a Western Electric UNIX source license. I lent my copy to Sam Leffler for the lawsuit. It was entered as evidence and I got it back a couple of years later.