⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unix time_share_system .htm

📁 讲解关于UXIX操作系统的资料,包含如何基本操作以及编程.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://cm.bell-labs.com/cm/cs/who/dmr/cacm.html -->
<HTML><HEAD><TITLE>BSTJ version of C.ACM Unix paper</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.2014.210" name=GENERATOR></HEAD>
<BODY aLink=#ff0044 bgColor=#ffffff link=#0000ff text=#000000 vLink=#330088>
<H1>The UNIX Time-Sharing System* </H1>
<DL>
  <DD><I>D. M. Ritchie and K. Thompson<BR></I></DD></DL>
<DL>
  <DD>
  <H4>ABSTRACT</H4>Unix is a general-purpose, multi-user, interactive operating 
  system for the larger Digital Equipment Corporation PDP-11 and the Interdata 
  8/32 computers. It offers a number of features seldom found even in larger 
  operating systems, including 
  <DL compact>
    <DT>i
    <DD>A hierarchical file system incorporating demountable volumes, 
    <DT>ii
    <DD>Compatible file, device, and inter-process I/O, 
    <DT>iii
    <DD>The ability to initiate asynchronous processes, 
    <DT>iv
    <DD>System command language selectable on a per-user basis, 
    <DT>v
    <DD>Over 100 subsystems including a dozen languages, 
    <DT>vi
    <DD>High degree of portability. </DD></DL><BR><BR>This paper discusses the 
  nature and implementation of the file system and of the user command 
  interface. </DD></DL>
<P></P>
<DL>
  <DT>
  <DT>
  <DD>NOTE:<I> * Copyright 1974, Association for Computing Machinery, Inc., 
  reprinted by permission. This electronic edition of this paper is a reprint of 
  the version appearing in The Bell System Technical Journal <B>57</B> no. 6, 
  part 2 (July-August 1978). In turn, that was a revised version of an article 
  that appeared in Communications of the ACM, <B>17</B>, No. 7 (July 1974), pp. 
  365-375. That article was a revised version of a paper presented at the Fourth 
  ACM Symposium on Operating Systems Principles, IBM Thomas J. Watson Research 
  Center, Yorktown Heights, New York, October 15-17, 1973. Most of the 
  differences between versions occur between the C. ACM version and the BSTJ 
  printing; we incorporated updated numbers and material on portability. </I>
  <DT>
  <DD></DD></DL><BR>
<H4>I. INTRODUCTION </H4>
<P>There have been four versions of the Unix time-sharing system. 12 The 
earliest (circa 1969-70) ran on the Digital Equipment Corporation PDP-7 and -9 
computers. The second version ran on the unprotected PDP-11/20 computer. The 
third incorporated multiprogramming and ran on the PDP-11/34, /40, /45, /60, and 
/70 computers; it is the one described in the previously published version of 
this paper, and is also the most widely used today. This paper describes only 
the fourth, current system that runs on the PDP-11/70 and the Interdata 8/32 
computers. In fact, the differences among the various systems is rather small; 
most of the revisions made to the originally published version of this paper, 
aside from those concerned with style, had to do with details of the 
implementation of the file system. </P>
<P>Since PDP-11 Unix became operational in February, 1971, over 600 
installations have been put into service. Most of them are engaged in 
applications such as computer science education, the preparation and formatting 
of documents and other textual material, the collection and processing of 
trouble data from various switching machines within the Bell System, and 
recording and checking telephone service orders. Our own installation is used 
mainly for research in operating systems, languages, computer networks, and 
other topics in computer science, and also for document preparation. </P>
<P>Perhaps the most important achievement of Unix is to demonstrate that a 
powerful operating system for interactive use need not be expensive either in 
equipment or in human effort: it can run on hardware costing as little as 
$40,000, and less than two man-years were spent on the main system software. We 
hope, however, that users find that the most important characteristics of the 
system are its simplicity, elegance, and ease of use. </P>
<P>Besides the operating system proper, some major programs available under Unix 
are 
<DL>
  <DT>
  <DD><TT><PRE>C compiler
Text editor based on QED[1];
Assembler, linking loader, symbolic debugger
Phototypesetting and equation setting programs[2, 3]
</PRE></TT></DD></DL><BR>Dozens of languages including Fortran 77, Basic, 
Snobol, APL, Algol 68, M6, TMG, Pascal There is a host of maintenance, utility, 
recreation and novelty programs, all written locally. The Unix user community, 
which numbers in the thousands, has contributed many more programs and 
languages. It is worth noting that the system is totally self-supporting. All 
Unix software is maintained on the system; likewise, this paper and all other 
documents in this issue were generated and formatted by the Unix editor and text 
formatting programs. 
<P></P>
<H4>II. HARDWARE AND SOFTWARE ENVIRONMENT </H4>
<P>The PDP-11/70 on which the Research Unix system is installed is a 16-bit word 
(8-bit byte) computer with 768K bytes of core memory; the system kernel occupies 
90K bytes about equally divided between code and data tables. This system, 
however, includes a very large number of device drivers and enjoys a generous 
allotment of space for I/O buffers and system tables; a minimal system capable 
of running the software mentioned above can require as little as 96K bytes of 
core altogether. There are even larger installations; see the description of the 
PWB/UNIX systems [4, 5], for example. There are also much smaller, though 
somewhat restricted, versions of the system [6]. </P>
<P>Our own PDP-11 has two 200-Mb moving-head disks for file system storage and 
swapping. There are 20 variable-speed communications interfaces attached to 300- 
and 1200-baud data sets, and an additional 12 communication lines hard-wired to 
9600-baud terminals and satellite computers. There are also several 2400- and 
4800-baud synchronous communication interfaces used for machine-to-machine file 
transfer. Finally, there is a variety of miscellaneous devices including 
nine-track magnetic tape, a line printer, a voice synthesizer, a 
phototypesetter, a digital switching network, and a chess machine. </P>
<P>The preponderance of Unix software is written in the abovementioned C 
language [7]. Early versions of the operating system were written in assembly 
language, but during the summer of 1973, it was rewritten in C. The size of the 
new system was about one-third greater than that of the old. Since the new 
system not only became much easier to understand and to modify but also included 
many functional improvements, including multiprogramming and the ability to 
share reentrant code among several user programs, we consider this increase in 
size quite acceptable. </P>
<H4>III. THE FILE SYSTEM </H4>
<P>The most important role of the system is to provide a file system. From the 
point of view of the user, there are three kinds of files: ordinary disk files, 
directories, and special files. </P>
<H4>3.1 Ordinary files </H4>
<P>A file contains whatever information the user places on it, for example, 
symbolic or binary (object) programs. No particular structuring is expected by 
the system. A file of text consists simply of a string of characters, with lines 
demarcated by the newline character. Binary programs are sequences of words as 
they will appear in core memory when the program starts executing. A few user 
programs manipulate files with more structure; for example, the assembler 
generates, and the loader expects, an object file in a particular format. 
However, the structure of files is controlled by the programs that use them, not 
by the system. </P>
<H4>3.2 Directories </H4>
<P>Directories provide the mapping between the names of files and the files 
themselves, and thus induce a structure on the file system as a whole. Each user 
has a directory of his own files; he may also create subdirectories to contain 
groups of files conveniently treated together. A directory behaves exactly like 
an ordinary file except that it cannot be written on by unprivileged programs, 
so that the system controls the contents of directories. However, anyone with 
appropriate permission may read a directory just like any other file. </P>
<P>The system maintains several directories for its own use. One of these is the 
<I>root</I> directory. All files in the system can be found by tracing a path 
through a chain of directories until the desired file is reached. The starting 
point for such searches is often the <I>root</I>. Other system directories 
contain all the programs provided for general use; that is, all the 
<B>commands</B>. As will be seen, however, it is by no means necessary that a 
program reside in one of these directories for it to be executed. </P>
<P>Files are named by sequences of 14 or fewer characters. When the name of a 
file is specified to the system, it may be in the form of a <B>path</B> 
<B>name</B>, which is a sequence of directory names separated by slashes, ``/'', 
and ending in a file name. If the sequence begins with a slash, the search 
begins in the root directory. The name <I>/alpha/beta/gamma</I> causes the 
system to search the root for directory <I>alpha</I>, then to search 
<I>alpha</I> for <I>beta</I>, finally to find <I>gamma</I> in <I>beta</I>. 
<I>gamma</I> may be an ordinary file, a directory, or a special file. As a 
limiting case, the name ``/'' refers to the root itself. </P>
<P>A path name not starting with ``/'' causes the system to begin the search in 
the user's current directory. Thus, the name <I>alpha/beta</I> specifies the 
file named <I>beta</I> in subdirectory <I>alpha</I> of the current directory. 
The simplest kind of name, for example, <I>alpha</I>, refers to a file that 
itself is found in the current directory. As another limiting case, the null 
file name refers to the current directory. </P>
<P>The same non-directory file may appear in several directories under possibly 
different names. This feature is called <B>linking</B>; a directory entry for a 
file is sometimes called a link. The Unix system differs from other systems in 
which linking is permitted in that all links to a file have equal status. That 
is, a file does not exist within a particular directory; the directory entry for 
a file consists merely of its name and a pointer to the information actually 
describing the file. Thus a file exists independently of any directory entry, 
although in practice a file is made to disappear along with the last link to it. 
</P>
<P>Each directory always has at least two entries. The name ``<B>.</B>'' in each 
directory refers to the directory itself. Thus a program may read the current 
directory under the name ``<B>.</B>'' without knowing its complete path name. 
The name ``<B>..</B>'' by convention refers to the parent of the directory in 
which it appears, that is, to the directory in which it was created. </P>
<P>The directory structure is constrained to have the form of a rooted tree. 
Except for the special entries ``<B>.</B>'' and ``<B>..</B>'', each directory 
must appear as an entry in exactly one other directory, which is its parent. The 
reason for this is to simplify the writing of programs that visit subtrees of 
the directory structure, and more important, to avoid the separation of portions 
of the hierarchy. If arbitrary links to directories were permitted, it would be 
quite difficult to detect when the last connection from the root to a directory 
was severed. </P>
<H4>3.3 Special files </H4>
<P>Special files constitute the most unusual feature of the Unix file system. 
Each supported I/O device is associated with at least one such file. Special 
files are read and written just like ordinary disk files, but requests to read 
or write result in activation of the associated device. An entry for each 
special file resides in directory <I>/dev</I>, although a link may be made to 
one of these files just as it may to an ordinary file. Thus, for example, to 
write on a magnetic tape one may write on the file <I>/dev/mt</I>. Special files 
exist for each communication line, each disk, each tape drive, and for physical 
main memory. Of course, the active disks and the memory special file are 
protected from indiscriminate access. </P>
<P>There is a threefold advantage in treating I/O devices this way: file and 
device I/O are as similar as possible; file and device names have the same 
syntax and meaning, so that a program expecting a file name as a parameter can 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -