9.html 85 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373
  1. <html>
  2. <title>
  3. -
  4. </title>
  5. <body BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#330088" ALINK="#FF0044">
  6. <H1>Plan 9 from Bell Labs
  7. </H1>
  8. <DL><DD><I>Rob Pike<br>
  9. Dave Presotto<br>
  10. Sean Dorward<br>
  11. Bob Flandrena<br>
  12. Ken Thompson<br>
  13. Howard Trickey<br>
  14. Phil Winterbottom<br>
  15. Bell Laboratories, Murray Hill, NJ, 07974
  16. USA<br>
  17. </I></DL>
  18. <H4>Motivation
  19. </H4>
  20. <P>
  21. </P>
  22. <DL>
  23. <DT><DT>&#32;<DD>
  24. NOTE:<I> Appeared in a slightly different form in
  25. Computing Systems,
  26. Vol 8 #3, Summer 1995, pp. 221-254.
  27. </I><DT>&#32;<DD></dl>
  28. <br>
  29. By the mid 1980's, the trend in computing was
  30. away from large centralized time-shared computers towards
  31. networks of smaller, personal machines,
  32. typically UNIX `workstations'.
  33. People had grown weary of overloaded, bureaucratic timesharing machines
  34. and were eager to move to small, self-maintained systems, even if that
  35. meant a net loss in computing power.
  36. As microcomputers became faster, even that loss was recovered, and
  37. this style of computing remains popular today.
  38. <P>
  39. In the rush to personal workstations, though, some of their weaknesses
  40. were overlooked.
  41. First, the operating system they run, UNIX, is itself an old timesharing system and
  42. has had trouble adapting to ideas
  43. born after it. Graphics and networking were added to UNIX well into
  44. its lifetime and remain poorly integrated and difficult to administer.
  45. More important, the early focus on having private machines
  46. made it difficult for networks of machines to serve as seamlessly as the old
  47. monolithic timesharing systems.
  48. Timesharing centralized the management
  49. and amortization of costs and resources;
  50. personal computing fractured, democratized, and ultimately amplified
  51. administrative problems.
  52. The choice of
  53. an old timesharing operating system to run those personal machines
  54. made it difficult to bind things together smoothly.
  55. </P>
  56. <P>
  57. Plan 9 began in the late 1980's as an attempt to have it both
  58. ways: to build a system that was centrally administered and cost-effective
  59. using cheap modern microcomputers as its computing elements.
  60. The idea was to build a time-sharing system out of workstations, but in a novel way.
  61. Different computers would handle
  62. different tasks: small, cheap machines in people's offices would serve
  63. as terminals providing access to large, central, shared resources such as computing
  64. servers and file servers. For the central machines, the coming wave of
  65. shared-memory multiprocessors seemed obvious candidates.
  66. The philosophy is much like that of the Cambridge
  67. Distributed System [NeHe82].
  68. The early catch phrase was to build a UNIX out of a lot of little systems,
  69. not a system out of a lot of little UNIXes.
  70. </P>
  71. <P>
  72. The problems with UNIX were too deep to fix, but some of its ideas could be
  73. brought along. The best was its use of the file system to coordinate
  74. naming of and access to resources, even those, such as devices, not traditionally
  75. treated as files.
  76. For Plan 9, we adopted this idea by designing a network-level protocol, called 9P,
  77. to enable machines to access files on remote systems.
  78. Above this, we built a naming
  79. system that lets people and their computing agents build customized views
  80. of the resources in the network.
  81. This is where Plan 9 first began to look different:
  82. a Plan 9 user builds a private computing environment and recreates it wherever
  83. desired, rather than doing all computing on a private machine.
  84. It soon became clear that this model was richer
  85. than we had foreseen, and the ideas of per-process name spaces
  86. and file-system-like resources were extended throughout
  87. the system&#173;to processes, graphics, even the network itself.
  88. </P>
  89. <P>
  90. By 1989 the system had become solid enough
  91. that some of us began using it as our exclusive computing environment.
  92. This meant bringing along many of the services and applications we had
  93. used on UNIX. We used this opportunity to revisit many issues, not just
  94. kernel-resident ones, that we felt UNIX addressed badly.
  95. Plan 9 has new compilers,
  96. languages,
  97. libraries,
  98. window systems,
  99. and many new applications.
  100. Many of the old tools were dropped, while those brought along have
  101. been polished or rewritten.
  102. </P>
  103. <P>
  104. Why be so all-encompassing?
  105. The distinction between operating system, library, and application
  106. is important to the operating system researcher but uninteresting to the
  107. user. What matters is clean functionality.
  108. By building a complete new system,
  109. we were able to solve problems where we thought they should be solved.
  110. For example, there is no real `tty driver' in the kernel; that is the job of the window
  111. system.
  112. In the modern world, multi-vendor and multi-architecture computing
  113. are essential, yet the usual compilers and tools assume the program is being
  114. built to run locally; we needed to rethink these issues.
  115. Most important, though, the test of a system is the computing
  116. environment it provides.
  117. Producing a more efficient way to run the old UNIX warhorses
  118. is empty engineering;
  119. we were more interested in whether the new ideas suggested by
  120. the architecture of the underlying system encourage a more effective way of working.
  121. Thus, although Plan 9 provides an emulation environment for
  122. running POSIX commands, it is a backwater of the system.
  123. The vast majority
  124. of system software is developed in the `native' Plan 9 environment.
  125. </P>
  126. <P>
  127. There are benefits to having an all-new system.
  128. First, our laboratory has a history of building experimental peripheral boards.
  129. To make it easy to write device drivers,
  130. we want a system that is available in source form
  131. (no longer guaranteed with UNIX, even
  132. in the laboratory in which it was born).
  133. Also, we want to redistribute our work, which means the software
  134. must be locally produced. For example, we could have used some vendors'
  135. C compilers for our system, but even had we overcome the problems with
  136. cross-compilation, we would have difficulty
  137. redistributing the result.
  138. </P>
  139. <P>
  140. This paper serves as an overview of the system. It discusses the architecture
  141. from the lowest building blocks to the computing environment seen by users.
  142. It also serves as an introduction to the rest of the Plan 9 Programmer's Manual,
  143. which it accompanies. More detail about topics in this paper
  144. can be found elsewhere in the manual.
  145. </P>
  146. <H4>Design
  147. </H4>
  148. <P>
  149. The view of the system is built upon three principles.
  150. First, resources are named and accessed like files in a hierarchical file system.
  151. Second, there is a standard protocol, called 9P, for accessing these
  152. resources.
  153. Third, the disjoint hierarchies provided by different services are
  154. joined together into a single private hierarchical file name space.
  155. The unusual properties of Plan 9 stem from the consistent, aggressive
  156. application of these principles.
  157. </P>
  158. <P>
  159. A large Plan 9 installation has a number of computers networked
  160. together, each providing a particular class of service.
  161. Shared multiprocessor servers provide computing cycles;
  162. other large machines offer file storage.
  163. These machines are located in an air-conditioned machine
  164. room and are connected by high-performance networks.
  165. Lower bandwidth networks such as Ethernet or ISDN connect these
  166. servers to office- and home-resident workstations or PCs, called terminals
  167. in Plan 9 terminology.
  168. Figure 1 shows the arrangement.
  169. <DL><DT><DD><TT><PRE>
  170. <br><img src="network.pic.6030.gif"><br>
  171. </PRE></TT></DL>
  172. </P>
  173. <DL>
  174. <DT><DT>&#32;<DD>
  175. <I>Figure 1. Structure of a large Plan 9 installation.</I>
  176. CPU servers and file servers share fast local-area networks,
  177. while terminals use slower wider-area networks such as Ethernet,
  178. Datakit, or telephone lines to connect to them.
  179. Gateway machines, which are just CPU servers connected to multiple
  180. networks, allow machines on one network to see another.
  181. <br>&#32;<br>
  182. </dl>
  183. <P>
  184. The modern style of computing offers each user a dedicated workstation or PC.
  185. Plan 9's approach is different.
  186. The various machines with screens, keyboards, and mice all provide
  187. access to the resources of the network, so they are functionally equivalent,
  188. in the manner of the terminals attached to old timesharing systems.
  189. When someone uses the system, though,
  190. the terminal is temporarily personalized by that user.
  191. Instead of customizing the hardware, Plan 9 offers the ability to customize
  192. one's view of the system provided by the software.
  193. That customization is accomplished by giving local, personal names for the
  194. publicly visible resources in the network.
  195. Plan 9 provides the mechanism to assemble a personal view of the public
  196. space with local names for globally accessible resources.
  197. Since the most important resources of the network are files, the model
  198. of that view is file-oriented.
  199. </P>
  200. <P>
  201. The client's local name space provides a way to customize the user's
  202. view of the network. The services available in the network all export file
  203. hierarchies.
  204. Those important to the user are gathered together into
  205. a custom name space; those of no immediate interest are ignored.
  206. This is a different style of use from the idea of a `uniform global name space'.
  207. In Plan 9, there are known names for services and uniform names for
  208. files exported by those services,
  209. but the view is entirely local. As an analogy, consider the difference
  210. between the phrase `my house' and the precise address of the speaker's
  211. home. The latter may be used by anyone but the former is easier to say and
  212. makes sense when spoken.
  213. It also changes meaning depending on who says it,
  214. yet that does not cause confusion.
  215. Similarly, in Plan 9 the name
  216. <TT>/dev/cons</TT>
  217. always refers to the user's terminal and
  218. <TT>/bin/date</TT>
  219. the correct version of the date
  220. command to run,
  221. but which files those names represent depends on circumstances such as the
  222. architecture of the machine executing
  223. <TT>date</TT>.
  224. Plan 9, then, has local name spaces that obey globally understood
  225. conventions;
  226. it is the conventions that guarantee sane behavior in the presence
  227. of local names.
  228. </P>
  229. <P>
  230. The 9P protocol is structured as a set of transactions that
  231. send a request from a client to a (local or remote) server and return the result.
  232. 9P controls file systems, not just files:
  233. it includes procedures to resolve file names and traverse the name
  234. hierarchy of the file system provided by the server.
  235. On the other hand,
  236. the client's name space is held by the client system alone, not on or with the server,
  237. a distinction from systems such as Sprite [OCDNW88].
  238. Also, file access is at the level of bytes, not blocks, which distinguishes
  239. 9P from protocols like NFS and RFS.
  240. A paper by Welch compares Sprite, NFS, and Plan 9's network file system structures [Welc94].
  241. </P>
  242. <P>
  243. This approach was designed with traditional files in mind,
  244. but can be extended
  245. to many other resources.
  246. Plan 9 services that export file hierarchies include I/O devices,
  247. backup services,
  248. the window system,
  249. network interfaces,
  250. and many others.
  251. One example is the process file system,
  252. <TT>/proc</TT>,
  253. which provides a clean way
  254. to examine and control running processes.
  255. Precursor systems had a similar idea [Kill84], but Plan 9 pushes the
  256. file metaphor much further [PPTTW93].
  257. The file system model is well-understood, both by system builders and general users,
  258. so services that present file-like interfaces are easy to build, easy to understand,
  259. and easy to use.
  260. Files come with agreed-upon rules for
  261. protection,
  262. naming,
  263. and access both local and remote,
  264. so services built this way are ready-made for a distributed system.
  265. (This is a distinction from `object-oriented' models, where these issues
  266. must be faced anew for every class of object.)
  267. Examples in the sections that follow illustrate these ideas in action.
  268. </P>
  269. <H4>The Command-level View
  270. </H4>
  271. <P>
  272. Plan 9 is meant to be used from a machine with a screen running
  273. the window system.
  274. It has no notion of `teletype' in the UNIX sense. The keyboard handling of
  275. the bare system is rudimentary, but once the window system, 8&#189; [Pike91],
  276. is running,
  277. text can be edited with `cut and paste' operations from a pop-up menu,
  278. copied between windows, and so on.
  279. 8&#189; permits editing text from the past, not just on the current input line.
  280. The text-editing capabilities of 8&#189; are strong enough to displace
  281. special features such as history in the shell,
  282. paging and scrolling,
  283. and mail editors.
  284. 8&#189; windows do not support cursor addressing and,
  285. except for one terminal emulator to simplify connecting to traditional systems,
  286. there is no cursor-addressing software in Plan 9.
  287. </P>
  288. <P>
  289. Each window is created in a separate name space.
  290. Adjustments made to the name space in a window do not affect other windows
  291. or programs, making it safe to experiment with local modifications to the name
  292. space, for example
  293. to substitute files from the dump file system when debugging.
  294. Once the debugging is done, the window can be deleted and all trace of the
  295. experimental apparatus is gone.
  296. Similar arguments apply to the private space each window has for environment
  297. variables, notes (analogous to UNIX signals), etc.
  298. </P>
  299. <P>
  300. Each window is created running an application, such as the shell, with
  301. standard input and output connected to the editable text of the window.
  302. Each window also has a private bitmap and multiplexed access to the
  303. keyboard, mouse, and other graphical resources through files like
  304. <TT>/dev/mouse</TT>,
  305. <TT>/dev/bitblt</TT>,
  306. and
  307. <TT>/dev/cons</TT>
  308. (analogous to UNIX's
  309. <TT>/dev/tty</TT>).
  310. These files are provided by 8&#189;, which is implemented as a file server.
  311. Unlike X windows, where a new application typically creates a new window
  312. to run in, an 8&#189; graphics application usually runs in the window where it starts.
  313. It is possible and efficient for an application to create a new window, but
  314. that is not the style of the system.
  315. Again contrasting to X, in which a remote application makes a network
  316. call to the X server to start running,
  317. a remote 8&#189; application sees the
  318. <TT>mouse</TT>,
  319. <TT>bitblt</TT>,
  320. and
  321. <TT>cons</TT>
  322. files for the window as usual in
  323. <TT>/dev</TT>;
  324. it does not know whether the files are local.
  325. It just reads and writes them to control the window;
  326. the network connection is already there and multiplexed.
  327. </P>
  328. <P>
  329. The intended style of use is to run interactive applications such as the window
  330. system and text editor on the terminal and to run computation- or file-intensive
  331. applications on remote servers.
  332. Different windows may be running programs on different machines over
  333. different networks, but by making the name space equivalent in all windows,
  334. this is transparent: the same commands and resources are available, with the same names,
  335. wherever the computation is performed.
  336. </P>
  337. <P>
  338. The command set of Plan 9 is similar to that of UNIX.
  339. The commands fall into several broad classes. Some are new programs for
  340. old jobs: programs like
  341. <TT>ls</TT>,
  342. <TT>cat</TT>,
  343. and
  344. <TT>who</TT>
  345. have familiar names and functions but are new, simpler implementations.
  346. <TT>Who</TT>,
  347. for example, is a shell script, while
  348. <TT>ps</TT>
  349. is just 95 lines of C code.
  350. Some commands are essentially the same as their UNIX ancestors:
  351. <TT>awk</TT>,
  352. <TT>troff</TT>,
  353. and others have been converted to ANSI C and extended to handle
  354. Unicode, but are still the familiar tools.
  355. Some are entirely new programs for old niches: the shell
  356. <TT>rc</TT>,
  357. text editor
  358. <TT>sam</TT>,
  359. debugger
  360. <TT>acid</TT>,
  361. and others
  362. displace the better-known UNIX tools with similar jobs.
  363. Finally, about half the commands are new.
  364. </P>
  365. <P>
  366. Compatibility was not a requirement for the system.
  367. Where the old commands or notation seemed good enough, we
  368. kept them. When they didn't, we replaced them.
  369. </P>
  370. <H4>The File Server
  371. </H4>
  372. <P>
  373. A central file server stores permanent files and presents them to the network
  374. as a file hierarchy exported using 9P.
  375. The server is a stand-alone system, accessible only over the network,
  376. designed to do its one job well.
  377. It runs no user processes, only a fixed set of routines compiled into the
  378. boot image.
  379. Rather than a set of disks or separate file systems,
  380. the main hierarchy exported by the server is a single
  381. tree, representing files on many disks.
  382. That hierarchy is
  383. shared by many users over a wide area on a variety of networks.
  384. Other file trees exported by
  385. the server include
  386. special-purpose systems such as temporary storage and, as explained
  387. below, a backup service.
  388. </P>
  389. <P>
  390. The file server has three levels of storage.
  391. The central server in our installation has
  392. about 100 megabytes of memory buffers,
  393. 27 gigabytes of magnetic disks,
  394. and 350 gigabytes of
  395. bulk storage in a write-once-read-many (WORM) jukebox.
  396. The disk is a cache for the WORM and the memory is a cache for the disk;
  397. each is much faster, and sees about an order of magnitude more traffic,
  398. than the level it caches.
  399. The addressable data in the file system can be larger than the size of the
  400. magnetic disks, because they are only a cache;
  401. our main file server has about 40 gigabytes of active storage.
  402. </P>
  403. <P>
  404. The most unusual feature of the file server
  405. comes from its use of a WORM device for
  406. stable storage.
  407. Every morning at 5 o'clock, a
  408. <I>dump</I>
  409. of the file system occurs automatically.
  410. The file system is frozen and
  411. all blocks modified since the last dump
  412. are queued to be written to the WORM.
  413. Once the blocks are queued,
  414. service is restored and
  415. the read-only root of the dumped
  416. file system appears in a
  417. hierarchy of all dumps ever taken, named by its date.
  418. For example, the directory
  419. <TT>/n/dump/1995/0315</TT>
  420. is the root directory of an image of the file system
  421. as it appeared in the early morning of March 15, 1995.
  422. It takes a few minutes to queue the blocks,
  423. but the process to copy blocks to the WORM, which runs in the background, may take hours.
  424. </P>
  425. <P>
  426. There are two ways the dump file system is used.
  427. The first is by the users themselves, who can browse the
  428. dump file system directly or attach pieces of
  429. it to their name space.
  430. For example, to track down a bug,
  431. it is straightforward to try the compiler from three months ago
  432. or to link a program with yesterday's library.
  433. With daily snapshots of all files,
  434. it is easy to find when a particular change was
  435. made or what changes were made on a particular date.
  436. People feel free to make large speculative changes
  437. to files in the knowledge that they can be backed
  438. out with a single
  439. copy command.
  440. There is no backup system as such;
  441. instead, because the dump
  442. is in the file name space,
  443. backup problems can be solved with
  444. standard tools
  445. such as
  446. <TT>cp</TT>,
  447. <TT>ls</TT>,
  448. <TT>grep</TT>,
  449. and
  450. <TT>diff</TT>.
  451. </P>
  452. <P>
  453. The other (very rare) use is complete system backup.
  454. In the event of disaster,
  455. the active file system can be initialized from any dump by clearing the
  456. disk cache and setting the root of
  457. the active file system to be a copy
  458. of the dumped root.
  459. Although easy to do, this is not to be taken lightly:
  460. besides losing any change made after the date of the dump, this recovery method
  461. results in a very slow system.
  462. The cache must be reloaded from WORM, which is much
  463. slower than magnetic disks.
  464. The file system takes a few days to reload the working
  465. set and regain its full performance.
  466. </P>
  467. <P>
  468. Access permissions of files in the dump are the same
  469. as they were when the dump was made.
  470. Normal utilities have normal
  471. permissions in the dump without any special arrangement.
  472. The dump file system is read-only, though,
  473. which means that files in the dump cannot be written regardless of their permission bits;
  474. in fact, since directories are part of the read-only structure,
  475. even the permissions cannot be changed.
  476. </P>
  477. <P>
  478. Once a file is written to WORM, it cannot be removed,
  479. so our users never see
  480. ``please clean up your files''
  481. messages and there is no
  482. <TT>df</TT>
  483. command.
  484. We regard the WORM jukebox as an unlimited resource.
  485. The only issue is how long it will take to fill.
  486. Our WORM has served a community of about 50 users
  487. for five years and has absorbed daily dumps, consuming a total of
  488. 65% of the storage in the jukebox.
  489. In that time, the manufacturer has improved the technology,
  490. doubling the capacity of the individual disks.
  491. If we were to upgrade to the new media,
  492. we would have more free space than in the original empty jukebox.
  493. Technology has created storage faster than we can use it.
  494. </P>
  495. <H4>Unusual file servers
  496. </H4>
  497. <P>
  498. Plan 9 is characterized by a variety of servers that offer
  499. a file-like interface to unusual services.
  500. Many of these are implemented by user-level processes, although the distinction
  501. is unimportant to their clients; whether a service is provided by the kernel,
  502. a user process, or a remote server is irrelevant to the way it is used.
  503. There are dozens of such servers; in this section we present three representative ones.
  504. </P>
  505. <P>
  506. Perhaps the most remarkable file server in Plan 9 is 8&#189;, the window system.
  507. It is discussed at length elsewhere [Pike91], but deserves a brief explanation here.
  508. 8&#189; provides two interfaces: to the user seated at the terminal, it offers a traditional
  509. style of interaction with multiple windows, each running an application, all controlled
  510. by a mouse and keyboard.
  511. To the client programs, the view is also fairly traditional:
  512. programs running in a window see a set of files in
  513. <TT>/dev</TT>
  514. with names like
  515. <TT>mouse</TT>,
  516. <TT>screen</TT>,
  517. and
  518. <TT>cons</TT>.
  519. Programs that want to print text to their window write to
  520. <TT>/dev/cons</TT>;
  521. to read the mouse, they read
  522. <TT>/dev/mouse</TT>.
  523. In the Plan 9 style, bitmap graphics is implemented by providing a file
  524. <TT>/dev/bitblt</TT>
  525. on which clients write encoded messages to execute graphical operations such as
  526. <TT>bitblt</TT>
  527. (RasterOp).
  528. What is unusual is how this is done:
  529. 8&#189; is a file server, serving the files in
  530. <TT>/dev</TT>
  531. to the clients running in each window.
  532. Although every window looks the same to its client,
  533. each window has a distinct set of files in
  534. <TT>/dev</TT>.
  535. 8&#189; multiplexes its clients' access to the resources of the terminal
  536. by serving multiple sets of files. Each client is given a private name space
  537. with a
  538. <I>different</I>
  539. set of files that behave the same as in all other windows.
  540. There are many advantages to this structure.
  541. One is that 8&#189; serves the same files it needs for its own implementation&#173;it
  542. multiplexes its own interface&#173;so it may be run, recursively, as a client of itself.
  543. Also, consider the implementation of
  544. <TT>/dev/tty</TT>
  545. in UNIX, which requires special code in the kernel to redirect
  546. <TT>open</TT>
  547. calls to the appropriate device.
  548. Instead, in 8&#189; the equivalent service falls out
  549. automatically: 8&#189; serves
  550. <TT>/dev/cons</TT>
  551. as its basic function; there is nothing extra to do.
  552. When a program wants to
  553. read from the keyboard, it opens
  554. <TT>/dev/cons</TT>,
  555. but it is a private file, not a shared one with special properties.
  556. Again, local name spaces make this possible; conventions about the consistency of
  557. the files within them make it natural.
  558. </P>
  559. <P>
  560. 8&#189; has a unique feature made possible by its design.
  561. Because it is implemented as a file server,
  562. it has the power to postpone answering read requests for a particular window.
  563. This behavior is toggled by a reserved key on the keyboard.
  564. Toggling once suspends client reads from the window;
  565. toggling again resumes normal reads, which absorb whatever text has been prepared,
  566. one line at a time.
  567. This allows the user to edit multi-line input text on the screen before the application sees it,
  568. obviating the need to invoke a separate editor to prepare text such as mail
  569. messages.
  570. A related property is that reads are answered directly from the
  571. data structure defining the text on the display: text may be edited until
  572. its final newline makes the prepared line of text readable by the client.
  573. Even then, until the line is read, the text the client will read can be changed.
  574. For example, after typing
  575. <DL><DT><DD><TT><PRE>
  576. % make
  577. rm *
  578. </PRE></TT></DL>
  579. to the shell, the user can backspace over the final newline at any time until
  580. <TT>make</TT>
  581. finishes, holding off execution of the
  582. <TT>rm</TT>
  583. command, or even point with the mouse
  584. before the
  585. <TT>rm</TT>
  586. and type another command to be executed first.
  587. </P>
  588. <P>
  589. There is no
  590. <TT>ftp</TT>
  591. command in Plan 9. Instead, a user-level file server called
  592. <TT>ftpfs</TT>
  593. dials the FTP site, logs in on behalf of the user, and uses the FTP protocol
  594. to examine files in the remote directory.
  595. To the local user, it offers a file hierarchy, attached to
  596. <TT>/n/ftp</TT>
  597. in the local name space, mirroring the contents of the FTP site.
  598. In other words, it translates the FTP protocol into 9P to offer Plan 9 access to FTP sites.
  599. The implementation is tricky;
  600. <TT>ftpfs</TT>
  601. must do some sophisticated caching for efficiency and
  602. use heuristics to decode remote directory information.
  603. But the result is worthwhile:
  604. all the local file management tools such as
  605. <TT>cp</TT>,
  606. <TT>grep</TT>,
  607. <TT>diff</TT>,
  608. and of course
  609. <TT>ls</TT>
  610. are available to FTP-served files exactly as if they were local files.
  611. Other systems such as Jade and Prospero
  612. have exploited the same opportunity [Rao81, Neu92],
  613. but because of local name spaces and the simplicity of implementing 9P,
  614. this approach
  615. fits more naturally into Plan 9 than into other environments.
  616. </P>
  617. <P>
  618. One server,
  619. <TT>exportfs</TT>,
  620. is a user process that takes a portion of its own name space and
  621. makes it available to other processes by
  622. translating 9P requests into system calls to the Plan 9 kernel.
  623. The file hierarchy it exports may contain files from multiple servers.
  624. <TT>Exportfs</TT>
  625. is usually run as a remote server
  626. started by a local program,
  627. either
  628. <TT>import</TT>
  629. or
  630. <TT>cpu</TT>.
  631. <TT>Import</TT>
  632. makes a network call to the remote machine, starts
  633. <TT>exportfs</TT>
  634. there, and attaches its 9P connection to the local name space. For example,
  635. <DL><DT><DD><TT><PRE>
  636. import helix /net
  637. </PRE></TT></DL>
  638. makes Helix's network interfaces visible in the local
  639. <TT>/net</TT>
  640. directory. Helix is a central server and
  641. has many network interfaces, so this permits a machine with one network to
  642. access to any of Helix's networks. After such an import, the local
  643. machine may make calls on any of the networks connected to Helix.
  644. Another example is
  645. <DL><DT><DD><TT><PRE>
  646. import helix /proc
  647. </PRE></TT></DL>
  648. which makes Helix's processes visible in the local
  649. <TT>/proc</TT>,
  650. permitting local debuggers to examine remote processes.
  651. </P>
  652. <P>
  653. The
  654. <TT>cpu</TT>
  655. command connects the local terminal to a remote
  656. CPU server.
  657. It works in the opposite direction to
  658. <TT>import</TT>:
  659. after calling the server, it starts a
  660. <I>local</I>
  661. <TT>exportfs</TT>
  662. and mounts it in the name space of a process, typically a newly created shell, on the
  663. server.
  664. It then rearranges the name space
  665. to make local device files (such as those served by
  666. the terminal's window system) visible in the server's
  667. <TT>/dev</TT>
  668. directory.
  669. The effect of running a
  670. <TT>cpu</TT>
  671. command is therefore to start a shell on a fast machine, one more tightly
  672. coupled to the file server,
  673. with a name space analogous
  674. to the local one.
  675. All local device files are visible remotely, so remote applications have full
  676. access to local services such as bitmap graphics,
  677. <TT>/dev/cons</TT>,
  678. and so on.
  679. This is not the same as
  680. <TT>rlogin</TT>,
  681. which does nothing to reproduce the local name space on the remote system,
  682. nor is it the same as
  683. file sharing with, say, NFS, which can achieve some name space equivalence but
  684. not the combination of access to local hardware devices, remote files, and remote
  685. CPU resources.
  686. The
  687. <TT>cpu</TT>
  688. command is a uniquely transparent mechanism.
  689. For example, it is reasonable
  690. to start a window system in a window running a
  691. <TT>cpu</TT>
  692. command; all windows created there automatically start processes on the CPU server.
  693. </P>
  694. <H4>Configurability and administration
  695. </H4>
  696. <P>
  697. The uniform interconnection of components in Plan 9 makes it possible to configure
  698. a Plan 9 installation many different ways.
  699. A single laptop PC can function as a stand-alone Plan 9 system;
  700. at the other extreme, our setup has central multiprocessor CPU
  701. servers and file servers and scores of terminals ranging from small PCs to
  702. high-end graphics workstations.
  703. It is such large installations that best represent how Plan 9 operates.
  704. </P>
  705. <P>
  706. The system software is portable and the same
  707. operating system runs on all hardware.
  708. Except for performance, the appearance of the system on, say,
  709. an SGI workstation is the same
  710. as on a laptop.
  711. Since computing and file services are centralized, and terminals have
  712. no permanent file storage, all terminals are functionally identical.
  713. In this way, Plan 9 has one of the good properties of old timesharing systems, where
  714. a user could sit in front of any machine and see the same system. In the modern
  715. workstation community, machines tend to be owned by people who customize them
  716. by storing private information on local disk.
  717. We reject this style of use,
  718. although the system itself can be used this way.
  719. In our group, we have a laboratory with many public-access machines&#173;a terminal
  720. room&#173;and a user may sit down at any one of them and work.
  721. </P>
  722. <P>
  723. Central file servers centralize not just the files, but also their administration
  724. and maintenance.
  725. In fact, one server is the main server, holding all system files; other servers provide
  726. extra storage or are available for debugging and other special uses, but the system
  727. software resides on one machine.
  728. This means that each program
  729. has a single copy of the binary for each architecture, so it is
  730. trivial to install updates and bug fixes.
  731. There is also a single user database; there is no need to synchronize distinct
  732. <TT>/etc/passwd</TT>
  733. files.
  734. On the other hand, depending on a single central server does limit the size of an installation.
  735. </P>
  736. <P>
  737. Another example of the power of centralized file service
  738. is the way Plan 9 administers network information.
  739. On the central server there is a directory,
  740. <TT>/lib/ndb</TT>,
  741. that contains all the information necessary to administer the local Ethernet and
  742. other networks.
  743. All the machines use the same database to talk to the network; there is no
  744. need to manage a distributed naming system or keep parallel files up to date.
  745. To install a new machine on the local Ethernet, choose a
  746. name and IP address and add these to a single file in
  747. <TT>/lib/ndb</TT>;
  748. all the machines in the installation will be able to talk to it immediately.
  749. To start running, plug the machine into the network, turn it on, and use BOOTP
  750. and TFTP to load the kernel.
  751. All else is automatic.
  752. </P>
  753. <P>
  754. Finally,
  755. the automated dump file system frees all users from the need to maintain
  756. their systems, while providing easy access to backup files without
  757. tapes, special commands, or the involvement of support staff.
  758. It is difficult to overstate the improvement in lifestyle afforded by this service.
  759. </P>
  760. <P>
  761. Plan 9 runs on a variety of hardware without
  762. constraining how to configure an installation.
  763. In our laboratory, we
  764. chose to use central servers because they amortize costs and administration.
  765. A sign that this is a good decision is that our cheap
  766. terminals remain comfortable places
  767. to work for about five years, much longer than workstations that must provide
  768. the complete computing environment.
  769. We do, however, upgrade the central machines, so
  770. the computation available from even old Plan 9 terminals improves with time.
  771. The money saved by avoiding regular upgrades of terminals
  772. is instead spent on the newest, fastest multiprocessor servers.
  773. We estimate this costs about half the money of networked workstations
  774. yet provides general access to more powerful machines.
  775. </P>
  776. <H4>C Programming
  777. </H4>
  778. <P>
  779. Plan 9 utilities are written in several languages.
  780. Some are scripts for the shell,
  781. <TT>rc</TT>
  782. [Duff90]; a handful
  783. are written in a new C-like concurrent language called Alef [Wint95], described below.
  784. The great majority, though, are written in a dialect of ANSI C [ANSIC].
  785. Of these, most are entirely new programs, but some
  786. originate in pre-ANSI C code
  787. from our research UNIX system [UNIX85].
  788. These have been updated to ANSI C
  789. and reworked for portability and cleanliness.
  790. </P>
  791. <P>
  792. The Plan 9 C dialect has some minor extensions,
  793. described elsewhere [Pike95], and a few major restrictions.
  794. The most important restriction is that the compiler demands that
  795. all function definitions have ANSI prototypes
  796. and all function calls appear in the scope of a prototyped declaration
  797. of the function.
  798. As a stylistic rule,
  799. the prototyped declaration is placed in a header file
  800. included by all files that call the function.
  801. Each system library has an associated header file, declaring all
  802. functions in that library.
  803. For example, the standard Plan 9 library is called
  804. <TT>libc</TT>,
  805. so all C source files include
  806. <TT>&lt;libc.h&gt;</TT>.
  807. These rules guarantee that all functions
  808. are called with arguments having the expected types &#173; something
  809. that was not true with pre-ANSI C programs.
  810. </P>
  811. <P>
  812. Another restriction is that the C compilers accept only a subset of the
  813. preprocessor directives required by ANSI.
  814. The main omission is
  815. <TT>#if</TT>,
  816. since we believe it
  817. is never necessary and often abused.
  818. Also, its effect is
  819. better achieved by other means.
  820. For instance, an
  821. <TT>#if</TT>
  822. used to toggle a feature at compile time can be written
  823. as a regular
  824. <TT>if</TT>
  825. statement, relying on compile-time constant folding and
  826. dead code elimination to discard object code.
  827. </P>
  828. <P>
  829. Conditional compilation, even with
  830. <TT>#ifdef</TT>,
  831. is used sparingly in Plan 9.
  832. The only architecture-dependent
  833. <TT>#ifdefs</TT>
  834. in the system are in low-level routines in the graphics library.
  835. Instead, we avoid such dependencies or, when necessary, isolate
  836. them in separate source files or libraries.
  837. Besides making code hard to read,
  838. <TT>#ifdefs</TT>
  839. make it impossible to know what source is compiled into the binary
  840. or whether source protected by them will compile or work properly.
  841. They make it harder to maintain software.
  842. </P>
  843. <P>
  844. The standard Plan 9 library overlaps much of
  845. ANSI C and POSIX [POSIX], but diverges
  846. when appropriate to Plan 9's goals or implementation.
  847. When the semantics of a function
  848. change, we also change the name.
  849. For instance, instead of UNIX's
  850. <TT>creat</TT>,
  851. Plan 9 has a
  852. <TT>create</TT>
  853. function that takes three arguments,
  854. the original two plus a third that, like the second
  855. argument of
  856. <TT>open</TT>,
  857. defines whether the returned file descriptor is to be opened for reading,
  858. writing, or both.
  859. This design was forced by the way 9P implements creation,
  860. but it also simplifies the common use of
  861. <TT>create</TT>
  862. to initialize a temporary file.
  863. </P>
  864. <P>
  865. Another departure from ANSI C is that Plan 9 uses a 16-bit character set
  866. called Unicode [ISO10646, Unicode].
  867. Although we stopped short of full internationalization,
  868. Plan 9 treats the representation
  869. of all major languages uniformly throughout all its
  870. software.
  871. To simplify the exchange of text between programs, the characters are packed into
  872. a byte stream by an encoding we designed, called UTF-8,
  873. which is now
  874. becoming accepted as a standard [FSSUTF].
  875. It has several attractive properties,
  876. including byte-order independence,
  877. backwards compatibility with ASCII,
  878. and ease of implementation.
  879. </P>
  880. <P>
  881. There are many problems in adapting existing software to a large
  882. character set with an encoding that represents characters with
  883. a variable number of bytes.
  884. ANSI C addresses some of the issues but
  885. falls short of
  886. solving them all.
  887. It does not pick a character set encoding and does not
  888. define all the necessary I/O library routines.
  889. Furthermore, the functions it
  890. <I>does</I>
  891. define have engineering problems.
  892. Since the standard left too many problems unsolved,
  893. we decided to build our own interface.
  894. A separate paper has the details [Pike93].
  895. </P>
  896. <P>
  897. A small class of Plan 9 programs do not follow the conventions
  898. discussed in this section.
  899. These are programs imported from and maintained by
  900. the UNIX community;
  901. <TT>tex</TT>
  902. is a representative example.
  903. To avoid reconverting such programs every time a new version
  904. is released,
  905. we built a porting environment, called the ANSI C/POSIX Environment, or APE [Tric95].
  906. APE comprises separate include files, libraries, and commands,
  907. conforming as much as possible to the strict ANSI C and base-level
  908. POSIX specifications.
  909. To port network-based software such as X Windows, it was necessary to add
  910. some extensions to those
  911. specifications, such as the BSD networking functions.
  912. </P>
  913. <H4>Portability and Compilation
  914. </H4>
  915. <P>
  916. Plan 9 is portable across a variety of processor architectures.
  917. Within a single computing session, it is common to use
  918. several architectures: perhaps the window system running on
  919. an Intel processor connected to a MIPS-based CPU server with files
  920. resident on a SPARC system.
  921. For this heterogeneity to be transparent, there must be conventions
  922. about data interchange between programs; for software maintenance
  923. to be straightforward, there must be conventions about cross-architecture
  924. compilation.
  925. </P>
  926. <P>
  927. To avoid byte order problems,
  928. data is communicated between programs as text whenever practical.
  929. Sometimes, though, the amount of data is high enough that a binary
  930. format is necessary;
  931. such data is communicated as a byte stream with a pre-defined encoding
  932. for multi-byte values.
  933. In the rare cases where a format
  934. is complex enough to be defined by a data structure,
  935. the structure is never
  936. communicated as a unit; instead, it is decomposed into
  937. individual fields, encoded as an ordered byte stream, and then
  938. reassembled by the recipient.
  939. These conventions affect data
  940. ranging from kernel or application program state information to object file
  941. intermediates generated by the compiler.
  942. </P>
  943. <P>
  944. Programs, including the kernel, often present their data
  945. through a file system interface,
  946. an access mechanism that is inherently portable.
  947. For example, the system clock is represented by a decimal number in the file
  948. <TT>/dev/time</TT>;
  949. the
  950. <TT>time</TT>
  951. library function (there is no
  952. <TT>time</TT>
  953. system call) reads the file and converts it to binary.
  954. Similarly, instead of encoding the state of an application
  955. process in a series of flags and bits in private memory,
  956. the kernel
  957. presents a text string in the file named
  958. <TT>status</TT>
  959. in the
  960. <TT>/proc</TT>
  961. file system associated with each process.
  962. The Plan 9
  963. <TT>ps</TT>
  964. command is trivial: it prints the contents of
  965. the desired status files after some minor reformatting; moreover, after
  966. <DL><DT><DD><TT><PRE>
  967. import helix /proc
  968. </PRE></TT></DL>
  969. a local
  970. <TT>ps</TT>
  971. command reports on the status of Helix's processes.
  972. </P>
  973. <P>
  974. Each supported architecture has its own compilers and loader.
  975. The C and Alef compilers produce intermediate files that
  976. are portably encoded; the contents
  977. are unique to the target architecture but the format of the
  978. file is independent of compiling processor type.
  979. When a compiler for a given architecture is compiled on
  980. another type of processor and then used to compile a program
  981. there,
  982. the intermediate produced on
  983. the new architecture is identical to the intermediate
  984. produced on the native processor. From the compiler's
  985. point of view, every compilation is a cross-compilation.
  986. </P>
  987. <P>
  988. Although each architecture's loader accepts only intermediate files produced
  989. by compilers for that architecture,
  990. such files could have been generated by a compiler executing
  991. on any type of processor.
  992. For instance, it is possible to run
  993. the MIPS compiler on a 486, then use the MIPS loader on a
  994. SPARC to produce a MIPS executable.
  995. </P>
  996. <P>
  997. Since Plan 9 runs on a variety of architectures, even in a single installation,
  998. distinguishing the compilers and intermediate names
  999. simplifies multi-architecture
  1000. development from a single source tree.
  1001. The compilers and the loader for each architecture are
  1002. uniquely named; there is no
  1003. <TT>cc</TT>
  1004. command.
  1005. The names are derived by concatenating a code letter
  1006. associated with the target architecture with the name of the
  1007. compiler or loader. For example, the letter `8' is
  1008. the code letter for Intel
  1009. <I>x</I>86
  1010. processors; the C compiler is named
  1011. <TT>8c</TT>,
  1012. the Alef compiler
  1013. <TT>8al</TT>,
  1014. and the loader is called
  1015. <TT>8l</TT>.
  1016. Similarly, the compiler intermediate files are suffixed
  1017. <TT>.8</TT>,
  1018. not
  1019. <TT>.o</TT>.
  1020. </P>
  1021. <P>
  1022. The Plan 9
  1023. build program
  1024. <TT>mk</TT>,
  1025. a relative of
  1026. <TT>make</TT>,
  1027. reads the names of the current and target
  1028. architectures from environment variables called
  1029. <TT>$cputype</TT>
  1030. and
  1031. <TT>$objtype</TT>.
  1032. By default the current processor is the target, but setting
  1033. <TT>$objtype</TT>
  1034. to the name of another architecture
  1035. before invoking
  1036. <TT>mk</TT>
  1037. results in a cross-build:
  1038. <DL><DT><DD><TT><PRE>
  1039. % objtype=sparc mk
  1040. </PRE></TT></DL>
  1041. builds a program for the SPARC architecture regardless of the executing machine.
  1042. The value of
  1043. <TT>$objtype</TT>
  1044. selects a
  1045. file of architecture-dependent variable definitions
  1046. that configures the build to use the appropriate compilers and loader.
  1047. Although simple-minded, this technique works well in practice:
  1048. all applications in Plan 9 are built from a single source tree
  1049. and it is possible to build the various architectures in parallel without conflict.
  1050. </P>
  1051. <H4>Parallel programming
  1052. </H4>
  1053. <P>
  1054. Plan 9's support for parallel programming has two aspects.
  1055. First, the kernel provides
  1056. a simple process model and a few carefully designed system calls for
  1057. synchronization and sharing.
  1058. Second, a new parallel programming language called Alef
  1059. supports concurrent programming.
  1060. Although it is possible to write parallel
  1061. programs in C, Alef is the parallel language of choice.
  1062. </P>
  1063. <P>
  1064. There is a trend in new operating systems to implement two
  1065. classes of processes: normal UNIX-style processes and light-weight
  1066. kernel threads.
  1067. Instead, Plan 9 provides a single class of process but allows fine control of the
  1068. sharing of a process's resources such as memory and file descriptors.
  1069. A single class of process is a
  1070. feasible approach in Plan 9 because the kernel has an efficient system
  1071. call interface and cheap process creation and scheduling.
  1072. </P>
  1073. <P>
  1074. Parallel programs have three basic requirements:
  1075. management of resources shared between processes,
  1076. an interface to the scheduler,
  1077. and fine-grain process synchronization using spin locks.
  1078. On Plan 9,
  1079. new processes are created using the
  1080. <TT>rfork</TT>
  1081. system call.
  1082. <TT>Rfork</TT>
  1083. takes a single argument,
  1084. a bit vector that specifies
  1085. which of the parent process's resources should be shared,
  1086. copied, or created anew
  1087. in the child.
  1088. The resources controlled by
  1089. <TT>rfork</TT>
  1090. include the name space,
  1091. the environment,
  1092. the file descriptor table,
  1093. memory segments,
  1094. and notes (Plan 9's analog of UNIX signals).
  1095. One of the bits controls whether the
  1096. <TT>rfork</TT>
  1097. call will create a new process; if the bit is off, the resulting
  1098. modification to the resources occurs in the process making the call.
  1099. For example, a process calls
  1100. <TT>rfork(RFNAMEG)</TT>
  1101. to disconnect its name space from its parent's.
  1102. Alef uses a
  1103. fine-grained fork in which all the resources, including
  1104. memory, are shared between parent
  1105. and child, analogous to creating a kernel thread in many systems.
  1106. </P>
  1107. <P>
  1108. An indication that
  1109. <TT>rfork</TT>
  1110. is the right model is the variety of ways it is used.
  1111. Other than the canonical use in the library routine
  1112. <TT>fork</TT>,
  1113. it is hard to find two calls to
  1114. <TT>rfork</TT>
  1115. with the same bits set; programs
  1116. use it to create many different forms of sharing and resource allocation.
  1117. A system with just two types of processes&#173;regular processes and threads&#173;could
  1118. not handle this variety.
  1119. </P>
  1120. <P>
  1121. There are two ways to share memory.
  1122. First, a flag to
  1123. <TT>rfork</TT>
  1124. causes all the memory segments of the parent to be shared with the child
  1125. (except the stack, which is
  1126. forked copy-on-write regardless).
  1127. Alternatively, a new segment of memory may be
  1128. attached using the
  1129. <TT>segattach</TT>
  1130. system call; such a segment
  1131. will always be shared between parent and child.
  1132. </P>
  1133. <P>
  1134. The
  1135. <TT>rendezvous</TT>
  1136. system call provides a way for processes to synchronize.
  1137. Alef uses it to implement communication channels,
  1138. queuing locks,
  1139. multiple reader/writer locks, and
  1140. the sleep and wakeup mechanism.
  1141. <TT>Rendezvous</TT>
  1142. takes two arguments, a tag and a value.
  1143. When a process calls
  1144. <TT>rendezvous</TT>
  1145. with a tag it sleeps until another process
  1146. presents a matching tag.
  1147. When a pair of tags match, the values are exchanged
  1148. between the two processes and both
  1149. <TT>rendezvous</TT>
  1150. calls return.
  1151. This primitive is sufficient to implement the full set of synchronization routines.
  1152. </P>
  1153. <P>
  1154. Finally, spin locks are provided by
  1155. an architecture-dependent library at user level.
  1156. Most processors provide atomic test and set instructions that
  1157. can be used to implement locks.
  1158. A notable exception is the MIPS R3000, so the SGI
  1159. Power series multiprocessors have special lock hardware on the bus.
  1160. User processes gain access to the lock hardware
  1161. by mapping pages of hardware locks
  1162. into their address space using the
  1163. <TT>segattach</TT>
  1164. system call.
  1165. </P>
  1166. <P>
  1167. A Plan 9 process in a system call will block regardless of its `weight'.
  1168. This means that when a program wishes to read from a slow
  1169. device without blocking the entire calculation, it must fork a process to do
  1170. the read for it. The solution is to start a satellite
  1171. process that does the I/O and delivers the answer to the main program
  1172. through shared memory or perhaps a pipe.
  1173. This sounds onerous but works easily and efficiently in practice; in fact,
  1174. most interactive Plan 9 applications, even relatively ordinary ones written
  1175. in C, such as
  1176. the text editor Sam [Pike87], run as multiprocess programs.
  1177. </P>
  1178. <P>
  1179. The kernel support for parallel programming in Plan 9 is a few hundred lines
  1180. of portable code; a handful of simple primitives enable the problems to be handled
  1181. cleanly at user level.
  1182. Although the primitives work fine from C,
  1183. they are particularly expressive from within Alef.
  1184. The creation
  1185. and management of slave I/O processes can be written in a few lines of Alef,
  1186. providing the foundation for a consistent means of multiplexing
  1187. data flows between arbitrary processes.
  1188. Moreover, implementing it in a language rather than in the kernel
  1189. ensures consistent semantics between all devices
  1190. and provides a more general multiplexing primitive.
  1191. Compare this to the UNIX
  1192. <TT>select</TT>
  1193. system call:
  1194. <TT>select</TT>
  1195. applies only to a restricted set of devices,
  1196. legislates a style of multiprogramming in the kernel,
  1197. does not extend across networks,
  1198. is difficult to implement, and is hard to use.
  1199. </P>
  1200. <P>
  1201. Another reason
  1202. parallel programming is important in Plan 9 is that
  1203. multi-threaded user-level file servers are the preferred way
  1204. to implement services.
  1205. Examples of such servers include the programming environment
  1206. Acme [Pike94],
  1207. the name space exporting tool
  1208. <TT>exportfs</TT>
  1209. [PPTTW93],
  1210. the HTTP daemon,
  1211. and the network name servers
  1212. <TT>cs</TT>
  1213. and
  1214. <TT>dns</TT>
  1215. [PrWi93].
  1216. Complex applications such as Acme prove that
  1217. careful operating system support can reduce the difficulty of writing
  1218. multi-threaded applications without moving threading and
  1219. synchronization primitives into the kernel.
  1220. </P>
  1221. <H4>Implementation of Name Spaces
  1222. </H4>
  1223. <P>
  1224. User processes construct name spaces using three system calls:
  1225. <TT>mount</TT>,
  1226. <TT>bind</TT>,
  1227. and
  1228. <TT>unmount</TT>.
  1229. The
  1230. <TT>mount</TT>
  1231. system call attaches a tree served by a file server to
  1232. the current name space. Before calling
  1233. <TT>mount</TT>,
  1234. the client must (by outside means) acquire a connection to the server in
  1235. the form of a file descriptor that may be written and read to transmit 9P messages.
  1236. That file descriptor represents a pipe or network connection.
  1237. </P>
  1238. <P>
  1239. The
  1240. <TT>mount</TT>
  1241. call attaches a new hierarchy to the existing name space.
  1242. The
  1243. <TT>bind</TT>
  1244. system call, on the other hand, duplicates some piece of existing name space at
  1245. another point in the name space.
  1246. The
  1247. <TT>unmount</TT>
  1248. system call allows components to be removed.
  1249. </P>
  1250. <P>
  1251. Using
  1252. either
  1253. <TT>bind</TT>
  1254. or
  1255. <TT>mount</TT>,
  1256. multiple directories may be stacked at a single point in the name space.
  1257. In Plan 9 terminology, this is a
  1258. <I>union</I>
  1259. directory and behaves like the concatenation of the constituent directories.
  1260. A flag argument to
  1261. <TT>bind</TT>
  1262. and
  1263. <TT>mount</TT>
  1264. specifies the position of a new directory in the union,
  1265. permitting new elements
  1266. to be added either at the front or rear of the union or to replace it entirely.
  1267. When a file lookup is performed in a union directory, each component
  1268. of the union is searched in turn and the first match taken; likewise,
  1269. when a union directory is read, the contents of each of the component directories
  1270. is read in turn.
  1271. Union directories are one of the most widely used organizational features
  1272. of the Plan 9 name space.
  1273. For instance, the directory
  1274. <TT>/bin</TT>
  1275. is built as a union of
  1276. <TT>/$cputype/bin</TT>
  1277. (program binaries),
  1278. <TT>/rc/bin</TT>
  1279. (shell scripts),
  1280. and perhaps more directories provided by the user.
  1281. This construction makes the shell
  1282. <TT>$PATH</TT>
  1283. variable unnecessary.
  1284. </P>
  1285. <P>
  1286. One question raised by union directories
  1287. is which element of the union receives a newly created file.
  1288. After several designs, we decided on the following.
  1289. By default, directories in unions do not accept new files, although the
  1290. <TT>create</TT>
  1291. system call applied to an existing file succeeds normally.
  1292. When a directory is added to the union, a flag to
  1293. <TT>bind</TT>
  1294. or
  1295. <TT>mount</TT>
  1296. enables create permission (a property of the name space) in that directory.
  1297. When a file is being created with a new name in a union, it is created in the
  1298. first directory of the union with create permission; if that creation fails,
  1299. the entire
  1300. <TT>create</TT>
  1301. fails.
  1302. This scheme enables the common use of placing a private directory anywhere
  1303. in a union of public ones,
  1304. while allowing creation only in the private directory.
  1305. </P>
  1306. <P>
  1307. By convention, kernel device file systems
  1308. are bound into the
  1309. <TT>/dev</TT>
  1310. directory, but to bootstrap the name space building process it is
  1311. necessary to have a notation that permits
  1312. direct access to the devices without an existing name space.
  1313. The root directory
  1314. of the tree served by a device driver can be accessed using the syntax
  1315. <TT>#</TT>&lt;I&gt;c&lt;/I&gt;,
  1316. where
  1317. <I>c</I>
  1318. is a unique character (typically a letter) identifying the
  1319. <I>type</I>
  1320. of the device.
  1321. Simple device drivers serve a single level directory containing a few files.
  1322. As an example,
  1323. each serial port is represented by a data and a control file:
  1324. <DL><DT><DD><TT><PRE>
  1325. % bind -a '#t' /dev
  1326. % cd /dev
  1327. % ls -l eia*
  1328. --rw-rw-rw- t 0 bootes bootes 0 Feb 24 21:14 eia1
  1329. --rw-rw-rw- t 0 bootes bootes 0 Feb 24 21:14 eia1ctl
  1330. --rw-rw-rw- t 0 bootes bootes 0 Feb 24 21:14 eia2
  1331. --rw-rw-rw- t 0 bootes bootes 0 Feb 24 21:14 eia2ctl
  1332. </PRE></TT></DL>
  1333. The
  1334. <TT>bind</TT>
  1335. program is an encapsulation of the
  1336. <TT>bind</TT>
  1337. system call; its
  1338. <TT>-a</TT>
  1339. flag positions the new directory at the end of the union.
  1340. The data files
  1341. <TT>eia1</TT>
  1342. and
  1343. <TT>eia2</TT>
  1344. may be read and written to communicate over the serial line.
  1345. Instead of using special operations on these files to control the devices,
  1346. commands written to the files
  1347. <TT>eia1ctl</TT>
  1348. and
  1349. <TT>eia2ctl</TT>
  1350. control the corresponding device;
  1351. for example,
  1352. writing the text string
  1353. <TT>b1200</TT>
  1354. to
  1355. <TT>/dev/eia1ctl</TT>
  1356. sets the speed of that line to 1200 baud.
  1357. Compare this to the UNIX
  1358. <TT>ioctl</TT>
  1359. system call: in Plan 9, devices are controlled by textual messages,
  1360. free of byte order problems, with clear semantics for reading and writing.
  1361. It is common to configure or debug devices using shell scripts.
  1362. </P>
  1363. <P>
  1364. It is the universal use of the 9P protocol that
  1365. connects Plan 9's components together to form a
  1366. distributed system.
  1367. Rather than inventing a unique protocol for each
  1368. service such as
  1369. <TT>rlogin</TT>,
  1370. FTP, TFTP, and X windows,
  1371. Plan 9 implements services
  1372. in terms of operations on file objects,
  1373. and then uses a single, well-documented protocol to exchange information between
  1374. computers.
  1375. Unlike NFS, 9P treats files as a sequence of bytes rather than blocks.
  1376. Also unlike NFS, 9P is stateful: clients perform
  1377. remote procedure calls to establish pointers to objects in the remote
  1378. file server.
  1379. These pointers are called file identifiers or
  1380. <I>fids</I>.
  1381. All operations on files supply a fid to identify an object in the remote file system.
  1382. </P>
  1383. <P>
  1384. The 9P protocol defines 17 messages, providing
  1385. means to authenticate users, navigate fids around
  1386. a file system hierarchy, copy fids, perform I/O, change file attributes,
  1387. and create and delete files.
  1388. Its complete specification is in Section 5 of the Programmer's Manual [9man].
  1389. Here is the procedure to gain access to the name hierarchy supplied by a server.
  1390. A file server connection is established via a pipe or network connection.
  1391. An initial
  1392. <TT>session</TT>
  1393. message performs a bilateral authentication between client and server.
  1394. An
  1395. <TT>attach</TT>
  1396. message then connects a fid suggested by the client to the root of the server file
  1397. tree.
  1398. The
  1399. <TT>attach</TT>
  1400. message includes the identity of the user performing the attach; henceforth all
  1401. fids derived from the root fid will have permissions associated with
  1402. that user.
  1403. Multiple users may share the connection, but each must perform an attach to
  1404. establish his or her identity.
  1405. </P>
  1406. <P>
  1407. The
  1408. <TT>walk</TT>
  1409. message moves a fid through a single level of the file system hierarchy.
  1410. The
  1411. <TT>clone</TT>
  1412. message takes an established fid and produces a copy that points
  1413. to the same file as the original.
  1414. Its purpose is to enable walking to a file in a directory without losing the fid
  1415. on the directory.
  1416. The
  1417. <TT>open</TT>
  1418. message locks a fid to a specific file in the hierarchy,
  1419. checks access permissions,
  1420. and prepares the fid
  1421. for I/O.
  1422. The
  1423. <TT>read</TT>
  1424. and
  1425. <TT>write</TT>
  1426. messages allow I/O at arbitrary offsets in the file;
  1427. the maximum size transferred is defined by the protocol.
  1428. The
  1429. <TT>clunk</TT>
  1430. message indicates the client has no further use for a fid.
  1431. The
  1432. <TT>remove</TT>
  1433. message behaves like
  1434. <TT>clunk</TT>
  1435. but causes the file associated with the fid to be removed and any associated
  1436. resources on the server to be deallocated.
  1437. </P>
  1438. <P>
  1439. 9P has two forms: RPC messages sent on a pipe or network connection and a procedural
  1440. interface within the kernel.
  1441. Since kernel device drivers are directly addressable,
  1442. there is no need to pass messages to
  1443. communicate with them;
  1444. instead each 9P transaction is implemented by a direct procedure call.
  1445. For each fid,
  1446. the kernel maintains a local representation in a data structure called a
  1447. <I>channel</I>,
  1448. so all operations on files performed by the kernel involve a channel connected
  1449. to that fid.
  1450. The simplest example is a user process's file descriptors, which are
  1451. indexes into an array of channels.
  1452. A table in the kernel provides a list
  1453. of entry points corresponding one to one with the 9P messages for each device.
  1454. A system call such as
  1455. <TT>read</TT>
  1456. from the user translates into one or more procedure calls
  1457. through that table, indexed by the type character stored in the channel:
  1458. <TT>procread</TT>,
  1459. <TT>eiaread</TT>,
  1460. etc.
  1461. Each call takes at least
  1462. one channel as an argument.
  1463. A special kernel driver, called the
  1464. <I>mount</I>
  1465. driver, translates procedure calls to messages, that is,
  1466. it converts local procedure calls to remote ones.
  1467. In effect, this special driver
  1468. becomes a local proxy for the files served by a remote file server.
  1469. The channel pointer in the local call is translated to the associated fid
  1470. in the transmitted message.
  1471. </P>
  1472. <P>
  1473. The mount driver is the sole RPC mechanism employed by the system.
  1474. The semantics of the supplied files, rather than the operations performed upon
  1475. them, create a particular service such as the
  1476. <TT>cpu</TT>
  1477. command.
  1478. The mount driver demultiplexes protocol
  1479. messages between clients sharing a communication channel
  1480. with a file server.
  1481. For each outgoing RPC message,
  1482. the mount driver allocates a buffer labeled by a small unique integer,
  1483. called a
  1484. <I>tag</I>.
  1485. The reply to the RPC is labeled with the same tag, which is used by
  1486. the mount driver to match the reply with the request.
  1487. </P>
  1488. <P>
  1489. The kernel representation of the name space
  1490. is called the
  1491. <I>mount table</I>,
  1492. which stores a list of bindings between channels.
  1493. Each entry in the mount table contains a pair of channels: a
  1494. <I>from</I>
  1495. channel and a
  1496. <I>to</I>
  1497. channel.
  1498. Every time a walk succeeds in moving a channel to a new location in the name space,
  1499. the mount table is consulted to see if a `from' channel matches the new name; if
  1500. so the `to' channel is cloned and substituted for the original.
  1501. Union directories are implemented by converting the `to'
  1502. channel into a list of channels:
  1503. a successful walk to a union directory returns a `to' channel that forms
  1504. the head of
  1505. a list of channels, each representing a component directory
  1506. of the union.
  1507. If a walk
  1508. fails to find a file in the first directory of the union, the list is followed,
  1509. the next component cloned, and walk tried on that directory.
  1510. </P>
  1511. <P>
  1512. Each file in Plan 9 is uniquely identified by a set of integers:
  1513. the type of the channel (used as the index of the function call table),
  1514. the server or device number
  1515. distinguishing the server from others of the same type (decided locally by the driver),
  1516. and a
  1517. <I>qid</I>
  1518. formed from two 32-bit numbers called
  1519. <I>path</I>
  1520. and
  1521. <I>version</I>.
  1522. The path is a unique file number assigned by a device driver or
  1523. file server when a file is created.
  1524. The version number is updated whenever
  1525. the file is modified; as described in the next section,
  1526. it can be used to maintain cache coherency between
  1527. clients and servers.
  1528. </P>
  1529. <P>
  1530. The type and device number are analogous to UNIX major and minor
  1531. device numbers;
  1532. the qid is analogous to the i-number.
  1533. The device and type
  1534. connect the channel to a device driver and the qid
  1535. identifies the file within that device.
  1536. If the file recovered from a walk has the same type, device, and qid path
  1537. as an entry in the mount table, they are the same file and the
  1538. corresponding substitution from the mount table is made.
  1539. This is how the name space is implemented.
  1540. </P>
  1541. <H4>File Caching
  1542. </H4>
  1543. <P>
  1544. The 9P protocol has no explicit support for caching files on a client.
  1545. The large memory of the central file server acts as a shared cache for all its clients,
  1546. which reduces the total amount of memory needed across all machines in the network.
  1547. Nonetheless, there are sound reasons to cache files on the client, such as a slow
  1548. connection to the file server.
  1549. </P>
  1550. <P>
  1551. The version field of the qid is changed whenever the file is modified,
  1552. which makes it possible to do some weakly coherent forms of caching.
  1553. The most important is client caching of text and data segments of executable files.
  1554. When a process
  1555. <TT>execs</TT>
  1556. a program, the file is re-opened and the qid's version is compared with that in the cache;
  1557. if they match, the local copy is used.
  1558. The same method can be used to build a local caching file server.
  1559. This user-level server interposes on the 9P connection to the remote server and
  1560. monitors the traffic, copying data to a local disk.
  1561. When it sees a read of known data, it answers directly,
  1562. while writes are passed on immediately&#173;the cache is write-through&#173;to keep
  1563. the central copy up to date.
  1564. This is transparent to processes on the terminal and requires no change to 9P;
  1565. it works well on home machines connected over serial lines.
  1566. A similar method can be applied to build a general client cache in unused local
  1567. memory, but this has not been done in Plan 9.
  1568. </P>
  1569. <H4>Networks and Communication Devices
  1570. </H4>
  1571. <P>
  1572. Network interfaces are kernel-resident file systems, analogous to the EIA device
  1573. described earlier.
  1574. Call setup and shutdown are achieved by writing text strings to the control file
  1575. associated with the device;
  1576. information is sent and received by reading and writing the data file.
  1577. The structure and semantics of the devices is common to all networks so,
  1578. other than a file name substitution,
  1579. the same procedure makes a call using TCP over Ethernet as URP over Datakit [Fra80].
  1580. </P>
  1581. <P>
  1582. This example illustrates the structure of the TCP device:
  1583. <DL><DT><DD><TT><PRE>
  1584. % ls -lp /net/tcp
  1585. d-r-xr-xr-x I 0 bootes bootes 0 Feb 23 20:20 0
  1586. d-r-xr-xr-x I 0 bootes bootes 0 Feb 23 20:20 1
  1587. --rw-rw-rw- I 0 bootes bootes 0 Feb 23 20:20 clone
  1588. % ls -lp /net/tcp/0
  1589. --rw-rw---- I 0 rob bootes 0 Feb 23 20:20 ctl
  1590. --rw-rw---- I 0 rob bootes 0 Feb 23 20:20 data
  1591. --rw-rw---- I 0 rob bootes 0 Feb 23 20:20 listen
  1592. --r--r--r-- I 0 bootes bootes 0 Feb 23 20:20 local
  1593. --r--r--r-- I 0 bootes bootes 0 Feb 23 20:20 remote
  1594. --r--r--r-- I 0 bootes bootes 0 Feb 23 20:20 status
  1595. %
  1596. </PRE></TT></DL>
  1597. The top directory,
  1598. <TT>/net/tcp</TT>,
  1599. contains a
  1600. <TT>clone</TT>
  1601. file and a directory for each connection, numbered
  1602. <TT>0</TT>
  1603. to
  1604. <I>n</I>.
  1605. Each connection directory corresponds to an TCP/IP connection.
  1606. Opening
  1607. <TT>clone</TT>
  1608. reserves an unused connection and returns its control file.
  1609. Reading the control file returns the textual connection number, so the user
  1610. process can construct the full name of the newly allocated
  1611. connection directory.
  1612. The
  1613. <TT>local</TT>,
  1614. <TT>remote</TT>,
  1615. and
  1616. <TT>status</TT>
  1617. files are diagnostic; for example,
  1618. <TT>remote</TT>
  1619. contains the address (for TCP, the IP address and port number) of the remote side.
  1620. </P>
  1621. <P>
  1622. A call is initiated by writing a connect message with a network-specific address as
  1623. its argument; for example, to open a Telnet session (port 23) to a remote machine
  1624. with IP address 135.104.9.52,
  1625. the string is:
  1626. <DL><DT><DD><TT><PRE>
  1627. connect 135.104.9.52!23
  1628. </PRE></TT></DL>
  1629. The write to the control file blocks until the connection is established;
  1630. if the destination is unreachable, the write returns an error.
  1631. Once the connection is established, the
  1632. <TT>telnet</TT>
  1633. application reads and writes the
  1634. <TT>data</TT>
  1635. file
  1636. to talk to the remote Telnet daemon.
  1637. On the other end, the Telnet daemon would start by writing
  1638. <DL><DT><DD><TT><PRE>
  1639. announce 23
  1640. </PRE></TT></DL>
  1641. to its control file to indicate its willingness to receive calls to this port.
  1642. Such a daemon is called a
  1643. <I>listener</I>
  1644. in Plan 9.
  1645. </P>
  1646. <P>
  1647. A uniform structure for network devices cannot hide all the details
  1648. of addressing and communication for dissimilar networks.
  1649. For example, Datakit uses textual, hierarchical addresses unlike IP's 32-bit addresses, so
  1650. an application given a control file must still know what network it represents.
  1651. Rather than make every application know the addressing of every network,
  1652. Plan 9 hides these details in a
  1653. <I>connection</I>
  1654. <I>server</I>,
  1655. called
  1656. <TT>cs</TT>.
  1657. <TT>Cs</TT>
  1658. is a file system mounted in a known place.
  1659. It supplies a single control file that an application uses to discover how to connect
  1660. to a host.
  1661. The application writes the symbolic address and service name for
  1662. the connection it wishes to make,
  1663. and reads back the name of the
  1664. <TT>clone</TT>
  1665. file to open and the address to present to it.
  1666. If there are multiple networks between the machines,
  1667. <TT>cs</TT>
  1668. presents a list of possible networks and addresses to be tried in sequence;
  1669. it uses heuristics to decide the order.
  1670. For instance, it presents the highest-bandwidth choice first.
  1671. </P>
  1672. <P>
  1673. A single library function called
  1674. <TT>dial</TT>
  1675. talks to
  1676. <TT>cs</TT>
  1677. to establish the connection.
  1678. An application that uses
  1679. <TT>dial</TT>
  1680. needs no changes, not even recompilation, to adapt to new networks;
  1681. the interface to
  1682. <TT>cs</TT>
  1683. hides the details.
  1684. </P>
  1685. <P>
  1686. The uniform structure for networks in Plan 9 makes the
  1687. <TT>import</TT>
  1688. command all that is needed to construct gateways.
  1689. </P>
  1690. <H4>Kernel structure for networks
  1691. </H4>
  1692. <P>
  1693. The kernel plumbing used to build Plan 9 communications
  1694. channels is called
  1695. <I>streams</I>
  1696. [Rit84][Presotto].
  1697. A stream is a bidirectional channel connecting a
  1698. physical or pseudo-device to a user process.
  1699. The user process inserts and removes data at one end of the stream;
  1700. a kernel process acting on behalf of a device operates at
  1701. the other end.
  1702. A stream comprises a linear list of
  1703. <I>processing modules</I>.
  1704. Each module has both an upstream (toward the process) and
  1705. downstream (toward the device)
  1706. <I>put routine</I>.
  1707. Calling the put routine of the module on either end of the stream
  1708. inserts data into the stream.
  1709. Each module calls the succeeding one to send data up or down the stream.
  1710. Like UNIX streams [Rit84],
  1711. Plan 9 streams can be dynamically configured.
  1712. </P>
  1713. <H4>The IL Protocol
  1714. </H4>
  1715. <P>
  1716. The 9P protocol must run above a reliable transport protocol with delimited messages.
  1717. 9P has no mechanism to recover from transmission errors and
  1718. the system assumes that each read from a communication channel will
  1719. return a single 9P message;
  1720. it does not parse the data stream to discover message boundaries.
  1721. Pipes and some network protocols already have these properties but
  1722. the standard IP protocols do not.
  1723. TCP does not delimit messages, while
  1724. UDP [RFC768] does not provide reliable in-order delivery.
  1725. </P>
  1726. <P>
  1727. We designed a new protocol, called IL (Internet Link), to transmit 9P messages over IP.
  1728. It is a connection-based protocol that provides
  1729. reliable transmission of sequenced messages between machines.
  1730. Since a process can have only a single outstanding 9P request,
  1731. there is no need for flow control in IL.
  1732. Like TCP, IL has adaptive timeouts: it scales acknowledge and retransmission times
  1733. to match the network speed.
  1734. This allows the protocol to perform well on both the Internet and on local Ethernets.
  1735. Also, IL does no blind retransmission,
  1736. to avoid adding to the congestion of busy networks.
  1737. Full details are in another paper [PrWi95].
  1738. </P>
  1739. <P>
  1740. In Plan 9, the implementation of IL is smaller and faster than TCP.
  1741. IL is our main Internet transport protocol.
  1742. </P>
  1743. <H4>Overview of authentication
  1744. </H4>
  1745. <P>
  1746. Authentication establishes the identity of a
  1747. user accessing a resource.
  1748. The user requesting the resource is called the
  1749. <I>client</I>
  1750. and the user granting access to the resource is called the
  1751. <I>server</I>.
  1752. This is usually done under the auspices of a 9P attach message.
  1753. A user may be a client in one authentication exchange and a server in another.
  1754. Servers always act on behalf of some user,
  1755. either a normal client or some administrative entity, so authentication
  1756. is defined to be between users, not machines.
  1757. </P>
  1758. <P>
  1759. Each Plan 9 user has an associated DES [NBS77] authentication key;
  1760. the user's identity is verified by the ability to
  1761. encrypt and decrypt special messages called challenges.
  1762. Since knowledge of a user's key gives access to that user's resources,
  1763. the Plan 9 authentication protocols never transmit a message containing
  1764. a cleartext key.
  1765. </P>
  1766. <P>
  1767. Authentication is bilateral:
  1768. at the end of the authentication exchange,
  1769. each side is convinced of the other's identity.
  1770. Every machine begins the exchange with a DES key in memory.
  1771. In the case of CPU and file servers, the key, user name, and domain name
  1772. for the server are read from permanent storage,
  1773. usually non-volatile RAM.
  1774. In the case of terminals,
  1775. the key is derived from a password typed by the user at boot time.
  1776. A special machine, known as the
  1777. <I>authentication</I>
  1778. <I>server</I>,
  1779. maintains a database of keys for all users in its administrative domain and
  1780. participates in the authentication protocols.
  1781. </P>
  1782. <P>
  1783. The authentication protocol is as follows:
  1784. after exchanging challenges, one party
  1785. contacts the authentication server to create
  1786. permission-granting
  1787. <I>tickets</I>
  1788. encrypted with
  1789. each party's secret key and containing a new conversation key.
  1790. Each
  1791. party decrypts its own ticket and uses the conversation key to
  1792. encrypt the other party's challenge.
  1793. </P>
  1794. <P>
  1795. This structure is somewhat like Kerberos [MBSS87], but avoids
  1796. its reliance on synchronized clocks.
  1797. Also
  1798. unlike Kerberos, Plan 9 authentication supports a `speaks for'
  1799. relation [LABW91] that enables one user to have the authority
  1800. of another;
  1801. this is how a CPU server runs processes on behalf of its clients.
  1802. </P>
  1803. <P>
  1804. Plan 9's authentication structure builds
  1805. secure services rather than depending on firewalls.
  1806. Whereas firewalls require special code for every service penetrating the wall,
  1807. the Plan 9 approach permits authentication to be done in a single place&#173;9P&#173;for
  1808. all services.
  1809. For example, the
  1810. <TT>cpu</TT>
  1811. command works securely across the Internet.
  1812. </P>
  1813. <H4>Authenticating external connections
  1814. </H4>
  1815. <P>
  1816. The regular Plan 9 authentication protocol is not suitable for text-based services such as
  1817. Telnet
  1818. or FTP.
  1819. In such cases, Plan 9 users authenticate with hand-held DES calculators called
  1820. <I>authenticators</I>.
  1821. The authenticator holds a key for the user, distinct from
  1822. the user's normal authentication key.
  1823. The user `logs on' to the authenticator using a 4-digit PIN.
  1824. A correct PIN enables the authenticator for a challenge/response exchange with the server.
  1825. Since a correct challenge/response exchange is valid only once
  1826. and keys are never sent over the network,
  1827. this procedure is not susceptible to replay attacks, yet
  1828. is compatible with protocols like Telnet and FTP.
  1829. </P>
  1830. <H4>Special users
  1831. </H4>
  1832. <P>
  1833. Plan 9 has no super-user.
  1834. Each server is responsible for maintaining its own security, usually permitting
  1835. access only from the console, which is protected by a password.
  1836. For example, file servers have a unique administrative user called
  1837. <TT>adm</TT>,
  1838. with special privileges that apply only to commands typed at the server's
  1839. physical console.
  1840. These privileges concern the day-to-day maintenance of the server,
  1841. such as adding new users and configuring disks and networks.
  1842. The privileges do
  1843. <I>not</I>
  1844. include the ability to modify, examine, or change the permissions of any files.
  1845. If a file is read-protected by a user, only that user may grant access to others.
  1846. </P>
  1847. <P>
  1848. CPU servers have an equivalent user name that allows administrative access to
  1849. resources on that server such as the control files of user processes.
  1850. Such permission is necessary, for example, to kill rogue processes, but
  1851. does not extend beyond that server.
  1852. On the other hand, by means of a key
  1853. held in protected non-volatile RAM,
  1854. the identity of the administrative user is proven to the
  1855. authentication server.
  1856. This allows the CPU server to authenticate remote users, both
  1857. for access to the server itself and when the CPU server is acting
  1858. as a proxy on their behalf.
  1859. </P>
  1860. <P>
  1861. Finally, a special user called
  1862. <TT>none</TT>
  1863. has no password and is always allowed to connect;
  1864. anyone may claim to be
  1865. <TT>none</TT>.
  1866. <TT>None</TT>
  1867. has restricted permissions; for example, it is not allowed to examine dump files
  1868. and can read only world-readable files.
  1869. </P>
  1870. <P>
  1871. The idea behind
  1872. <TT>none</TT>
  1873. is analogous to the anonymous user in FTP
  1874. services.
  1875. On Plan 9, guest FTP servers are further confined within a special
  1876. restricted name space.
  1877. It disconnects guest users from system programs, such as the contents of
  1878. <TT>/bin</TT>,
  1879. but makes it possible to make local files available to guests
  1880. by binding them explicitly into the space.
  1881. A restricted name space is more secure than the usual technique of exporting
  1882. an ad hoc directory tree; the result is a kind of cage around untrusted users.
  1883. </P>
  1884. <H4>The cpu command and proxied authentication
  1885. </H4>
  1886. <P>
  1887. When a call is made to a CPU server for a user, say Peter,
  1888. the intent is that Peter wishes to run processes with his own authority.
  1889. To implement this property,
  1890. the CPU server does the following when the call is received.
  1891. First, the listener forks off a process to handle the call.
  1892. This process changes to the user
  1893. <TT>none</TT>
  1894. to avoid giving away permissions if it is compromised.
  1895. It then performs the authentication protocol to verify that the
  1896. calling user really is Peter, and to prove to Peter that
  1897. the machine is itself trustworthy.
  1898. Finally, it reattaches to all relevant file servers using the
  1899. authentication protocol to identify itself as Peter.
  1900. In this case, the CPU server is a client of the file server and performs the
  1901. client portion of the authentication exchange on behalf of Peter.
  1902. The authentication server will give the process tickets to
  1903. accomplish this only if the CPU server's administrative user name is allowed to
  1904. <I>speak for</I>
  1905. Peter.
  1906. </P>
  1907. <P>
  1908. The
  1909. <I>speaks for</I>
  1910. relation [LABW91] is kept in a table on the authentication server.
  1911. To simplify the management of users computing in different authentication domains,
  1912. it also contains mappings between user names in different domains,
  1913. for example saying that user
  1914. <TT>rtm</TT>
  1915. in one domain is the same person as user
  1916. <TT>rtmorris</TT>
  1917. in another.
  1918. </P>
  1919. <H4>File Permissions
  1920. </H4>
  1921. <P>
  1922. One of the advantages of constructing services as file systems
  1923. is that the solutions to ownership and permission problems fall out naturally.
  1924. As in UNIX,
  1925. each file or directory has separate read, write, and execute/search permissions
  1926. for the file's owner, the file's group, and anyone else.
  1927. The idea of group is unusual:
  1928. any user name is potentially a group name.
  1929. A group is just a user with a list of other users in the group.
  1930. Conventions make the distinction: most people have user names without group members,
  1931. while groups have long lists of attached names. For example, the
  1932. <TT>sys</TT>
  1933. group traditionally has all the system programmers,
  1934. and system files are accessible
  1935. by group
  1936. <TT>sys</TT>.
  1937. Consider the following two lines of a user database stored on a server:
  1938. <DL><DT><DD><TT><PRE>
  1939. pjw:pjw:
  1940. sys::pjw,ken,philw,presotto
  1941. </PRE></TT></DL>
  1942. The first establishes user
  1943. <TT>pjw</TT>
  1944. as a regular user. The second establishes user
  1945. <TT>sys</TT>
  1946. as a group and lists four users who are
  1947. <I>members</I>
  1948. of that group.
  1949. The empty colon-separated field is space for a user to be named as the
  1950. <I>group</I>
  1951. <I>leader</I>.
  1952. If a group has a leader, that user has special permissions for the group,
  1953. such as freedom to change the group permissions
  1954. of files in that group.
  1955. If no leader is specified, each member of the group is considered equal, as if each were
  1956. the leader.
  1957. In our example, only
  1958. <TT>pjw</TT>
  1959. can add members to his group, but all of
  1960. <TT>sys</TT>'s
  1961. members are equal partners in that group.
  1962. </P>
  1963. <P>
  1964. Regular files are owned by the user that creates them.
  1965. The group name is inherited from the directory holding the new file.
  1966. Device files are treated specially:
  1967. the kernel may arrange the ownership and permissions of
  1968. a file appropriate to the user accessing the file.
  1969. </P>
  1970. <P>
  1971. A good example of the generality this offers is process files,
  1972. which are owned and read-protected by the owner of the process.
  1973. If the owner wants to let someone else access the memory of a process,
  1974. for example to let the author of a program debug a broken image, the standard
  1975. <TT>chmod</TT>
  1976. command applied to the process files does the job.
  1977. </P>
  1978. <P>
  1979. Another unusual application of file permissions
  1980. is the dump file system, which is not only served by the same file
  1981. server as the original data, but represented by the same user database.
  1982. Files in the dump are therefore given identical protection as files in the regular
  1983. file system;
  1984. if a file is owned by
  1985. <TT>pjw</TT>
  1986. and read-protected, once it is in the dump file system it is still owned by
  1987. <TT>pjw</TT>
  1988. and read-protected.
  1989. Also, since the dump file system is immutable, the file cannot be changed;
  1990. it is read-protected forever.
  1991. Drawbacks are that if the file is readable but should have been read-protected,
  1992. it is readable forever, and that user names are hard to re-use.
  1993. </P>
  1994. <H4>Performance
  1995. </H4>
  1996. <P>
  1997. As a simple measure of the performance of the Plan 9 kernel,
  1998. we compared the
  1999. time to do some simple operations on Plan 9 and on SGI's IRIX Release 5.3
  2000. running on an SGI Challenge M with a 100MHz MIPS R4400 and a 1-megabyte
  2001. secondary cache.
  2002. The test program was written in Alef,
  2003. compiled with the same compiler,
  2004. and run on identical hardware,
  2005. so the only variables are the operating system and libraries.
  2006. </P>
  2007. <P>
  2008. The program tests the time to do a context switch
  2009. (<TT>rendezvous</TT>
  2010. on Plan 9,
  2011. <TT>blockproc</TT>
  2012. on IRIX);
  2013. a trivial system call
  2014. (<TT>rfork(0)</TT>
  2015. and
  2016. <TT>nap(0)</TT>);
  2017. and
  2018. lightweight fork
  2019. (<TT>rfork(RFPROC)</TT>
  2020. and
  2021. <TT>sproc(PR_SFDS|PR_SADDR)</TT>).
  2022. It also measures the time to send a byte on a pipe from one process
  2023. to another and the throughput on a pipe between two processes.
  2024. The results appear in Table 1.
  2025. <br><img src="-.6031.gif"><br>
  2026. Table 1. Performance comparison.
  2027. </P>
  2028. <br>&#32;<br>
  2029. Although the Plan 9 times are not spectacular, they show that the kernel is
  2030. competitive with commercial systems.
  2031. <H4>Discussion
  2032. </H4>
  2033. <P>
  2034. Plan 9 has a relatively conventional kernel;
  2035. the system's novelty lies in the pieces outside the kernel and the way they interact.
  2036. When building Plan 9, we considered all aspects
  2037. of the system together, solving problems where the solution fit best.
  2038. Sometimes the solution spanned many components.
  2039. An example is the problem of heterogeneous instruction architectures,
  2040. which is addressed by the compilers (different code characters, portable
  2041. object code),
  2042. the environment
  2043. (<TT>$cputype</TT>
  2044. and
  2045. <TT>$objtype</TT>),
  2046. the name space
  2047. (binding in
  2048. <TT>/bin</TT>),
  2049. and other components.
  2050. Sometimes many issues could be solved in a single place.
  2051. The best example is 9P,
  2052. which centralizes naming, access, and authentication.
  2053. 9P is really the core
  2054. of the system;
  2055. it is fair to say that the Plan 9 kernel is primarily a 9P multiplexer.
  2056. </P>
  2057. <P>
  2058. Plan 9's focus on files and naming is central to its expressiveness.
  2059. Particularly in distributed computing, the way things are named has profound
  2060. influence on the system [Nee89].
  2061. The combination of
  2062. local name spaces and global conventions to interconnect networked resources
  2063. avoids the difficulty of maintaining a global uniform name space,
  2064. while naming everything like a file makes the system easy to understand, even for
  2065. novices.
  2066. Consider the dump file system, which is trivial to use for anyone familiar with
  2067. hierarchical file systems.
  2068. At a deeper level, building all the resources above a single uniform interface
  2069. makes interoperability easy.
  2070. Once a resource exports a 9P interface,
  2071. it can combine transparently
  2072. with any other part of the system to build unusual applications;
  2073. the details are hidden.
  2074. This may sound object-oriented, but there are distinctions.
  2075. First, 9P defines a fixed set of `methods'; it is not an extensible protocol.
  2076. More important,
  2077. files are well-defined and well-understood
  2078. and come prepackaged with familiar methods of access, protection, naming, and
  2079. networking.
  2080. Objects, despite their generality, do not come with these attributes defined.
  2081. By reducing `object' to `file', Plan 9 gets some technology for free.
  2082. </P>
  2083. <P>
  2084. Nonetheless, it is possible to push the idea of file-based computing too far.
  2085. Converting every resource in the system into a file system is a kind of metaphor,
  2086. and metaphors can be abused.
  2087. A good example of restraint is
  2088. <TT>/proc</TT>,
  2089. which is only a view of a process, not a representation.
  2090. To run processes, the usual
  2091. <TT>fork</TT>
  2092. and
  2093. <TT>exec</TT>
  2094. calls are still necessary, rather than doing something like
  2095. <DL><DT><DD><TT><PRE>
  2096. cp /bin/date /proc/clone/mem
  2097. </PRE></TT></DL>
  2098. The problem with such examples is that they require the server to do things
  2099. not under its control.
  2100. The ability to assign meaning to a command like this does not
  2101. imply the meaning will fall naturally out of the structure of answering the 9P requests
  2102. it generates.
  2103. As a related example, Plan 9 does not put machine's network names in the file
  2104. name space.
  2105. The network interfaces provide a very different model of naming, because using
  2106. <TT>open</TT>,
  2107. <TT>create</TT>,
  2108. <TT>read</TT>,
  2109. and
  2110. <TT>write</TT>
  2111. on such files would not offer a suitable place to encode all the details of call
  2112. setup for an arbitrary network.
  2113. This does not mean that the network interface cannot be file-like, just that it must
  2114. have a more tightly defined structure.
  2115. </P>
  2116. <P>
  2117. What would we do differently next time?
  2118. Some elements of the implementation are unsatisfactory.
  2119. Using streams to implement network interfaces in the kernel
  2120. allows protocols to be connected together dynamically,
  2121. such as to attach the same TTY driver to TCP, URP, and
  2122. IL connections,
  2123. but Plan 9 makes no use of this configurability.
  2124. (It was exploited, however, in the research UNIX system for which
  2125. streams were invented.)
  2126. Replacing streams by static I/O queues would
  2127. simplify the code and make it faster.
  2128. </P>
  2129. <P>
  2130. Although the main Plan 9 kernel is portable across many machines,
  2131. the file server is implemented separately.
  2132. This has caused several problems:
  2133. drivers that must be written twice,
  2134. bugs that must be fixed twice,
  2135. and weaker portability of the file system code.
  2136. The solution is easy: the file server kernel should be maintained
  2137. as a variant of the regular operating system, with no user processes and
  2138. special compiled-in
  2139. kernel processes to implement file service.
  2140. Another improvement to the file system would be a change of internal structure.
  2141. The WORM jukebox is the least reliable piece of the hardware, but because
  2142. it holds the metadata of the file system, it must be present in order to serve files.
  2143. The system could be restructured so the WORM is a backup device only, with the
  2144. file system proper residing on magnetic disks.
  2145. This would require no change to the external interface.
  2146. </P>
  2147. <P>
  2148. Although Plan 9 has per-process name spaces, it has no mechanism to give the
  2149. description of a process's name space to another process except by direct inheritance.
  2150. The
  2151. <TT>cpu</TT>
  2152. command, for example, cannot in general reproduce the terminal's name space;
  2153. it can only re-interpret the user's login profile and make substitutions for things like
  2154. the name of the binary directory to load.
  2155. This misses any local modifications made before running
  2156. <TT>cpu</TT>.
  2157. It should instead be possible to capture the terminal's name space and transmit
  2158. its description to a remote process.
  2159. </P>
  2160. <P>
  2161. Despite these problems, Plan 9 works well.
  2162. It has matured into the system that supports our research,
  2163. rather than being the subject of the research itself.
  2164. Experimental new work includes developing interfaces to faster networks,
  2165. file caching in the client kernel,
  2166. encapsulating and exporting name spaces,
  2167. and the ability to re-establish the client state after a server crash.
  2168. Attention is now focusing on using the system to build distributed applications.
  2169. </P>
  2170. <P>
  2171. One reason for Plan 9's success is that we use it for our daily work, not just as a research tool.
  2172. Active use forces us to address shortcomings as they arise and to adapt the system
  2173. to solve our problems.
  2174. Through this process, Plan 9 has become a comfortable, productive programming
  2175. environment, as well as a vehicle for further systems research.
  2176. </P>
  2177. <H4>References
  2178. <DL COMPACT>
  2179. <DT>[9man]<DD>
  2180. Plan 9 Programmer's Manual,
  2181. Volume 1,
  2182. AT&amp;T Bell Laboratories,
  2183. Murray Hill, NJ,
  2184. 1995.
  2185. <DT>[ANSIC]<DD>
  2186. <I>American National Standard for Information Systems -
  2187. Programming Language C</I>, American National Standards Institute, Inc.,
  2188. New York, 1990.
  2189. <DT>[Duff90]<DD>
  2190. Tom Duff, ``Rc - A Shell for Plan 9 and UNIX systems'',
  2191. Proc. of the Summer 1990 UKUUG Conf.,
  2192. London, July, 1990, pp. 21-33, reprinted, in a different form, in this volume.
  2193. <DT>[Fra80]<DD>
  2194. A.G. Fraser,
  2195. ``Datakit - A Modular Network for Synchronous and Asynchronous Traffic'',
  2196. Proc. Int. Conf. on Commun.,
  2197. June 1980, Boston, MA.
  2198. <DT>[FSSUTF]<DD>
  2199. File System Safe UCS Transformation Format (FSS-UTF),
  2200. X/Open Preliminary Specification, 1993.
  2201. ISO designation is
  2202. ISO/IEC JTC1/SC2/WG2 N 1036, dated 1994-08-01.
  2203. <DT>[ISO10646] <DD>
  2204. ISO/IEC DIS 10646-1:1993
  2205. Information technology -
  2206. Universal Multiple-Octet Coded Character Set (UCS) &#173;
  2207. Part 1: Architecture and Basic Multilingual Plane.
  2208. <DT>[Kill84]<DD>
  2209. T.J. Killian,
  2210. ``Processes as Files'',
  2211. USENIX Summer 1984 Conf. Proc.,
  2212. June 1984, Salt Lake City, UT.
  2213. <DT>[LABW91] <DD>
  2214. Butler Lampson,
  2215. Mart&iacute;n Abadi,
  2216. Michael Burrows, and
  2217. Edward Wobber,
  2218. ``Authentication in Distributed Systems: Theory and Practice'',
  2219. Proc. 13th ACM Symp. on Op. Sys. Princ.,
  2220. Asilomar, 1991,
  2221. pp. 165-182.
  2222. <DT>[MBSS87] <DD>
  2223. S. P. Miller,
  2224. B. C. Neumann,
  2225. J. I. Schiller, and
  2226. J. H. Saltzer,
  2227. ``Kerberos Authentication and Authorization System'',
  2228. Massachusetts Institute of Technology,
  2229. 1987.
  2230. <DT>[NBS77]<DD>
  2231. National Bureau of Standards (U.S.),
  2232. Federal Information Processing Standard 46,
  2233. National Technical Information Service, Springfield, VA, 1977.
  2234. <DT>[Nee89]<DD>
  2235. R. Needham, ``Names'', in
  2236. Distributed systems,
  2237. S. Mullender, ed.,
  2238. Addison Wesley, 1989
  2239. <DT>[NeHe82] <DD>
  2240. R.M. Needham and A.J. Herbert,
  2241. The Cambridge Distributed Computing System,
  2242. Addison-Wesley, London, 1982
  2243. <DT>[Neu92]<DD>
  2244. B. Clifford Neuman,
  2245. ``The Prospero File System'',
  2246. USENIX File Systems Workshop Proc.,
  2247. Ann Arbor, 1992, pp. 13-28.
  2248. <DT>[OCDNW88] <DD>
  2249. John Ousterhout, Andrew Cherenson, Fred Douglis, Mike Nelson, and Brent Welch,
  2250. ``The Sprite Network Operating System'',
  2251. IEEE Computer,
  2252. 21(2), 23-38, Feb. 1988.
  2253. <DT>[Pike87]<DD>
  2254. Rob Pike, ``The Text Editor <TT>sam</TT>'',
  2255. Software - Practice and Experience,
  2256. Nov 1987, <B>17</B>(11), pp. 813-845; reprinted in this volume.
  2257. <DT>[Pike91]<DD>
  2258. Rob Pike, ``8&#189;, the Plan 9 Window System'',
  2259. USENIX Summer Conf. Proc.,
  2260. Nashville, June, 1991, pp. 257-265,
  2261. reprinted in this volume.
  2262. <DT>[Pike93]<DD>
  2263. Rob Pike and Ken Thompson, ``Hello World or &#191;ALPHA&#191;&#191;MU&#191;&#191;ALPHA &#191;&#191;&#191;MUEPSILON or
  2264. &#191;&#191;&#191;&#191;&#191; &#191;&#191;'',
  2265. USENIX Winter Conf. Proc.,
  2266. San Diego, 1993, pp. 43-50,
  2267. reprinted in this volume.
  2268. <DT>[Pike94]<DD>
  2269. Rob Pike,
  2270. ``Acme: A User Interface for Programmers'',
  2271. USENIX Proc. of the Winter 1994 Conf.,
  2272. San Francisco, CA,
  2273. <DT>[Pike95]<DD>
  2274. Rob Pike,
  2275. ``How to Use the Plan 9 C Compiler'',
  2276. Plan 9 Programmer's Manual,
  2277. Volume 2,
  2278. AT&amp;T Bell Laboratories,
  2279. Murray Hill, NJ,
  2280. 1995.
  2281. <DT>[POSIX]<DD>
  2282. Information Technology&#173;Portable Operating
  2283. System Interface (POSIX) Part 1:
  2284. System Application Program Interface (API)
  2285. [C Language],
  2286. IEEE, New York, 1990.
  2287. <DT>[PPTTW93] <DD>
  2288. Rob Pike, Dave Presotto, Ken Thompson, Howard Trickey, and Phil Winterbottom, ``The Use of Name Spaces in Plan 9'',
  2289. Op. Sys. Rev.,
  2290. Vol. 27, No. 2, April 1993, pp. 72-76,
  2291. reprinted in this volume.
  2292. <DT>[Presotto]<DD>
  2293. Dave Presotto,
  2294. ``Multiprocessor Streams for Plan 9'',
  2295. UKUUG Summer 1990 Conf. Proc.,
  2296. July 1990, pp. 11-19.
  2297. <DT>[PrWi93]<DD>
  2298. Dave Presotto and Phil Winterbottom,
  2299. ``The Organization of Networks in Plan 9'',
  2300. USENIX Proc. of the Winter 1993 Conf.,
  2301. San Diego, CA,
  2302. pp. 43-50,
  2303. reprinted in this volume.
  2304. <DT>[PrWi95]<DD>
  2305. Dave Presotto and Phil Winterbottom,
  2306. ``The IL Protocol'',
  2307. Plan 9 Programmer's Manual,
  2308. Volume 2,
  2309. AT&amp;T Bell Laboratories,
  2310. Murray Hill, NJ,
  2311. 1995.
  2312. <DT>[RFC768] <DD>
  2313. J. Postel, RFC768,
  2314. <I>User Datagram Protocol,</I>
  2315. <I>DARPA Internet Program Protocol Specification,</I>
  2316. August 1980.
  2317. <DT>[RFC793] <DD>
  2318. RFC793,
  2319. <I>Transmission Control Protocol,</I>
  2320. <I>DARPA Internet Program Protocol Specification,</I>
  2321. September 1981.
  2322. <DT>[Rao91]<DD>
  2323. Herman Chung-Hwa Rao,
  2324. The Jade File System,
  2325. (Ph. D. Dissertation),
  2326. Dept. of Comp. Sci,
  2327. University of Arizona,
  2328. TR 91-18.
  2329. <DT>[Rit84]<DD>
  2330. D.M. Ritchie,
  2331. ``A Stream Input-Output System'',
  2332. AT&amp;T Bell Laboratories Technical Journal,
  2333. <B>63</B>(8), October, 1984.
  2334. <DT>[Tric95]<DD>
  2335. Howard Trickey,
  2336. ``APE &#173; The ANSI/POSIX Environment'',
  2337. Plan 9 Programmer's Manual,
  2338. Volume 2,
  2339. AT&amp;T Bell Laboratories,
  2340. Murray Hill, NJ,
  2341. 1995.
  2342. <DT>[Unicode]<DD>
  2343. The Unicode Standard,
  2344. Worldwide Character Encoding,
  2345. Version 1.0, Volume 1,
  2346. The Unicode Consortium,
  2347. Addison Wesley,
  2348. New York,
  2349. 1991.
  2350. <DT>[UNIX85]<DD>
  2351. UNIX Time-Sharing System Programmer's Manual,
  2352. Research Version, Eighth Edition, Volume 1.
  2353. AT&amp;T Bell Laboratories, Murray Hill, NJ, 1985.
  2354. <DT>[Welc94]<DD>
  2355. Brent Welch,
  2356. ``A Comparison of Three Distributed File System Architectures: Vnode, Sprite, and Plan 9'',
  2357. Computing Systems,
  2358. 7(2), pp. 175-199, Spring, 1994.
  2359. <DT>[Wint95]<DD>
  2360. Phil Winterbottom,
  2361. ``Alef Language Reference Manual'',
  2362. Plan 9 Programmer's Manual,
  2363. Volume 2,
  2364. AT&amp;T Bell Laboratories,
  2365. Murray Hill, NJ,
  2366. 1995.
  2367. </H4>
  2368. </dl>
  2369. <br>&#32;<br>
  2370. <A href=http://www.lucent.com/copyright.html>
  2371. Copyright</A> &#169; 2001 Lucent Technologies Inc. All rights reserved.
  2372. </body></html>