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