%!PS-Adobe-3.0 %%Creator: groff version 1.16.1 %%CreationDate: Sat Jul 6 12:10:48 2002 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%+ font Symbol %%DocumentSuppliedResources: procset grops 1.16 1 %%Pages: 15 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.16 1 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic %%IncludeResource: font Symbol grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE /Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 16/Times-Bold@0 SF(The U)196.201 114 Q/F2 14/Times-Bold@0 SF(NIX)A F1 -.288(Ti)4 G(me-Sharing System).288 E/F3 10/Times-Italic@0 SF(Dennis M. Ritc)269.83 147.6 Q(hie)-.15 E -.35 (Ke)276.035 159.6 S 2.5(nT).35 G(hompson)-2.5 E(Bell Labor)270.655 183.6 Q(atories)-.15 E(Murr)256.34 195.6 Q(ay Hill, N. J)-.15 E 2.5(.0)-.25 G (7974)-2.5 E/F4 10/Times-Bold@0 SF(ABSTRA)279.05 243.6 Q(CT)-.55 E F0(U) 72 267.6 Q/F5 8/Times-Roman@0 SF(NIX)A F0 3.674 (is a general-purpose, multi-user)6.174 F 6.174(,i)-.4 G(nteracti)-6.174 E 3.974 -.15(ve o)-.25 H 3.673 (perating system for the Digital Equipment Corporation).15 F F5(PDP)72 279.6 Q F0 .935(-11/40, 11/45 and 11/70 computers.)B .936(It of)5.936 F .936(fers a number of features seldom found e)-.25 F -.15(ve)-.25 G 3.436(ni).15 G 3.436(nl)-3.436 G(ar)-3.436 E .936(ger operating sys-) -.18 F(tems, including)72 291.6 Q (1. A hierarchical \214le system incorporating demountable v)98 307.2 Q (olumes,)-.2 E(2. Compatible \214le, de)98 322.8 Q(vice, and inter)-.25 E(-process I/O,)-.2 E (3. The ability to initiate asynchronous processes,)98 338.4 Q (4. System command language selectable on a per)98 354 Q(-user basis,) -.2 E(5. Ov)98 369.6 Q(er 100 subsystems including a dozen languages.) -.15 E(This paper discusses the nature and implementation of the \214le\ system and of the user command interf)72 385.2 Q(ace.)-.1 E F4(1. Intr) 72 421.2 Q(oduction)-.18 E F0 .009(There ha)82 435.6 R .309 -.15(ve b) -.2 H .009(een three v).15 F .009(ersions of)-.15 F F5(UNIX)2.509 E F0 5.009(.T)C .009(he earliest v)-5.009 F .008 (ersion \(circa 1969-70\) ran on the Digital Equipment Corpo-)-.15 F (ration)72 447.6 Q F5(PDP)3.854 E F0 1.354(-7 and -9 computers.)B 1.354 (The second v)6.354 F 1.354(ersion ran on the unprotected)-.15 F F5(PDP) 3.854 E F0 1.354(-11/20 computer)B 6.354(.T)-.55 G 1.355(his paper de-) -6.354 F .129(scribes only the)72 459.6 R F5(PDP)2.629 E F0 .129 (-11/40, /45 and /70)B/F6 6/Times-Roman@0 SF(1)1 -3 M F0 .129 (system, since it is more modern and man)4.295 3 N 2.628(yo)-.15 G 2.628 (ft)-2.628 G .128(he dif)-2.628 F .128(ferences between it and)-.25 F (older)72 471.6 Q F5(UNIX)2.5 E F0(systems result from redesign of feat\ ures found to be de\214cient or lacking.)2.5 E(Since)82 489.6 Q F5(PDP) 2.784 E F0(-11)A F5(UNIX)2.784 E F0 .284(became operational in February) 2.784 F 2.784(,1)-.65 G .284(971, about 100 installations ha)-2.784 F .584 -.15(ve b)-.2 H .284(een put into service; the).15 F(y)-.15 E .207 (are generally smaller than the system described here.)72 501.6 R .207 (Most of them are eng)5.207 F .206 (aged in applications such as the prepara-)-.05 F .947 (tion and formatting of patent applications and other te)72 513.6 R .948 (xtual material, the collection and processing of trouble data)-.15 F .185(from v)72 525.6 R .185(arious switching machines within the Bell S\ ystem, and recording and checking telephone service orders.)-.25 F(Our) 5.184 E -.25(ow)72 537.6 S 2.695(ni).25 G .196(nstallation is used main\ ly for research in operating systems, languages, computer netw)-2.695 F .196(orks, and other topics in)-.1 F (computer science, and also for document preparation.)72 549.6 Q .4 LW 77 570.6 72 570.6 DL 81 570.6 76 570.6 DL 86 570.6 81 570.6 DL 91 570.6 86 570.6 DL 96 570.6 91 570.6 DL 101 570.6 96 570.6 DL 106 570.6 101 570.6 DL 111 570.6 106 570.6 DL 116 570.6 111 570.6 DL 121 570.6 116 570.6 DL 126 570.6 121 570.6 DL 131 570.6 126 570.6 DL 136 570.6 131 570.6 DL 141 570.6 136 570.6 DL 146 570.6 141 570.6 DL 151 570.6 146 570.6 DL 156 570.6 151 570.6 DL 161 570.6 156 570.6 DL 166 570.6 161 570.6 DL 171 570.6 166 570.6 DL 176 570.6 171 570.6 DL 181 570.6 176 570.6 DL 186 570.6 181 570.6 DL 191 570.6 186 570.6 DL 196 570.6 191 570.6 DL 201 570.6 196 570.6 DL 206 570.6 201 570.6 DL 211 570.6 206 570.6 DL 216 570.6 211 570.6 DL F5(Cop)80 584.1 Q .083 (yright \251 1974, Association for Computing Machinery)-.08 F 2.083(,I) -.52 G 2.083(nc. General)-2.083 F .083(permission to republish, b)2.083 F .083(ut not for pro\214t, all or part of this material is)-.16 F .021 (granted pro)72 593.1 R .021(vided that)-.12 F/F7 7/Times-Roman@0 SF -.28(AC)2.021 G(M).28 E F5 .901 -.44('s c)D(op).44 E .021 (yright notice is gi)-.08 F -.12(ve)-.2 G 2.021(na).12 G .022(nd that r\ eference is made to the publication, to its date of issue, and to the f) -2.021 F .022(act that reprint-)-.08 F(ing pri)72 602.1 Q(vile)-.2 E(ge\ s were granted by permission of the Association for Computing Machinery) -.12 E(.)-.52 E .156(This is a re)80 615.6 R .156(vised v)-.2 F .156 (ersion of an article appearing in the Communications of the)-.12 F F7 -.28(AC)2.156 G(M).28 E F5 2.156(,V)C .156 (olume 17, Number 7 \(July 1974\) pp. 365-375.)-3.188 F .155(That arti-) 4.155 F .556(cle is a re)72 624.6 R .556(vised v)-.2 F .557 (ersion of a paper presented at the F)-.12 F(ourth)-.12 E F7 -.28(AC) 2.557 G(M).28 E F5 .557(Symposium on Operating Systems Principles,)2.557 F F7(IBM)2.557 E F5 .557(Thomas J. W)2.557 F .557(atson Research)-.64 F (Center)72 633.6 Q 2(,Y)-.32 G(orkto)-2.88 E(wn Heights, Ne)-.2 E 2(wY) -.2 G(ork, October 15-17, 1973.)-2.88 E EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)72 60 Q/F2 8 /Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 2).55 E F0 .685(Perhaps the most important achie)82 106.8 R -.15(ve)-.25 G .684 (ment of).15 F/F3 8/Times-Roman@0 SF(UNIX)3.184 E F0 .684 (is to demonstrate that a po)3.184 F .684 (werful operating system for interac-)-.25 F(ti)72 118.8 Q .68 -.15 (ve u)-.25 H .38(se need not be e).15 F(xpensi)-.15 E .681 -.15(ve e) -.25 H .381(ither in equipment or in human ef).15 F(fort:)-.25 E F3 (UNIX)2.881 E F0 .381(can run on hardw)2.881 F .381 (are costing as little as)-.1 F .358($40,000, and less than tw)72 130.8 R 2.858(om)-.1 G .358(an-years were spent on the main system softw) -2.858 F 2.858(are. Y)-.1 F(et)-1 E F3(UNIX)2.858 E F0 .357 (contains a number of fea-)2.858 F .221(tures seldom of)72 142.8 R .221 (fered e)-.25 F -.15(ve)-.25 G 2.721(ni).15 G 2.721(nm)-2.721 G .221 (uch lar)-2.721 F .221(ger systems.)-.18 F(Hopefully)5.221 E 2.721(,h) -.65 G -.25(ow)-2.721 G -2.15 -.25(ev e).25 H 1.021 -.4(r, t).25 H .222 (he users of).4 F F3(UNIX)2.722 E F0 .222(will \214nd that the most im-) 2.722 F(portant characteristics of the system are its simplicity)72 154.8 Q 2.5(,e)-.65 G(le)-2.5 E -.05(ga)-.15 G(nce, and ease of use.).05 E(Besides the system proper)82 172.8 Q 2.5(,t)-.4 G(he major programs a) -2.5 E -.25(va)-.2 G(ilable under).25 E F3(UNIX)2.5 E F0(are)2.5 E (assembler)108 196.8 Q(,)-.4 E(te)108 208.8 Q(xt editor based on)-.15 E F3(QED)2.5 E/F4 6/Times-Roman@0 SF(2)1 -3 M F0(,)1.666 3 M (linking loader)108 220.8 Q(,)-.4 E(symbolic deb)108 232.8 Q(ugger)-.2 E (,)-.4 E(compiler for a language resembling)108 244.8 Q F3(BCPL)2.5 E F4 (3)1 -3 M F0(with types and structures \(C\),)4.166 3 M (interpreter for a dialect of)108 256.8 Q F3 -.28(BA)2.5 G(SIC).28 E F0 (,)A(phototypesetting and equation setting programs)108 268.8 Q -.15(Fo) 108 280.8 S(rtran compiler).15 E(,)-.4 E(Snobol interpreter)108 292.8 Q (,)-.4 E(top-do)108 304.8 Q(wn compiler)-.25 E(-compiler \()-.2 E F3 (TMG)A F4(4)1 -3 M F0(\),)1.666 3 M(bottom-up compiler)108 316.8 Q (-compiler \()-.2 E F3 -.4 -.96(YA C)D(C).96 E F0(\),)A (form letter generator)108 328.8 Q(,)-.4 E(macro processor \(M6)108 340.8 Q F4(5)1 -3 M F0(\),)1.666 3 M(permuted inde)108 352.8 Q 2.5(xp) -.15 G(rogram.)-2.5 E .194(There is also a host of maintenance, utility) 72 370.8 R 2.693(,r)-.65 G .193(ecreation and no)-2.693 F -.15(ve)-.15 G .193(lty programs.).15 F .193(All of these programs were written lo-) 5.193 F(cally)72 382.8 Q 5.159(.I)-.65 G 2.659(ti)-5.159 G 2.659(sw) -2.659 G .16(orth noting that the system is totally self-supporting.) -2.759 F(All)5.16 E F3(UNIX)2.66 E F0(softw)2.66 E .16 (are is maintained under)-.1 F F3(UNIX)2.66 E F0 2.66(;l)C(ik)-2.66 E (e-)-.1 E .474(wise, this paper and all other)72 394.8 R F3(UNIX)2.974 E F0 .474(documents were generated and formatted by the)2.974 F F3(UNIX) 2.973 E F0 .473(editor and te)2.973 F .473(xt formatting)-.15 F (program.)72 406.8 Q/F5 10/Times-Bold@0 SF(2. Hard)72 439.2 Q(war)-.15 E 2.5(ea)-.18 G(nd softwar)-2.5 E 2.5(ee)-.18 G -.4(nv)-2.5 G(ir).4 E (onment)-.18 E F0(The)82 453.6 Q F3(PDP)3.21 E F0 .71 (-11/45 on which our)B F3(UNIX)3.21 E F0 .71 (installation is implemented is a 16-bit w)3.21 F .711 (ord \(8-bit byte\) computer with 112K)-.1 F 1.21(bytes of core memory;) 72 465.6 R F3(UNIX)3.71 E F0 1.209(occupies 53K bytes.)3.71 F 1.209 (This system, ho)6.209 F(we)-.25 E -.15(ve)-.25 G 2.009 -.4(r, i).15 H 1.209(ncludes a v).4 F 1.209(ery lar)-.15 F 1.209(ge number of de)-.18 F (vice)-.25 E(dri)72 477.6 Q -.15(ve)-.25 G .081(rs and enjo).15 F .081 (ys a generous allotment of space for I/O b)-.1 F(uf)-.2 E .081 (fers and system tables; a minimal system capable of run-)-.25 F (ning the softw)72 489.6 Q(are mentioned abo)-.1 E .3 -.15(ve c)-.15 H (an require as little as 64K bytes of core altogether).15 E(.)-.55 E (Our)82 507.6 Q F3(PDP)3.753 E F0 1.253(-11 has a 1M byte \214x)B 1.252 (ed-head disk, used for \214le system storage and sw)-.15 F 1.252 (apping, four mo)-.1 F 1.252(ving-head disk)-.15 F(dri)72 519.6 Q -.15 (ve)-.25 G 2.589(sw).15 G .089(hich each pro)-2.589 F .089 (vide 2.5M bytes on remo)-.15 F -.25(va)-.15 G .089 (ble disk cartridges, and a single mo).25 F .09(ving-head disk dri)-.15 F .39 -.15(ve w)-.25 H .09(hich uses).15 F(remo)72 531.6 Q -.25(va)-.15 G .06(ble 40M byte disk packs.).25 F .06 (There are also a high-speed paper tape reader)5.06 F .06 (-punch, nine-track magnetic tape, and)-.2 F F3(DEC)72 543.6 Q F0 .774 (tape \(a v)B .774(ariety of magnetic tape f)-.25 F .774 (acility in which indi)-.1 F .775 (vidual records may be addressed and re)-.25 F 3.275(written\). Besides) -.25 F .672(the console type)72 555.6 R(writer)-.25 E 3.172(,t)-.4 G .672(here are 30 v)-3.172 F .671(ariable-speed communications interf) -.25 F .671(aces attached to 100-series datasets and a)-.1 F .292 (201 dataset interf)72 567.6 R .293 (ace used primarily for spooling printout to a communal line printer)-.1 F 5.293(.T)-.55 G .293(here are also se)-5.293 F -.15(ve)-.25 G .293 (ral one-of-).15 F .711(a-kind de)72 579.6 R .711 (vices including a Picturephone\256 interf)-.25 F .711(ace, a v)-.1 F .711(oice response unit, a v)-.2 F .71(oice synthesizer)-.2 F 3.21(,ap) -.4 G(hototypesetter)-3.21 E 3.21(,a)-.4 G .671(digital switching netw) 72 591.6 R .672(ork, and a satellite)-.1 F F3(PDP)3.172 E F0 .672 (-11/20 which generates v)B .672(ectors, curv)-.15 F .672 (es, and characters on a T)-.15 F(ektronix)-.7 E (611 storage-tube display)72 603.6 Q(.)-.65 E .192(The greater part of) 82 621.6 R F3(UNIX)2.692 E F0(softw)2.692 E .192 (are is written in the abo)-.1 F -.15(ve)-.15 G .192 (-mentioned C language).15 F F4(6)1 -3 M F0 5.192(.E)1.666 3 O .192 (arly v)-5.192 F .191(ersions of the operating)-.15 F .847 (system were written in assembly language, b)72 633.6 R .847 (ut during the summer of 1973, it w)-.2 F .847(as re)-.1 F .847 (written in C.)-.25 F .847(The size of the)5.847 F(ne)72 645.6 Q 2.815 (ws)-.25 G .315(ystem is about one third greater than the old.)-2.815 F .315(Since the ne)5.315 F 2.815(ws)-.25 G .314 (ystem is not only much easier to understand and)-2.815 F 1.273 (to modify b)72 657.6 R 1.273(ut also includes man)-.2 F 3.773(yf)-.15 G 1.274(unctional impro)-3.773 F -.15(ve)-.15 G 1.274 (ments, including multiprogramming and the ability to share).15 F (reentrant code among se)72 669.6 Q -.15(ve)-.25 G(ral user programs, w\ e considered this increase in size quite acceptable.).15 E EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)419.342 60 Q /F2 8/Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 3).55 E/F3 10/Times-Bold@0 SF(3. The File system)72 100.8 Q F0 .769 (The most important role of)82 115.2 R/F4 8/Times-Roman@0 SF(UNIX)3.269 E F0 .769(is to pro)3.269 F .769(vide a \214le system.)-.15 F .769 (From the point of vie)5.769 F 3.269(wo)-.25 G 3.269(ft)-3.269 G .769 (he user)-3.269 F 3.269(,t)-.4 G .769(here are three)-3.269 F(kinds of \ \214les: ordinary disk \214les, directories, and special \214les.)72 127.2 Q F3(3.1 Ordinary \214les)72 151.2 Q F0 2.778<418c>82 165.6 S .278 (le contains whate)-2.778 F -.15(ve)-.25 G 2.779(ri).15 G .279 (nformation the user places on it, for e)-2.779 F .279 (xample symbolic or binary \(object\) programs.)-.15 F(No)5.279 E .411 (particular structuring is e)72 177.6 R .411(xpected by the system.)-.15 F .411(Files of te)5.411 F .41 (xt consist simply of a string of characters, with lines de-)-.15 F .85 (marcated by the ne)72 189.6 R .85(w-line character)-.25 F 5.85(.B)-.55 G .851(inary programs are sequences of w)-5.85 F .851(ords as the)-.1 F 3.351(yw)-.15 G .851(ill appear in core memory)-3.351 F .452 (when the program starts e)72 201.6 R -.15(xe)-.15 G 2.952(cuting. A).15 F(fe)2.952 E 2.952(wu)-.25 G .452 (ser programs manipulate \214les with more structure; for e)-2.952 F .451(xample, the as-)-.15 F .051(sembler generates, and the loader e)72 213.6 R .052(xpects, an object \214le in a particular format.)-.15 F(Ho) 5.052 E(we)-.25 E -.15(ve)-.25 G .852 -.4(r, t).15 H .052 (he structure of \214les is con-).4 F (trolled by the programs which use them, not by the system.)72 225.6 Q F3(3.2 Dir)72 249.6 Q(ectories)-.18 E F0 .591(Directories pro)82 264 R .591 (vide the mapping between the names of \214les and the \214les themselv) -.15 F .59(es, and thus induce a structure)-.15 F .05 (on the \214le system as a whole.)72 276 R .05 (Each user has a directory of his o)5.05 F .051 (wn \214les; he may also create subdirectories to contain)-.25 F .569 (groups of \214les con)72 288 R -.15(ve)-.4 G .569 (niently treated together).15 F 5.568(.A)-.55 G .568(directory beha)-2.5 F -.15(ve)-.2 G 3.068(se).15 G .568(xactly lik)-3.218 F 3.068(ea)-.1 G 3.068(no)-3.068 G .568(rdinary \214le e)-3.068 F .568 (xcept that it cannot)-.15 F .986(be written on by unpri)72 300 R(vile) -.25 E .986 (ged programs, so that the system controls the contents of directories.) -.15 F(Ho)5.987 E(we)-.25 E -.15(ve)-.25 G 1.787 -.4(r, a).15 H -.15(ny) .4 G(one).15 E (with appropriate permission may read a directory just lik)72 312 Q 2.5 (ea)-.1 G .3 -.15(ny o)-2.5 H(ther \214le.).15 E .046 (The system maintains se)82 330 R -.15(ve)-.25 G .046 (ral directories for its o).15 F .046(wn use.)-.25 F .045 (One of these is the)5.046 F F1 -.45(ro)2.545 G(ot).45 E F0(directory) 2.545 E 5.045(.A)-.65 G .045(ll \214les in the system)-5.045 F .425(can\ be found by tracing a path through a chain of directories until the de\ sired \214le is reached.)72 342 R .425(The starting point for)5.425 F .195(such searches is often the root.)72 354 R .195 (Another system directory contains all the programs pro)5.195 F .195 (vided for general use; that is,)-.15 F .061(all the)72 366 R F1 (commands)2.561 E F0 5.061(.A)C 2.561(sw)-5.061 G .061(ill be seen, ho) -2.561 F(we)-.25 E -.15(ve)-.25 G .861 -.4(r, i).15 H 2.561(ti).4 G 2.561(sb)-2.561 G 2.561(yn)-2.561 G 2.561(om)-2.561 G .062 (eans necessary that a program reside in this directory for it)-2.561 F (to be e)72 378 Q -.15(xe)-.15 G(cuted.).15 E .039 (Files are named by sequences of 14 or fe)82 396 R .039(wer characters.) -.25 F .038 (When the name of a \214le is speci\214ed to the system, it may)5.039 F .179(be in the form of a)72 408 R F1 .179(path name)2.679 F(,)-.1 E F0 .18(which is a sequence of directory names separated by slashes `)2.679 F 1.666(`/')-.74 G 2.68('a)-2.406 G .18(nd ending in a \214le)-2.68 F 3.032(name. If)72 420 R .532(the sequence be)3.032 F .531 (gins with a slash, the search be)-.15 F .531 (gins in the root directory)-.15 F 5.531(.T)-.65 G .531(he name)-5.531 F F1 1.666(/a)3.031 G -.834(lpha / beta / gamma)-1.666 F F0 .198 (causes the system to search the root for directory)72 432 R F1(alpha,) 2.698 E F0 .199(then to search)2.699 F F1(alpha)2.699 E F0(for)2.699 E F1(beta,)2.699 E F0 .199(\214nally to \214nd)2.699 F F1(gamma)2.699 E F0 (in)2.699 E F1(beta)2.699 E F0(.)A F1(Gamma)72 444 Q F0 .348 (may be an ordinary \214le, a directory)2.848 F 2.848(,o)-.65 G 2.848 (ras)-2.848 G .348(pecial \214le.)-2.848 F .348 (As a limiting case, the name `)5.348 F -.834(`/ ')-.74 F 2.848('r)-.74 G .348(efers to the root it-)-2.848 F(self.)72 456 Q 2.726(Ap)82 474 S .226(ath name not starting with `)-2.726 F -.834(`/ ')-.74 F 2.726('c) -.74 G .226(auses the system to be)-2.726 F .226 (gin the search in the user')-.15 F 2.727(sc)-.55 G .227 (urrent directory)-2.727 F 5.227(.T)-.65 G .227(hus, the)-5.227 F(name) 72 486 Q F1 -.834(alpha / beta)3.062 F F0 .561 (speci\214es the \214le named)3.061 F F1(beta)3.061 E F0 .561 (in subdirectory)3.061 F F1(alpha)3.061 E F0 .561 (of the current directory)3.061 F 5.561(.T)-.65 G .561 (he simplest kind of)-5.561 F .374(name, for e)72 498 R(xample)-.15 E F1 (alpha)2.874 E F0 2.874(,r)C .374 (efers to a \214le which itself is found in the current directory)-2.874 F 5.375(.A)-.65 G 2.875(sa)-5.375 G .375(nother limiting case, the) -2.875 F(null \214le name refers to the current directory)72 510 Q(.) -.65 E 1.491(The same non-directory \214le may appear in se)82 528 R -.15(ve)-.25 G 1.491(ral directories under possibly dif).15 F 1.49 (ferent names.)-.25 F 1.49(This feature is)6.49 F(called)72 540 Q F1 (linking;)2.804 E F0 2.805(ad)2.804 G .305 (irectory entry for a \214le is sometimes called a link.)-2.805 F F4 (UNIX)5.305 E F0(dif)2.805 E .305 (fers from other systems in which link-)-.25 F .25 (ing is permitted in that all links to a \214le ha)72 552 R .55 -.15 (ve e)-.2 H .25(qual status.).15 F .25(That is, a \214le does not e)5.25 F .25(xist within a particular directory;)-.15 F .306(the directory ent\ ry for a \214le consists merely of its name and a pointer to the inform\ ation actually describing the \214le.)72 564 R .104(Thus a \214le e)72 576 R .104(xists independently of an)-.15 F 2.604(yd)-.15 G .104 (irectory entry)-2.604 F 2.604(,a)-.65 G .103 (lthough in practice a \214le is made to disappear along with the)-2.604 F(last link to it.)72 588 Q .024(Each directory al)82 606 R -.1(wa)-.1 G .024(ys has at least tw).1 F 2.524(oe)-.1 G 2.524(ntries. The)-2.524 F .024(name `)2.524 F(`)-.74 E F3(.)1.666 E F0 1.504 -.74('' i)1.666 H 2.524(ne).74 G .024(ach directory refers to the directory itself.)-2.524 F(Thus)5.025 E 2.877(ap)72 618 S .377 (rogram may read the current directory under the name `)-2.877 F(`)-.74 E F3(.)1.666 E F0 1.856 -.74('' w)1.666 H .376(ithout kno).74 F .376 (wing its complete path name.)-.25 F .376(The name)5.376 F -.74(``)72 630 S F3 1.666(..)2.406 G F0 1.868 -.74('' b)D 2.888(yc).74 G(on)-2.888 E -.15(ve)-.4 G .389(ntion refers to the parent of the directory in whi\ ch it appears, that is, to the directory in which it w).15 F(as)-.1 E (created.)72 642 Q .787(The directory structure is constrained to ha)82 660 R 1.087 -.15(ve t)-.2 H .787(he form of a rooted tree.).15 F .787 (Except for the special entries `)5.787 F(`)-.74 E F3(.)3.332 E F0 2.266 -.74('' a)1.666 H(nd).74 E -.74(``)72 672 S F3 1.666(..)2.406 G F0 -.74 ('')C 2.758(,e).74 G .258(ach directory must appear as an entry in e) -2.758 F .258(xactly one other)-.15 F 2.758(,w)-.4 G .258 (hich is its parent.)-2.758 F .259(The reason for this is to sim-)5.258 F .07(plify the writing of programs which visit subtrees of the directo\ ry structure, and more important, to a)72 684 R -.2(vo)-.2 G .069 (id the separa-).2 F .392(tion of portions of the hierarch)72 696 R 4.192 -.65(y. I)-.05 H 2.892(fa).65 G .392 (rbitrary links to directories were permitted, it w)-2.892 F .392 (ould be quite dif)-.1 F .393(\214cult to detect)-.25 F (when the last connection from the root to a directory w)72 708 Q(as se) -.1 E -.15(ve)-.25 G(red.).15 E EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)72 60 Q/F2 8 /Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 4).55 E/F3 10/Times-Bold@0 SF(3.3 Special \214les)72 100.8 Q F0 .102 (Special \214les constitute the most unusual feature of the)82 115.2 R /F4 8/Times-Roman@0 SF(UNIX)2.601 E F0 .101(\214le system.)2.601 F .101 (Each I/O de)5.101 F .101(vice supported by)-.25 F F4(UNIX)2.601 E F0 .101(is as-)2.601 F .054(sociated with at least one such \214le.)72 127.2 R .054(Special \214les are read and written just lik)5.054 F 2.554 (eo)-.1 G .055(rdinary disk \214les, b)-2.554 F .055 (ut requests to read)-.2 F .016(or write result in acti)72 139.2 R -.25 (va)-.25 G .016(tion of the associated de).25 F 2.516(vice. An)-.25 F .015(entry for each special \214le resides in directory)2.515 F F1 1.666 (/d)2.515 G -.15(ev)-1.666 G(,)-.59 E F0(although)2.515 E 2.861(al)72 151.2 S .361(ink may be made to one of these \214les just lik)-2.861 F 2.862(ea)-.1 G 2.862(no)-2.862 G .362(rdinary \214le.)-2.862 F .362 (Thus, for e)5.362 F .362(xample, to punch paper tape, one may)-.15 F .027(write on the \214le)72 163.2 R F1 1.666(/d)4.192 G -.534 -.15 (ev / p)-1.666 H(pt).15 E F0 5.026(.S)C .026(pecial \214les e)-5.026 F .026(xist for each communication line, each disk, each tape dri)-.15 F -.15(ve)-.25 G 2.526(,a).15 G .026(nd for ph)-2.526 F(ysi-)-.05 E (cal core memory)72 175.2 Q 5(.O)-.65 G 2.5(fc)-5 G(ourse, the acti)-2.5 E .3 -.15(ve d)-.25 H(isks and the core special \214le are protected fr\ om indiscriminate access.).15 E .53(There is a threefold adv)82 193.2 R .53(antage in treating I/O de)-.25 F .53(vices this w)-.25 F .53 (ay: \214le and de)-.1 F .53 (vice I/O are as similar as possible; \214le)-.25 F .238(and de)72 205.2 R .238(vice names ha)-.25 F .537 -.15(ve t)-.2 H .237 (he same syntax and meaning, so that a program e).15 F .237 (xpecting a \214le name as a parameter can be)-.15 F(passed a de)72 217.2 Q(vice name; \214nally)-.25 E 2.5(,s)-.65 G (pecial \214les are subject to the same protection mechanism as re)-2.5 E(gular \214les.)-.15 E F3(3.4 Remo)72 241.2 Q -.1(va)-.1 G (ble \214le systems).1 E F0 .146 (Although the root of the \214le system is al)82 255.6 R -.1(wa)-.1 G .146(ys stored on the same de).1 F .147 (vice, it is not necessary that the entire \214le sys-)-.25 F .441 (tem hierarch)72 267.6 R 2.941(yr)-.05 G .441(eside on this de)-2.941 F 2.941(vice. There)-.25 F .441(is a)2.941 F F1(mount)2.941 E F0 .441 (system request which has tw)2.941 F 2.941(oa)-.1 G -.18(rg)-2.941 G .441(uments: the name of an e).18 F(x-)-.15 E .278(isting ordinary \214\ le, and the name of a special \214le whose associated storage v)72 279.6 R .279(olume \(e. g. disk pack\) should ha)-.2 F .579 -.15(ve t)-.2 H (he).15 E .22 (structure of an independent \214le system containing its o)72 291.6 R .219(wn directory hierarch)-.25 F 4.019 -.65(y. T)-.05 H .219(he ef).65 F .219(fect of)-.25 F F1(mount)2.719 E F0 .219(is to cause refer)2.719 F (-)-.2 E .17(ences to the heretofore ordinary \214le to refer instead t\ o the root directory of the \214le system on the remo)72 303.6 R -.25 (va)-.15 G .171(ble v).25 F(olume.)-.2 E .341(In ef)72 315.6 R(fect,) -.25 E F1(mount)2.841 E F0 .341(replaces a leaf of the hierarch)2.841 F 2.841(yt)-.05 G .34(ree \(the ordinary \214le\) by a whole ne)-2.841 F 2.84(ws)-.25 G .34(ubtree \(the hierarch)-2.84 F 2.84(ys)-.05 G(tored) -2.84 E .348(on the remo)72 327.6 R -.25(va)-.15 G .348(ble v).25 F 2.848(olume\). After)-.2 F(the)2.848 E F1(mount)2.848 E F0 2.848(,t)C .348(here is virtually no distinction between \214les on the remo)-2.848 F -.25(va)-.15 G .349(ble v).25 F(olume)-.2 E .373 (and those in the permanent \214le system.)72 339.6 R .372 (In our installation, for e)5.372 F .372 (xample, the root directory resides on the \214x)-.15 F(ed-head)-.15 E .555(disk, and the lar)72 351.6 R .555(ge disk dri)-.18 F -.15(ve)-.25 G 3.055(,w).15 G .555(hich contains user')-3.055 F 3.056<738c>-.55 G .556 (les, is mounted by the system initialization program; the four)-3.056 F .633(smaller disk dri)72 363.6 R -.15(ve)-.25 G 3.133(sa).15 G .633 (re a)-3.133 F -.25(va)-.2 G .632(ilable to users for mounting their o) .25 F .632(wn disk packs.)-.25 F 3.132(Am)5.632 G .632 (ountable \214le system is generated)-3.132 F .022 (by writing on its corresponding special \214le.)72 375.6 R 2.522(Au) 5.022 G .022(tility program is a)-2.522 F -.25(va)-.2 G .022 (ilable to create an empty \214le system, or one may).25 F(simply cop)72 387.6 Q 2.5(ya)-.1 G 2.5(ne)-2.5 G(xisting \214le system.)-2.65 E .749 (There is only one e)82 405.6 R .749 (xception to the rule of identical treatment of \214les on dif)-.15 F .749(ferent de)-.25 F .749(vices: no link may e)-.25 F .749(xist be-) -.15 F .753(tween one \214le system hierarch)72 417.6 R 3.253(ya)-.05 G .753(nd another)-3.253 F 5.753(.T)-.55 G .753 (his restriction is enforced so as to a)-5.753 F -.2(vo)-.2 G .753 (id the elaborate bookk).2 F(eeping)-.1 E .147(which w)72 429.6 R .147 (ould otherwise be required to assure remo)-.1 F -.25(va)-.15 G 2.647 (lo).25 G 2.646(ft)-2.647 G .146(he links when the remo)-2.646 F -.25 (va)-.15 G .146(ble v).25 F .146(olume is \214nally dismounted.)-.2 F .282(In particular)72 441.6 R 2.782(,i)-.4 G 2.782(nt)-2.782 G .282 (he root directories of all \214le systems, remo)-2.782 F -.25(va)-.15 G .283(ble or not, the name `).25 F(`)-.74 E F3 1.666(..)1.666 G F0 1.763 -.74('' r)D .283(efers to the directory itself).74 F (instead of to its parent.)72 453.6 Q F3(3.5 Pr)72 477.6 Q(otection)-.18 E F0 .016(Although the access control scheme in)82 492 R F4(UNIX)2.515 E F0 .015(is quite simple, it has some unusual features.)2.515 F .015 (Each user of the system)5.015 F .831 (is assigned a unique user identi\214cation number)72 504 R 5.831(.W) -.55 G .831(hen a \214le is created, it is mark)-5.831 F .832 (ed with the user)-.1 F F4(ID)3.332 E F0 .832(of its o)3.332 F(wner)-.25 E(.)-.55 E .222(Also gi)72 516 R -.15(ve)-.25 G 2.722(nf).15 G .222 (or ne)-2.722 F 2.722<778c>-.25 G .222(les is a set of se)-2.722 F -.15 (ve)-.25 G 2.722(np).15 G .221(rotection bits.)-2.722 F .221 (Six of these specify independently read, write, and e)5.221 F -.15(xe) -.15 G(cute).15 E(permission for the o)72 528 Q (wner of the \214le and for all other users.)-.25 E .27(If the se)82 546 R -.15(ve)-.25 G .271(nth bit is on, the system will temporarily change\ the user identi\214cation of the current user to that of the).15 F .281 (creator of the \214le whene)72 558 R -.15(ve)-.25 G 2.781(rt).15 G .281 (he \214le is e)-2.781 F -.15(xe)-.15 G .281(cuted as a program.).15 F .28(This change in user)5.28 F F4(ID)2.78 E F0 .28(is ef)2.78 F(fecti) -.25 E .58 -.15(ve o)-.25 H .28(nly during the e).15 F(x-)-.15 E .694 (ecution of the program which calls for it.)72 570 R .694(The set-user) 5.694 F(-)-.2 E F4(ID)A F0 .694(feature pro)3.194 F .694(vides for pri) -.15 F(vile)-.25 E .694(ged programs which may use)-.15 F .457 (\214les inaccessible to other users.)72 582 R -.15(Fo)5.456 G 2.956(re) .15 G .456(xample, a program may k)-3.106 F .456 (eep an accounting \214le which should neither be read)-.1 F .677 (nor changed e)72 594 R .678(xcept by the program itself.)-.15 F .678 (If the set-user)5.678 F .678 (-identi\214cation bit is on for the program, it may access the)-.2 F .107 (\214le although this access might be forbidden to other programs in)72 606 R -.2(vo)-.4 G -.1(ke).2 G 2.607(db).1 G 2.607(yt)-2.607 G .107 (he gi)-2.607 F -.15(ve)-.25 G 2.607(np).15 G(rogram')-2.607 E 2.607(su) -.55 G(ser)-2.607 E 5.107(.S)-.55 G .107(ince the actual)-5.107 F(user) 72 618 Q F4(ID)3.401 E F0 .901(of the in)3.401 F -.2(vo)-.4 G -.1(ke).2 G 3.401(ro).1 G 3.401(fa)-3.401 G 1.202 -.15(ny p)-3.401 H .902 (rogram is al).15 F -.1(wa)-.1 G .902(ys a).1 F -.25(va)-.2 G .902 (ilable, set-user).25 F(-)-.2 E F4(ID)A F0 .902(programs may tak)3.402 F 3.402(ea)-.1 G 1.202 -.15(ny m)-3.402 H .902(easures desired to).15 F .476(satisfy themselv)72 630 R .476(es as to their in)-.15 F -.2(vo)-.4 G -.1(ke).2 G(r').1 E 2.975(sc)-.55 G 2.975(redentials. This)-2.975 F .475(mechanism is used to allo)2.975 F 2.975(wu)-.25 G .475(sers to e) -2.975 F -.15(xe)-.15 G .475(cute the carefully-).15 F .419 (written commands which call pri)72 642 R(vile)-.25 E .419 (ged system entries.)-.15 F -.15(Fo)5.419 G 2.919(re).15 G .42 (xample, there is a system entry in)-3.069 F -.2(vo)-.4 G .42 (kable only by the).2 F -.74(``)72 654 S(super).74 E(-user')-.2 E 2.676 ('\()-.74 G(belo)-2.676 E .176(w\) which creates an empty directory)-.25 F 5.176(.A)-.65 G 2.676(si)-5.176 G .176(ndicated abo)-2.676 F -.15(ve) -.15 G 2.676(,d).15 G .176(irectories are e)-2.676 F .176(xpected to ha) -.15 F .476 -.15(ve e)-.2 H(ntries).15 E .641(for `)72 666 R(`)-.74 E F3 (.)1.666 E F0 2.121 -.74('' a)1.666 H .641(nd `).74 F(`)-.74 E F3 1.666 (..)1.666 G F0 -.74('')C 5.641(.T).74 G .641 (he command which creates a directory is o)-5.641 F .642 (wned by the super)-.25 F .642(-user and has the set-user)-.2 F(-)-.2 E F4(ID)A F0(bit)3.142 E 2.769(set. After)72 678 R .269(it checks its in) 2.769 F -.2(vo)-.4 G -.1(ke).2 G(r').1 E 2.769(sa)-.55 G .268 (uthorization to create the speci\214ed directory)-2.769 F 2.768(,i)-.65 G 2.768(tc)-2.768 G .268(reates it and mak)-2.768 F .268 (es the entries for)-.1 F -.74(``)72 690 S F3(.)2.406 E F0 1.48 -.74 ('' a)1.666 H(nd `).74 E(`)-.74 E F3 1.666(..)1.666 G F0 -.74('')C(.).74 E .122(Since an)82 708 R .122(yone may set the set-user)-.15 F(-)-.2 E F4(ID)A F0 .123(bit on one of his o)2.622 F .123 (wn \214les, this mechanism is generally a)-.25 F -.25(va)-.2 G .123 (ilable without ad-).25 F(ministrati)72 720 Q 1.022 -.15(ve i)-.25 H (nterv).15 E 3.222(ention. F)-.15 F .721(or e)-.15 F .721 (xample, this protection scheme easily solv)-.15 F .721(es the)-.15 F F4 (MOO)3.221 E F0 .721(accounting problem posed in)3.221 F EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)419.342 60 Q /F2 8/Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 5).55 E F0([7].)72 100.8 Q .734(The system recognizes one particular user)82 118.8 R/F3 8/Times-Roman@0 SF(ID)3.234 E F0 .734(\(that of the `)3.234 F (`super)-.74 E(-user')-.2 E .734('\) as e)-.74 F -.15(xe)-.15 G .734 (mpt from the usual constraints on).15 F .381 (\214le access; thus \(for e)72 130.8 R .38(xample\) programs may be wr\ itten to dump and reload the \214le system without unw)-.15 F .38 (anted inter)-.1 F(-)-.2 E(ference from the protection system.)72 142.8 Q/F4 10/Times-Bold@0 SF(3.6 I/O calls)72 166.8 Q F0 .334 (The system calls to do I/O are designed to eliminate the dif)82 181.2 R .334(ferences between the v)-.25 F .334(arious de)-.25 F .335 (vices and styles of ac-)-.25 F 2.614(cess. There)72 193.2 R .114 (is no distinction between `)2.614 F(`random')-.74 E 2.613('a)-.74 G .113(nd `)-2.613 F(`sequential')-.74 E 2.613('I)-.74 G .113 (/O, nor is an)-2.613 F 2.613(yl)-.15 G .113 (ogical record size imposed by the)-2.613 F 2.93(system. The)72 205.2 R .431(size of an ordinary \214le is determined by the highest byte writt\ en on it; no predetermination of the size)2.93 F (of a \214le is necessary or possible.)72 217.2 Q 2.556 -.8(To i)82 235.2 T .956(llustrate the essentials of I/O in).8 F F3(UNIX)3.456 E F0 3.456(,s)C .956(ome of the basic calls are summarized belo)-3.456 F 3.455(wi)-.25 G 3.455(na)-3.455 G 3.455(na)-3.455 G(non)-3.455 E .955 (ymous lan-)-.15 F .9(guage which will indicate the required parameters\ without getting into the comple)72 247.2 R .9 (xities of machine language pro-)-.15 F 2.933(gramming. Each)72 259.2 R .432(call to the system may potentially result in an error return, whic\ h for simplicity is not represented)2.933 F(in the calling sequence.)72 271.2 Q 1.6 -.8(To r)82 289.2 T(ead or write a \214le assumed to e).8 E (xist already)-.15 E 2.5(,i)-.65 G 2.5(tm)-2.5 G (ust be opened by the follo)-2.5 E(wing call:)-.25 E(\214lep = open)144 307.2 Q 1.666(\(n)1.666 G(ame, \215ag)-1.666 E(\))1.666 E F1(Name)72 325.2 Q F0 .125(indicates the name of the \214le.)2.625 F .125 (An arbitrary path name may be gi)5.125 F -.15(ve)-.25 G 2.625(n. The) .15 F F1<8d61>2.626 E(g)-.1 E F0(ar)2.626 E .126 (gument indicates whether the)-.18 F (\214le is to be read, written, or `)72 337.2 Q(`updated,)-.74 E 1.48 -.74('' t)-.7 H(hat is read and written simultaneously).74 E(.)-.65 E .31(The returned v)82 355.2 R(alue)-.25 E F1(\214lep)2.81 E F0 .31 (is called a)2.81 F F1 .31(\214le descriptor)2.81 F(.)-1.11 E F0 .31 (It is a small inte)5.31 F .31 (ger used to identify the \214le in subsequent calls)-.15 F (to read, write or otherwise manipulate the \214le.)72 367.2 Q 1.776 -.8 (To c)82 385.2 T .176(reate a ne).8 F 2.676<778c>-.25 G .176 (le or completely re)-2.676 F .176(write an old one, there is a)-.25 F F1(cr)2.677 E(eate)-.37 E F0 .177(system call which creates the gi)2.677 F -.15(ve)-.25 G 2.677<6e8c>.15 G .177(le if it)-2.677 F .105 (does not e)72 397.2 R .105 (xist, or truncates it to zero length if it does e)-.15 F(xist.)-.15 E F1(Cr)5.104 E(eate)-.37 E F0 .104(also opens the ne)2.604 F 2.604<778c> -.25 G .104(le for writing and, lik)-2.604 F(e)-.1 E F1(open,)2.604 E F0 (returns a \214le descriptor)72 409.2 Q(.)-.55 E 1.046 (There are no user)82 427.2 R 1.046 (-visible locks in the \214le system, nor is there an)-.2 F 3.546(yr) -.15 G 1.046(estriction on the number of users who may)-3.546 F(ha)72 439.2 Q .741 -.15(ve a \214)-.2 H .441(le open for reading or writing.) .15 F .44(Although it is possible for the contents of a \214le to becom\ e scrambled when)5.441 F(tw)72 451.2 Q 2.553(ou)-.1 G .053 (sers write on it simultaneously)-2.553 F 2.553(,i)-.65 G 2.553(np) -2.553 G .053(ractice dif)-2.553 F .053(\214culties do not arise.)-.25 F 1.653 -.8(We t)5.053 H(ak).8 E 2.553(et)-.1 G .053(he vie)-2.553 F 2.553 (wt)-.25 G .053(hat locks are neither nec-)-2.553 F .467(essary nor suf) 72 463.2 R .467(\214cient, in our en)-.25 F .467(vironment, to pre)-.4 F -.15(ve)-.25 G .466(nt interference between users of the same \214le.) .15 F(The)5.466 E 2.966(ya)-.15 G .466(re unneces-)-2.966 F .601 (sary because we are not f)72 475.2 R .601(aced with lar)-.1 F .601 (ge, single-\214le data bases maintained by independent processes.)-.18 F(The)5.602 E 3.102(ya)-.15 G .602(re in-)-3.102 F(suf)72 487.2 Q .779 (\214cient because locks in the ordinary sense, whereby one user is pre) -.25 F -.15(ve)-.25 G .779(nted from writing on a \214le which another) .15 F .05(user is reading, cannot pre)72 499.2 R -.15(ve)-.25 G .05 (nt confusion when, for e).15 F .051 (xample, both users are editing a \214le with an editor which mak)-.15 F (es)-.1 E 2.5(ac)72 511.2 S(op)-2.5 E 2.5(yo)-.1 G 2.5(ft)-2.5 G (he \214le being edited.)-2.5 E .963 (It should be said that the system has suf)82 529.2 R .962 (\214cient internal interlocks to maintain the logical consistenc)-.25 F 3.462(yo)-.15 G 3.462(ft)-3.462 G .962(he \214le)-3.462 F .857 (system when tw)72 541.2 R 3.357(ou)-.1 G .857(sers eng)-3.357 F .857 (age simultaneously in such incon)-.05 F -.15(ve)-.4 G .858(nient acti) .15 F .858(vities as writing on the same \214le, creating)-.25 F (\214les in the same directory)72 553.2 Q 2.5(,o)-.65 G 2.5(rd)-2.5 G (eleting each other')-2.5 E 2.5(so)-.55 G(pen \214les.)-2.5 E .42 (Except as indicated belo)82 571.2 R 1.72 -.65(w, r)-.25 H .42 (eading and writing are sequential.).65 F .419 (This means that if a particular byte in the \214le w)5.42 F(as)-.1 E .025(the last byte written \(or read\), the ne)72 583.2 R .025 (xt I/O call implicitly refers to the \214rst follo)-.15 F .026 (wing byte.)-.25 F -.15(Fo)5.026 G 2.526(re).15 G .026 (ach open \214le there is)-2.526 F 2.893(ap)72 595.2 S(ointer)-2.893 E 2.893(,m)-.4 G .393(aintained by the system, which indicates the ne) -2.893 F .393(xt byte to be read or written.)-.15 F(If)5.393 E F1(n) 2.892 E F0 .392(bytes are read or writ-)2.892 F(ten, the pointer adv)72 607.2 Q(ances by)-.25 E F1(n)2.5 E F0(bytes.)2.5 E (Once a \214le is open, the follo)82 625.2 Q(wing calls may be used.) -.25 E 2.5(n=r)144 643.2 S -.834(ead \( \214lep,)-2.5 F -.2(bu)2.5 G -.25(ff).2 G(er).25 E 2.5(,c)-.4 G -.834(ount \))-2.5 F 2.5(n=w)144 661.2 S -.834(rite \( \214lep,)-2.5 F -.2(bu)2.5 G -.25(ff).2 G(er).25 E 2.5(,c)-.4 G -.834(ount \))-2.5 F .617(Up to)72 679.2 R F1(count)3.117 E F0 .617(bytes are transmitted between the \214le speci\214ed by)3.117 F F1(\214lep)3.118 E F0 .618(and the byte array speci\214ed by)3.118 F F1 -.2(bu)3.118 G -.18(ff).2 G(er).18 E(.)-1.11 E F0 .618(The re-)5.618 F .153(turned v)72 691.2 R(alue)-.25 E F1(n)2.653 E F0 .153 (is the number of bytes actually transmitted.)2.653 F .152(In the)5.152 F F1(write)2.652 E F0(case,)2.652 E F1(n)2.652 E F0 .152(is the same as) 2.652 F F1(count)2.652 E F0 -.15(ex)2.652 G .152(cept under e).15 F(x-) -.15 E .075(ceptional conditions lik)72 703.2 R 2.575(eI)-.1 G .075 (/O errors or end of ph)-2.575 F .075 (ysical medium on special \214les; in a)-.05 F F1 -.37(re)2.575 G(ad,) .37 E F0(ho)2.575 E(we)-.25 E -.15(ve)-.25 G -.4(r,).15 G F1(n)2.975 E F0 .075(may without er)2.575 F(-)-.2 E .929(ror be less than)72 715.2 R F1(count.)3.429 E F0 .929 (If the read pointer is so near the end of the \214le that reading)5.929 F F1(count)3.428 E F0 .928(characters w)3.428 F .928(ould cause)-.1 F .114(reading be)72 727.2 R .114(yond the end, only suf)-.15 F .115(\214\ cient bytes are transmitted to reach the end of the \214le; also, type) -.25 F(writer)-.25 E(-lik)-.2 E 2.615(ed)-.1 G -.25(ev)-2.615 G(ices).25 E EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)72 60 Q/F2 8 /Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 6).55 E F0 (ne)72 100.8 Q -.15(ve)-.25 G 3.151(rr).15 G .651 (eturn more than one line of input.)-3.151 F .651(When a)5.651 F F1 -.37 (re)3.151 G(ad).37 E F0 .651(call returns with)3.151 F F1(n)3.151 E F0 .651(equal to zero, it indicates the end of the)3.151 F 3.226(\214le. F) 72 112.8 R .726(or disk \214les this occurs when the read pointer becom\ es equal to the current size of the \214le.)-.15 F .727 (It is possible to)5.727 F(generate an end-of-\214le from a type)72 124.8 Q(writer by use of an escape sequence which depends on the de)-.25 E(vice used.)-.25 E .125(Bytes written on a \214le af)82 142.8 R .124(f\ ect only those implied by the position of the write pointer and the cou\ nt; no other part of)-.25 F(the \214le is changed.)72 154.8 Q (If the last byte lies be)5 E (yond the end of the \214le, the \214le is gro)-.15 E(wn as needed.)-.25 E 1.893 -.8(To d)82 172.8 T 2.793(or).8 G .293 (andom \(direct access\) I/O it is only necessary to mo)-2.793 F .593 -.15(ve t)-.15 H .293 (he read or write pointer to the appropriate location).15 F (in the \214le.)72 184.8 Q(location = seek)144 202.8 Q 1.666<288c>1.666 G(lep, of)-1.666 E(fset, base)-.25 E(\))1.666 E .503 (The pointer associated with)72 220.8 R F1(\214lep)3.003 E F0 .503 (is mo)3.003 F -.15(ve)-.15 G 3.003(dt).15 G 3.003(oap)-3.003 G(osition) -3.003 E F1(of)3.003 E(fset)-.18 E F0 .503(bytes from the be)3.003 F .503(ginning of the \214le, from the current)-.15 F .822 (position of the pointer)72 232.8 R 3.322(,o)-.4 G 3.322(rf)-3.322 G .822(rom the end of the \214le, depending on)-3.322 F F1(base)3.323 E 5.823(.O)-.15 G -.18(ff)-5.823 G(set).18 E F0 .823(may be ne)3.323 F -.05(ga)-.15 G(ti).05 E -.15(ve)-.25 G 5.823(.F).15 G .823(or some de) -5.973 F(vices)-.25 E .188(\(e.g. paper tape and type)72 244.8 R .188 (writers\) seek calls are ignored.)-.25 F .188(The actual of)5.188 F .188(fset from the be)-.25 F .188(ginning of the \214le to which the) -.15 F(pointer w)72 256.8 Q(as mo)-.1 E -.15(ve)-.15 G 2.5(di).15 G 2.5 (sr)-2.5 G(eturned in)-2.5 E F1(location)2.5 E F0(.)A/F3 10/Times-Bold@0 SF(3.6.1 Other I/O calls)72 280.8 Q F0 .599(There are se)82 295.2 R -.15 (ve)-.25 G .599(ral additional system entries ha).15 F .599 (ving to do with I/O and with the \214le system which will not be dis-) -.2 F 2.852(cussed. F)72 307.2 R .352(or e)-.15 F .352(xample: close a \ \214le, get the status of a \214le, change the protection mode or the o) -.15 F .351(wner of a \214le, create a)-.25 F(directory)72 319.2 Q 2.5 (,m)-.65 G(ak)-2.5 E 2.5(eal)-.1 G(ink to an e)-2.5 E (xisting \214le, delete a \214le.)-.15 E F3 2.5(4. Implementation)72 351.6 R(of the \214le system)2.5 E F0 .226(As mentioned in \2473.2 abo) 82 366 R -.15(ve)-.15 G 2.726(,ad).15 G .227(irectory entry contains on\ ly a name for the associated \214le and a pointer to the \214le)-2.726 F 2.979(itself. This)72 378 R .478(pointer is an inte)2.979 F .478 (ger called the)-.15 F F1(i-number)2.978 E F0 .478(\(for inde)2.978 F 2.978(xn)-.15 G .478(umber\) of the \214le.)-2.978 F .478 (When the \214le is accessed, its i-)5.478 F .028 (number is used as an inde)72 390 R 2.529(xi)-.15 G .029 (nto a system table \(the)-2.529 F F1(i-list)2.529 E F0 2.529(\)s)1.666 G .029(tored in a kno)-2.529 F .029(wn part of the de)-.25 F .029 (vice on which the directory)-.25 F 2.5(resides. The)72 402 R (entry thereby found \(the \214le')2.5 E(s)-.55 E F1(i-node)2.5 E F0 2.5 (\)c)1.666 G(ontains the description of the \214le:)-2.5 E(1. its o)98 426 Q(wner;)-.25 E(2. its protection bits;)98 438 Q(3. the ph)98 450 Q (ysical disk or tape addresses for the \214le contents;)-.05 E (4. its size;)98 462 Q(5. time of last modi\214cation;)98 474 Q(6. the \ number of links to the \214le; that is, the number of times it appears \ in a directory;)98 486 Q (7. a bit indicating whether the \214le is a directory;)98 498 Q (8. a bit indicating whether the \214le is a special \214le;)98 510 Q (9. a bit indicating whether the \214le is `)98 522 Q(`lar)-.74 E(ge') -.18 E 2.5('o)-.74 G 2.5(r`)-2.5 G(`small.)-3.24 E -.74('')-.7 G .349 (The purpose of an)72 546 R F1(open)2.849 E F0(or)2.849 E F1(cr)2.849 E (eate)-.37 E F0 .349(system call is to turn the path name gi)2.849 F -.15(ve)-.25 G 2.849(nb).15 G 2.848(yt)-2.849 G .348 (he user into an i-number by search-)-2.848 F .014(ing the e)72 558 R .014(xplicitly or implicitly named directories.)-.15 F .014 (Once a \214le is open, its de)5.014 F .015(vice, i-number)-.25 F 2.515 (,a)-.4 G .015(nd read/write pointer are)-2.515 F .639 (stored in a system table inde)72 570 R -.15(xe)-.15 G 3.139(db).15 G 3.139(yt)-3.139 G .639(he \214le descriptor returned by the)-3.139 F F1 (open)3.139 E F0(or)3.139 E F1(cr)3.139 E(eate)-.37 E(.)-.15 E F0 .639 (Thus the \214le descriptor sup-)5.639 F .654(plied during a subsequent\ call to read or write the \214le may be easily related to the informat\ ion necessary to access)72 582 R(the \214le.)72 594 Q .393(When a ne)82 612 R 2.893<778c>-.25 G .392(le is created, an i-node is allocated for \ it and a directory entry is made which contains the name of)-2.893 F 1.015(the \214le and the i-node number)72 624 R 6.015(.M)-.55 G 1.015 (aking a link to an e)-6.015 F 1.016(xisting \214le in)-.15 F -.2(vo)-.4 G(lv).2 E 1.016(es creating a directory entry with the ne)-.15 F(w)-.25 E .053(name, cop)72 636 R .053 (ying the i-number from the original \214le entry)-.1 F 2.553(,a)-.65 G .053(nd incrementing the link-count \214eld of the i-node.)-2.553 F (Remo)5.052 E(v-)-.15 E .352(ing \(deleting\) a \214le is done by decre\ menting the link-count of the i-node speci\214ed by its directory entry\ and erasing)72 648 R(the directory entry)72 660 Q 5(.I)-.65 G 2.5(ft)-5 G(he link-count drops to 0, an)-2.5 E 2.5(yd)-.15 G (isk blocks in the \214le are freed and the i-node is deallocated.)-2.5 E .193(The space on all \214x)82 678 R .193(ed or remo)-.15 F -.25(va) -.15 G .193(ble disks which contain a \214le system is di).25 F .192 (vided into a number of 512-byte blocks)-.25 F .631 (logically addressed from 0 up to a limit which depends on the de)72 690 R 3.131(vice. There)-.25 F .632 (is space in the i-node of each \214le for)3.131 F .993(eight de)72 702 R .993(vice addresses.)-.25 F(A)5.992 E F1(small)3.492 E F0 .992 (\(non-special\) \214le \214ts into eight or fe)3.492 F .992 (wer blocks; in this case the addresses of the)-.25 F .231 (blocks themselv)72 714 R .231(es are stored.)-.15 F -.15(Fo)5.231 G(r) .15 E F1(lar)2.732 E -.1(ge)-.37 G F0 .232(\(non-special\) \214les, se) 2.832 F -.15(ve)-.25 G 2.732(no).15 G 2.732(ft)-2.732 G .232 (he eight de)-2.732 F .232(vice addresses may point to indirect)-.25 F .417(blocks each containing 256 addresses for the data blocks of the \ \214le.)72 726 R .417(If required, the eighth w)5.417 F .416 (ord is the address of a)-.1 F EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)419.342 60 Q /F2 8/Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 7).55 E F0 2.18(double-indirect block containing 256 more addresses of indire\ ct blocks.)72 100.8 R 2.181(Thus \214les may conceptually gro)7.181 F 4.681(wt)-.25 G(o)-4.681 E(\(7+256\))72 112.8 Q(.)-3.6 I(256)3.6 I(.) -3.6 I .32(512 bytes; actually the)3.6 J 2.82(ya)-.15 G .32 (re restricted to 16,777,216 \()-2.82 F(2)1.666 E/F3 6/Times-Roman@0 SF (24)-5 I F0 2.819(\)b)1.666 5 O 2.819(ytes. Once)-2.819 F .319 (opened, a small \214le \(size 1 to 8)2.819 F .556 (blocks\) can be accessed directly)72 124.8 R 5.557(.A)-.65 G(lar)-2.5 E .557(ge \214le \(size 9 to 32768 blocks\) requires one additional acces\ s to read belo)-.18 F(w)-.25 E(logical block 1792 \(7)72 136.8 Q(.)-3.6 I(256\) and tw)3.6 I 2.5(oa)-.1 G(dditional references abo)-2.5 E .3 -.15(ve 1)-.15 H(792.).15 E .549(The fore)82 154.8 R .549 (going discussion applies to ordinary \214les.)-.15 F .549 (When an I/O request is made to a \214le whose i-node indicates)5.549 F 1.015(that it is special, the last se)72 166.8 R -.15(ve)-.25 G 3.516 (nd).15 G -.25(ev)-3.516 G 1.016(ice address w).25 F 1.016 (ords are immaterial, and the \214rst is interpreted as a pair of bytes) -.1 F 1.287(which constitute an internal)72 178.8 R F1(de)3.787 E 1.287 (vice name)-.15 F(.)-.15 E F0 1.287(These bytes specify respecti)6.287 F -.15(ve)-.25 G 1.287(ly a de).15 F 1.286(vice type and subde)-.25 F 1.286(vice number)-.25 F(.)-.55 E .443(The de)72 190.8 R .444 (vice type indicates which system routine will deal with I/O on that de) -.25 F .444(vice; the subde)-.25 F .444(vice number selects, for)-.25 F -.15(ex)72 202.8 S(ample, a disk dri).15 E .3 -.15(ve a)-.25 H (ttached to a particular controller or one of se).15 E -.15(ve)-.25 G (ral similar type).15 E(writer interf)-.25 E(aces.)-.1 E 1.032 (In this en)82 220.8 R 1.032(vironment, the implementation of the)-.4 F F1(mount)3.532 E F0 1.032(system call \(\2473.4\) is quite straightforw) 3.532 F(ard.)-.1 E F1(Mount)6.032 E F0(main-)3.532 E .038 (tains a system table whose ar)72 232.8 R .038 (gument is the i-number and de)-.18 F .038 (vice name of the ordinary \214le speci\214ed during the)-.25 F F1 (mount,)2.538 E F0 .76(and whose corresponding v)72 244.8 R .76 (alue is the de)-.25 F .76(vice name of the indicated special \214le.) -.25 F .76(This table is searched for each \(i-)5.76 F(number)72 256.8 Q 3.664(,d)-.4 G -.25(ev)-3.664 G 1.164 (ice\)-pair which turns up while a path name is being scanned during an) .25 F F1(open)3.664 E F0(or)3.664 E F1(cr)3.664 E(eate;)-.37 E F0 1.164 (if a match is)3.664 F .304(found, the i-number is replaced by 1 \(whic\ h is the i-number of the root directory on all \214le systems\), and th\ e de)72 268.8 R(vice)-.25 E(name is replaced by the table v)72 280.8 Q (alue.)-.25 E 1.739 -.8(To t)82 298.8 T .139(he user).8 F 2.639(,b)-.4 G .139 (oth reading and writing of \214les appear to be synchronous and unb) -2.639 F(uf)-.2 E 2.64(fered. That)-.25 F .14(is, immediately after)2.64 F .689(return from a)72 310.8 R F1 -.37(re)3.189 G(ad).37 E F0 .689 (call the data are a)3.189 F -.25(va)-.2 G .689(ilable, and con).25 F -.15(ve)-.4 G .688(rsely after a).15 F F1(write)3.188 E F0 .688 (the user')3.188 F 3.188(sw)-.55 G .688(orkspace may be reused.)-3.288 F (In)5.688 E -.1(fa)72 322.8 S .159 (ct the system maintains a rather complicated b).1 F(uf)-.2 E .16 (fering mechanism which reduces greatly the number of I/O opera-)-.25 F 1.181(tions required to access a \214le.)72 334.8 R 1.181(Suppose a) 6.181 F F1(write)3.681 E F0 1.181 (call is made specifying transmission of a single byte.)3.681 F(U)6.18 E /F4 8/Times-Roman@0 SF(NIX)A F0(will)3.68 E .71(search its b)72 346.8 R (uf)-.2 E .71(fers to see whether the af)-.25 F .71(fected disk block c\ urrently resides in core memory; if not, it will be read in)-.25 F .447 (from the de)72 358.8 R 2.947(vice. Then)-.25 F .447(the af)2.947 F .447 (fected byte is replaced in the b)-.25 F(uf)-.2 E .446 (fer and an entry is made in a list of blocks to be writ-)-.25 F 3.048 (ten. The)72 370.8 R .548(return from the)3.048 F F1(write)3.048 E F0 .548(call may then tak)3.048 F 3.048(ep)-.1 G .548 (lace, although the actual I/O may not be completed until a later)-3.048 F 3.108(time. Con)72 382.8 R -.15(ve)-.4 G(rsely).15 E 3.108(,i)-.65 G 3.108(fas)-3.108 G .608(ingle byte is read, the system determines wheth\ er the secondary storage block in which the)-3.108 F .088 (byte is located is already in one of the system')72 394.8 R 2.589(sb) -.55 G(uf)-2.789 E .089 (fers; if so, the byte can be returned immediately)-.25 F 5.089(.I)-.65 G 2.589(fn)-5.089 G .089(ot, the block)-2.589 F(is read into a b)72 406.8 Q(uf)-.2 E(fer and the byte pick)-.25 E(ed out.)-.1 E .281(The sy\ stem recognizes when a program has made accesses to sequential blocks o\ f a \214le, and asynchronously pre-)82 424.8 R 1.183(reads the ne)72 436.8 R 1.183(xt block.)-.15 F 1.184(This signi\214cantly reduces the r\ unning time of most programs while adding little to system)6.183 F -.15 (ove)72 448.8 S(rhead.).15 E 2.529(Ap)82 466.8 S .028 (rogram which reads or writes \214les in units of 512 bytes has an adv) -2.529 F .028(antage o)-.25 F -.15(ve)-.15 G 2.528(rap).15 G .028 (rogram which reads or writes)-2.528 F 2.644(as)72 478.8 S .144 (ingle byte at a time, b)-2.644 F .144(ut the g)-.2 F .144 (ain is not immense; it comes mainly from the a)-.05 F -.2(vo)-.2 G .144 (idance of system o).2 F -.15(ve)-.15 G 2.645(rhead. A).15 F(pro-)2.645 E 1.016(gram which is used rarely or which does no great v)72 490.8 R 1.016(olume of I/O may quite reasonably read and write in units as)-.2 F (small as it wishes.)72 502.8 Q .789 (The notion of the i-list is an unusual feature of)82 520.8 R F4(UNIX) 3.289 E F0 5.789(.I)C 3.289(np)-5.789 G .79(ractice, this method of or) -3.289 F -.05(ga)-.18 G .79(nizing the \214le system has).05 F(pro)72 532.8 Q -.15(ve)-.15 G 3.145(dq).15 G .645 (uite reliable and easy to deal with.)-3.145 F 2.244 -.8(To t)5.645 H .644(he system itself, one of its strengths is the f).8 F .644 (act that each \214le has a)-.1 F .055 (short, unambiguous name which is related in a simple w)72 544.8 R .056 (ay to the protection, addressing, and other information need-)-.1 F .153(ed to access the \214le.)72 556.8 R .153(It also permits a quite s\ imple and rapid algorithm for checking the consistenc)5.153 F 2.653(yo) -.15 G 2.652(fa\214)-2.653 G .152(le system,)-2.652 F .23(for e)72 568.8 R .23(xample v)-.15 F .23(eri\214cation that the portions of each de) -.15 F .231 (vice containing useful information and those free to be allocated)-.25 F .573(are disjoint and together e)72 580.8 R .573 (xhaust the space on the de)-.15 F 3.073(vice. This)-.25 F .573 (algorithm is independent of the directory hierarch)3.073 F -.65(y,)-.05 G .052(since it need only scan the linearly-or)72 592.8 R -.05(ga)-.18 G .052(nized i-list.).05 F .053 (At the same time the notion of the i-list induces certain peculiar) 5.053 F(-)-.2 E .365(ities not found in other \214le system or)72 604.8 R -.05(ga)-.18 G 2.864(nizations. F).05 F .364(or e)-.15 F .364 (xample, there is the question of who is to be char)-.15 F .364 (ged for the)-.18 F .37 (space a \214le occupies, since all directory entries for a \214le ha)72 616.8 R .67 -.15(ve e)-.2 H .37(qual status.).15 F(Char)5.37 E .37 (ging the o)-.18 F .37(wner of a \214le is unf)-.25 F .37(air in)-.1 F .024(general, since one user may create a \214le, another may link to i\ t, and the \214rst user may delete the \214le.)72 628.8 R .024 (The \214rst user is)5.024 F .314(still the o)72 640.8 R .314 (wner of the \214le, b)-.25 F .314(ut it should be char)-.2 F .314 (ged to the second user)-.18 F 5.314(.T)-.55 G .314 (he simplest reasonably f)-5.314 F .314(air algorithm seems)-.1 F .341 (to be to spread the char)72 652.8 R .341 (ges equally among users who ha)-.18 F .641 -.15(ve l)-.2 H .341 (inks to a \214le.).15 F .341(The current v)5.341 F .341(ersion of)-.15 F F4(UNIX)2.84 E F0 -.2(avo)2.84 G .34(ids the is-).2 F(sue by not char) 72 664.8 Q(ging an)-.18 E 2.5(yf)-.15 G(ees at all.)-2.5 E EP %%Page: 8 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)72 60 Q/F2 8 /Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 8).55 E/F3 10/Times-Bold@0 SF(4.1 Ef\214ciency of the \214le system)72 100.8 Q F0 2.133 -.8(To p)82 115.2 T(ro).8 E .533(vide an indication of the o)-.15 F -.15(ve)-.15 G .533(rall ef).15 F(\214cienc)-.25 E 3.033(yo)-.15 G(f) -3.033 E/F4 8/Times-Roman@0 SF(UNIX)3.033 E F0 .533 (and of the \214le system in particular)3.033 F 3.033(,t)-.4 G .533 (imings were made)-3.033 F .664(of the assembly of a 8848-line program.) 72 127.2 R .664(The assembly w)5.664 F .663 (as run alone on the machine; the total clock time w)-.1 F .663(as 32) -.1 F .662(seconds, for a rate of 276 lines per second.)72 139.2 R .663 (The time w)5.663 F .663(as di)-.1 F .663(vided as follo)-.25 F .663 (ws: 66% assembler e)-.25 F -.15(xe)-.15 G .663(cution time, 21%).15 F .824(system o)72 151.2 R -.15(ve)-.15 G .824(rhead, 13% disk w).15 F .824(ait time.)-.1 F 2.424 -.8(We w)5.824 H .824(ill not attempt an).8 F 3.323(yi)-.15 G .823(nterpretation of these \214gures nor an)-3.323 F 3.323(yc)-.15 G(omparison)-3.323 E(with other systems, b)72 163.2 Q (ut merely note that we are generally satis\214ed with the o)-.2 E -.15 (ve)-.15 G(rall performance of the system.).15 E F3(5. Pr)72 195.6 Q (ocesses and images)-.18 E F0(An)82 210 Q F1(ima)3.134 E -.1(ge)-.1 G F0 .634(is a computer e)3.234 F -.15(xe)-.15 G .634(cution en).15 F 3.134 (vironment. It)-.4 F .634(includes a core image, general re)3.134 F .634 (gister v)-.15 F .635(alues, status of open)-.25 F (\214les, current directory and the lik)72 222 Q 2.5(e. An)-.1 F (image is the current state of a pseudo-computer)2.5 E(.)-.55 E(A)82 240 Q F1(pr)2.971 E(ocess)-.45 E F0 .471(is the e)2.971 F -.15(xe)-.15 G .471(cution of an image.).15 F .471(While the processor is e)5.471 F -.15(xe)-.15 G .47(cuting on behalf of a process, the image must).15 F .416(reside in core; during the e)72 252 R -.15(xe)-.15 G .416(cution o\ f other processes it remains in core unless the appearance of an acti) .15 F -.15(ve)-.25 G 2.917(,h).15 G(igher)-2.917 E(-)-.2 E (priority process forces it to be sw)72 264 Q(apped out to the \214x)-.1 E(ed-head disk.)-.15 E .6(The user)82 282 R .6 (-core part of an image is di)-.2 F .6(vided into three logical se)-.25 F 3.1(gments. The)-.15 F .6(program te)3.1 F .6(xt se)-.15 F .6 (gment be)-.15 F .6(gins at loca-)-.15 F .028 (tion 0 in the virtual address space.)72 294 R .028(During e)5.028 F -.15(xe)-.15 G .028(cution, this se).15 F .028 (gment is write-protected and a single cop)-.15 F 2.528(yo)-.1 G 2.528 (fi)-2.528 G 2.528(ti)-2.528 G 2.528(ss)-2.528 G(hared)-2.528 E .375 (among all processes e)72 306 R -.15(xe)-.15 G .375 (cuting the same program.).15 F .375 (At the \214rst 8K byte boundary abo)5.375 F .675 -.15(ve t)-.15 H .375 (he program te).15 F .375(xt se)-.15 F .375(gment in)-.15 F .113 (the virtual address space be)72 318 R .114 (gins a non-shared, writable data se)-.15 F .114 (gment, the size of which may be e)-.15 F .114(xtended by a system)-.15 F 4.109(call. Starting)72 330 R 1.609 (at the highest address in the virtual address space is a stack se)4.109 F 1.608(gment, which automatically gro)-.15 F(ws)-.25 E(do)72 342 Q(wnw) -.25 E(ard as the hardw)-.1 E(are')-.1 E 2.5(ss)-.55 G (tack pointer \215uctuates.)-2.5 E F3(5.1 Pr)72 366 Q(ocesses)-.18 E F0 .124(Except while)82 380.4 R F4(UNIX)2.624 E F0 .124 (is bootstrapping itself into operation, a ne)2.624 F 2.624(wp)-.25 G .124(rocess can come into e)-2.624 F .124(xistence only by use of the) -.15 F F1(fork)72 392.4 Q F0(system call:)2.5 E(processid = fork)144 410.4 Q 1.666(\(l)1.666 G -.834(abel \))-1.666 F(When)72 428.4 Q F1 (fork)2.504 E F0 .004(is e)2.504 F -.15(xe)-.15 G .003 (cuted by a process, it splits into tw).15 F 2.503(oi)-.1 G .003 (ndependently e)-2.503 F -.15(xe)-.15 G .003(cuting processes.).15 F .003(The tw)5.003 F 2.503(op)-.1 G .003(rocesses ha)-2.503 F .303 -.15 (ve i)-.2 H(n-).15 E .534 (dependent copies of the original core image, and share an)72 440.4 R 3.034(yo)-.15 G .535(pen \214les.)-3.034 F .535(The ne)5.535 F 3.035(wp) -.25 G .535(rocesses dif)-3.035 F .535(fer only in that one is)-.25 F 1.421(considered the parent process: in the parent, control returns dir\ ectly from the)72 452.4 R F1(fork)3.92 E F0 3.92(,w)C 1.42 (hile in the child, control is)-3.92 F(passed to location)72 464.4 Q F1 (label.)2.5 E F0(The)5 E F1(pr)2.5 E(ocessid)-.45 E F0(returned by the) 2.5 E F1(fork)2.5 E F0 (call is the identi\214cation of the other process.)2.5 E .704(Because \ the return points in the parent and child process are not the same, eac\ h image e)82 482.4 R .704(xisting after a)-.15 F F1(fork)3.204 E F0(may) 3.204 E(determine whether it is the parent or child process.)72 494.4 Q F3(5.2 Pipes)72 518.4 Q F0 .677 (Processes may communicate with related processes using the same system) 82 532.8 R F1 -.37(re)3.176 G(ad).37 E F0(and)3.176 E F1(write)3.176 E F0 .676(calls that are used for)3.176 F(\214le system I/O.)72 544.8 Q (The call)5 E(\214lep = pipe)144 562.8 Q 3.332(\(\))1.666 G .076 (returns a \214le descriptor)72 580.8 R F1(\214lep)2.577 E F0 .077 (and creates an inter)2.577 F .077(-process channel called a)-.2 F F1 (pipe)2.577 E F0 5.077(.T)C .077(his channel, lik)-5.077 F 2.577(eo)-.1 G .077(ther open \214les, is)-2.577 F .388 (passed from parent to child process in the image by the)72 592.8 R F1 (fork)2.888 E F0 2.888(call. A)2.888 F F1 -.37(re)2.888 G(ad).37 E F0 .387(using a pipe \214le descriptor w)2.888 F .387(aits until an-)-.1 F .223 (other process writes using the \214le descriptor for the same pipe.)72 604.8 R .224(At this point, data are passed between the images of)5.224 F(the tw)72 616.8 Q 2.5(op)-.1 G 2.5(rocesses. Neither)-2.5 F (process need kno)2.5 E 2.5(wt)-.25 G (hat a pipe, rather than an ordinary \214le, is in)-2.5 E -.2(vo)-.4 G (lv).2 E(ed.)-.15 E .452(Although inter)82 634.8 R .451 (-process communication via pipes is a quite v)-.2 F .451 (aluable tool \(see \2476.2\), it is not a completely general)-.25 F(me\ chanism, since the pipe must be set up by a common ancestor of the proc\ esses in)72 646.8 Q -.2(vo)-.4 G(lv).2 E(ed.)-.15 E F3 (5.3 Execution of pr)72 670.8 Q(ograms)-.18 E F0 (Another major system primiti)82 685.2 Q .3 -.15(ve i)-.25 H 2.5(si).15 G -1.9 -.4(nv o)-2.5 H -.1(ke).4 G 2.5(db).1 G(y)-2.5 E -.15(exe)144 703.2 S -.834(cute \( \214le,).15 F(ar)2.5 E(g)-.18 E/F5 6/Times-Roman@0 SF(1)3 I F0 2.5(,a)-3 K -.18(rg)-2.5 G F5(2).18 3 M F0 2.5(,.)-3 K -3.332 1.666(.. , a)-.834 H -.18(rg)-1.666 G F5(n).18 3 M F0(\))1.666 -3 M .377(which requests the system to read in and e)72 721.2 R -.15(xe) -.15 G .377(cute the program named by).15 F F1(\214le)2.877 E F0 2.877 (,p)C .378(assing it string ar)-2.877 F(guments)-.18 E F1(ar)2.878 E(g) -.37 E/F6 6/Times-Italic@0 SF(1)3.6 I F1 2.878(,a)1.666 -3.6 O -.37(rg) -2.878 G F6(2).37 3.6 M F1(,)1.666 -3.6 M EP %%Page: 9 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Italic@0 SF(-)72 12 Q(U)419.342 60 Q/F1 8/Times-Italic@0 SF (NIX)A F0 -.55(Ti)2.5 G(me-Sharing System - 9).55 E -2.5 1.666(... ,)72 100.8 T(ar).995 E(g)-.37 E/F2 6/Times-Italic@0 SF(n)3.6 I F0(.)-3.6 I/F3 10/Times-Roman@0 SF .161(All the code and data in the process using) 5.161 F F0 -.2(ex)2.66 G(ecute).2 E F3 .16(is replaced from the)2.66 F F0(\214le)2.66 E F3 2.66(,b)C .16(ut open \214les, current directo-) -2.86 F(ry)72 112.8 Q 2.56(,a)-.65 G .06(nd inter)-2.56 F .06 (-process relationships are unaltered.)-.2 F .06(Only if the call f)5.06 F .061(ails, for e)-.1 F .061(xample because)-.15 F F0(\214le)2.561 E F3 .061(could not be found or)2.561 F .959(because its e)72 124.8 R -.15 (xe)-.15 G .959(cute-permission bit w).15 F .958 (as not set, does a return tak)-.1 F 3.458(ep)-.1 G .958(lace from the) -3.458 F F0 -.2(ex)3.458 G(ecute).2 E F3(primiti)3.458 E -.15(ve)-.25 G 3.458(;i).15 G 3.458(tr)-3.458 G .958(esembles a)-3.458 F -.74(``)72 136.8 S(jump').74 E 2.5('m)-.74 G (achine instruction rather than a subroutine call.)-2.5 E/F4 10 /Times-Bold@0 SF(5.4 Pr)72 160.8 Q(ocess synchr)-.18 E(onization)-.18 E F3(Another process control system call)82 175.2 Q(processid = w)144 193.2 Q -.834(ait \()-.1 F(\))3.332 E .567 (causes its caller to suspend e)72 211.2 R -.15(xe)-.15 G .568 (cution until one of its children has completed e).15 F -.15(xe)-.15 G 3.068(cution. Then).15 F F0(wait)3.068 E F3 .568(returns the)3.068 F F0 (pr)3.068 E(o-)-.45 E(cessid)72 223.2 Q F3 .671 (of the terminated process.)3.172 F .671(An error return is tak)5.671 F .671(en if the calling process has no descendants.)-.1 F .671 (Certain status)5.671 F(from the child process is also a)72 235.2 Q -.25 (va)-.2 G(ilable.).25 E F4(5.5 T)72 259.2 Q(ermination)-.92 E F3(Lastly) 82 273.6 Q(,)-.65 E -.15(ex)144 291.6 S -.834(it \( status \)).15 F .005 (terminates a process, destro)72 309.6 R .005 (ys its image, closes its open \214les, and generally obliterates it.) -.1 F .006(When the parent is noti\214ed)5.006 F .176(through the)72 321.6 R F0(wait)2.676 E F3(primiti)2.676 E -.15(ve)-.25 G 2.676(,t).15 G .176(he indicated)-2.676 F F0(status)2.676 E F3 .176(is a)2.676 F -.25 (va)-.2 G .176(ilable to the parent.).25 F .175 (Processes may also terminate as a result of)5.176 F -.25(va)72 333.6 S (rious ille).25 E -.05(ga)-.15 G 2.5(la).05 G(ctions or user)-2.5 E (-generated signals \(\2477 belo)-.2 E(w\).)-.25 E F4(6. The Shell)72 366 Q F3 -.15(Fo)82 380.4 S 2.837(rm).15 G .337 (ost users, communication with)-2.837 F/F5 8/Times-Roman@0 SF(UNIX)2.837 E F3 .338(is carried on with the aid of a program called the Shell.) 2.837 F .338(The Shell is a)5.338 F .296(command line interpreter: it r\ eads lines typed by the user and interprets them as requests to e)72 392.4 R -.15(xe)-.15 G .296(cute other programs.).15 F .409 (In simplest form, a command line consists of the command name follo)72 404.4 R .41(wed by ar)-.25 F .41(guments to the command, all sepa-)-.18 F(rated by spaces:)72 416.4 Q(command ar)144 434.4 Q(g)-.18 E/F6 6 /Times-Roman@0 SF(1)3 I F3(ar)2.5 -3 M(g)-.18 E F6(2)3 I F3 -3.332 1.666 (... a)2.5 -3 P -.18(rg)-1.666 G F6(n).18 3 M F3 .477 (The Shell splits up the command name and the ar)72 452.4 R .477 (guments into separate strings.)-.18 F .477(Then a \214le with name) 5.477 F F0(command)2.976 E F3(is)2.976 E(sought;)72 464.4 Q F0(command) 2.985 E F3 .485(may be a path name including the `)2.985 F(`/')-.74 E 2.985('c)-.74 G .486(haracter to specify an)-2.985 F 2.986<798c>-.15 G .486(le in the system.)-2.986 F(If)5.486 E F0(command)2.986 E F3(is) 2.986 E .877(found, it is brought into core and e)72 476.4 R -.15(xe) -.15 G 3.377(cuted. The).15 F(ar)3.377 E .876 (guments collected by the Shell are accessible to the command.)-.18 F .947(When the command is \214nished, the Shell resumes its o)72 488.4 R .948(wn e)-.25 F -.15(xe)-.15 G .948 (cution, and indicates its readiness to accept another).15 F (command by typing a prompt character)72 500.4 Q(.)-.55 E .726 (If \214le)82 518.4 R F0(command)3.226 E F3 .726 (cannot be found, the Shell pre\214x)3.226 F .726(es the string)-.15 F F0 1.666(/b)5.726 G(in/)-1.666 E F3(to)5.726 E F0(command)3.226 E F3 .726(and attempts ag)3.226 F .726(ain to \214nd the)-.05 F 2.5 (\214le. Directory)72 530.4 R F0 1.666(/b)2.5 G(in)-1.666 E F3 (contains all the commands intended to be generally used.)2.5 E F4 (6.1 Standard I/O)72 554.4 Q F3 .272(The discussion of I/O in \2473 abo) 82 568.8 R .572 -.15(ve s)-.15 H .272(eems to imply that e).15 F -.15 (ve)-.25 G .273 (ry \214le used by a program must be opened or created by).15 F .267 (the program in order to get a \214le descriptor for the \214le.)72 580.8 R .267(Programs e)5.267 F -.15(xe)-.15 G .267 (cuted by the Shell, ho).15 F(we)-.25 E -.15(ve)-.25 G 1.067 -.4(r, s) .15 H .267(tart of).4 F 2.767(fw)-.25 G .267(ith tw)-2.767 F(o)-.1 E .225(open \214les which ha)72 592.8 R .526 -.15(ve \214)-.2 H .226 (le descriptors 0 and 1.).15 F .226(As such a program be)5.226 F .226 (gins e)-.15 F -.15(xe)-.15 G .226 (cution, \214le 1 is open for writing, and is).15 F .429 (best understood as the standard output \214le.)72 604.8 R .429 (Except under circumstances indicated belo)5.429 F 1.729 -.65(w, t)-.25 H .429(his \214le is the user').65 F 2.928(st)-.55 G(ype-)-2.928 E (writer)72 616.8 Q 6.118(.T)-.55 G 1.118 (hus programs which wish to write informati)-6.118 F 1.419 -.15(ve o) -.25 H 3.619(rd).15 G 1.119 (iagnostic information ordinarily use \214le descriptor 1.)-3.619 F(Con) 72 628.8 Q -.15(ve)-.4 G(rsely).15 E 3.104<2c8c>-.65 G .604 (le 0 starts of)-3.104 F 3.104(fo)-.25 G .604(pen for reading, and prog\ rams which wish to read messages typed by the user usually)-3.104 F (read this \214le.)72 640.8 Q .996(The Shell is able to change the stan\ dard assignments of these \214le descriptors from the user')82 658.8 R 3.496(st)-.55 G(ype)-3.496 E .996(writer printer)-.25 F .651(and k)72 670.8 R -.15(ey)-.1 G 3.151(board. If).15 F .651(one of the ar)3.151 F .651(guments to a command is pre\214x)-.18 F .651(ed by `)-.15 F(`>') -.74 E .651(', \214le descriptor 1 will, for the duration of)-.74 F (the command, refer to the \214le named after the `)72 682.8 Q(`>')-.74 E 2.5('. F)-.74 F(or e)-.15 E(xample,)-.15 E(ls)144 700.8 Q (ordinarily lists, on the type)72 718.8 Q(writer)-.25 E 2.5(,t)-.4 G (he names of the \214les in the current directory)-2.5 E 5(.T)-.65 G (he command)-5 E EP %%Page: 10 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)72 60 Q/F2 8 /Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 10).55 E F0(ls >there)144 100.8 Q .361(creates a \214le called)72 118.8 R F1 (ther)2.861 E(e)-.37 E F0 .361(and places the listing there.)2.861 F .361(Thus the ar)5.361 F .361(gument `)-.18 F(`>there')-.74 E 2.861('m) -.74 G .361(eans, `)-2.861 F .361(`place output on)-.74 F F1(ther)2.862 E(e)-.37 E F0 -.7(.')C(')-.04 E(On the other hand,)72 130.8 Q(ed)144 148.8 Q(ordinarily enters the editor)72 166.8 Q 2.5(,w)-.4 G(hich tak) -2.5 E(es requests from the user via his type)-.1 E(writer)-.25 E 5(.T) -.55 G(he command)-5 E(ed ')-3.574 E 2.834('a)-.74 G .334 (ppears to be an ar)-2.834 F .334(gument to the command, in f)-.18 F .334(act it is interpreted)-.1 F .158 (completely by the Shell and is not passed to the command at all.)72 232.8 R .158(Thus no special coding to handle I/O redirection is)5.158 F .624(needed within each command; the command need merely use the standa\ rd \214le descriptors 0 and 1 where appropri-)72 244.8 R(ate.)72 256.8 Q /F3 10/Times-Bold@0 SF(6.2 Filters)72 280.8 Q F0 .244(An e)82 295.2 R .245(xtension of the standard I/O notion is used to direct output from \ one command to the input of another)-.15 F 5.245(.A)-.55 G(se-)-2.5 E .355(quence of commands separated by v)72 307.2 R .355 (ertical bars causes the Shell to e)-.15 F -.15(xe)-.15 G .354 (cute all the commands simultaneously and to).15 F .293 (arrange that the standard output of each command be deli)72 319.2 R -.15(ve)-.25 G .293(red to the standard input of the ne).15 F .293 (xt command in the se-)-.15 F 2.5(quence. Thus)72 331.2 R (in the command line)2.5 E(ls | pr)144 349.2 Q/F4 10/Symbol SF(-)2.5 E F0 2.5(2|o)C(pr)-2.5 E F1(ls)72 367.2 Q F0 .402(lists the names of the \ \214les in the current directory; its output is passed to)2.903 F F1(pr) 2.902 E F0 2.902(,w)C .402(hich paginates its input with dated)-2.902 F 2.98(headings. The)72 379.2 R(ar)2.98 E .48(gument `)-.18 F(`)-.74 E F4 (-)A F0(2')A 2.98('m)-.74 G .48(eans double column.)-2.98 F(Lik)5.48 E -.25(ew)-.1 G .481(ise the output from).25 F F1(pr)2.981 E F0 .481 (is input to)2.981 F F1(opr)2.981 E F0 5.481(.T)C .481(his command) -5.481 F(spools its input onto a \214le for of)72 391.2 Q (f-line printing.)-.25 E(This procedure could ha)82 409.2 Q .3 -.15 (ve b)-.2 H(een carried out more clumsily by).15 E(ls >temp1)144 427.2 Q (pr)144 439.2 Q F4(-)2.5 E F0 2.5(2<)C(temp1 >temp2)-2.5 E(opr output &) 144 693.6 Q(causes)72 711.6 Q F1(sour)3.079 E(ce)-.37 E F0 .579 (to be assembled, with diagnostic output going to)3.079 F F1(output;) 3.079 E F0 .579(no matter ho)3.079 F 3.079(wl)-.25 G .579 (ong the assembly tak)-3.079 F .578(es, the)-.1 F .349 (Shell returns immediately)72 723.6 R 5.349(.W)-.65 G .349 (hen the Shell does not w)-5.349 F .35 (ait for the completion of a command, the identi\214cation of the)-.1 F EP %%Page: 11 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)414.342 60 Q /F2 8/Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 11) .55 E F0 .946(process running that command is printed.)72 100.8 R .946 (This identi\214cation may be used to w)5.946 F .946 (ait for the completion of the com-)-.1 F(mand or to terminate it.)72 112.8 Q(The `)5 E(`&')-.74 E 2.5('m)-.74 G(ay be used se)-2.5 E -.15(ve) -.25 G(ral times in a line:).15 E(as source >output & ls >\214les &)144 130.8 Q .905(does both the assembly and the listing in the background.) 72 148.8 R .905(In the e)5.905 F .905(xamples abo)-.15 F 1.205 -.15 (ve u)-.15 H .906(sing `).15 F(`&')-.74 E .906 (', an output \214le other)-.74 F .576(than the type)72 160.8 R .576 (writer w)-.25 F .576(as pro)-.1 F .575 (vided; if this had not been done, the outputs of the v)-.15 F .575 (arious commands w)-.25 F .575(ould ha)-.1 F .875 -.15(ve b)-.2 H(een) .15 E(intermingled.)72 172.8 Q(The Shell also allo)82 190.8 Q (ws parentheses in the abo)-.25 E .3 -.15(ve o)-.15 H 2.5(perations. F) .15 F(or e)-.15 E(xample)-.15 E 1.666(\(d)144 208.8 S(ate; ls)-1.666 E 2.5(\)>)1.666 G 2.5(x&)-2.5 G .352 (prints the current date and time follo)72 226.8 R .353 (wed by a list of the current directory onto the \214le)-.25 F F1(x.) 2.853 E F0 .353(The Shell also returns im-)5.353 F (mediately for another request.)72 238.8 Q/F3 10/Times-Bold@0 SF (6.4 The Shell as a Command; Command Files)72 262.8 Q F0 (The Shell is itself a command, and may be called recursi)82 277.2 Q -.15(ve)-.25 G(ly).15 E 5(.S)-.65 G(uppose \214le)-5 E F1(tryout)2.5 E F0(contains the lines)2.5 E(as source)144 295.2 Q(mv a.out testprog)144 307.2 Q(testprog)144 319.2 Q(The)72 337.2 Q F1(mv)2.528 E F0 .028 (command causes the \214le)2.528 F F1(a.out)2.528 E F0 .028 (to be renamed)2.528 F F1(testpr)2.528 E -.1(og)-.45 G 5.028(.A)-.05 G (.out)-5.028 E F0 .028(is the \(binary\) output of the assembler)2.528 F 2.528(,r)-.4 G .028(eady to)-2.528 F .233(be e)72 349.2 R -.15(xe)-.15 G 2.733(cuted. Thus).15 F .233(if the three lines abo)2.733 F .534 -.15 (ve w)-.15 H .234(ere typed on the console,).15 F F1(sour)2.734 E(ce) -.37 E F0 -.1(wo)2.734 G .234(uld be assembled, the resulting pro-).1 F (gram renamed)72 361.2 Q F1(testpr)2.5 E -.1(og)-.45 G F0 2.5(,a).1 G (nd)-2.5 E F1(testpr)2.5 E -.1(og)-.45 G F0 -.15(exe)2.6 G 2.5 (cuted. When).15 F(the lines are in)2.5 E F1(tryout)2.5 E F0 2.5(,t)C (he command)-2.5 E(sh .15 G .295 (les and to perform transfers of control within \214led command)-2.795 F (sequences.)72 451.2 Q F3(6.5 Implementation of the Shell)72 475.2 Q F0 .167(The outline of the operation of the Shell can no)82 489.6 R 2.667 (wb)-.25 G 2.667(eu)-2.667 G 2.667(nderstood. Most)-2.667 F .167 (of the time, the Shell is w)2.667 F .167(aiting for the us-)-.1 F .116 (er to type a command.)72 501.6 R .116(When the ne)5.116 F .115 (w-line character ending the line is typed, the Shell')-.25 F(s)-.55 E F1 -.37(re)2.615 G(ad).37 E F0 .115(call returns.)2.615 F .115 (The Shell)5.115 F .331(analyzes the command line, putting the ar)72 513.6 R .332(guments in a form appropriate for)-.18 F F1 -.2(ex)2.832 G (ecute).2 E F0 5.332(.T)C(hen)-5.332 E F1(fork)2.832 E F0 .332 (is called.)2.832 F .332(The child)5.332 F 1.016(process, whose code of\ course is still that of the Shell, attempts to perform an)72 525.6 R F1 -.2(ex)3.516 G(ecute).2 E F0 1.015(with the appropriate ar)3.515 F(gu-) -.18 E 3.116(ments. If)72 537.6 R .616 (successful, this will bring in and start e)3.116 F -.15(xe)-.15 G .616 (cution of the program whose name w).15 F .616(as gi)-.1 F -.15(ve)-.25 G 3.117(n. Meanwhile,).15 F(the)3.117 E .182 (other process resulting from the)72 549.6 R F1(fork)2.681 E F0 2.681 (,w)C .181(hich is the parent process,)-2.681 F F1(wait)2.681 E F0 2.681 (sf)1.666 G .181(or the child process to die.)-2.681 F .181 (When this hap-)5.181 F .01(pens, the Shell kno)72 561.6 R .01(ws the c\ ommand is \214nished, so it types its prompt and reads the type)-.25 F .01(writer to obtain another com-)-.25 F(mand.)72 573.6 Q(Gi)82 591.6 Q -.15(ve)-.25 G 2.919(nt).15 G .419(his frame)-2.919 F -.1(wo)-.25 G .419 (rk, the implementation of background processes is tri).1 F .418 (vial; whene)-.25 F -.15(ve)-.25 G 2.918(rac).15 G .418 (ommand line contains)-2.918 F -.74(``)72 603.6 S(&').74 E (', the Shell merely refrains from w)-.74 E (aiting for the process which it created to e)-.1 E -.15(xe)-.15 G (cute the command.).15 E(Happily)82 621.6 Q 2.585(,a)-.65 G .085 (ll of this mechanism meshes v)-2.585 F .085 (ery nicely with the notion of standard input and output \214les.)-.15 F .086(When a pro-)5.086 F .785(cess is created by the)72 633.6 R F1(fork) 3.285 E F0(primiti)3.285 E -.15(ve)-.25 G 3.285(,i).15 G 3.285(ti)-3.285 G .784(nherits not only the core image of its parent b)-3.285 F .784 (ut also all the \214les currently)-.2 F .621 (open in its parent, including those with \214le descriptors 0 and 1.)72 645.6 R .622(The Shell, of course, uses these \214les to read com-)5.621 F 2.14(mand lines and to write its prompts and diagnostics, and in the \ ordinary case its children_the command pro-)72 657.6 R .108 (grams_inherit them automatically)72 669.6 R 5.108(.W)-.65 G .108 (hen an ar)-5.108 F .109(gument with `)-.18 F(`<')-.74 E 2.609('o)-.74 G 2.609(r`)-2.609 G(`>')-3.349 E 2.609('i)-.74 G 2.609(sg)-2.609 G -2.15 -.25(iv e)-2.609 H 2.609(nh).25 G -.25(ow)-2.609 G -2.15 -.25(ev e).25 H .909 -.4(r, t).25 H .109(he of).4 F .109(fspring process, just)-.25 F .348(before it performs)72 681.6 R F1 -.2(ex)2.848 G(ecute).2 E(,)-.1 E F0(mak)2.848 E .348 (es the standard I/O \214le descriptor 0 or 1 respecti)-.1 F -.15(ve) -.25 G .348(ly refer to the named \214le.).15 F .348(This is)5.348 F .005(easy because, by agreement, the smallest unused \214le descriptor \ is assigned when a ne)72 693.6 R 2.505<778c>-.25 G .005(le is)-2.505 F F1(open)2.505 E F0 .006(ed \(or)1.666 F F1(cr)2.506 E(eate)-.37 E F0 .006(d\); it)1.666 F .107(is only necessary to close \214le 0 \(or 1\) \ and open the named \214le.)72 705.6 R .107 (Because the process in which the command program)5.107 F .163(runs sim\ ply terminates when it is through, the association between a \214le spe\ ci\214ed after `)72 717.6 R(`<')-.74 E 2.663('o)-.74 G 2.663(r`)-2.663 G (`>')-3.403 E 2.664('a)-.74 G .164(nd \214le descrip-)-2.664 F .384 (tor 0 or 1 is ended automatically when the process dies.)72 729.6 R .384(Therefore the Shell need not kno)5.384 F 2.884(wt)-.25 G .383 (he actual names of the)-2.884 F EP %%Page: 12 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)72 60 Q/F2 8 /Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 12).55 E F0(\214les which are its o)72 100.8 Q (wn standard input and output, since it need ne)-.25 E -.15(ve)-.25 G 2.5(rr).15 G(eopen them.)-2.5 E(Filters are straightforw)82 118.8 Q (ard e)-.1 E(xtensions of standard I/O redirection with pipes used inst\ ead of \214les.)-.15 E .825 (In ordinary circumstances, the main loop of the Shell ne)82 136.8 R -.15(ve)-.25 G 3.325(rt).15 G 3.325(erminates. \(The)-3.325 F .826 (main loop includes that branch of)3.325 F .46(the return from)72 148.8 R F1(fork)2.96 E F0 .46 (belonging to the parent process; that is, the branch which does a)2.96 F F1(wait)2.959 E F0 2.959(,t)C .459(hen reads another com-)-2.959 F .864(mand line.\))72 160.8 R .864 (The one thing which causes the Shell to terminate is disco)5.864 F -.15 (ve)-.15 G .865(ring an end-of-\214le condition on its input).15 F 2.5 (\214le. Thus,)72 172.8 R(when the Shell is e)2.5 E -.15(xe)-.15 G (cuted as a command with a gi).15 E -.15(ve)-.25 G 2.5(ni).15 G (nput \214le, as in)-2.5 E(sh -.15 G .06(le or de)-2.56 F .06 (vice as input or output, it is also desir)-.25 F(-)-.2 E 1.397 (able from a space-ef)72 166.8 R(\214cienc)-.25 E 3.897(ys)-.15 G 1.398 (tandpoint to push de)-3.897 F 1.398 (vice-dependent considerations into the operating system itself.)-.25 F .255(The only alternati)72 178.8 R -.15(ve)-.25 G 2.755(ss).15 G .254 (eem to be to load routines for dealing with each de)-2.755 F .254 (vice with all programs, which is e)-.25 F(xpensi)-.15 E -.15(ve)-.25 G .158(in space, or to depend on some means of dynamically linking to the\ routine appropriate to each de)72 190.8 R .159(vice when it is ac-)-.25 F(tually needed, which is e)72 202.8 Q(xpensi)-.15 E .3 -.15(ve e)-.25 H (ither in o).15 E -.15(ve)-.15 G(rhead or in hardw).15 E(are.)-.1 E(Lik) 82 220.8 Q -.25(ew)-.1 G .972 (ise, the process control scheme and command interf).25 F .972(ace ha) -.1 F 1.272 -.15(ve p)-.2 H(ro).15 E -.15(ve)-.15 G 3.472(db).15 G .972 (oth con)-3.472 F -.15(ve)-.4 G .972(nient and ef).15 F 3.472 (\214cient. Since)-.25 F .558(the Shell operates as an ordinary)72 232.8 R 3.058(,s)-.65 G -.1(wa)-3.058 G .558 (ppable user program, it consumes no wired-do).1 F .559 (wn space in the system proper)-.25 F(,)-.4 E .724 (and it may be made as po)72 244.8 R .723 (werful as desired at little cost.)-.25 F .723(In particular)5.723 F 3.223(,g)-.4 G -2.15 -.25(iv e)-3.223 H 3.223(nt).25 G .723(he frame) -3.223 F -.1(wo)-.25 G .723(rk in which the Shell e).1 F(x-)-.15 E .342 (ecutes as a process which spa)72 256.8 R .342(wns other processes to p\ erform commands, the notions of I/O redirection, background)-.15 F (processes, command \214les, and user)72 268.8 Q (-selectable system interf)-.2 E(aces all become essentially tri)-.1 E (vial to implement.)-.25 E/F3 10/Times-Bold@0 SF(8.1 In\215uences)72 292.8 Q F0 .656(The success of)82 307.2 R/F4 8/Times-Roman@0 SF(UNIX) 3.156 E F0 .656(lies not so much in ne)3.156 F 3.155(wi)-.25 G -1.85 -.4 (nv e)-3.155 H .655(ntions b).4 F .655(ut rather in the full e)-.2 F .655(xploitation of a carefully selected)-.15 F .056 (set of fertile ideas, and especially in sho)72 319.2 R .057 (wing that the)-.25 F 2.557(yc)-.15 G .057(an be k)-2.557 F -.15(ey)-.1 G 2.557(st).15 G 2.557(ot)-2.557 G .057 (he implementation of a small yet po)-2.557 F .057(werful op-)-.25 F (erating system.)72 331.2 Q(The)82 349.2 Q F1(fork)3.593 E F0 1.093 (operation, essentially as we implemented it, w)3.593 F 1.093 (as present in the Berk)-.1 F(ele)-.1 E 3.592(yt)-.15 G 1.092 (ime sharing system)-3.592 F/F5 6/Times-Roman@0 SF(8)1 -3 M F0 6.092(.O) 1.666 3 O 3.592(na)-6.092 G .55(number of points we were in\215uenced b\ y Multics, which suggested the particular form of the I/O system calls) 72 361.2 R F5(9)1 -3 M F0(and)4.717 3 M .134 (both the name of the Shell and its general functions.)72 373.2 R .133 (The notion that the Shell should create a process for each com-)5.133 F .51(mand w)72 385.2 R .51(as also suggested to us by the early design o\ f Multics, although in that system it w)-.1 F .511 (as later dropped for ef)-.1 F<8c2d>-.25 E(cienc)72 397.2 Q 2.5(yr)-.15 G 2.5(easons. A)-2.5 F(similar scheme is used by)2.5 E F4(TENEX)2.5 E F5 (10)1 -3 M F0(.)1.666 3 M F3(9. Statistics)72 429.6 Q F0 .998(The follo) 82 444 R .998 (wing numbers are presented to suggest the scale of our operation.)-.25 F .997(Those of our users not in)5.998 F -.2(vo)-.4 G(lv).2 E .997 (ed in)-.15 F 1.072 (document preparation tend to use the system for program de)72 456 R -.15(ve)-.25 G 1.072(lopment, especially language w).15 F 3.572 (ork. There)-.1 F 1.072(are fe)3.572 F(w)-.25 E(important `)72 468 Q (`applications')-.74 E 2.5('p)-.74 G(rograms.)-2.5 E(Ov)82 486 Q (erall, we ha)-.15 E -.15(ve)-.2 G 36.5(100 user)108 504 R(population) 2.5 E 41.5(14 maximum)108 516 R(simultaneous users)2.5 E 36.5 (380 directories)108 528 R 31.5(4800 \214les)108 540 R 26.5 (66300 512-byte)108 552 R(secondary storage blocks used)2.5 E .341 (There is a `)82 570 R(`background')-.74 E 2.841('p)-.74 G .341 (rocess that runs at the lo)-2.841 F .34 (west possible priority; it is used to soak up an)-.25 F 2.84(yi)-.15 G (dle)-2.84 E F4(CPU)2.84 E F0(time.)2.84 E .21(It has been used to prod\ uce a million-digit approximation to the constant)72 582 R F1(e)2.711 E /F6 10/Symbol SF(-)A F0 .211(2, and is no)B 2.711(ws)-.25 G .211 (olving all rook-and-pa)-2.711 F(wn)-.15 E(vs. rook chess endg)72 594 Q 2.5(ames. Not)-.05 F(counting this background w)2.5 E(ork, we a)-.1 E -.15(ve)-.2 G(rage daily).15 E 31.5(2400 commands)108 612 R(5.5)108 624 Q F4(CPU)41.5 E F0(hours)2.5 E 36.5(100 connect)108 636 R(hours)2.5 E 41.5(32 dif)108 648 R(ferent users)-.25 E 36.5(100 logins)108 660 R F1 (Ac)72 684 Q(knowledg)-.2 E(ements.)-.1 E F0 2.85 -.8(We a)6.25 H 1.25 (re grateful to R.H. Canaday).8 F 3.749(,L)-.65 G 1.249(.L. Cherry) -3.749 F 3.749(,a)-.65 G 1.249(nd L.E. McMahon for their contrib)-3.749 F 1.249(utions to)-.2 F F4(UNIX)72 696 Q F0 5.329(.W)C 2.829(ea)-6.129 G .33(re particularly appreciati)-2.829 F .63 -.15(ve o)-.25 H 2.83(ft).15 G .33(he in)-2.83 F -.15(ve)-.4 G(nti).15 E -.15(ve)-.25 G .33 (ness, thoughtful criticism, and constant support of R. Morris,).15 F (M.D. McIlro)72 708 Q 1.3 -.65(y, a)-.1 H(nd J.F).65 E 2.5(.O)-.8 G (ssanna.)-2.5 E EP %%Page: 15 15 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(-)72 12 Q/F1 10/Times-Italic@0 SF(U)414.342 60 Q /F2 8/Times-Italic@0 SF(NIX)A F1 -.55(Ti)2.5 G(me-Sharing System - 15) .55 E/F3 10/Times-Bold@0 SF(Refer)72 106.8 Q(ences)-.18 E F0 20 (1. Digital)72 118.8 R 1.611(Equipment Corporation.)4.111 F F2(PDP)6.611 E F1 1.611(-11/40 Pr)B 1.611(ocessor Handbook)-.45 F F0(\(1972\),)4.111 E F2(PDP)4.11 E F1 1.61(-11/45 Pr)B 1.61(ocessor Handbook)-.45 F F0 (\(1971\), and)102 130.8 Q F2(PDP)2.5 E F1(-11/70 Pr)A(ocessor Handbook) -.45 E F0(\(1975\).)2.5 E 20(2. Deutsch,)72 142.8 R(L.P)2.5 E (., and Lampson, B.W)-1.11 E 5(.A)-.92 G 2.5(no)-5 G(nline editor)-2.5 E (.)-.55 E F1(Comm. A)5 E(CM 10,)-.3 E F0 (12 \(Dec. 1967\), 793-799, 803.)2.5 E 20(3. Richards,)72 154.8 R(M.) 2.542 E/F4 8/Times-Roman@0 SF(BCPL)5.042 E F0 2.542(:At)C .042 (ool for compiler writing and system programming.)-2.542 F .042 (Proc. AFIPS 1969 SJCC, V)5.042 F .042(ol. 34,)-1.29 F (AFIPS Press, Montv)102 166.8 Q(ale, N.J., pp. 557-566.)-.25 E 20 (4. McClure,)72 178.8 R(R.M.)2.679 E F4(TMG)5.179 E F0 .179 (\212A syntax directed compiler)B 5.179(.P)-.55 G .179(roc. A)-5.179 F .179(CM 20th Nat. Conf., A)-.4 F .179(CM, 1965, Ne)-.4 F 2.679(wY)-.25 G .178(ork, pp.)-3.779 F(262-274.)102 190.8 Q 20(5. Hall,)72 202.8 R 2.8 (A.D. The)2.8 F .301(M6 macroprocessor)2.8 F 5.301(.C)-.55 G .301 (omputing Science T)-5.301 F .301(ech. Rep. #2, Bell T)-.7 F .301 (elephone Laboratories, 1969.)-.7 F 20(6. Ritchie,)72 214.8 R 2.5 (D.M. C)2.5 F(reference manual. Unpublished memorandum, Bell T)2.5 E (elephone Laboratories \(1973\).)-.7 E 20(7. Aleph-null.)72 226.8 R (Computer Recreations.)2.5 E F1(Softwar)5 E 2.5(eP)-.37 G -.15(ra)-2.5 G (ctice and Experience 1,).15 E F0 2.5(2\()2.5 G(Apr)-2.5 E (.-June 1971\), 201-204.)-.55 E 20(8. Deutch,)72 238.8 R(L.P)5.73 E 5.73 (.a)-1.11 G 3.23(nd Lampson, B.W)-5.73 F(.)-.92 E F4(SDS)8.23 E F0 3.23 (930 time-sharing system preliminary reference manual.)5.73 F(Doc.)8.229 E(30.10.10, Project)102 250.8 Q F4(GENIE)2.5 E F0 2.5(,U)C(ni)-2.5 E 1.3 -.65(v. C)-.25 H(al. at Berk).65 E(ele)-.1 E 2.5(y\()-.15 G(Apr)-2.5 E 2.5(.1)-.55 G(965\).)-2.5 E 20(9. Feiertag,)72 262.8 R .933 (R.J., and Or)3.433 F -.05(ga)-.18 G .934(nick, E.I.).05 F .934 (The Multics input-output system.)5.934 F .934 (Proc. Third Symposium on Operating)5.934 F(Systems Principles.)102 274.8 Q(Oct. 18-20, 1971, A)5 E(CM, Ne)-.4 E 2.5(wY)-.25 G (ork, pp. 35-41.)-3.6 E 15(10. Bobro)72 286.8 R 1.877 -.65(w, D)-.25 H .577(.G., Burch\214el, J.D., Murph).65 F 1.877 -.65(y, D)-.05 H .577 (.L., and T).65 F .577(omlinson, R.S.)-.8 F F4(TENEX)5.577 E F0 3.077 (,ap)C .577(aged time sharing system for)-3.077 F(the)102 298.8 Q F4 (PDP)2.5 E F0(-10.)A F1(Comm. A)5 E(CM 15.,)-.3 E F0 2.5(3\()2.5 G (March 1972\) 135-143.)-2.5 E EP %%Trailer end %%EOF