|
|
1.1 root 1: .TH INTRO 1
2: .SH NAME
3: intro \- introduction to Plan 9
4: .SH DESCRIPTION
5: Plan 9 is a distributed computing environment assembled from
6: separate machines acting as terminals,
7: CPU servers, and file servers.
8: A user works at a terminal, running a window system on a bitmapped display.
9: Some windows are connected to CPU servers; the intent is that heavy computing
10: should be done in those windows but it is also possible to compute on the terminal.
11: A separate file server provides file storage for terminals and
12: CPU servers alike.
13: .SS Name Spaces
14: In Plan 9, almost all objects look like files.
15: The object retrieved by a given name is determined by a mapping called the
16: .I name space.
17: A quick tour of the standard name space is in
18: .IR namespace (4).
19: Every program running in Plan 9 belongs to a
20: .I process group
21: (see
22: .I rfork
23: in
24: .IR fork (2)),
25: and the name space for each process group can be independently
26: customized.
27: .PP
28: A name space is hierarchically structured.
29: A full file name (also called a
30: .IR "full path name" )
31: has the form
32: .IP
33: .RI / e1 / e2 /.../ en
34: .PP
35: This represents an object in a tree of files: the tree has a root,
36: represented by the first
37: .LR / ;
38: the root has a child file named
39: .IR e1 ,
40: which in turn has child
41: .IR e2 ,
42: and so on; the descendent
43: .I en
44: is the object represented by the path name.
45: .PP
46: There are a number of Plan 9
47: .I services
48: available, each of which provides a tree of files.
49: A name space is built by
50: .I binding
51: services (or subtrees of services) to names in the name-space-so-far.
52: Typically, a user's home file server is bound to the root of the name space,
53: and other services are bound to conventionally named subdirectories.
54: For example, there is a service resident in the operating system for accessing
55: hardware devices and that is bound to
56: .B /dev
57: by convention.
58: Kernel services have names (outside the name space) that are a
59: .L #
60: sign followed by a single letter;
61: for example,
62: .B #c
63: is conventionally bound to
64: .BR /dev .
65: .PP
66: Plan 9 has
67: .IR "union directories" :
68: directories made of several directories all bound to the
69: same name.
70: The directories making up a union directory are ordered in a list.
71: When the bindings are made
72: (see
73: .IR bind (1)),
74: flags specify whether a newly bound member goes at the head or the tail of the list
75: or completely replaces the list.
76: To look up a name in a union directory, each member directory is searched
77: in list order until the name is found.
78: A bind
79: flag specifies whether file creation is allowed in a member directory:
80: a file created in the union directory goes in
81: the first member directory in list order that allows creation, if any.
82: .PP
83: The glue that holds Plan 9 together is a network protocol called
84: .IR 9P ,
85: described in section 5 of this manual.
86: All Plan 9 servers read and respond to 9P requests to navigate through
87: a file tree and to perform operations such as reading and writing
88: files within the tree.
89: .SS Booting
90: When a terminal is powered on or reset,
91: it must be told the name of a file server to boot from,
92: the operating system kernel to boot,
93: and a user name and password.
94: How this dialog proceeds is environment- and machine-dependent.
95: Once it is complete,
96: the terminal loads a Plan 9 kernel,
97: which sets some environment variables (see
98: .IR env (3))
99: and builds an initial name space.
100: See
101: .IR namespace (4),
102: .IR boot (8),
103: and
104: .IR init (8)
105: for details, but some important aspects of the initial name space are:
106: .IP \(bu
107: The environment variable
108: .B $cputype
109: is set to the name of the kernel's CPU's architecture: one of
110: .BR 68020 ,
111: .BR mips ,
112: .BR sparc ,
113: or
114: .BR 386 .
115: The environment variable
116: .B $objtype
117: is initially the same as
118: .BR $cputype .
119: .IP \(bu
120: The environment variable
121: .B $terminal
122: is set to the model of the machine running the kernel: e.g.,
123: .BR "mips magnum 3000" .
124: .IP \(bu
125: The environment variable
126: .B $service
127: is set to
128: .BR terminal .
129: (Other ways of accessing Plan 9 may set
130: .B $service
131: to one of
132: .BR cpu ,
133: .BR con ,
134: or
135: .BR rx .)
136: .IP \(bu
137: The environment variable
138: .B $user
139: is set to the name of the user who booted the terminal.
140: The environment variable
141: .B $home
142: is set to that user's home directory.
143: .IP \(bu
144: .B /$cputype/bin
145: and
146: .B /rc/bin
147: are unioned into
148: .BR /bin .
149: .PD
150: .PP
151: After booting, the terminal runs the command interpreter,
152: .IR rc (1),
153: on
154: .B /usr/$user/lib/profile
155: after moving to the user's home directory.
156: .PP
157: Here is a typical profile:
158: .IP
159: .EX
160: bind -c $home/tmp /tmp
161: bind -a $home/bin/rc /bin
162: bind -a $home/bin/$cputype /bin
163: font = /lib/font/bit/pelm/euro.9.font
164: switch($service){
165: case terminal
166: prompt=('term% ' ' ')
167: exec 8½ -f $font
168: case cpu
169: bind -b /mnt/term/mnt/8½ /dev
170: prompt=('cpu% ' ' ')
171: news
172: case con
173: prompt=('cpu% ' ' ')
174: news
175: }
176: .EE
177: .PD
178: .PP
179: The first three lines replace
180: .B /tmp
181: with a
182: .B tmp
183: in the user's home directory
184: and union personal
185: .B bin
186: directories with
187: .BR /bin ,
188: to be searched after the standard
189: .B bin
190: directories.
191: Then different things happen, depending on the
192: .B $service
193: environment variable,
194: such as running the window system
195: .IR 8½ (1)
196: on a terminal.
197: .PP
198: To do heavy work such as compiling, the
199: .IR cpu (1)
200: command connects a window to a CPU server;
201: the same environment variables are set (to different values)
202: and the same profile is run.
203: The initial directory is the current directory in the terminal window
204: where
205: .I cpu
206: was typed.
207: The value of
208: .B $service
209: will be
210: .BR cpu ,
211: so the second arm of the profile switch is executed.
212: The root of the terminal's name space is accessible through
213: .BR /mnt/term ,
214: so the
215: .I bind
216: is a way of making the window system's graphics interface (see
217: .IR bit (3))
218: available to programs running on the CPU server.
219: The
220: .IR news (1)
221: command reports current Plan 9 affairs.
222: .PP
223: The third possible service type,
224: .BR con ,
225: is set when the CPU server is called from a non-Plan-9 machine,
226: such as through
227: .I telnet
228: (see
229: .IR con (1)).
230: .SS Using Plan 9
231: The user commands of Plan 9 are reminiscent of those in Research Unix, version 10;
232: the window system is a lot like
233: .IR mux .
234: There are a number of differences, however.
235: .PP
236: The standard shell is
237: .IR rc (1),
238: not the Bourne shell.
239: The most noticeable differences appear only when programming and macro processing.
240: .PP
241: The character-delete character is backspace, and the line-kill character is
242: control-U; these cannot be changed.
243: .PP
244: DEL is the interrupt character: typing it sends an interrupt to processes running in that window.
245: See
246: .IR keyboard (6)
247: for instructions on typing characters like DEL on the various keyboards.
248: .PP
249: If a program dies with something like an address error, it enters a `Broken'
250: state. It lingers, available for debugging with
251: .IR db (1)
252: or
253: .IR acid (1).
254: .I Broke
255: (see
256: .IR kill (1))
257: cleans up broken processes.
258: .PP
259: The standard editor is
260: .IR sam (1).
261: There is a variant that permits running the file-manipulating part of
262: .I sam
263: on a non-Plan-9 system:
264: .IP
265: .EX
266: sam -r tcp!kremvax
267: .EE
268: .PP
269: Machine names may be prefixed by the network name,
270: here
271: .BR tcp ;
272: others include
273: .B dk
274: for Datakit and
275: .B il
276: for the Plan 9 Internet protocol.
277: .PP
278: Login connections and remote execution on non-Plan-9 machines are usually
279: done by saying, for example,
280: .IP
281: .EX
282: con kremvax
283: .EE
284: .PP
285: or
286: .IP
287: .EX
288: rx deepthought chess
289: .EE
290: .PP
291: (see
292: .IR con (1)).
293: .PP
294: .I 9fs
295: connects to file systems of remote systems
296: (see
297: .IR srv (4)).
298: For example,
299: .IP
300: .EX
301: 9fs kremvax
302: .EE
303: .PP
304: sets things up so that the root of
305: .BR kremvax 's
306: file tree is visible locally in
307: .BR /n/kremvax .
308: .PP
309: .I Seemail
310: gives graphical notification of arriving mail
311: (see
312: .IR mail (1));
313: if your mail arrives elsewhere, use
314: .IR vismon :
315: .IP
316: .EX
317: vismon tcp!kremvax
318: .EE
319: .PP
320: The Plan 9 file server has an integrated backup facility.
321: The command
322: .IP
323: .EX
324: 9fs dump
325: .EE
326: .PP
327: binds to
328: .B /n/dump
329: a tree containing the daily backups on the file server.
330: The dump tree has years as top level file names, and month-day
331: as next level file names.
332: For example,
333: .B /n/dump/1990/0120
334: is the root of the file system as it appeared at dump time on
335: January 20, 1990.
336: If more than one dump is taken on the same day, dumps after
337: the first have an extra digit.
338: To recover the version of this file as it was on June 15, 1991,
339: .IP
340: .EX
341: cp /n/dump/1991/0615/sys/man/man1/Intro.1 .
342: .EE
343: .PP
344: or use
345: .IR yesterday (1).
346: .SH SEE ALSO
347: This section for general publicly accessible commands.
348: .br
349: Section (2) for library functions, including system calls.
350: .br
351: Section (3) for kernel devices (accessed via
352: .IR bind (1)).
353: .br
354: Section (4) for file services (accessed via
355: .IR mount ).
356: .br
357: Section (5) for the Plan 9 file protocol.
358: .br
359: Section (6) for file formats.
360: .br
361: Section (7) for databases and database access programs.
362: .br
363: Section (8) for things related to administering Plan 9.
364: .br
365: Section (9) for raster image software.
366: .br
367: .B /sys/doc
368: for copies of papers referenced in this manual.
369: .PP
370: The back of this volume has a permuted index to aid searches.
371: .SH DIAGNOSTICS
372: Upon termination each program returns a string called the
373: .IR "exit status" .
374: It was either supplied by a call to
375: .IR exits (2)
376: or was written to the command's
377: .BI /proc/ pid /note
378: file
379: (see
380: .IR proc (3)),
381: causing an abnormal termination.
382: The empty string is customary for successful execution;
383: a non-empty string gives a clue to the failure of the command.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.