This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ----UNIX ImplementationK. ThompsonAT&T Bell LaboratoriesMurray Hill, New Jersey 07974ABSTRACTThis paper describes in high-level terms the implementation of the resident UNIX²kernel. This discussion is broken into three parts. The first part describes how the UNIXsystem views processes, users, and programs. The second part describes the I/O system.The last part describes the UNIX file system.1. INTRODUCTIONThe UNIX kernel consists of about 10,000 lines of C code and about 1,000 lines of assembly code.The assembly code can be further broken down into 200 lines included for the sake of efficiency (theycould have been written in C) and 800 lines to perform hardware functions not possible in C.This code represents 5 to 10 percent of what has been lumped into the broad expression ‘‘the UNIXoperating system.’’ The kernel is the only UNIX code that cannot be substituted by a user to his own liking.For this reason, the kernel should make as few real decisions as possible. This does not mean to allow theuser a million options to do the same thing. Rather, it means to allow only one way to do one thing, buthave that way be the least-common divisor of all the options that might have been provided.What is or is not implemented in the kernel represents both a great responsibility and a great power.It is a soap-box platform on ‘‘the way things should be done.’’ Even so, if ‘‘the way’’ is too radical, noone will follow it. Every important decision was weighed carefully. Throughout, simplicity has been sub-stituted for efficiency. Complex algorithms are used only if their complexity can be localized.2. PROCESS CONTROLIn the UNIX system, a user executes programs in an environment called a user process. When a sys-tem function is required, the user process calls the system as a subroutine. At some point in this call, thereis a distinct switch of environments. After this, the process is said to be a system process. In the normaldefinition of processes, the user and system processes are different phases of the same process (they neverexecute simultaneously). For protection, each system process has its own stack.The user process may execute from a read-only text segment, which is shared by all processes exe-cuting the same code. There is nofunctionalbenefit from shared-text segments. Anefficiencybenefitcomes from the fact that there is no need to swap read-only segments out because the original copy onsecondary memory is still current. This is a great benefit to interactive programs that tend to be swappedwhile waiting for terminal input. Furthermore, if two processes are executing simultaneously from thesame copy of a read-only segment, only one copy needs to reside in primary memory. This is a secondaryeffect, because simultaneous execution of a program is not common. It is ironic that this effect, whichreduces the use of primary memory, only comes into play when there is an overabundance of primarymemory, that is, when there is enough memory to keep waiting processes loaded.memory, that is, when there is enough memory to keep waiting processes loaded....
View Full Document
This note was uploaded on 11/15/2010 for the course ECE 1234 taught by Professor G.wdwdw during the Spring '10 term at St. Johns Seminary.
- Spring '10