Lions' Commentary on UNIX 6th Edition, with Source Code
   HOME

TheInfoList



OR:

''A Commentary on the UNIX Operating System'' by
John Lions John Lions (19 January 1937 – 5 December 1998) was an Australian computer scientist. He is best known as the author of ''Lions' Commentary on UNIX 6th Edition, with Source Code'', commonly known as the ''Lions Book''. Early life Lions ga ...
(later reissued as ''Lions' Commentary on UNIX 6th Edition'') is a highly influential 1976 publication containing analytical commentary on the
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
of the 6th Edition
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations (computation) automatically. Modern digital electronic computers can perform generic sets of operations known as C ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
"resident nucleus" (i.e.,
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
)
software Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work. At the lowest programming level, executable code consists ...
, plus copy formatted and indexed by Lions, of said source code obtained from the authors at
AT&T AT&T Inc. is an American multinational telecommunications holding company headquartered at Whitacre Tower in Downtown Dallas, Texas. It is the world's largest telecommunications company by revenue and the third largest provider of mobile tel ...
Bell Labs Nokia Bell Labs, originally named Bell Telephone Laboratories (1925–1984), then AT&T Bell Laboratories (1984–1996) and Bell Labs Innovations (1996–2007), is an American industrial research and scientific development company owned by mult ...
. It is also commonly referred to as the Lions Book. Itself an exemplar of the early success of UNIX as portable code for a publishing platform, Lions's work was typeset using UNIX tools, on systems running code ported at the University, similar to that which it documented, see ''page vi''. It was commonly held to be the most copied book in
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
. Despite its age, Lions's book is still considered an excellent commentary on simple, high quality code. Lions's work was most recently reprinted in 1996 by Peer-To-Peer Communications, and has been circulated, recreated or reconstructed variously in a number of media by other parties, e.g. see webpage of Greg Lehey.


Synopsis

''UNIX Operating System Source Code Level Six'' is the kernel source code, lightly edited by Lions to better separate the functionality — system initialization and process management, interrupts and system calls, basic I/O, file systems and pipes and character devices. All procedures and symbols are listed alphabetically with a cross reference. The code as presented will run on a
PDP-11 The PDP-11 is a series of 16-bit minicomputers sold by Digital Equipment Corporation (DEC) from 1970 into the 1990s, one of a set of products in the Programmed Data Processor (PDP) series. In total, around 600,000 PDP-11s of all models were sold, ...
/40 with RK-05 disk drive, LP-11 line printer interface, PCL-11 paper tape writer and KL-11 terminal interface, or a suitable PDP-11 emulator, such as
SIMH SIMH is a free and open source, multi-platform multi-system emulator. It is maintained by Bob Supnik, a former DEC engineer and DEC vice president, and has been in development in one form or another since the 1960s. History SIMH was based on ...
. ''A Commentary on the UNIX Operating System'' starts with notes on UNIX and other useful documentation (the UNIX manual pages, DEC hardware manuals and so on), a section on the architecture of the PDP-11 and a chapter on how to read C programs. The source commentary follows, divided into the same sections as the code. The book ends with suggested exercises for the student. As Lions explains, this commentary supplements the comments in the source. It is possible to understand the code without the extra commentary, and the reader is advised to do so and only read the notes as needed. The commentary also remarks on how the code might be improved.


History

The source code and commentary were printed in book form in 1977, after first being assembled in May 1976, as a set of lecture notes for Lions's
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
courses (6.602B and 6.657G, mentioned in the introduction of the book) at the
University of New South Wales The University of New South Wales (UNSW), also known as UNSW Sydney, is a public research university based in Sydney, New South Wales, Australia. It is one of the founding members of Group of Eight, a coalition of Australian research-intensive ...
. UNSW had actually obtained
UNIX Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
source code in 1975, in response to a 1974 query to Dennis Ritchie at Bell. Bell Labs was a subsidiary of AT&T, under restrictions owing to its monopolistic nature as a national telecommunications infrastructure provider, and not permitted to conduct business in any other field, and so was not at liberty to profit from sale of software, however UNIX was being provided under license by another AT&T subsidiary,
Western Electric The Western Electric Company was an American electrical engineering and manufacturing company officially founded in 1869. A wholly owned subsidiary of American Telephone & Telegraph for most of its lifespan, it served as the primary equipment ma ...
at least by 1977. The UNIX User's group, USENIX's newsletter, ''UNIX News'', of March 1977, announced the availability of the book to UNIX licensees. Note that the newsletter's own strongly worded circulation restriction notice, could only ever have applied within the framework of existing licenses to the licensees with agreements held with the mentioned organisations, not to non-licensees, as a matter of civil contract—the newsletter displays no evidence of governmental authority of the type which might allow general suppression of circulation, such as national security
Top Secret Classified information is material that a government body deems to be sensitive information that must be protected. Access is restricted by law or regulation to particular groups of people with the necessary security clearance and need to know, ...
classification.) Difficulty in keeping pace with the book's popularity, meant that by 1978 it was available only from AT&T
Bell Labs Nokia Bell Labs, originally named Bell Telephone Laboratories (1925–1984), then AT&T Bell Laboratories (1984–1996) and Bell Labs Innovations (1996–2007), is an American industrial research and scientific development company owned by mult ...
. For many years, the Lions book was the only UNIX kernel documentation available outside Bell Labs. Although the license of 6th Edition allowed classroom use of the source code, the license of 7th Edition specifically excluded such use, so subsequent to this, the book, based on the more liberally licensed version, spread widely through copy machine reproductions, made arguably under various excuses, including (but not limited to!) generous educational licensing terms afforded the publishing institution by the source code owner, as well as various
copyright A copyright is a type of intellectual property that gives its owner the exclusive right to copy, distribute, adapt, display, and perform a creative work, usually for a limited time. The creative work may be in a literary, artistic, education ...
exemptions protecting discussion of mathematical work, though in the shadow of increasing political pressure to erode such rights, as technological means to ‘self-copy’ -- and even self-publish—works became cheaper, more efficient, and more prolific. UNIX ''itself'', was one of these, having been a successful innovation financed at Bell in order to facilitate publishing of technical manuals in-house. When AT&T announced UNIX Version 7 at USENIX in June 1979, the academic/research license no longer automatically permitted classroom use. However, thousands of computer science students around the world spread photocopies. As they were not being taught it in class, they would sometimes meet after hours to discuss the book. Many pioneers of UNIX and
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
had a treasured multiple-generation photocopy. Other follow-on effects of the license change included
Andrew S. Tanenbaum Andrew Stuart Tanenbaum (born March 16, 1944), sometimes referred to by the handle ast, is an American-Dutch computer scientist and professor emeritus of computer science at the Vrije Universiteit Amsterdam in the Netherlands. He is the author ...
creating Minix. As Tanenbaum wrote in ''Operating Systems'' (1987): Various UNIX people, particularly
Peter H. Salus Peter Henry Salus is a linguist, computer scientist, historian of technology, author in many fields, and an editor of books and journals. He has conducted research in germanistics, language acquisition, and computer languages. Education and c ...
, Dennis Ritchie and Berny Goodheart, lobbied Unix's various owners (AT&T,
Novell Novell, Inc. was an American software and services company headquartered in Provo, Utah, that existed from 1980 until 2014. Its most significant product was the multi-platform network operating system known as Novell NetWare. Under the lead ...
, the
Santa Cruz Operation The Santa Cruz Operation, Inc. (usually known as SCO, pronounced either as individual letters or as a word) was an American software company, based in Santa Cruz, California, that was best known for selling three Unix operating system variants ...
) for many years to allow the book to be published officially. In 1996, the Santa Cruz Operation finally authorised the release of the twenty-year-old 6th Edition source code (along with the source code of other versions of "
Ancient UNIX Ancient UNIX is any early release of the Unix code base prior to Unix System III, particularly the Research Unix releases prior to and including Version 7 (the base for UNIX/32V as well as later developments of AT&T Unix). After the publicati ...
"), and the full code plus the 1977 version of the commentary was published by Peer-To-Peer Communications (). The reissue includes commentary from Michael Tilson (SCO), Peter Salus, Dennis Ritchie,
Ken Thompson Kenneth Lane Thompson (born February 4, 1943) is an American pioneer of computer science. Thompson worked at Bell Labs for most of his career where he designed and implemented the original Unix operating system. He also invented the B programmi ...
, Peter Collinson, Greg Rose, Mike O'Dell, Berny Goodheart and Peter Reintjes.


"You are not expected to understand this"

The infamous program comment "You are not expected to understand this" occurs on line 2238 of the source code (''Lions' Commentary'', p. 22) at the end of a comment explaining the process exchange mechanism. It refers to line 325 of the file slp.c. The source code reads: /* * If the new process paused because it was * swapped out, set the stack level to the 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 * the savu. * * You are not expected to understand this. */ if(rp->p_flag&SSWAP) A major reason why this piece of code was hard to understand was that it depended on a quirk of the way the C-compiler for the
PDP-11 The PDP-11 is a series of 16-bit minicomputers sold by Digital Equipment Corporation (DEC) from 1970 into the 1990s, one of a set of products in the Programmed Data Processor (PDP) series. In total, around 600,000 PDP-11s of all models were sold, ...
saved registers in procedure calls. This code failed when ported to other machines and had to be redesigned in
Version 7 UNIX Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system. V7, released in 1979, was the last Bell Laboratories release to see widespread distribution before the commercial ...
. Dennis Ritchie later explained the meaning of this remark:


See also

*
xv6 xv6 is a modern reimplementation of Sixth Edition Unix in ANSI C for multiprocessor x86 and RISC-V systems. It was created for pedagogical purposes in MIT's Operating System Engineering course in 2006. Purpose MIT's Operating System Engineerin ...
, a modern reimplementation of
Sixth Edition UNIX Sixth Edition Unix, also called Version 6 Unix or just V6, was the first version of the Unix operating system to see wide release outside Bell Labs. It was released in May 1975 and, like its direct predecessor, targeted the DEC PDP-11 family of m ...
in
ANSI C ANSI C, ISO C, and Standard C are successive standards for the C programming language published by the American National Standards Institute (ANSI) and ISO/IEC JTC 1/SC 22/WG 14 of the International Organization for Standardization (ISO) and th ...
for
multiprocessor Multiprocessing is the use of two or more central processing units (CPUs) within a single computer system. The term also refers to the ability of a system to support more than one processor or the ability to allocate tasks between them. There ar ...
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was introd ...
and
RISC-V RISC-V (pronounced "risk-five" where five refers to the number of generations of RISC architecture that were developed at the University of California, Berkeley since 1981) is an open standard instruction set architecture (ISA) based on estab ...
systems.


References


Further reading

*
Andrew S. Tanenbaum Andrew Stuart Tanenbaum (born March 16, 1944), sometimes referred to by the handle ast, is an American-Dutch computer scientist and professor emeritus of computer science at the Vrije Universiteit Amsterdam in the Netherlands. He is the author ...
, ''Operating Systems: Design and Implementation'', (
Prentice Hall Prentice Hall was an American major educational publisher owned by Savvas Learning Company. Prentice Hall publishes print and digital content for the 6–12 and higher-education market, and distributes its technical titles through the Safari B ...
, , June 1987)
Code Critic
(Rachel Chalmers, ''
Salon Salon may refer to: Common meanings * Beauty salon, a venue for cosmetic treatments * French term for a drawing room, an architectural space in a home * Salon (gathering), a meeting for learning or enjoyment Arts and entertainment * Salon (P ...
, 30 November 1999)
The Daemon, The GNU and the Penguin - Ch. 6: 1979
(
Peter H. Salus Peter Henry Salus is a linguist, computer scientist, historian of technology, author in many fields, and an editor of books and journals. He has conducted research in germanistics, language acquisition, and computer languages. Education and c ...
) *
Brian W. Kernighan Brian Wilson Kernighan (; born 1942) is a Canadian computer scientist. He worked at Bell Labs and contributed to the development of Unix alongside Unix creators Ken Thompson and Dennis Ritchie. Kernighan's name became widely known through co-aut ...
and Dennis Ritchie, ''
The C Programming Language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
'', {{ISBN, 0-13-110362-8 1976 non-fiction books Unix books Computer programming books Computer science books