Lions' Commentary On Unix 6th Edition With Source Code / Edition 6

Paperback (Print)
Buy New
Buy New from
Used and New from Other Sellers
Used and New from Other Sellers
from $35.84
Usually ships in 1-2 business days
(Save 10%)
Other sellers (Paperback)
  • All (10) from $35.84   
  • New (8) from $35.84   
  • Used (2) from $78.39   


The most famous suppressed book in computer history!

• Used as an Operating System textbook at MIT"After 20 years, this is still the best expostion of the workings of a 'real' operating system."
--- Ken Thompson (Developer of the UNIX operating system)After years of suppression (as trade secrets) by various owners of the UNIX code, this tome has been re-released, and we owe a debt to all involved in making this happen. I consider this to be the single most important book of 1996.
Unix Review, June 1997"The Lions book", cherished by UNIX hackers and widely circulated as a photocopied bootleg document since the late 1970's, is again available in an unrestricted edition. This legendary underground classic, reproduced without modification, is really two works in one: the complete source code to an early version (Edition 6) of the UNIX operating system, a treasure in itself! a brilliant commentary on that code by John Lionswith additional historical perspective essays added in 1996.Lions' marriage of source code with commentary was originally used as an operating systems textbook, a purpose for which it remains superbly well-suited (as evidenced by it's ongoing use at MIT).

Written in 1977 as an Operating Systems text for his students at the University of New South Wales, this gives complete source code to an early version of UNIX, plus commentary from Lions. This famous underground manuscript was never permitted to be formally published, so generations of UNIX hackers learned UNIX by referring to pirated photocopies of this book... it is arguably the most famous suppressed book in computer history! Foreword by Dennis Ritchie, retrospective essays from Ken Thompson, Berny Goodheart, Peter Salus, Mike Tilson, and other well-known UNIX figures. Many consider the early UNIX kernel (personally written by Thompson and Ritchie) the most elegant computer code ever written--- this book shows why! Note that the book covers the 6th 'edition' (rev) of UNIX; the book itself is the historical first edition (it was never revised).

Read More Show Less

Product Details

  • ISBN-13: 9781573980135
  • Publisher: Annabooks
  • Publication date: 1/1/1996
  • Series: Computer Classics Revisited Series
  • Edition description: 6TH
  • Edition number: 6
  • Pages: 260
  • Sales rank: 866,621
  • Product dimensions: 8.25 (w) x 11.00 (h) x 0.55 (d)

Read an Excerpt

Chapter 8: Process Management

Process management is concerned with the sharing of the processor and the main memory amongst the various processes, which can be seen as competitors for these resources.

Decisions to reallocate resources are made from time to time, either on the Initiative of the process which holds the resource, of for some other reason.

Process Switching

An active process may suspend itself i.e relinquish the processor, by calling "swtch" (2178) which calls "retu" (0740). This may be done for example if a process has reached a point beyond which it cannot proceed immediately. The process calls "sleep" (2066) which calls "swtch".

Alternatively a kernel process which is ready to revert to user mode will test the variable "runrun" and if this is non-zero, implying that a process with a higher precedence is ready to run, the kernel process will call "swtch".

"swtch" searches the "proc" table, for entries for which "p stat" equals "SRUN" and the "SLOAD" bit is set in "p_flag". From these it selects the process for which the value of "p_pri" is a minimum, and transfers control to it.

Values for "p_pri" are recalculated for each process from time to time by use of the procedure "setpri" (2156). Obviously the algorithm used by "setpri" has a significant influence.

A process which has called "sleep" and suspended itself may be returned to the "ready to run" state by another process. This often occurs during the handling of interrupts when the processhandling the interrupt calls "setrun" (2134) either directly or indirectly via a call on "wakeup" (2113).


It should be noted that a hardware interrupt (see Chapter Nine) does not directly cause a call on "swtch" or its equivalent. A hardware interrupt will cause a user process to revert to a kernel process, which as just noted, may call "swtch" as an alternative to reverting to user mode after the interrupt handling is complete.

If a kernel process is interrupted, then after the interrupt has been handled, the kernel process resumes where it had left off regardless. This point is important for understanding how UNIX avoids many of the pitfalls associated with "critical sections" of code, which are discussed at the end of this chapter.

Program Swapping

In general there will be insufficient main memory for all the process images at once, and the data segments for some of these will have to be 'swapped out* i.e. written to disk in a special area designated as the swap area.

While on disk the process images are relatively inaccessible and certainly unexecutable. The set of process images in main memory must therefore be changed regularly by swapping images in and out. Most decisions regarding swapping are made by the procedure "sched" (1940) which is considered in detail in Chapter Fourteen.

"sched" is executed by process #0, which after completing its initial tasks, spends its time in a double role: openly as the "scheduler" i.e.a normal kernel process; and surreptitiously as the intermediate process of "swtch" (discussed in Chapter Seven). Since the procedure "sched" never terminates, kernel process #0 never completes its task, and so the question of a user process #0 does not arise.


There is no concept of "job" in UNIX, at least in the sense in which this term is understood in more conventional, batch processing oriented systems.

Any process may "fork" a new copy of itself at any time, essentially without delay, and hence create the equivalent of a new job. Hence job scheduling, job classes, etc. are non-events here. . . .

Read More Show Less

Table of Contents

Prefatory Notes
A Short Historical Note
UNIX Operating system Source Code Level Six
A Commentary on the UNIX operating System
About the Author
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)