Home > Archive > Linux/Unix > April 2004 > Notes From A Plan 9 User





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Notes From A Plan 9 User
Papiya

2003-07-13, 1:26 pm

I have been using Plan 9 for nearly a year now and since this forum seems to be the one where the computer hobbyists frequent, I'll just put my two cents in here. Plan 9 is an operating system. It is the intellectual and philosophical successor to Unix, and was created by the same group of people. It takes most of the good ideas in Unix to the next level, and gets rid of a lot of the baggage that had accumulated over the years.
For instance, there are no PTY's in Plan 9, and only minimal support for a "console". Why? Because it's assumed that in this day and age, you have a bitmapped display capable of running a modern window system
that provides a superset of the features traditionally found in the kernel's TTY driver. There are no signals, since the system provides a mechanism for interupting a process, and other forms of IPC are more
convenient for most of what signals were commonly used for. Other little problems are fixed; pipes are full duplex (that is, bi-directional), symbolic links disappear (there's another mechanism that is once
again offers a superset of their functionality), the idea of a root or super-user is done away with, setuid and setgid binaries disappear, the authentication model is significantly strengthened, the (user-level) authorization model is generalized, the system supports UNICODE instead
of ASCII as the basic character encoding (and provides fonts for quite a few languages), most of the utilities have been re-implemented to take advantage of these enhancements and fix little problems here and there, etc. Cross compilation is now handled cleanly and is well integrated
into the base system. System administration is considerably simplified.

When using the system in the distributed mode alluded to above, machines on the network are classified into three different sets: fileservers, which hold large repositories of data, CPU servers that are shared multi-processor machines with fast CPUs, lots of memory, and fast connections to
the fileservers, and terminals which users work with and have nice display multimedia capabilities, a keyboard and mouse, a slow to medium power CPU (you can use a fast one and it won't hurt anything), a modest amount of RAM (you can stick a lot in a terminal if you want and again, it won't hurt anything), and a slow to medium speed connection to the fileservers. In a typical installation, the fileserver might be a mid-range Pentium
or AMD machine with a few hundred megs of RAM, a huge amount of disk, and a gigabit ethernet connection. A CPU server might be a dual or quad processor AMD machine with really fast processors, a few gigs of RAM and
a gigabit ethernet interface or 3. A terminal might be a normal desktop
machine with a couple hundred megs of RAM, a really nice display, nice speakers, a standard fast ethernet interface, and enough CPU horses to drive all of the above at a good clip. These all interact in a novel
and ubiquitous way.

The biggest advance in Plan 9 is the pervasive use of files and filesystems to provide services, and how this is used in per-process file namespaces. Where in Unix everything is supposed to be a file,
it often isn't. Instead, it's some weird interface like ioctl or sockets, which kinda sorta look like files, but aren't really.
In Plan 9, everything really *is* a file. For instance, network communication is done by creating and opening files (no more sockets). Setting the speed on a serial port is done by writing a string to a file.
Getting the status of a device is done by reading a file. Seeing the size of a disk or partition is done by stat'ing a file and looking at the size field in the stat structure (or, more commonly, by running
ls -l on it). Access to the window system is done through files. What's more, all files are served by a single, easy to implement and
efficient protocol called 9P. This protocol can run over just about anything, including TLS-encrypted TCP, and 9P connections are usually authenticated using a Kerberos-like protocol (though just about any mechanism can be used; authentication, by the way, is built into another program that applications interact with via, yup you guessed it, files.
Only in this case, the files don't really exist on disk, but represent IPC endpoints provided by the authentication manager. In this respect they're like named pipes or Unix domain sockets. This means that to
add another authentication mechanism, one need only implement it in the authentication manager; you don't even have to relink the applications that might use it). What's more, a user can arbitrarily modify their
personal view of the filesystem namespace on a per-process basis. So, I might sweep open a new window, and import some resource from a remote server and overlay that onto some local part of my view of the filesystem.
Other processes running in another window won't be bothered by or even notice the change. Using the system primitives, I can bind names onto other names, making parts of the file namespace visible from multiple
locations. This was how we got rid of symbolic links; we just replaced them with the binding primitive. A collolary of this is that one can get networked window systems over an encrypted authenticated channel for free. Simply login to a remote machine and import your filesystem namespace from
your client. Bind your local window system onto the place the remote system expects it, and any graphical application you want just runs, coming up on your local display. Similarly with, for instance, sound.
What's more, since the window system is basically just a multiplexor for the underlying primitives, you can run the window system recursively. That is, you can run it in a window (which makes it nice to debug).

Another thing that usually shocks new users is that there are no backup tools like dump or tar. Instead, once a day at 5am (or whenever the sysadmin decides to run it) the entire filesystem is marked copy on write and anything that's changed in the last day is sent off to a tertiary storage system for permanent archival. As blocks are copied,
the filesystem computes the SHA-1 hash of the contents and uses that as a key into an index of disk blocks. Blocks with the same signature are stored in the same disk block (which can be replicated, striped across multiple devices, etc). So the net effect is that replicated data is only stored once. If you make a copy of a file, the data in the
file won't take up any more space on the archive than it already does. The fileserver also compresses blocks as it archives them, so it's very efficient. If you want to get access to the archive, you can do so through a filesystem interface. So you can effectively cd back in time. There's also a command, called "yesterday", that lets
me look for the most recent version of a file in the archive, diff it against a local copy, etc. Since the archives look like a filesystem, and I can change around my namespace any way I like, I can bind things
from the archives into my active working space. So if, for instance,
I'm writing a program and I think a change I made to a library might be messing it up, I can bind yesterday's version of the library over the version I'm using now, relink it, and test using the old library, without
doing anything special on my part. Since the fileserver is efficient, if I recreate the entire library, but only change one file in it, only the parts that have changed are stored again.

To successfully use Plan 9, one has to forget a fair amount of what one knows and (more importantly) expects from Unix. To the user, Plan 9 looks an awful lot like Unix, but it really isn't. If one goes
into it thinking it's just Unix with some enhancements, one will be very disappointed and frustrated. Looking for standard Unix paradigms in another environment that's cursorily similar but actually quite
different is the single biggest hurdle new comers have to overcome.

The single biggest problem is that it's a 0% system. That is, 0% of the world uses and supports it, so there's a lack of applications and third party tools, and documentation is sparse and what's there is
aimed at an academic audience. There's very little in the way of "How-To"
style documents. There are very few compilers; there's no C++, Java,
Ada, or FORTRAN for instance (though there is a GCC port that has these things; it's quirky). The dialect of C that Plan 9 uses isn't ANSI/ISO C, but their own version. There *is* an ANSI/POSIX emulation environment so it's not too difficult to port Unix software as long as it actually
conforms to the standards (most doesn't, though and some things, like
pthreads and curses are missing).

The lack of a TTY subsystem can be irritating at times. For instance,
if you're stuck in front of a machine that can only use telnet or SSH to login, you'll have an unauthentic and often frustrating experience because you aren't using the window system (consider logging in to check
your email from a cybercafe or place like that). This is often worked around by installing "drawterm," a program that runs on Windows and Unix (including MacOS X) that emulates enough of the Plan 9 kernel to start
export a graphics interface to a remote CPU server and start the window system, effectively giving you a Plan 9 desktop running in a window.

A lot of utilities people consider essential under Unix or windows don't exist. There's no word processor, spreadsheet, database package (well, there's a really small one), page layout program, web browser,
etc). There's no emacs (though there is a man page; have a look at:
http://plan9.bell-labs.com/magic/man2html/1/emacs), and vi is a MIPS emulator. At the labs, they work around most of this stuff by running a
VNC client under Plan 9 that logs into a Unix machine where they can run that stuff. There's a mechanism for sending messages to processes, so they can send things to, e.g., a web browser but it's still unsatisfying
since you lose the nice file integration stuff I mentioned earlier.

Another big problem is that, since there's a very small team of people working on Plan 9, none of whom are getting paid to do so actively, it's way behind in terms of hardware support and drivers. Commercial vendors don't write drivers for it, one has to roll one's own (which isn't so
bad if you can get the device specs; the kernel is nice to work with). In general, when building Plan 9 stuff, one has to be careful to get hardware that's supported by the system, unless you want to be stuck
writing device drivers. A side effect of the small support team is that non-critical bugs and asthetic worts can linger for a long time. Even if you fix them yourself and send them into Bell Labs, they can still
linger for a while until someone gets around to incorporating them (and unlike Linux, it's not a free for all; new stuff has to integrate cleanly into the system of they won't incorporate it. For instance, you'd have a hard time getting them to incorporate a Mozilla or OpenOffice port. Hell will freeze over before they ship emacs with the system).

So, the next obvious question is, "why would I want to use it?" or, "who uses it? What kind of people are interested in this system?" Those are totally fair questions, and the answers depend. If you're
the type of person who likes to play around and experiment with new computing paradigms, by all means install Plan 9 and set up a little network because it's a departure from the usual way of doing things, and you'll probably find it refreshing. If you're a person who wants a nice Unix-like environment on which to write Java and C++ code and run Mathematica and LaTeX, it's probably not for you since those things don't exist under Plan 9 (well, LaTeX does, but the rest don't). You'd be happier using something like Linux or one of the BSD's. If you want to investigate distributed computing, Plan 9 might be very nice;
the communication paradigm is novel and makes it easy to distribute applications all over the place using simple, well understood primitives. If you want to do production distributed computing, maybe using something
like CORBA, it's not for you. If you want to do experimentation in large scale cluster computing paradigms, by all means check it out. If you want to run large scientific codes *now*, then look for something like Linux or the BSD's and MPI; there's no MPI or FORTRAN compiler for Plan 9. If you absolutely need a good web browser and a graphical MP3 player, it's definitely not for you. Most of the people working on it now are doing so because it meets their needs (or most of them, anyway), they're
researchers in the field, and they like it. Some are doing it because they *don't* like Unix and want something cleaner with a better design. Almost everyone is doing it because it's fun (or at least funner than
the alternative).

Hope this interested someone else enough to give it a shot.

Get it here: www.cs.bell-labs.com/plan9dist/
mikop

2003-07-13, 10:26 pm

The article and its site sum it up pretty well... this is a very specific OS that address very specific needs.

as tempting as that bunny is cute, for me personally there is just simply too many platforms out there that I still can't consider myself to be proficient in...

time investment wise... learning more about VMS would still rank a bit higher

Glenda the bunny is cute tho...

if I had even a remote goal where this can be the platform to use, I would try it, but unfortunately I don't.

interesting stuff tho, good info.

they sell a plan 9 T-shirt on the nuova site, does it have the bunny on it?

edit:

"Feel free to use these images to make t-shirts and other paraphernalia, but if you do a production run, please send us a sample for our collection. "


hmmm maybe I will finally get one of those do it yourself t-shirt screening thingy? that space glenda is neat.
prezbedard

2003-07-14, 11:54 am

Good information you have given us. I won't pretend I understood it 100% It was a very intersting read non-the-less.
I agree with mikop. There is so nuch out there to learn about. Though it would be nice it is quite impractical for most.

Thanks for taking the time to share.
Papiya

2003-07-15, 1:30 pm

Well, I made the post for people who simply love computers and are interested in them, not mainly for those who use them mainly because they are useful.
prezbedard

2003-07-15, 1:40 pm

Well I am quite interested in them. However if I pursued my ever interest in computers alone I would get no where. The info is appreciated though.
Papiya

2003-07-16, 7:15 am

quote:
Originally posted by prezbedard
Well I am quite interested in them. However if I pursued my ever interest in computers alone I would get no where.


Tell that to Linus!
prezbedard

2003-07-16, 11:51 am

By "alone" I meant just my computer interests since I have many other area's of interests besides computers.
Dr. C

2004-04-16, 4:52 pm

I'm sorry but I have to say this. I have been using Plan 9 for about a month, and as far as I can tell, I can say this: Plan 9 sucks. Glenda, the window manager, looks almost as pleasant and functional as fvwm. Absolutely *ntohing* runs on Plan 9 . . . no browser, no editors, no this, no that, no command that I tried worked, there was little documentation, and in general, regardless of its technical merits, I am afraid that the environment sucks even worse than the movie.

Sorry.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2009 examnotes.net