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