![]() |
|
Thanks, in part, to the current Linux popularity/publicity surge, a lot of new people are getting interested in Unix -- new enough (and often, young enough) to be unaware of some of the older but still important, even essential books for the serious Unix hacker, or indeed, for any computer scientist.
One of these, in my opinion, is Lion's Commentary on UNIX 6th Edition, with Source Code, by the late John Lions.
My first copy of this legendary book was -- like for thousands of other computer science students -- an illegal photocopy.
Since the copyright of UNIX at the time rested firmly in the hands of AT&T (and later SCO, The Santa Cruz Operation), the publication of the UNIX source code was not permitted. John Lions' book contains -- as it did in those days -- (1) the entire source listing of the UNIX Version 6 kernel, and (2) a commentary on the source discussing the algorithms. This was circulated internally at the University of New South Wales beginning 1976, and was, for years after, the only detailed kernel documentation available to anyone outside Bell Labs.
Because the various owners of UNIX wished to maintain trade secret status on the kernel, the Lions book was never formally published and was only supposed to be distributed to affiliates of source licensees. Despite this, many generations of kernel hackers, Open Source developers, computer science graduate students and algorithms aficionados incurred risks and expenses to obtain a cherished copy of this book.
In 1998, the SCO company agreed to the publication of this book and everyone can now obtain it legally, for $29.95 (www.peer-to-peer.com). As testimony to the importance of Lion's achievements, the book contains appreciative statements from well-known players into the Unix and Open Source communities, including Dennis Ritchie, Peter Collinson, Eric Raymond, Greg Rose, Mike O'Dell, and others enrich this book.
This is a rather technical book. A good half of the roughly 200 pages is dedicated to source code listings, of which about 8 pages are PDP-11 assembler and the rest C code. The other half of the book is technical commentary on the code presented in the first section. Therefore, it is better to speak of the style of the code rather than of the language used for the commentary (which is per se clear, to the point, and at times even humorous). The C code used by Kernighan, Thompson and Ritchie, the writers of Unix, is terse and compact. As the creators of C itself, they make full use of the powerful features of the language, which at times can confuse even the experienced C programmer. The extensive use of recursion, pointer arithmetic and bit-wise operators needs the fullest concentration of the reader to be able to follow. No section of the code is less important than others and a lack of understanding of any one part will preclude the overall understanding.
The code is less than 9,000 lines. Many people say that 10,000 lines of code is the limit that any one person can really, fully understand. The rewards for the study of this book are big. The readers will receive the benefit of the true understanding of the working of any operating system and the interaction between the various components in computers.
Although the less than 400 lines of assembler are written for the PDP-11, the source code is as easy or difficult to interpret as the C code, depending on the experience of the reader.
It is in the discussion of the source code that the genius of the late John Lions really shines through. Not only does he find the meaning behind the most challenging code sections and algorithms, but quite often he proposes either more elegant and clear alternatives or points the reader to the risks and dangers. It is quite clear the author had a complete understanding of source code and he must indeed have known it by heart.
The kernel data structures were still quite modestly sized in those years and the reader is well advised to start the study of this book by first learning said structures well. Once this step is over-come, the understanding of the algorithms applying to the kernel data structures are much less difficult.
Concepts like virtual memory, interrupt handling, priority scheduling, and device handling are all very well explained and the student is able through this book to get their complete understanding. The source code of the Unix Version 6 operating system is available in electronic form directly from SCO for a $100. Together with the PDP-11 software emulator available (you can also find the binary version of Unix versions 5, 6, 7 as well as RSTS and other old OSes) at www.dbit.com, enthusiasts can play with the source and actually run a full PDP11-70 on their home PC. I have a PDP-11 emulator running on a quad-CPU Sun computer and the PDP-11 is faster emulated than the real PDP-11 that John Lions used to write this book on. PDP-11s, by the way, are still manufactured (www.mentec.com) and there are still thousands used daily in the defense and telecommunications industry.
The benefits of obtaining and studying the Unix Version 6 source code with this book are evident: it is only through one's own experiments with the code and by changing it that one can really get a full understanding. Since there is no commentary on the Linux or BSD kernels yet (the author of this review is writing a book with a commentary on the Linux kernel to be published separately), this is the only true option for the committed student or enthusiast.
This is a book that belongs into the library of any graduate computer-science student, hacker or Unix historian. Recommended.
| -- Moshe Bar (http://www.moelabs.com/) | From Byte On-Line, August 23, 1999 |