headers now go at top of page 1
[unix-history] / usr / src / share / doc / psd / 01.cacm / p5
CommitLineData
36cb0877 1.\" @(#)p5 6.1 (Berkeley) %G%
06fe2591
NC
2.\"
3.SH
4VII. TRAPS
5.PP
6The \*sPDP\*n-11 hardware detects a number of program faults,
7such as references to non-existent memory, unimplemented instructions,
8and odd addresses used where an even address is required.
9Such faults cause the processor to trap to a system routine.
10Unless other arrangements have been made,
11an illegal action causes the system
12to terminate the process and to write its
13image
14on file
15.UL core
16in the current directory.
17A debugger can be used to determine
18the state of the program at the time of the fault.
19.PP
20Programs that are looping, that produce unwanted output, or about which
21the user has second thoughts may be halted by the use of the
22.UL interrupt
23signal, which is generated by typing the ``delete''
24character.
25Unless special action has been taken, this
26signal simply causes the program to cease execution
27without producing a
28.UL core
29file.
30There is also a
31.UL quit
32signal
33used to force an image file to be produced.
34Thus programs that loop unexpectedly may be
35halted and the remains inspected without prearrangement.
36.PP
37The hardware-generated faults
38and the interrupt and quit signals
39can, by request, be either ignored or caught by a process.
40For example,
41the \&shell ignores quits to prevent
42a quit from logging the user out.
43The editor catches interrupts and returns
44to its command level.
45This is useful for stopping long printouts
46without losing work in progress (the editor
47manipulates a copy of the file it is editing).
48In systems without floating-point hardware,
49unimplemented instructions are caught
50and floating-point instructions are
51interpreted.
52.SH
53VIII. PERSPECTIVE
54.PP
55Perhaps paradoxically,
56the success of
57the
58.UX
59system
60is largely due to the fact that it was not
61designed to meet any
62predefined objectives.
63The first version was written when one of us
64(Thompson),
65dissatisfied with the available computer facilities,
66discovered a little-used \*sPDP\*n-7
67and set out to create a more
68hospitable environment.
69This (essentially personal) effort was
70sufficiently successful
71to gain the interest of the other author
72and several colleagues,
73and later to justify the acquisition
74of the \*sPDP\*n-11/20, specifically to support
75a text editing and formatting system.
76When in turn the 11/20 was outgrown,
77the system
78had proved useful enough to persuade management to
79invest in the \*sPDP\*n-11/45,
80and later in the
81\*sPDP\*n-11/70 and Interdata 8/32 machines,
82upon which it developed to its present form.
83Our goals throughout the effort,
84when articulated at all, have always been to build
85a comfortable relationship with the machine
86and to explore ideas and inventions in operating systems
87and other software.
88We have not been faced with the need to satisfy someone
89else's requirements,
90and for this freedom we are grateful.
91.PP
92Three considerations that influenced the design of
93.UX
94are visible in retrospect.
95.PP
96First:
97because we are programmers,
98we naturally designed the system to make it easy to
99write, test, and run programs.
100The most important expression of our desire for
101programming convenience
102was that the system
103was arranged for interactive use,
104even though the original version only
105supported one user.
106We believe that a properly designed
107interactive system is much more
108productive
109and satisfying to use than a ``batch'' system.
110Moreover, such a system is rather easily
111adaptable to noninteractive use, while the converse is not true.
112.PP
113Second:
114there have always been fairly severe size constraints
115on the system and its software.
116Given the partially antagonistic desires for reasonable efficiency and
117expressive power,
118the size constraint has encouraged
119not only economy, but also a certain elegance of design.
120This may be a thinly disguised version of the ``salvation
121through suffering'' philosophy,
122but in our case it worked.
123.PP
124Third: nearly from the start, the system was able to, and did, maintain itself.
125This fact is more important than it might seem.
126If designers of a system are forced to use that system,
127they quickly become aware of its functional and superficial deficiencies
128and are strongly motivated to correct them before it is too late.
129Because all source programs were always available
130and easily modified on-line,
131we were willing to revise and rewrite the system and its software
132when new ideas were invented, discovered,
133or suggested by others.
134.PP
135The aspects of
136.UX
137discussed in this paper exhibit clearly
138at least the first two of these
139design considerations.
140The interface to the file
141system, for example, is extremely convenient from
142a programming standpoint.
143The lowest possible interface level is designed
144to eliminate distinctions
145between
146the various devices and files and between
147direct and sequential access.
148No large ``access method'' routines
149are required
150to insulate the programmer from the
151system calls;
152in fact, all user programs either call the system
153directly or
154use a small library program, less than a page long,
155that buffers a number of characters
156and reads or writes them all at once.
157.PP
158Another important aspect of programming
159convenience is that there are no ``control blocks''
160with a complicated structure partially maintained by
161and depended on by the file system or other system calls.
162Generally speaking, the contents of a program's address space
163are the property of the program, and we have tried to
164avoid placing restrictions
165on the data structures within that address space.
166.PP
167Given the requirement
168that all programs should be usable with any file or
169device as input or output,
170it is also desirable
171to push device-dependent considerations
172into the operating system itself.
173The only alternatives seem to be to load,
174with all programs,
175routines for dealing with each device,
176which is expensive in space,
177or to depend on some means of dynamically linking to
178the routine appropriate to each device when it is actually
179needed,
180which is expensive either in overhead or in hardware.
181.PP
182Likewise,
183the process-control scheme and the command interface
184have proved both convenient and efficient.
185Because the \&shell operates as an ordinary, swappable
186user program,
187it consumes no ``wired-down'' space in the system proper,
188and it may be made as powerful as desired
189at little cost.
190In particular,
191given the framework in which the \&shell executes
192as a process that spawns other processes to
193perform commands,
194the notions of I/O redirection, background processes,
195command files, and user-selectable system interfaces
196all become essentially trivial to implement.
197.SH
198Influences
199.PP
200The success of
201.UX
202lies
203not so much in new inventions
204but rather in the full exploitation of a carefully selected
205set of fertile ideas,
206and especially in showing that
207they can be keys to the implementation of a small
208yet powerful operating system.
209.PP
210The
211.UL fork
212operation, essentially as we implemented it, was
213present in the \*sGENIE\*n time-sharing system.
214.[
215lampson deutsch 930 manual 1965 system preliminary
216.]
217On a number of points we were influenced by Multics,
218which suggested the particular form of the I/O system calls
219.[
220multics input output feiertag organick
221.]
222and both the name of the \&shell and its general functions.
223The notion that the \&shell should create a process
224for each command was also suggested to us by
225the early design of Multics, although in that
226system it was later dropped for efficiency reasons.
227A similar scheme is used by \*sTENEX\*n.
228.[
229bobrow burchfiel tenex
230.]