Investigating the Plan 9 Operating System

Plan 9 is an operating system designed by the same people who created the original UNIX. Its development began in the late 1980’s and it was a research project intended to address a variety of system scalability issues that the UNIX and LINUX kernels don’t do particularly well, namely, distributed computing, distributed name spaces, and distributed file systems. Plan 9 is open source and its current and fourth major release was in 2002. It is
available as an install or LiveCD and it can be downloaded here. Note: This is an entry to our Alternative OS Contest.

Plan 9 does not have a lot of flashy demos and is not intended for home users. It is not intended for use by novices or as a starter operating system. Instead, it was intended as a platform for trying out new algorithms, new methodologies, and new technologies and it does these very well. Its development tools and documentation assume a fair amount of familiarity with UNIX fundamentals.

Similarities to and differences from UNIX

Plan 9 is similar to UNIX in that is has a kernel, a command shell, and various C compilers. It also has man pages and runs standard UNIX
applications like awk, emacs, cp, ls, and others listed here. It is different from UNIX in that the people who wrote it had 20 years of kernel and user experience to re-think and redesign the entire operating system. One major difference from UNIX and most other operating systems is that all major applications understand 9P, the underlying, distributed file system protocol. And because everything under Plan 9 is part of the file system, and the file system is distributed, everything under Plan 9 is distributed, and easily accessible as a file object.

Instead of the X11 window management system, Plan 9 has Rio. Rio is small, intuitive, and easy to program. A Plan 9 contributor, Geoff Collyer, wrote a graphics front end for the Reversi game in 469 lines of C code. That’s impressive. Because Rio sits on top of 9P, Rio itself is a distributed windowing system.

UNIX’s name server, BIND, has been replaced by ndb, which is easy to configure, much more secure, and is the partial basis for Plan 9’s powerful,
distributed name space.

Plan 9 does not use UNIX sockets for inter-process and inter-computer communications. Instead, all communications are done through 9P, the distributed file system paradigm. Protocol stacks and network cards are implemented as file system objects. Ethernet packet types are simply subdirectories. Plan 9 does have an extremely robust implementation of TCP/IP including IPV6. The abstraction of network communications separates ordinary programs from the gory details of network connection specifics. New protocols and transport media can be added or changed with virtually no impact on basic applications.

How is Plan 9 Better?

It was designed as a faster, cleaner, more-lightweight multi-processor operating system with better security in all aspects of operation. It uses
lightweight processes that were designed for fine-grained resource control across forks. The thread library uses no kernel support and this makes it very
quick. Plan 9’s system libraries were built with multi-processing and Unicode character support from day 1. In fact, UTF-8 was invented for Plan 9. These
libraries, in conjunction with a new generation of high performance Plan 9 compilers, make application development very fast and very reliable.

The Plan 9 security model is quite different from other mainstream operating systems. It has no root, administrator, or super user. Instead, local host owners have privileges over their own machines and can join various network groups that extend more privileges and access to resources such as printers or the CPU. Authentication is done using the Secstore client application. The Secstore server exchanges encrypted passwords or hardware passkeys, and stores sensitive information in memory.

Distributing resources is especially easy. Want to use someone else’s sound card? Simply import their /dev/audio. Remember that everything in Plan 9 is a file system object, including multimedia devices. Want to debug a process running on someone else’s machine? Simply import its /proc file.

Because all distributed resources have been rewritten for simplicity and efficiency, network administrators love it for its ease of use. Developers love Plan 9 because its libraries are elegant and the compilers are clean and fast.

How is Plan 9 worse?

As with other innovative operating systems, Plan 9 suffers from a lack of commercial support, a lack of device driver support, and a lack of mainstream applications. When this article was written Plan 9 did not have a web browser, it does not have support for VMWare virtualization (but does for Xen), it did not have accelerated video card support other than GForce and some Radeons, it supports only a few sound cards beyond AC97 and Soundblaster. It
did not have office productivity software. And it did not support Windows compatibility through Wine.

Why use Plan 9?

Plan 9 offers only a few advantages to single workstation users running in isolation. Its advantages grow rapidly as the number of networked Plan 9 workstations increase. If you are developing a large distributed computing application, using Plan 9 makes a lot of sense. If, for instance, you are performing large-scale scientific computing that needs to run across a large number of computers you are faced with a variety of difficult challenges. A particular problem in large node computing is that the failure of a single node can bring your whole computing cluster to a halt. This problem is
increasingly likely as the number of processors increase. Consider that a computer node with a mean time between failure of 10,000 hours (or about 1.15
years), when used in a cluster of 10,000 nodes will fail on average of once an hour. In other words, your large, expensive super-computer will crash once an hour. Plan 9 provides the basis for writing processes that can be mirrored or replicated in more efficient ways and can become fault tolerant. Without
increased fault tolerance, large scale computing just doesn’t scale well.

Taking the Plan 9 test drive

I downloaded the Plan9 installation ISO, burned the Install/LiveCD and tried it on five different computers with varying degrees of success. The supported hardware is somewhat limited so you should check the Supported
PC hardware list
to avoid the frustration of a failed install with cryptic error messages. After aborted installations on my home BH6, K7S5A, and Proliant systems I successfully booted the LiveCD on a Dell SC400. The default window size is 640*480 which is too small to get much done, but this is easily changed with the aux/vga command. By default you get a nice system load monitor, a date and time window, an rc shell window, and an acme window for integrated editing and executing.

Next I decided to install Plan 9 on an ancient IBM 390X Thinkpad laptop. The install script took me through several dozen input steps
most of which had defaults, which I accepted. The steps are described here. The only tricky part was deleting the existing NTFS file system and creating a new Plan 9 file system. The only frustrating part of the install was copying the distribution files from the install CD to the new file system. This took about 30 minutes. After installation the boot time was an impressive 12 seconds. Not bad on a 400 MHz laptop. Unfortunately the internal NeoMagic VGA was not supported and I couldn’t use the Rio window manager. I proceeded using the command line interpreter, rc.

Here’s how I created an account for myself:

term% con /srv/fscons
prompt: uname andrew andrew
prompt: uname sys +andew

I rebooted using reboot:

term% reboot

and logged in as andrew with permission to write to the /tmp folder. This permission is not given by default. Next I changed to the /tmp
directory:

term% cd /tmp

and used the ed editor to enter in a hello world program in the 8C C dialect:

term% ed
i
    #include 
    #include 
    void

    main(void)
    {
        print("hello world\\n");
        exits(0);
    }

w test.c
q

I compiled the C program with the 8C compiler:

term% 8c test.c

And linked it into an executable with the 8L linker:

term% 8l test.8

Then I ran my new executable:

term% 8.out
hello world

Not exactly rocket science but it worked out of the box.

What’s happening with Plan 9 now?

Although the original Bell Labs department that created Plan 9 was disbanded in October 2005, commercial support continues in the form of
Vita Nuova’s implementation of Inferno (PDF). Development and non-commercial support can be found on the Plan 9 user group list. Development of Plan 9 still continues but at a slower pace.

Where did the Plan 9 name come from?

The name was taken from the infamous sci-fi horror movie by Ed Wood, Plan 9 From Outer Space.
Some people call it the worst movie ever made. Other people say it’s so bad it’s good. The Ed Wood movie
by Tim Burton, on the other hand is a great movie and gives a great historic account of Ed Wood’s low budget movie making. Here’s the actual Plan 9 quote:

RULER: “What plan will you follow now?”

EROS: “Plan 9. It’s been absolutely impossible to work through these Earth creatures. Their soul is too controlled.”

RULER: “Plan 9… Ah yes. Plan 9 deals with the resurrection of the dead. Long-distance electrodes shot into the pinion pituitary glands of recent dead.”

Plan 9 / BeOS Factoid

An older version of Plan 9 runs on the original BeOS BeBox hardware.

References

  • The official Plan 9 home page, http://cm.bell-labs.com/plan9
  • The official Plan 9 Wikipedia page, http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs
  • The Plan 9 FAQ, http://cm.bell-labs.com/wiki/plan9/FAQ/index.html
  • Why the Plan 9 Distributed System Matters, Geoff Collyer, http://www.collyer.net/who/geoff/9book.pdf
  • Fault Tolerant Message Passing, Nehal Desai, Dean Prichard, Andrey Mirtchovski, http://pages.cpsc.ucalgary.ca/~mirtchov/lanlp9/mp/ldrd.html
  • How to Use the Plan 9 C Compiler, Rob Pike, http://www.quut.com/c/plan9c.html
  • More papers on Plan 9, http://cm.bell-labs.com/sys/doc


    If you would like to see your thoughts or experiences with technology published, please consider writing an article for OSNews.

  • 31 Comments

    1. 2006-07-19 7:26 pm
    2. 2006-07-19 8:22 pm
    3. 2006-07-19 9:57 pm
      • 2006-07-19 10:16 pm
    4. 2006-07-19 11:00 pm
      • 2006-07-19 11:46 pm
        • 2006-07-20 12:47 am
      • 2006-07-20 3:21 pm
    5. 2006-07-19 11:42 pm
      • 2006-07-20 12:26 am
        • 2006-07-20 12:33 am
      • 2006-07-20 8:21 am
    6. 2006-07-20 1:14 am
      • 2006-07-20 10:05 am
      • 2006-07-20 2:13 pm
    7. 2006-07-20 1:28 am
    8. 2006-07-20 1:37 am
    9. 2006-07-20 9:33 am
    10. 2006-07-20 10:19 am
      • 2006-07-20 7:53 pm
    11. 2006-07-20 10:41 am
    12. 2006-07-20 11:20 am
    13. 2006-07-20 3:26 pm
    14. 2006-07-20 4:00 pm
    15. 2006-07-20 7:05 pm
    16. 2006-07-20 7:35 pm
    17. 2006-07-20 8:32 pm
    18. 2006-07-20 9:01 pm
  • 2006-07-23 2:06 pm