A Plan 9 Primer

by B. Boehler

Early in the 1980s, a trend in computing was starting in which users were ditching large, time-sharing computers in favor of small, individual microcomputers.

People and businesses were tired of costly, centralized computer systems that were often bogged down by the large amount of users, and found that everyone was much more productive when using their own computer.  Even though there was quite a loss in computing power per person during this switch, many individuals found the change to be worth it.

And even though lots of issues were solved with this, much more were created.  Operating systems designed for centralized computers, in particular UNIX, were ported to the new microcomputers in an attempt to recreate the same environment users had before.  But there was a major problem: UNIX by the 1980s was very old, and it didn't quite adapt well to the newer concepts of the time, especially networking.

Networking was poorly integrated into UNIX, making it a challenge to connect all the microcomputers together, and users lost many of the features they enjoyed when they all shared a centralized system.  Not only this, but updating, maintaining, and administrating a network of varying hardware on UNIX caused a bunch of headaches.  UNIX by this time was clearly deprecated and something needed to change.

Bell Labs was well aware of these problems.

The same team that developed the C programming language, with people such as Rob Pike, Ken Thompson, Dave Presotto, and Phil Winterbottom, set out to develop a new operating system to meet changing needs.  Instead of multiple users sharing resources on one large computer, their new operating system was designed to pool the resources of many small computers over a network.  Using many of the ideas of UNIX, they developed the Plan 9 operating system, and it is a very unique piece of software.

Plan 9 was designed off of two concepts.

The first is that all things are treated as a file.  This means that even hardware is represented by a file, and can be accessed through actions of read and write, and not through some complex system call.  For example, to get the location of the mouse, all a program would have to do is read the state of /dev/mouse without ever having to communicate directly with the hardware.  This proved to be a successful part of UNIX, and is still used today in UNIX derivatives such as Linux or OS X.

What makes Plan 9 so special is the second concept, which dictates how these hardware resources can be accessed.  The team at Bell Labs developed a set of protocols simply named "9P," which is not only a set of rules for how a machine can access its own resources, but also allows computers to access the resources of other computers.  Accessing resources remotely is as simple as accessing a file across a network, and since all hardware is treated as files, any two computers can share any physical device.  This is the mechanism Plan 9 uses to pool the resources of the computers.

By being able to access hardware remotely, this allows servers to be set up on a network with special hardware that can be accessed by anyone.

For example, say a group of users does computationally intensive work on their systems, but the pool of their microcomputers doesn't provide enough power.  In this case, a CPU server with powerful processors could be set up and connected to the network, and users could use the CPUs on the server as if they were their own.  This makes networks very cost effective and modular, and they can be tailored to specific needs.

Even though Plan 9 is a spiritual successor to UNIX, it incorporates a new suite of tools and brought along some modified old ones.

Plan 9 utilizes a new shell, simply named "rc", which replaced the Bourne shell (the shell that would later become Bash).  The rc shell uses a more simplified but similar syntax to that of the Bourne shell, and conditional control structures resemble that of C.

rc comes with some new features such as advanced string and array handling, and has much more powerful I/O redirection than that of the Bourne shell.

Programming is also different on Plan 9.

Almost all programming for Plan 9 is done in C, but they use a modified version of the language where they threw out some "unnecessary" parts.  In early versions, programs for Plan 9 were written in a C-like language named "Alef," but this was quickly dropped and replaced with a special C library.

It comes with an interesting default text editor named Acme, and has a debugger named Acid.  Both of these tools have a bit of a learning curve, but some people swear by these tools (and others swear at them).

Plan 9 also comes built-in with a graphics system that's gone through many changes as time has progressed.

The window system started out being named "" and was written in C.  It was later written in Alef and renamed the "Rio" window system, but the functionality remained the same.

The GUI is by no means pretty, but it is functional and easy to learn as it simply consists of drawing terminal windows which can then later be used to start other programs.  Rio is special due to the fact that it makes its operations transparent to other applications, and this allows for Rio to be run recursively within itself and within other window managers.

Sadly, by the mid-1990s, Plan 9 development was put on the back burner and the resources were redirected to another experimental operating system, Inferno.

When Lucent Technologies bought Bell Labs, the Plan 9 project was officially ended and the source was released to the public for free in 2000.

But this is not where the story ends.  Multiple online groups exist that are keeping it alive today by updating and adding onto the code, and they're doing a pretty impressive job.  Many of these modified versions, called "forks," stay true to the original software and have been ported to most modern architectures (Plan 9 can even be run on a Raspberry Pi).

Those looking to try out a canon version of Plan 9 will have success looking at Bell Lab's website at: plan9.bell-labs.com/plan9

A popular fork that can run on a wide variety of hardware, called "plan9front," can be found at ninetimes.cat-v.org.

If you're interested in using some of the tools listed above, but don't want to have to use Plan 9, they have been ported to Linux and Mac OS X (sorry, Windows users) in a package called "Plan 9 from User Space," which can be found at swtch.com/plan9port.

Their shell can be used on Linux, although documentation may be a little scarce.  This obscure little operating system sure isn't going to be anyone's desktop OS anytime soon, but it sure does make a fun weekend project.

Return to $2600 Index