1. Introduction ACM Symposium on Operating Systems Principles There have been three versions of . The earliest Yorktown Heights, N.Y.: October, 1963 version (circa 1969-70) ran on the Digital Equipment Corporation PDP-7 and -9 computers. The second ver. sion ran on the unprotected PDP.~~'20 computer. hi^ paper describes only the PDP-ll 40 and .'45 [I] system System The UNIX Time- since it is more modern and many of the diferences The UNMO Time-Sharing between it and older UNlx systems result from redesign Dennis M. Ritchie and Ken Thompson Sharing System of features found to be deficient or lacking. Since PDP-l l UNIX became operational in February July, 1974 Dennis M. Ritchie and Ken Thompson 1971, about 40 installations have been put into service; Volume 17, Number 7 Bell Laboratories they are generally smaller than the system described here. Most of them are engaged in applications such as pp. 365-375 the preparation and formatting of patent applications and other textual material, the collection and processing of trouble data from vartous switching machines within the Bell System, and recording and checking telephone service orders. Our own installation is used mainly machines, most notably the PDP-I1 family. for research in operating systems, languages, com- UNIPhas become one of the most widely puter networks, and other topics in computer scienc', known and imitated operating systems of all The genius of Ritchie and Thompson is in UNIX is a general-purpose, multi-user, interactive and also for document preparation. time. Ken Thompson, in working on a pro- their selection of a subset of the most pow- for the Digital Equipment Corporation Perhaps the most important achievement of L.NIX PDP-II/~Oand 11/45 computers. It offers a number of is to demonstrate that a powerful operating system gram for simulating the movements of celes- e@lfunctions of MUUICS (especially pro- features seldom found even in larger operating systems, for interactive use need not be expensive either in cesses, directory hierarchies, stream- including: (I) a hierarchical file system incorporating equipment or in human eRort: u~ixcan run on hardware tial bodies in the solar system, became dis- demountable volumes; (2) compatible file, device. and costlng as little as $40,000, and less than two man- satisjied with the excessively slow rate by oriented IIO, file-like devices, and the shell) inter-process 1/O; (3) the ability to initiate asynchronous years were spent on the main system software. Yet which he developed programs within MUL- together with their own invention of the pipe. processes; (4) system command language selectable on a UNlX contains a number of features seldom ofered even per-user basis; and (5) over LOO subsystems including a in much larger systems. It is hoped, however, the users TICS as then constituted. (MUUICS was These elements made their operating system dozen languages. This paper discusses the nature and of UNIX will find that the most important characteristics the advanced time-sharing system con- a very powe@l programming environment. implementation of the file system and of the user of the system are its simplicity, elegance, and ease of use. command interface. Besides the system proper, the mior programs structed jointly by Bell Labs and MIT) The name, UNIX, was a tra&omtion of Key Words and Phrases: time-sharing, operating available under u~ixare: assembler, text editor based Thompson wrote an operating systemfor the MUUICS, with MUL.TI- becoming UNI- system, file system, command language, PDP-11 on QED (21, linking loader, symbolic debugger, compiler CR Categories: 4.30,4.32 for a language resembling BCPL [3] with types and PDP-7 and worked on his and -CS becoming -X. These tramfom- structures (C), interpreter for a dialect of BASIC, text "space program" there. Dennis Ritchie , tions connoted the simplijicatiom in their formatting program, Fortran compiler, Snobol inter- preter, top-down compiler-comp~ler (TMC) 141, bot- who wrote the C programming language, operating system, its orientation toward tom-up compiler-compiler (YAK), form letter generator, became a collaborator and rewrote single-user systems, and its ejiciency. This macro processor (M6) [S], and permuted index program. There is also a host of maintenance, utility, recred- Thompson's operating system in C.Because paper received the ACM award for best tion, and novelty programs. All of these programs were the operating system was small enough tofit paper in programming languages and sys- written locally. It is worth noting that the system is totally self-supporting. AII UNIX software is maintained in a minicomputer,the C language allowed it tems in 1974. under UNIX; likewise, UNIX documents are generated to be transported to a wide variety of other -I? J D. and formatted by the UNIX editqr and text formatting program.

Copyright @ 1974, Association for Computing Mach~nery,Inc. General permission to republish, but not for profit, all or part 2. Hardware and Software Environment of this material is granted provided that ACM's copyr~ghtnotice is given and that reference is made to the publication, to its date The PDP-II/~Son which our UNIX installation is of issue, and to the fact that reprrnting privileges were granted by permission of the Association for Computing Machinery. implemented is a 16-bit word (8-bit byte) computer with This is a revised venion of a paper presented at the Fourth 144K bytes of core memory; UNIX occupies 42K bytes. ACM Symposium on Operating Systems Principles, IBM Thomas This system, however, includes a very large number of I. Watson Rerearch Center, Yorktown Heights, New York, October 15-17, 1973. Authors' address: Bell Laboratories, Murray Hill, device drivers and enjoys a generous allotment of space NJ 07974. for I/o buffers and system tables; a minimal system Communications 25th Anniversary Issue January, 1983 of Volume 26 the ACM Number 1 capable of running the software mentioned above can directory of his own files; he may also create subdirec- visit subtrees of the directory structure, and more im- keeping which would otherwise be required to assure require as little as 50K bytes of core altogether. tories to contain groups of files conveniently treated portant, to avoid the separation of portions of the removal of the links when the removable volume is The PDP-ll has a 1M byte fixed-head disk, used for together. A directory behaves exactly like an ordinary hierarchy. If arbitrary links to directories were per- finally dismounted. In particular, in the root directories file system storage and swapping, four moving-head file except that it cannot be written on by unprivileged mitted, it would be quite difficult to detect when the of all file systems, removable or not, the name ".." disk drives which each provide 2.5M bytes on removable programs, so that the system controls the contents last connection from the root to a directory was severed. refers to the directory itself instead of to its parent. disk cartridges, and a single moving-head disk drive of directories. However, anyone with appropriate per- which uses removable 40M byte disk packs. There are mission may read a directory just like any other file. 3.3 Special Files 3.5 Protection also a high-speed paper tape reader-punch, nine-track The system maintains several directories for its own Special files constitute the most unusual feature of Although the access control scheme in UNlx is quite magnetic tape, and DEctape (a variety of magnetic use. One of these is the root directory. All files in the the UNIX file system. Each I/O device supported by simple, it has some unusual features. Each user of the tape facility in which individual records may be ad- system can be found by tracing a path through a chain UNIX is associated with at least one such file. Special system is assigned a unique user identification number. dressed and rewritten). Besides the console typewriter, of directories until the desired file is reached. The files are read and written just like ordinary disk files, When a file is created, it is marked with the user ID of there are 14 variable-speed communications interfaces startingpolnt forsuch searches isoften the root.Another but requests to read or write result in activation of the its owner. Also given for new files is a set of seven attached to 100-series datasets and a 201 dataset in- system directory contains all the programs provided for associated device. An entry for each special file resides in protection bits. Six of these specrfy independently read, terface used primarily for spooling printout to a com- general use; that is, all the commands. As will be seen, directory ,,dev, although a link may be made to one of write, and execute permission for the owner of the munal line printer. There are also several one-of-a-kind however, it is by no means necessary that a program these files just like an ordinary file. Thus, for example, file and for all other users. devices including a Picturephonea interface, a voice reside in this directory for it to be executed. to punch paper tape, one may write on the file !dev/ppt. If the seventh bit is on, the system will temporarily response unit, a voice synthesizer, a phototypesetter, a Files are named by sequences of 14 or fewer Special files exist for each communication line, each change the user identification of the current user to digital switching network, and a satellite PDP-II~~Ocharacters. When the name of a file is specified to the dlsk, each tape drive, and for physical core memory. that of the creator of the file whenever the file is executed which generates vectors, curves, and characters on a system, it may be in the form of a path name, which is a Of course, the active disks and the core special file are as a program. This change in user ID is effective only Tektronix 61 1 storage-tube display. sequence of directory names separated by slashes "1" protected from indiscriminate access. during the execution of the program which calls for it. The greater part of UNIX software is written in the and ending in a file name. If the sequence begins with a There is a threefold advantage in treating I/O devices The set-user-ID feature provides for privileged pro- above-mentioned C language [6].Early versions of the slash, the search begins in the root directory. The this way: file and device I/O are as similar as possible; grams which may use files inaccessible to other users. operating system were written in assembly language, name /alpho,lbcta/gamma causes the system to search file and device names have the same syntax and mean- For example, a program may keep an accounting file but during the summer of 1973, it was rewritten in C. the root for directory alpha, then to search alpha for ing, so that a program expecting a file name as a param- which should neither be read nor changed except by The size of the new system is about one third greater beta, finally to find gamma in beta. Gamma may be an eter can be passed a device name; finally, special files the program itself. If the set-user-identification bit is on than the old. Since the new system is not only much ordinary file, a directory, or a special file. As a limiting are subject to the same protection mechanism as regular for the program, it may access the file although this easier to understand and to modify but also includes case, the name "j" refers to the root itself. files. access might be forbidden to other programs invoked by many functional improvements, including multipro- A path name not starting with "/" causes the sys- the given program's user. Since the actual user ID of gramming and the ability to share reentrant code tem to begin the scarch in the user's current directory. 3.4 Removable File Systems the invoker of any program is always available, set- among several user programs, we considered this in- Thus, the name olpha/beta specifies the file named Although the root of the file system is always sto~ed user-ID programs may take any measures desired to crease in size quite acceptable. beta in subdirectory alpha of the current directory. on the same device, it is not necessary that the entire satisfy themselves as to their invoker's credentials. This The simplest kind of name, for example olphn, refers to file system hierarchy reside on this device. There is a mechanism is used to allow users to execute the care- a file which itself is found in the current directory. As mount system request which has two arguments: the fully written commands which call privileged system 3. The File System another limiting case, the null file name refers to the name of an existing ordinary file, and the name of a entries. For example, there is a system entry invokable current directory. direct-access special file whose associated storage vol- only by the "super-user" (below) which creates an The most important role of UNI~is to provide a The same nondirectory file may appear in several ume (e.g. disk pack) should have the structure of an empty directory. As indicated above, directories are file system. From the point of view of the user, there directories under possibly different names. This feature independent file system containing its own directory expected to have entries for " ." and ". .". The com- are three kinds of files: ord~narydisk files, directories, is called linki~~g;a directory entry for a file is sometimes hierarchy. The effect of mount is to cause references to mand which creates a directory is owned by the super- and special files. called a link. UNIX differs from other systems in which the heretofore ordinary file to refer instead to the root user and has the set-user-ID bit set. After it checks its linking is permitted in that all links to a file have equal directory of the file system on the removable volume. invoker's authorization to create the specified directory, 3.1 Ordinary Filcs status. That is, a file does not exist within a particular In effect, mount replaces a leaf of the hierarchy tree it creates it and makes the entries for "." and ". .". A file contains whatever information the user places directory; the directory entry for a file consists merely (the ordinary file) by a whole new subtree (the hierarchy Since anyone may set the set-user-ID bit on one of on it, for example symbolic or binary (object) programs. of its name and a pointer to the information actually stored on the removable volume). After the mount, his own files, this mechanism is generally available with- No particular structuring is cxpected by the system. describing the file. Thus a file exists independently of there is virtually no distinction between files on the out administrative intervention. For example, this pro- Files of text consist simply of a string of characters, any directory entry, although in practice a file is made removable volume and those in the permanent file tection scheme easily solves the MW accounting prob- with lines demarcated by the new-line character. Binary to disappear along with the last link to it. system. In our installation, for example, the root lem posed in (71. programs are sequcnccs of words as thcy uill appear Each directory always has at least two entries. The directory resides on the fixed-head disk, and the large The system recognizes one particular user ID (that of in core memory uhen the program starts executing. A name "." in each directory refers to the directory itself. disk drive, which contains user's files, is mounted by the "super-user") as exempt from the usual constraints few user programs manipulate files uith more structure: Thus a program may read the current directory under the system initialization program; the four smaller disk on file access; thus (for example) programs may be the assembler gencratea and the loader cxpects an the name "." without knowing its complete path name. drives are available to users for mounting their own written to dump and reload the file system without un- object file in a particular format. Hone\er, the structure The name *..." by convention refers to the parent of disk packs. A mountable file system is generated by wanted interference from the protection system. of files is controlled by the progralns uhich use them, the directory In which it appears, that is, to the directory writing on its corresponding special file. A utility pro- not by the system. in which it was created. gram is available to create an empty file system, or one 3.6 110 Calls The directory structure is constrained to have the may simply copy an existing file system. The system calls to do I/O are designed to eliminate 3.2 Directories form of a rooted tree. Except for the special entries There is only one exception to the rule of identical the differences between the various devices and styles of Directories provide the mapping between the names "." and ". .", each directory must appear as an entry treatment of files on different devices: no link may exist access. There is no distinction between "random" and of files and the files themselves, and thus induce a in exactly one other, which is its parent. The reason between one file system hierarchy and another. This "sequential" I/O, nor is any logical record size imposed structure on the file system as a whole. Each user has a for this is to simplify the writing of programs which restriction is enforced so as to avoid the elaborate book- by the system. The size of an ordinary file is determined '[In li! ray due 5u!8isq> -az!q sil P (luno~'Jaynq 'daly)al!~m = u qqw) [ Lq ppaseld~ls! laqmnu-! aql 'plmnj s! q-om ej! tom Lq anss! aql sp!o.re slNn JO uoislaa IUJIJ~J 3q~ '%ualtxo> liunos 'laynq 'daly)pea~ = u 'a,ua,.1 I" irado ue Bu!~nppauuex Su!aq r! aupu qled o ;r,y u nl syuq ahoq oq~tsmn Buomn illenba ESIB~? aly J~Ilo! SJSSJI~~Badz1 10 %sip j~a!sbqdaq.1 I allqrn dn su~niqslqm lwd-(s~rnap'~~qwnu-I) qaua roj :paw q LEU s[lea Su!mo[loj aqi '"ado E! alg s 3x10 aql pv~~dn01 aq ol swaas wqi!~oSjsI!PJ l([qe~OSB31 -suq uo!loaauld SI[ 'i paqx"as s! qqsl n!ql 'a[& [e!>ads palexpu! aql jo ameu .saliq tr iqsanuenpn ~sa[dLulr aql lann puom all1 01 paSluq3 aq pllnoqr 11 '1Jumo "1 1 amap aql s! anlcn Su!puods~ilo~xoqm pun 'rutrow aql ~alrr!od aql 'ua~llln10 peal ale raliq u 11 .uali!lw 1nq 'aly aql ju laumo aql [[!is s! 'asmssy aql 'sly 341 5br!~nppa~j~~aifs aiy .Oeu!p~o aqi jo aueu a3!hap pun laq 'smollo) se sly 10 pear aq ol ariq lrau aqi salel!pu! qqm 'malsbs alalap is!u lssn 15~ga11 pun 'I! 01 q~![Leu1 'aqloua 'sly arll .(q p>Ulelil!EW 'lalu!nd e rt alarll alg "ado q3ea -mnu-! oql s! iuamna~aas0q.n alqrrl walaic B ru!elu!su aql jo uo!ld!~osap aql su!s~noa (.~po,ouin,aly agl) punuj e alga13 deru Jar" auo am!$ ye~aua5u! 'JIRJU~s! a1y e jo ,u,in~'p~~M1ojlll8!ell~ al!nb r! ttf$)[lea walr6s rimow .(qalaqi i~ruaaql 'sap!sal .bol~si!paql q31qm uo >>!nap lad .a~.Kq8U!mOllOj >sly aql 01 slajal ill!s!idm! llns muno aql BUTBJP~Jsnlnis lvnba a*nq qg e lo! sa!oua LO) aql JO uo!l~luam~ldwisqi 'luauuo~ihua srq1 UI at(] jo llcd uhoux i? ur paloln [,r!/-r agl) 21401 lualPs 01, 1x3" -1q1'fpna~ uw!,n a~tq~ss[ aql rem aly AJOIJJJI~[~~mu!r 'sa!dnmo ~[ynaopdr aqi~qpaB~eqs~q sae)laiu! ia!m e olu! xapu! ue se pasn s! lqwnu-! sir 'passaa3~ S! oqi u! a~nq~e[nmiled e j! leql sueam s!ql .[enurnbas oi s! nqn j0 uo~lranhaql sc alaql 'a[danuxa 103 sua!l Bu!l!~n pun BUI~P~'noliq palc>lpo! se-lda~xg -adh~,rl!m!s lrlanss lo auo lo ~q[o~iuos1n[n3~1~ud "[g all1 uaqfi -a[y aql JO (~aqumuXWPU! IOJ) IJ~W~U' am -ez!ueS~o ruaisAr qy nqlo u! punq iau s~l~!ie~[n~~d 'saly "ado s,daqlo ~JBJ P 01 ~J~JPIII?an!ip lr!p e 'aldwera ~uj'n~alas lqmnu aql palre, laZalu! ua s! Inu!od s!q~.jlasi! sly aql oi ulcl~~lrampul lr!l-i aql JO UOIIOU a111 awl1 ~LLLYF a,!napqnn aql !as!nlp leql uo ojl qi!m [Pap IIKMau!lno~ ~alu!odB puu afg paln!Jolsn aql inj aucu n i[uo su!~) Burlalap lo '.(~olmlp alum aql u! saly aulloa~~'aly aqi 1v .ln![~! paz!ueB~o-b[~~au!laql ueJs iluo paau II maisis 4214~s.~e~!pt1! addl a3!hap aql xaqwnu a!nap uog I~ua.ilol32J!P e 'aoqe i,t! U! pauo!luam sy arum oql uu Su!l!lm Ee ra!l!n!l5e lua!uanuo3u! qsns u! ~sucs'iys~~la!qL~olna~!p aqijo luapuadalxu s! mq~!~oSle gnr pue adh~axhap e [an!lssdsal hj!aads sqiq .qql 6,snoaun11nrna a8du3 slxn om1 uaqm mqsir aly aq) ju s!ql =!nap aqi uo >suds aql imcqra ~aqla%olpup i~uals!ruo3 je3!5o[ aql u!elu!vu "1 SqJoyalu! leulalu! aiaoii aJ!a.?p pwlalo! uu alni!xnuuz q>!qn raliq jo ~!ed llI!o@!p p~ll?3O[ll?2q 01 2aIJ XOql pue L~ollBmlOJU! ~uapylnsseq maabs aqi lnql p!ns aq plnoqs 11 i. SP pala~d~alu!s! irly aql pun '~~!~sleruwrJJB spmn Injarn Su~u!i.~uu~a"!\ap qxa jo ruo!uod aqi IP~I UO!I sralppn aauap ";mar ]re[ aql 'p!>adr r! i!1eq1 saieJ!pu! paupa Su!aq aly aql jo idos -asyuar aldmpxa ~oj'toalrdr qy 0 jo dnua~r~ruo,rll ,sly e alalap 'aly Bu~ls!yaue oi xu![ s aqem slam .?pow aaoqn sly B oi aprw st ~sanbs, oil ua uaq* z saxem qsrqm ~ol!paue 411~"19 u Bu!;!pa aln q~oq Su!y>aq, loj IU~I!JOSI.E pld~~PUR a[(lw\s ai!nb E sl!uJad 'i~alna~!pI? ;rlcam 'a[g e jo mum0 aql lo apolu uo!~ ralg ilnulplo 01 ralddu uo!rnrm!p Su!olaloj aql 'aldmeua lq 'uaqm oo!snjuoo luana~dlouue3 'Su!peal osl~11 '213S~L IS~J~E 01 papaau uonnmlojo! 12410 pire ~aroldaql oZueq= 'qy e JO swels aql la8 'afy e asap sr ~asnJ~~IOUB q3!qn ,114 e uo SUII!JM UIOJJ paluan sabq 9~s5'8~0'1do 'ZIS 9si.8 sn aZle[ 'Zu!ssadppP 'uo!l~alo~daql ur iem aldu~ss u! p2ielal (9~3 :aldwmra passnmp aq IOU I[!%q~zqm u~alsde rs ~q isuss[g rnql jla5lc 214 aq~Ytr!lit~!lsuo~sqxlq jo ads! ,zla auu dqalaqm 'anu2r I(IP.U!~IOaqi U! s)(301 s! q3qn aueu snona~qmsun 'Ilaqr I? riy a~g~pt?" aly aqi q~!mpue o;~ql!m op ol Zu!&eq sa!llua maahs ,assalppi. 95: JO 7~01q13a~pu! ua 01 iqod iewSJSSJlppe asnexq iua!J![(nsu! ale iaql 'sxsa3o~dluapu~dapu! iq isqi 151'~aqa rl bqi8uans SI! jo auu a an^! u~~sirsql o~ ,a"oillppB le~aoacale aiaqL 'spj O/I la10 1'9% pau!su!rer rasrq ~ii?l)~[g-dlauis 'Piel ql!m paaql IOU >>!zap iqBm aq) JO qma 'rqy ([e!3aclsuou) a8ioi .qlln Imp 01 .irna pun alqezlJ1 ~llnbp~ao~d mq ma~rir 'UO!i"JO/ U! ah asnexq bessasauun s~eLag1 'aly amps art1 pau~sarc >azlanmaql sq3olq aqi jo sassalppe aql XFJ am "13 aql Zuzr!oeZ~ujo poqlaru E!~I '~J!IJIJ~ "1 SIN^ pJUlnl>l s! psnou sen ~alulodaql q~lqmol a[y aql Jn slql ul !sq~olq,an;ij lo tq;?!" ole! sly z[y ([o!~adruou) 10 wann uz2mlaq aJuaJaj>alu! titara~d01 'loau#uul!nua 10 2lnlBJJ [BnSnUn UP El 11!1-I 241 JO UOllOU 24 1 lu!uu!Oaq aql mol) lasju lanlos aql .palou5! am s[le3 ,no u! 'lua!qns ~oui~essaJau laql!~~ ale sq901 1eq1 /,,IUP v raksalppP >>!hap ~ql!aloj 21% qJea jo spou-r saqs!m 11 ri. lletus )Y SI!U~ U! alui) pup pnal lax (slai>~m~di]pus adnl ladad -%a) ras!*ap am03 ~rcnaql 2901 acun IOU op r;lll[nq!p 'a~w,e~du! 241 u! mrds r! 2uql nhrp aql un spoadzp 431q" ~[~RUOSR~Jarmb Lnm o,',jo ~wn[o,\las~S ou 5aOp qJf4M JO~-anlis5au aq iem iaqT0 uo Su!puadap -sly 1!u#!1r ot dn 0 mog parsalpps .(I~E,I~O~ sx~olqslq 'ilsnoauei[nu!s 11 uo ar!lm slasn om1 uaqm palqmnlns lo ilac" "par" b! q>!qa ~un3oldy -peaylanu ~ualsir aql jo pua aqr malj lo '~aurod341 jo uo~~lsodluauns amoarq oi aly R jo s~ualuo~241 lo, alqlsrod s! I! -ZIZ jo ~~qunun olul paprnlp c! rnalrir zlg E LI!FIUOJ zql r~mo~j'dl4 aql JO Bu!uu!5y aql wu~jsa~dq ,asy;l j0 asueplone ~qlmnlj i[u!nu sa!JoJ 11 :acuawm! IOU qsnoqllv 'Bu!i!la du lu!p~a141 "ado alg s aneq .n JO spi.2, uo!i~sode 01 panolu s! daj$qi!m palermssn ~>iu!oday I. panmllvap r! apou-! aq~pue paaj oqm uasn jo laqmnu aql uo uoris!~lra~.(un amql r! lou qyrn ur>dold n Jakn s%slus.ips un 5nq cs;Lq ils 'mardr aly aql o! EYJU~ alqls!,, ~a~nou ale anqL ale JIY 341 LI~~q~o1q q'!p iue :O oi sdolp luno>~?u!l (iaryo 'aseq 'da1y)qaX = uo!reJo[ JO "!on u! rJly sai!lm iu 5pi.a) qym rus~Zu~dy J~Ijl .blua i~o$aa~~psql Bu~rs~a pin iqua d~olm~!pFI! ~oldt~~rapaly 0 sulmal 'irado aarl 'pug In0 -sly aqi ti! uo!ieml iq p~y!~adr~puu~! aql ju iuno3-qu![ aql %u!iuama~sap Su!l!ln ioj aly nau aqi suado usle OlOJ1J '1E!Y5 S50p pay+ aliq aql pun qnqr olu8 pea at qmlq aql 'luu ~ie!ldoldd~aql 01 ~alulodsil~ 10 p8al aqr 3now 01 dq mop s! qy n (Bu01a13p) Pu~nnwaxapou-! aql jo play I! J! qi5ual our a1 I! saesunll 10 'isrxa IOU smp ii J! aly 'b[Slalpawm! paulnlal 3q ues sliq aqi 'or ji !sls,gnq ilcrranau i[uo r! I! 'oil (ssame llal!p) wlop~elOp 01 )I itlno, qtul 2111 In!luawa#~u!pur 'b,lua aly [eu!8!lo aql uan!Z aql salean qn!q.n [lea uai~bsaroa.rJ e r! alaqi '~uo s,uld~s.Ss aqi jo auo u! .(~P~J[PE! p~ir3ol a14 aql .papa>" se u*\ol% s! qq aql 's[g sql jo pus aql r! tuolj laqwnu-l sq~Bu~Ados 'amnu mau aql qllm i~~ua plo ua llllMJl ilalaldwo~lo alg m~ue ales12 o~ qsrqm uc qsolq a;?~~nls.<~epua~ss aql nqeqn s~ullu punirq $a112114 1181 ;1q1 j[ paSuwq3 E! alg 3'1) jo 1'cd I! alqndlseua arin\l?qlo ro 'ai!~m'pua~ ul rile^ iuanbsr iml~d18pi! D~lilsal~Ea]u?u! aly Su!s!xa ue oi -Jalap rnalsib aql '~PZJa! zliq alYu!i P j! 'dlan2h uqlo ou !iuno, aqi PUB ~atu!od33!1\ aqljo UO!IISO~ aql -qnr a[g aql ?j!IUap! 01 psrn ~aB>iur~(sms c 11 qu!l i? Bu!yn~.Jsqmnu ~pou-!all1 pun sly Jql JO >me" ul r! -uo) JwcI ~alale I!urn pal;l[dwos ~q ~ouLam nl iq prldrul aroql (luo I~JB aly n uo uall!lm saliu -,aid~~sqs(f u pallua s! dd/g anlun paulnlal aqL at(, su!i~uin~qJ!qn apaw st i~maL~opal!p e pue I! IR~IIJP aql q5noqila 'ascld ay~lo~ql LPW IIP, d,,.,~aql .pxn aqnap aql uo spuadap qqqm aau~nbasadp~s3 .L[rnosue~lnm!s UJIIIIM puo peal 'oj pP"rr>ol[P SI ?PO"-I uc '~xF>J>?! alg nau n uaq,a wo~jumal aql Iuallllm aq nl s~3olqjc 1511r "I ~pntu ue lo asn iq ~alzimad4e um~j2Ig~jO~pLla un alu~zua8 01 .dig all1 IldJ>e "1 i~P.lb232U UUlleWlOJ s! 1cc11 ,,'palepdn. lo 'iratl!ln 'peal aq s! aly aql s! Ldlua us pue '~aynqzql u! pmi:ldal r! aiiq II~I>>JV on alq!rrod E! 11 'aly aql jo am lualln~aql 01 [snb~ laqlaqmsale3!pu! luaunl~eB@~ql.uan!l sq ismatuw u! aql or palela, h[!sP1 aq Arm alg sql a!ln JO pna, rJmoJaq ~~lu!odpeal aqi uaqm slnsso s!ill salg ?r!p JO~ aql usql aJ!aap a11 uls~j~r, pna' aq 11m 11 '10" JI 01 ~lv.?~umha$qnr e Pul~nppr!lddnr ~ul'l!map aly aqi qled iza111q~oov -llg 291 JO awnu ail1 salnxpu! awqy 'Alumam are, uf sap!sa .([lua~~n~q~01q ls!p pal~a~e .a[y aqi JO pua aql saieo!pu! I! 'omz 01 [snba u ql!n rnql .wuaiJ 10 ~mdoaql iq p~ulnls~~old!nssp aly (8x11 'bueu) u~do= daly aqi rqlala aar ol rqnq 511 qadsss Ill* rasn su~nr~ille3 paal n usq~'~nduc jo -?~qauo unq1 rloat 241 iq p9xapuc alqel w2lsir i! o! par015 xi: ~a~u!ud -216q u~nla~nnau $al!hap ay!l~~a!~aadil'osls 'aly aql jo :Ile3 lu!mollq aql .iq pauado q lrnu a1p.n peal put! Isqmnu~!'a,!iap sl! 'uado aly P ~JUO rl li '6pea~)ewxa ol pJmnsre sly e alllm lo peal ol slluis I? jo UO!SS!~L!SLI~U88118dj~-)i~~ds SPI?~ SI [la3 JI!.,'~ pua aql qxal ol palllmsue~lale raliq iualJlyn5 61uo caiiolsalip pawnu dli~aldrniin ill~~ldxaaqi lul~~~~eas 'pua aql ptroiaq Bu!pea~asnl!? p1nu.n rlai3eleqo irnoJ .a~uanbasSu!({e, aqr u! paiuasa~da~luu s! 4!aqd P as~lddn~.alg v SSJJJC01 paqnba~buu8is~ado n I jo 6q laqlunu~!m olui sin aqi .Sq u~h!8aWPU qlvd aql lsqunu aql illear8 sa>np*> cpqn wslupqaam 5u1~~ynq lu!peal leql aly ~qljo pus sql leJu or rl ~31UlodpF31 -mlr ~oj4J14M 'ulnlal ~ouaue u~ llnrJl dllc!lualod u~nlol $1 1la.1~u>lrdr .>,o~.(J 10 i,~dr?UE JU a~od~r~d~ql p~~~~!Idwoadaqi~~~.SUIFIU!PW ual~isaqli~q rtl pa,naI oql j, ~,m~o.ueqi %dl aq ~uua~noyl!n Leu n 'Ja,tanuq Leu uralrin aql ui Ilea q3e3 'Zu!wwc~So~daZsn4ue[ ,. ~lPruS..l0,,1~18[._Sl3ly2~11?412~h aUllC31PU! Ilq V 'poai s u! lsaly [~!3xlsuo mn~p~wleardqd jo pua au!qsnm jo sautxJldwos aql olul lu!llJI )aoyl!n ao il?w a3~Jrrlorn. 5 ,~asr air1 r,,.itl I? lal[P. Ll~vJnuoJ. 6 lo uoma al!l SUO!I#~UOJ ~suo!lda~xaiapun lda~xa s~a~ame~edpal!nbal aql ale3!pu! ll!m q?qm alenauo[ PUP 'J[~B~!RABSJI! UIPp Sql lli'2pUJ.i V LUOJJ UJlllal JalJe Jig 1~13"d~I' 5! ?lg dC11 .laUldl(% BU!IBJ!PUI I!q V '8 o,'r rnoluiuaue ul? ul mol~qpaz!lemmnr am qlla3 meq aql 6pii7!p~t11tu! 's!leql pJl>#nqU" PU" S"OU~~~JU,aq%!q~ql 69 4.1 Efficiency of the File System 5.2 Pipes and so on. Processes may also terminate as a result of there." On the other hand, To provide an indication of the overall efficiency of Processes may communicate with related processes various illegal actions or user-generated signals (57 UNIX and of the file system in particular, timings were using the same system read and ~vrire calls that are below). made of the assembly of a 7621-line program. The used for file system I!O. The call ordinarily enters the editor, which takes requests from assembly was run alone on the mach~ne;the total the user via his typewriter. The command clock time was 35.9 sec, for a rate of 212 lines per sec. 6. The Shell ed (script The time was divided as follows: 63.5 percent assembler returns a file descriptor/ilep and creates an interprocess execution time, 16.5 percent system overhead, 20.0 channel called a pipe. This channel, l~keother open For most users, communication with UNlX is carried interprets rcripr as a file of editor commands; thus percent disk wait time. We will not attempt any interpre- files, is passed from parent to ch~ldprocess in the image on with the aid of a program called the Shell. The Shell "(script" means, "take input from scr~pr." tation of these figures nor any comparison with other by thefork call. A read using a pipe file descriptor waits is a command line interpreter: it reads lines typed by Although the file name following "(" or ")" appears systems, but merely note that we are generally satisfied until another process writes using the file descriptor for the user and interprets them as requests to execute to be an argument to the command, in fact it is in- with the overall performance of the system. the same pipe. At this point, data are passed between other programs. In simplest form, a command line terpreted completely by the Shell and is not passed to the images of the two processes. Neither process need consists of the command name followed by arguments the command at all. Thus no special coding to handle know that a pipe, rather than an ordinary file, is in- to the command, all separated by spaces: I/O redirection is needed within each command; the 5. Processes and Images volved. command arg, arg, . . . arg. command need merely use the standard file descriptors Although interprocess communication via pipes is 0 and 1 where appropriate. An irnuge is a computer execution environment. It a quite valuable tool (see $6.2), it is not a completely The Shell splits up the command name and the argu- includes a core image, general register values, status of general mechanism since the pipe must be set up by a ments into separate strings. Then a file with name 6.2 Filters open files, current directory, and the like. An image is common ancestor of the processes involved. command is sought; commalid may be a path name in- An extension of the standard I, 0 notion is used to the current state of a pseudo computer. cluding the "/" character to specify any file in the sys- direct output from one command to the input of another. A process is the execution of an image. While the 5.3 Execution of Programs tem. If command is found, it is brought into core and A sequence of commands separated by vertical bars processor is executing on behalf of a process, the image Another major system primitive is invoked by executed. The arguments collected by the Shell are causes the Shell to execute all the commands simul- must reside in core; during the execution of other pro- accessible to the command. When the command is taneously and to arrange that the standard output of cesses it remains in core unless the appearance of an finished, the Shell resumes its own execution, and in- each command be delivered to the standard input of active, higher-priority process forces it to be swapped which requests the system to read in and execute the dicates its readiness to accept another command by the next command in the sequence. Thus in the com- out to the fixed-head disk. program named by file, passing it string arguments typing a prompt character. mand line The user-core part of an image is divided into three arg,, arg,, ..., arg,. Ordinarily, urg, should be the same If file command cannot be found, the Shell prefixes logical segments. The program text segment begins at string as file, so that the program may determine the the string /bin/ to command and attempts again to location 0 in the virtual address space. During execution, name by which it was invoked. All the code and data find the file. Directory /bin contains all the command.^ Is lists the names of the files in the current directory; its this segment is write-protected and a single copy of it in the process using execute is replaced from thefirle, but intended to be generally used. output is passed to pr, which paginates its input with is shared among all processes executing the same pro- open files, current directory, and interprocess relation- 6.1 Standard I/O dated headings. The argument "-2" means double gram. At the first 8K byte boundary above the program ships are unaltered. Only if the call fails, for example column. Likewise the output from pr is input to opr. The discussion of I/O in $3 above seems to imply text segment in the virtual address space begins a non- because file could not be found or because its execute- that every file used by a program must be opened or This command spools its input onto a file for off-line shared, writable data segment, the size of which may be permission bit was not set, does a return take place from created by the program in order to get a file descriptor printing. extended by a system call. Starting at the highest address the execute primitive; it resembles a "jump" machine for the file. Programs executed by the Shell, however, This process could have been carried out more instruction rather than a subroutine call. in the virtual address space is a stack segment, which start off with two open files which have file descriptors clumsily by automatically grows downward as the hardware's stack 0 and 1. As such a program begins execution, file I is 5.4 Process Synchronization 1s)templ pointer fluctuates. open for writing, and is best understood as the standard Another process control system call pr -2 (temp1 )temp2 output file. Except under circumstances indicated be- opr (temp2 5.1 Processes processid = wait( ) low, this file is the user's typewriter. Thus programs Except while UNIX is bootstrapping itself into opera- which wish to write informative or diagnostic informa- followed by removal of the temporary files. In the tion, a new process can come into existence only by causes its caller to suspend execution until one of its tion ordinarily use file descriptor l. Conversely, file 0 absence of the ability to redirect output and input, a children has completed execution. Then wait returns use of the fork system call: starts off open for reading, and programs which wish still clumsier method would have been to require the Is the processid of the terminated process. An error return to read messages typed by the user usually read this file. command to accept user requests to paginate its out- processid = fork(1abel) is taken if the calling process has no descendants. The Shell isable to change the standard assignments put, to print in multi-column format, and to arrange Certain status from the child process is also available. When fork is executed by a process, it splits into two of these file descriptors from the user's typewriter that its output be delivered off-line. Actually it would independently executing processes. The two processes Wait may also present status from a grandchild or printer and keyboard. If one of the arguments to a be surprising, and in fact unwise for efficiency reasons, have independent copies of the original core image, and more distant ancestor; see 55.5. command is prefixed by ")", file descriptor I will, for to expect authors of commands such as 1.r to provide share any open files. The new processes differ only in the duration of the command, refer to the file named such a wide variety of output options. that one is considered the parent process: in the parent, 5.5 Termination after the ")". For example, A program such aspr which copies its standard input control returns directly from the fork, while in the Lastly, to its standard output (with processing) is called a Is child, control is passed to location label. The processid exit (status) filter. Some filters which we have found useful per- returned by the fork call is the identification of the ordinarily lists, on the typewriter, the names of the files form character transliteration, sorting of the input, and other process. terminates a process, destroys its image, closes its open in the current directory. The command encryption and decryption. Because the return points in the parent and child files, and generally obliterates it. When the parent is process are not the same, each image existing after a notified through the wait primitive, the indicated status 6.3 Command Separators: Multitasking fork may determine whether it is the parent or child is available to the parent; if the parent has already creates a file called there and places the listing there. Another feature provided by the Shell is relatively process. terminated, the status is available to the grandparent, Thus the argument ")therem means, "place output on straightforward. Commands need not be on different lines; instead they may be separated by semicolons. 6.5 Implementation of the Shell Shell invoked by sh will terminate. Since this Shell begin work immediately; also, they can be prevented The outline of the operation of the Shell can now process is the child of another instance of the Shell, from invoking u~isprogranis not tntended for their Is; ed be understood. Most of the time, the Shell is waiting the wait executed in the latter wtll return, and another use. In practice, it has proved desirable to allow a will first list the contents of the current directory, then for the user to type a comniand. When the new-line command may be processed. temporary escape from the editor to execute the format- enter the editor. character ending the line is typed, the Shell's read ting program and other util~ties. A related feature is more interesting. If a command call returns. The Shell analyzes the command line, 6.6 Initialization Several of the gamcs (c.g, chess, blackjack. 3D tic- is followed by ""t", the Shell will not watt for the putting the arguments in a form appropriate for e.~cnrtt.. The instances of the Shell to which users type com- lac-toe) ava~lableon UNIY illustrate a nruch more severely command to finish before prompting again; instead, it Then fi~rk is called. The child process, whose code of mands are themselves children of another process. restricted environment. For each of these an entry is ready immediately to accept a new command. For course is still that of the Shell, attempts to perform an The last step in the initialization of u~txis the creation exists in the password file specifying that the appro- example, extjcure with the appropriate arguments. If successful. of a single process and the invocation (via e\-eclrre) priate game-playing program is to be invoked instead this uill bring in and start execution of the program of a program called inir. The role of ilrir is to create one of the Shell. People who log in as a player of one of the as source )output C whose name was given. Meanwhile, the other process process for each typewriter channel which may be dialed games find themselves limited to the game and unable causes sorrrcc to be assembled, with diagnostic output resulting from the fbrk, which is the parent process, up by a user. The various subinstances of in;! open the to investigate the presumably more interesting offerings going to ourprrt; no matter how long the assembly ~rairsfor the child process to die. When this happens, appropriate typewriters for input and output. Since of u~lsas a whole. takes, the Shell returns immediately. When the Shell the Shell knows the command is finished, so it types when i~lirwas invoked there were no files open, in each does not wait for the completion of a command, the its prompt and reads the typewriter to obtain another process the typewriter keyboard will receive file de- identification of the process running that command is command. scriptor 0 and the printer file descriptor 1. Each process 7. Traps printed. This identification may be used to wait for Given this framework, the implemenlation of back- types out a message requesting that the user log in and the completion of the command or to terminate it. ground processes is trivial; whenever a command line waits, reading the typewriter, for a reply. At the outset. The PDP-Il hardware detects a number of program The "&" may be used several times in a line: contains "B", the Shell merely refrains from waiting no one is logged in, so each process simply hangs. faults, such as references to nonexistent memory, for the process which it created toexecute the command. Finally someone types his name or other identification. unimplemented instructions, and odd addresses used as source )output B Is )files & Happily, all of this mechanism meshes very nicely The appropriate instance of inir wakes up, receives the where an even address is required. Such faults cause the does both the assembly and the listing in the back- with the notion of standard input and output files. log-in line, and reads a password file. If the user name processor to trap to a system routine. When an illegal ground. In the examples above using "&", an output When a process is created by the fork primitive, it is found, and if he is able to supply the correct pass- action IS caught, unless other arrangements have been file other than the typewriter was provided; if this had inherits not only the core image of its parent but also word, init changes to the user's deftault current directory. made, the system terminates the process and writes not been done, the outputs of the various commands all the files currently open in its parent, including those sets the process's user ID to that of the person logging the user's image on file cow in the current directory. A would have been intermingled. with file descriptors 0 and I. The Shell, of course, uses in, and performs an execure of the Shell. At this point debugger can be used to determine the state of the The Shell also allows parentheses in the above these files to read command lines and to write its the Shell is ready to receive commands and the logging-in program at the time of the fault. operations. For example prompts and diagnostics, and in the ordinary case its protocol is complete. Programs which are looping, which produce un- (date; Is) )x B children-the command programs-inherit them auto- Meanwhile, the mainstream path of iriir (the parent wanted output, or about which the user has second matically. When an argument with "(" or ")" is given of all the subinstances of itself which will later become thoughts may be halted by the use of the infc,rrrrpl prints the current date and time followed by a list of however, the offspring process, just before it performs Shells) does a wait. If one of the child processes term- signal, whtch is generated hy typing the "delete" the current directory onto the file A. The Shell also esccurc, makes the standard I o file descriptor 0 or I inates, either because a Shell found an end of file or character. Unless special action has been taken, this returns immediately for another request. respectively refer to the named file. This is easy because, because a user typed an incorrect name or password, signal simply causes the program to cease execution by agreement, the smallest unused file descriptor is this path of init simply recreates the defunct process, without producing a core image file. 6.4 The Shell as a Command: Command files assigned when a new file is opened (or crcurcd); it is which in turn reopens the appropriate input and output There is also a qirit signal which is used to force a The Shell is itself a command, and may be called only necessary to close file 0 (or I) and open the named files and types another login message. Thus a user'may core image to be produced. Thus programs which loop recursively. Suppose file tryout contains the lines file. Because the process in which the command pro- log out simply by typing the end-of-file sequence in unexpectedly may be halted and the core image ex- as source gram runs simply terminates when it is through, the place of a command to the Shell. amined without prearrangement. mv a .out testprog association between a file specified after "(" or ")" The hardware-generated faults and the interrupt and testprog and file descriptor 0 or I is ended automatically when 6.7 Other Programs as Shell quit signals can, by request, be either ignored or caught The mv command causes the file a.oirt to be renamed the process dies. Therefore the Shell need not know the The Shell as described above is designed to allow by the process. For example, the Shell ignores quits to testprog. a.out is the (binary) output of the assembler, actual names of the files which are its own standard users full access to the facilities of the system since it prevent a quit from logging the user out. The editor ready to be executed. Thus if the three ltnes above were input and output since it need never reopen them. will invoke the execution of any program with appro- catches interrupts and returns to its command level. typed on the console, source would be assembled, the Filters are straightforward extensions of standard priate protection mode. Sometimes, however, a dif- This is useful for stopping long printouts without losing resulting program named testprog, and testprog ex- r/o redirection with pipes used instead of files. ferent interface to the system is desirable, and this work in progress (the editor manipulates a copy of ecuted. When the lines are in tryout, the command In ordinary circumstances, the main loop of the feature is easily arranged. the file it is editing). In systems without floating point Shell never terminates. (The main loop includes that Recall that after a user has successfully logged in by hardware, unimplemented instruktions are caught, and sh (tryout branch of the return fromfork belonging to the parent supplying his name and password, init ordinarily invokes floating point instructions are interpreted. would cause the Shell sh to execute the commands process; that is, the branch which does a aoit, then the Shell to interpret command lines. The user's entry sequentially. reads another command line.) The one thing which in the password file may contain the name of a program The Shell has further capabilities, including the causes the Shell to terminate is discovering an end-of-file to be invoked after login instead of the Shell- This 8. Perspective ability to substitute parameters and to construct argu- condition on its input file. Thus, when the Shell is program is free to interpret the user's messages in any ment lists from a specified subset of the file names in a executed as a command with a given input file, as in way it wishes. Perhaps paradoxically, the success of uNlx is largely directory. It is also possible to execute commands For example, the password file entries for users of a due to the fact that it was not designed to meet any sh (comfile conditionally on character string comparisons or on secretarial editing system specify that the editor ed is predefined objectives. The first version was written existence of given files and to perform transfers of the commands in comfile will be executed until the to be used instead of the Shell. Thus when editing when one of us (Thompson), dissatisfied with the control within filed command sequences. end of comJile is reached; then the instance of the system users log'in, they are inside the editor and can available computer facilities, discovered a little-used PDP-7 and set out to cmate a more hospitable environ- Another important aspect of programming con- 9.1 Overall ficulties such as power dips and inexplicable processor ment. This essentially personal effort was sufficiently venience is that there are no "control blocks" with a interrupts to random locations. The remainder are successful to gain the interest of the remaining author complicated structure partially maintained by and de- 72 user population software failures. The longest uninterrupted up time and others, and later to justify the acquisition of the pended on by the file system or other system calls. 14 maximum simultaneous users was about two weeks. Service calls average one every PDP-II/~~,s~ecificall~ to suppor: a text editing and Generally speaking, the contents of a program's address 300 directories three weeks, but are heavily clustered. Total up time 4400 files formatting system. When in turn the 11/20 was out- space are the property of the program, and we have 34000 512-byte secondary storage blocks used has been about 98 percent of our 24-hour, 365-day grown, UNlX had proved useful enough to persuade tried to avoid placing restrictions on the data structures schedule. management to invest in the ~~~-11/45.Our goals within that address space. 9.2 Per day (24-hour day, 7-day week basis) throughout the effort, when articulated at all, have Given the requirement that all programs should be There is a "background" process that runs at the Acknowledgments. We are grateful to R.H. Canaday, always ~~~~cernedthemselves with building a comfort- usable with any file or device as input or output, it is lowest possible priority; it is used to soak up any idle L.L. Cherry, and L.E. McMahon for their contribu- able relationship with the machine and with exploring also desirable from a space-efficiency standpoint to push CPU time. It has been used to produce a million-digit tions to UNIX. We are particularly appreciative of the ideas and inventions in operating systems. We have device-dependent considerations into the operating sys- approximation to the constant e - 2, and is now inventiveness, thoughtful criticism, and constant sup- not been fmed with the need to satisfy someone else's tem itself. The only alternatives seem to be to load generating composite pseudoprimes (base 2). port of R. Morris, M.D. Mcllroy, and J.F. Ossanna. requirements, and for this freedom we are grateful. routines for dealing with each device with all programs, Three considerations which influenced the design 1800 commands which is expensive in space, or to depend on some means 4.3 CPU hours (aside from background) of UNlX are visible in retrospect. of dynamically linking to the routine appropriate to References 70 connect hours 1. Digital Equipment Corporation. PDP-I 1/40 Processor First, since we are programmers, we naturally each device when it is actually needed, which is expen- 30 different users Handbook, 1972, and PDP-l1/45 Processor Handbook, 1971. designed the system to make it easy to write, test, and sive either in overhead or in hardware. 75 logins 2. Deutsch, L.P., and Lampson, B.W. An online editor. Conri~i. run programs. The most important expression of our Likewise, the process control scheme and command ACM 10, 12 (Dec. 1967), 793-799,803. 3. Richards, M. BCPL: A tool for compiler writing and system desire for Prograrhming convenience was that the interface have proved both convenient and efficient. 9.3 Command CPU Usage (cut off at 1 %) programming. Proc. AFIPS 1969 SJCC, Vol. 34, AFIPS Press, system was arranged for interactive use, even though Since the Shell operates as an ordinary, swappable user Montvale, N.J., pp. 557-566. the original version only supported one user. We be- program, it consumes no wired-down space in the C compiler Fortran compiler 4. McClure, R.M. TMG-A syntax directed compiler. Proc. users' programs remove file ACM 20th Nat. Conf., ACM, 1965, New York, pp. 262-274. believe that a properly-designed interactive system is system proper, and it may be made as powerful as editor . tape archive 5. Hall, A.D. The M6 macroprocessor.Computing Science Tech. much more productive and satisfying to use than a desired at little cost. In particular, given the framework Shell (used as a com- file system consistency Rep.#2, Bell Telephone Laboratories 1969. "bdtch" system. Moreover such a system is rather in which the Shell executes as a process which spawns mand, including com- check 6. Ritchie, D.M. C reference rhanuk. Unpublished memorandum, Bell Teleuhone---.- - Laboratories.-- - . 1973. easily adaptable to noninteractive use, while the con- other processes to perform commands, the notions of mand times) library maintainer 7. Aleph-null. Computer Recreations. Sqfiwure Prcccricr uid verse is not true. I/O redirection, background processes, command files, chess concatenate/print files E.rpririrce I,2 (Apr.-June 1971 ), 201-204. Second, there have always been fairly severe size and user-selectable~systeminterfaces all become essen- list directory paginate and print file 8. Deutsch, L.P., and Lampson, B.W. SDS 930 time-sharing document forrnatter print disk usage system preliminary reference manual. Doc. 30.10.10, , constraints on the system and its software. Given the tially trivial to implement. backup dumper copy file U of California at Berkeley, Apr. 1965. partially antagonistic desires for reasonable efficiency assembler 9. Feiertag, R.J., and Organick, E.I. The input-output and expressive power, the size constraint has encouraged 8.1 Influences system. Proc. Third Symp. on Oper. Syst. Princ., Oct. 18-20, 1971, ACM, New York, pp. 35-41. not only economy but a certain elegance of design. The success of UNIX lies not so much in new inven- 9.4 Command Accesses (cut off at 1%) 10. Bobrow, D.G., Burchfiel, J.D., Murphy, D.L., and Tomlinson, This may be a thinly disguised version of the "salva- tions but rather in the full exploitation of a carefully R.S. TENEX, a paged time sharing system tbr the PDP-10. Conmi. tion through suffering1$philosophy, but in our case it selected set of fertile ideas, and especially in showing editor debugger ACM IS, 3 (Mar. 1972), 135-143. worked. that they can. be keys to the implementation of a small list directory Shell (used as a command) remove file print disk availability Third, nearly from the start, the system was able to, yet powerful operating system. C compiler list processes executing and did, maintain itself. This fact is more important The fork operation, essentially as we implemented it, concatenate/print file assembler than it might seem. If designers of a system are forced was present in the Berkeley time-sharing system (81. On users' programs print arguments to use that System, they quickly become aware of its a number of points we were influenced by Multics, which list people logged on copy file functional and superficial deficiencies and are strongly suggested the particular form of the I/O system calls system paginate and print file rename/move file print current date/time motivated to correct them before it is too late. Since 191 and both the name of the Shell and its general func- file status file system consistency all source programs were always available and easily tions. The notion that the Shell should create a process library maintainer check modified on-line, we were willing to revise and rewrite for each command was also suggested to US by the document formatter tape archive the system and its software when new ideas were early design of Multics, although in that system it was execute another com- invented, discovered, or suggested by others. later dropped for efficiency reasons. A similar scheme mand conditionally The aspects of NIX discussed in this paper exhibit is used by TENEX [lo]. clearly at least the first two of these design considera- 9.5 Reliability tions. The interface to the file system, for example, is Our statistics on reliability are much more subjective extremely convenient from a programming standpoint. 9. Statistics than the others. The following results are true to the The lowest possible interface level is designed to best of our combined recollections. The time span is eliminate distinctions between the various devices and The following statistics from UNlX are presented to over one year with a very early vintage 11/45. files and between direct and sequential access. No show the scale of the system and to show how a system There has been one loss of a file system (one disk large "access methodr*routines are required to insulate of this scale is used. Those of our users not involved in out of five) caused by software inability to cope with the programmer from the system calls; in fact, all document preparation tend to use the system for pro- a hardware problem causing repeated power fail traps. user programs either call the system directly or use a gram development, especially language work. There are Files on that disk were backed up three days. small library program, only tens of instructions long, few important "applications" programs. A "crash" is an unscheduled system reboot or which buffers a number of characters and reads or halt. There is about one crash every other day; about writes them all at once. two-thirds of them are caused by hardware-related dif-