The Plan 9 Network Operating System the OTHER OS Original Photo
Total Page:16
File Type:pdf, Size:1020Kb
KNOW-HOW Plan 9 The Plan 9 network operating system THE OTHER OS original photo: www.sxc.hu photo: original In the eery, distant days before the birth of Linux, a strange alien sys- tem set out to fulfill the promise of Unix. Descendents of that system are still living. We caught one and dissected it. BY OLIVER FROMMEL inux has its roots in the famous and develop Plan 9. The license was lib- install is spartan, but well-organized and AT&T Bell Labs, home of the orig- eralized over the years, and in 2003, more or less foolproof (Figure 1). The in- Linal Unix system. The Bell Labs Plan 9 was finally released under a rec- staller checks the current status after programmers have been busy ever since, ognized open source license. A commer- each step. An image for graphics adapt- and one of the fruits of their labors is the cial offshoot, known as Inferno, is also ers with Vesa mode support is also avail- distributed operating system Plan 9 [1]. available under a free license [2]. able. Plan 9 began in the late 1980s as a We had a look at the current “4th Edi- If you prefer not to experiment with a new system designed to address some tion” release of Plan 9 to see if this leg- full installation right now, you might like problems with Unix that the Bell engi- endary alternative is still alluring. to try your luck with a virtual machine. neers considered “too deep to fix.” This See the “Virtual Plan 9” box for details. new operating system did indeed come Getting Started If you are interested, you can also try out with some innovations that had an influ- The distribution takes the form of a a userspace-only install including Plan ence on later systems. But until recently, 65Mbyte packed ISO image, which is 9’s most important tools [3]. Plan 9 was under a proprietary license also suitable for use as a live CD. If you that never really caught on with users. have difficulty booting from the CD, you More Consistent than Unix Bell Labs and a small community of can check the website for a boot floppy The underlying concept for Plan 9 is that programmers have continued to perfect generator to match your hardware. The it is a distributed operating system, not 56 ISSUE 62 JANUARY 2006 WWW.LINUX - MAGAZINE.COM Plan 9 KNOW-HOW kernel mainstream vastly simplifies programming models. in version 2.6.14, The underlying model is based on thus removing any Niklaus Wirth’s Oberon [5], which in obstacles to Linux turn draws on the Xerox Cedar system. and Plan 9 interac- Plan 9’s desktop provides a simple pro- tion. gramming model with a file interface and elementary operations. For example, Namespaces a simple cat /dev/screen > output cre- Plan 9 takes this ates a screenshot of an application. In file-based design a contrast to this, the Rio implementation step further with is quite sophisticated: it comprises con- the concept of current processes and threads that call namespaces. Tra- each other reciprocally. ditionally, Unix Rio can be seen as a departure from manages all its re- the legacy, line-oriented terminal model sources in a single that harks back to the days when print- Figure 1: The so-called graphical installation displays the system load namespace, in ers really did echo user input. Linux still and a log window below the text-based menu. The tool suggests the which /dev/tty1 has residual traces of this line-oriented four required partitions. always represents heritage in the form of the many termi- the same terminal. nal window applications, from Xterm to like Unix, where network functionality is In contrast to this, Plan 9 applications the KDE console. This makes it possible added by mechanisms such as remote have their own namespaces, so that to enter input at any position in a win- login and networking filesystems. In /dev/window will always point to an ap- dow: users simply select a command Plan 9, networking is built into the foun- plication’s own window. and use the mouse to execute. As an ad- dations of the operating system. For ex- Union mount is another important fea- vanced windowing system, Rio makes ample, all resources can theoretically be ture. The union mount feature helps heavy use of any mouse buttons you distributed transparently across a Plan 9 simplify the management of resources have available. network. The system hides the fact that such as files and directories by mounting The Acme program is an unusual mix resources are non-local from the user. multiple directories in a single directory. of shell, editor, and windowing system. Plan 9 not only supports file servers, but This makes it possible to mount directo- Acme follows the principle we just out- also authentication servers and CPU ries with executables on the file server in lined but adds elementary menus to ter- servers. You can use Plan 9 to implement the local /bin directory, which removes minal windows and redirects output to grid systems such as 9grid. the need for typical PATH variable tricks. new subwindows (Figure 2). An X11 im- Plan 9 is based on the Unix paradigm Linux just recently adopted this design plementation of Acme, dubbed Wily, is that “Everything is a file.” Due to the with the overlay file system, Union-FS. based on the 9lib library [6]. huge collection of add-ons, Unix was in- Despite its advanced age, Rio can also creasingly forced to accept ad-hoc Graphics with Rio handle multi-language programs, as it changes that contravene this original In contrast to X11 on Unix, Plan 9 di- relies on Unicode character sets. Plan 9 principle. One example of this is the rectly integrates a GUI desktop, and this uses UTF-8 encoding, which was actu- ghastly socket interface, which uses read and write functions that are different The Name from normal files. Plan 9 puts an end to Plan 9 derives its name from the title of a It is interesting to consider whether Bell this, providing file-based system inter- cult trash film “Plan 9 from Outer engineers chose the name because they faces, for example, /net/tcp and /net/ Space,” by the genial Hollywood felt they were resurrecting the mortal re- udp, as network interfaces. dilettante, Ed Wood. According to the mains of Unix to attack the world. The Most system services follow the server FAQ [8], the name upholds the Bell Labs’ tantalizing similarity of "Solaranite" with principle and interact via file-based in- tradition of “selecting names that make "Solaris," another enemy weapon that terfaces. Plan 9 does not have the usual marketeers wince.” derives its power from a different Sun, FTP program. Instead, the ftps server In the film, which is often considered is perhaps stretching the metaphor, al- mounts the directory in /n/ftp on the Wood's greatest contribution to cinema, though the first versions of Solaris ap- server. The 9660fs server is responsible a pair of aliens launch a plan to resurrect peared when Plan 9 was in early devel- for mounting CD ROMs. Plan 9 was one dead people and create an army of opment. of the first operating systems to imple- zombies that will attack the capitals of Other Plan 9 names also contain refer- ment the Proc filesystem to support file- the Earth. The purpose of this gruesome ences to pop culture, such as the Acme based process control. Basic network mission is to stop humans from com- editor, named for the company in the functionality is provided by the Plan 9 pleting their work on the Solaranite, an Warner Brothers Roadrunner cartoon. file protocol, 9P, which comprises about exotic weapon that will "explode the par- The old windowing system was known ticles of sunlight" and destroy the uni- as 8 1/ 2, based on the name of a Fellini 30 protocol messages. A Linux imple- verse. movie. mentation [4] of 9P was added to the WWW.LINUX - MAGAZINE.COM ISSUE 62 JANUARY 2006 57 KNOW-HOW Plan 9 ally invented by the Plan 9 programming team led by Rob Pike. Security Plan 9 does not have a root superuser, and thus it does not have the kind of SUID programs that have caused no end of security problems on Unix. Following a similar approach to Kerberos, a distrib- uted Plan 9 system does not transmit passwords over the wire but uses en- crypted tickets instead. One way to cre- ate a user account, is to enable the Fossil fileserver by entering con /srv/fscons, and then give the uname user user com- mand. New users can initialize their en- vironments the first time they log in by entering /sys/lib/newuser. Of course, Plan 9 has developer tools for the C programming language. The compiler for the x86 architecture is titled 8c, the linker is 8l, and the build pro- gram is mk. To compile a new kernel Figure 2: A Plan 9 system in action. A multiply-tiled Acme editor window is hiding behind the with these tools, the sysop changes the mascot, Glenda, as is evidenced by the menu items: New, Cut, Paste, and so on. directory to /sys/src/9/pc and edits the corresponding configuration file, which able online and in the Plan 9 Wiki. Un- which continues to work hard on devel- can be named differently depending on fortunately, a lot of changes were intro- oping Plan 9, fights a constant battle the environment: in the simplest of duced with the 4th Edition, and this against the lack of resources.