A Pi-Powered Plan 9 ClusterFollow article
Building a 4-node cluster for experimenting with the distributed operating system.
Plan 9 from Bell Labs comes from the same stable as the UNIX operating system, which of course Linux was designed after, and Apple’s OS X runs on top of a certified UNIX operating system. Just like UNIX, Plan 9 was developed as a research O/S — a vehicle for trying out new concepts — with it building on key UNIX principles and taking the idea of devices are just files even further.
In this post, we take a quick look at the Plan 9 O/S and some of the notable features, before moving on to the construction of a self-contained 4-node Raspberry Pi cluster that will provide a compact platform for experimentation.
From Outer Space!
Image: Glenda, the Plan 9 bunny, by Renée French.
The Plan 9 from Bell Labs operating system takes its name from cult science fiction film, Plan 9 from Outer Space. It also has arguably the cutest mascot of any O/S, Glenda. Fans of the Go programming language may notice some artistic similarities between its gopher mascot and Glenda, which is due to the fact that both were designed by comics writer and illustrator, Renée French.
The connections by no means end there and in fact Go builds on certain key ideas from Plan 9, with Ken Thompson — who designed and implemented UNIX — and Rob Pike being co-creators of both the programming language and the O/S, amongst many other notable achievements.
So what’s special about Plan 9? Well, it’s a distributed O/S where you have machines that are designated as file servers, CPU servers or terminals. Which might not sound that unusual, however, access to resources across these is transparent; everything is presented as a file that can be exported for use remotely, e.g. CPU, I/O devices, backup services and the window system.
Plan 9 does away with the idea of a superuser (root) and instead, the “host owner” of each system owns all of its resources and is able to manipulate CPU, disk and processes etc. Processes (including users) each have their own view of the namespace (file system) too, which facilitates distributed operation and supporting remote access as the common case.
Programs that provide services-as-files speak a common unified protocol called 9P. There is a windowing system, text editors and other commonly used applications, such as a mail client.
The 1st edition of Plan 9 was released to universities in 1992 and it subsequently went on to be released for non-commercial purposes, then under an open source licence. The last official release was made by Lucent Technologies in 2002. Despite being a research O/S, Plan 9 did find its way into some products, such as a RAID array for use in data centres. It also gained something of a dedicated following, with the original codebase and forks still being maintained today.
The idea with the Pi cluster is to have a self-contained system, or rather a neatly packaged distributed system, that can be used for experimenting with Plan 9. It is housed in a custom laser cut acrylic enclosure, with parts folded so as to simplify the case design and require fewer fasteners.
The enclosure is made from two folded pieces, with an additional disc located above vents in the top half, which if we’re honest is there mostly to give it a suitably space-age feel!
There is also a bracket for an Ethernet switch — which avoids having a bunch of network cables sticking out of it — and a second small bracket to hold an absolutely essential LED that is there to illuminate the outline of Glenda which is etched onto the inside of the case front.
Panel mount extension cables are used for access to USB and HDMI on the Raspberry Pi that will be configured as a terminal, along with an Ethernet connection from the switch to the outside world.
Power is supplied to the stack of Pi boards plus Ethernet switch via a 3-pin XLR connector.
A number of hexagonal nylon spacers were fitted together to provide long stand-offs that could be secured to the top and bottom halves by M3 nylon screws. The disc above the vent on the top of the case was secured in place via an additional four M3 nylon screws and nuts, with 5mm circular spacers between the two acrylic parts, although M3 nylon nuts could be used here instead.
One of the more distinctive Plan 9 forks goes by the name of 9Front and while the website is a little strange, handily for us, they also provide a Raspberry Pi image that we can simply write out to a Micro SD card.
EDIT 25/06/18: while we used a Raspberry Pi 2 Model B and at the time of writing this was the latest version support by 9Front, it turns out that the authentic Plan 9 distribution has benefited from continued updates. For example, the Pi 3 Model B+, along with its gigabit Ethernet and new WLAN module, is supported. An SD card image is available to download.
A Micro SD card was written out and inserted into the Pi at the bottom of the stack, which is the one with HDMI and USB connections brought out to the back of the enclosure.
The project provided an excuse to make use of a Vortex Core 47-key keyboard, which together with a mini white HDMI monitor, provided a particularly compact and suitably futuristic feeling setup.
Upon power being applied our mascot, Glenda, was illuminated.
The terminal booted and we were presented with a windowing system and welcome text.
You might be thinking, “but why would anyone want to build such a thing?” And the possible answers for which include, “because you can!” In any case, while Plan 9 may not be destined for world domination it is fascinating from an operating systems engineering perspective and, as previously noted, ideas taken from it have gone on to be implemented elsewhere.
If you’d like to build your own 4-node Pi cluster, to run Plan 9 or some other operating system(s), you can find the design files for the case on GitHub.