Plan 9 is most notable for representing all system interfaces, including those required for networking and the user-interface, through the filesystem rather than specialized interfaces. Plan 9 aims to provide users with a workstation-independent working environment through the use of the 9P protocols. Plan 9 continues to be used and developed in some circles as a research operating system and by hobbyists.
The name Plan 9 from Bell Labs is a reference to the 1959 cult science fiction B-movie Plan 9 from Outer Space.
Plan 9 replaced Unix at Bell Labs as the organization's primary platform for research. It explored several changes to the original Unix model that facilitate the use and programming of the system, notably in distributed multi-user environments. Plan 9 was a Bell Labs internal project from its start during the mid 1980s. In 1992, Bell Labs provided the first public release to universities. In 1995, a commercial second release version became available to the general public. In the late 1990s, Lucent Technologies, having inherited Bell Labs, dropped support for commercial interests in the project. In 2000, a non-commercial third release was distributed under an open source license. A fourth release under a new free software license occurred in 2002.
A user and development community, including current and former Bell Labs members and Massachusetts Institute of Technology personnel, continues to produce minor daily releases in form of ISO images. Bell Labs still hosts the development. The development source tree is accessible over the 9P and HTTP protocols and is used to update existing installations. In addition to the official components of the OS included in the ISOs, Bell Labs also hosts a repository of externally developed applications and tools.
Plan 9 from Bell Labs was originally developed by members of the Computing Science Research Center at Bell Labs, the same group that developed original UNIX and C. The Plan 9 team was originally led by Rob Pike, Ken Thompson, Dave Presotto and Phil Winterbottom with support from Dennis Ritchie as head of the Computing Techniques Research Department. Over the years many notable developers have contributed to the project including Brian Kernighan, Tom Duff, Doug McIlroy, Bjarne Stroustrup, Bruce Ellis, Steve Simon and others. Plan 9 is engineered for modern distributed environments, designed from the start to be a networked operating system. It has graphics built-in, unlike Unix, which added these features to the design later. Plan 9 has yet to become as popular as Unix derivatives, but it has an expanding community of developers.
Plan 9 has a distributed architecture. It can be installed and used on a single self-contained system, but also has the capability to separate the functional components of the OS between separate hardware platforms. In a typical Plan 9 installation, users work at lightweight terminals running the rio GUI and connect via the network to CPU servers that handle computation-intensive processes, with permanent data storage provided by additional hosts acting as file servers and archival storage. Currently available desktop computers can also re-create this architecture internally using multiple virtual machines.
Plan 9's designers were interested in goals similar to those of microkernels, but chose different architecture and design details to achieve them. Plan 9's design goals included:
* File system based devices: All resources are represented by nodes in the hierarchical file system.
* Namespaces: The application view of the network is a single, coherent namespace that appears as a hierarchical file system but may represent local or remote physically separated resources. The namespace of each process can be constructed independently, and the user may work simultaneously with applications with heterogeneous namespaces
* Standard communication protocol: a standard protocol, called 9P, is used to access all resources, both local and remote.
Unified input/output model.
Before Unix, most operating systems had different mechanisms for accessing different types of devices. For example, the application programming interface (API) to access a disk drive was different from the API used to send and receive data with a serial port, or from the API used to operate a printer.
Unix attempted to remove these distinctions by performing all input/output operations via disk inodes. Every device driver was required to support meaningful read and write operations as a means of control.
This allowed users to send data from one device to another, with utilities like cp and dd, without being aware of the underlying implementation details. However, at the time, many key concepts (such as the control of process state) did not map uniformly onto the file system. As new features like Berkeley sockets and the X Window System were developed, they were implemented outside of the file system. New hardware features (such as the ability to eject a CD in software) also encouraged the use of hardware-specific control mechanisms like the ioctl system call.
The Plan 9 research project rejected these different approaches and returned to the file system-centric view of the system. Each Plan 9 program views all available resources, including networking and the user-interface resources, such as the window it is running in, as part of the hierarchical file system, rather than specialized interfaces.
File systems, files and names.
Plan 9 extended the system beyond files to "names", that is, a unique path to any object whether it be a file, screen, user, or computer. All are handled using the existing Unix standards, but are extended such that any object can be named and addressed uniformly. This is similar in concept to the Uniform Resource Identifier (URI) used in the World Wide Web. In Unix, devices such as printers were represented by names using software converters in /dev, but these addressed only devices attached by hardware, and did not address networked devices. Under Plan 9 all printers are virtualized as files, and can be accessed over the network from any workstation.
Another Plan 9 innovation was the ability for users to have different names for the same "real world" objects. Each user could create a personalized environment by collecting various objects into their namespace. Unix has a similar concept in which users gain privileges by being copied from another user,[clarification needed] but Plan 9 extends this to all objects. Users can easily spawn "clones" of themselves, modify them, and then remove them without affecting the resources from which they were created.
Unix allows file systems to be built up from disparate resources using concepts such as links and file system mounts. These features masked the original directory; if one mounts a new filesystem on the directory named "net", one can no longer access its previous contents until the operation is reversed.
Plan 9 introduced the idea of union directories, directories that combine resources across different media or across a network, binding transparently to other directories. For example, another computer's /bin (applications) directory can be bound to one's own, and then this directory will hold both local and remote applications and the user can access both transparently. Using the same system, under Plan 9 external devices and resources can be bound to /dev, allowing any device to be shared over the network without any additional code.
Many live CDs for Linux distributions implement a limited form of this feature, based on union file systems as opposed to union directories.
The /proc directory, in which all running processes are listed, illustrates how these features work together to produce a greater whole. This special Plan 9 "file system" has also been adopted by Linux and other later operating systems. Processes appear as named objects (sub-directories with info and control files) under /proc, along with other kernel resources, giving the user a dynamic I/O channel to send commands to them and read data from them. The user does not have to use a limited set and form of system calls to interact with the kernel from compiled programs; rather, he can use tools such as ls and cat to search, query and manipulate processes.
Users can also mount /proc directories (and any other special file systems) from any other machines into their namespace as well, interacting with them as if they are local. The result is a distributed computing environment assembled from separate machines — terminals that sit on users' desks, file servers that store permanent data, and other servers that provide faster CPUs, user authentication, and network gateways, all using the existing hierarchical directory/name system familiar to most computer users. A user can "build" a system by collecting up directories on file servers, applications running on servers, printers on the network and then bind them all together into their personal namespace running on a terminal.
Plan 9 does not have system calls for the multitude of communication protocols or device driver interfaces. For example /net is the API for all TCP/IP, and it can be used even with scripts or shell tools, writing data to control files to write and read connections. Relevant sub-directories like /net/tcp and /net/udp are used to interface to respective protocols. You can implement a NAT by mounting a /net from a perimeter machine with a public IP, while connecting to it from an internal network of private IP addresses, using the Plan 9 protocol 9P in the internal network. Or you can implement a virtual private network (VPN) by mounting a /net directory from a remote gateway, using secured 9P over the public Internet.
Here would be an example of using union (a stack) directories in /net: just like inheritance in OOP, you can take one (possibly remote) /special directory and bind another local special directory on top of that, adding some new control files and hiding others. The union directory now is like a child object instance of the original parent. The functionality of the original can be partially modified. Consider the /net file system. If you modify or hide its /net/udp sub-directory you may control or extend the UDP interface with local filter processes, still leaving the original /net/tcp running intact, perhaps in a remote machine. Note that name space is per process: if you give an untrusted application a limited, modified /net union directory, you restrict its access to the net.
All this makes it easy to combine "objects" or file systems written in different languages on different systems, while using standard naming, access control and security of the file system, largely transparent to the programmer.
This is similar to the facility offered by the mount_portal command in BSD which by convention is mounted on /p instead of /net with only /tcp available.
Networking and distributed computing
Plan 9 is based on UNIX but was developed to demonstrate the concept of making communication the central function of the computing system. All system resources are named and accessed as if they were files and multiple views of the distributed system can be defined dynamically for each program running on a particular machine. This approach improves generality and modularity of application design by encouraging servers that hold any information to appear to users and to applications just like collections of ordinary files.
Key to supporting the network transparency of Plan 9 was a new low-level networking protocol known as 9P. The 9P protocol and its implementation connected named network objects and presented a file-like system interface. 9P is a fast byte-oriented (rather than block-oriented) distributed file system that can virtualize any object, not only those presented by an NFS server on a remote machine. The protocol is used to refer to and communicate with processes, programs, and data, including both the user interface and the network. With the release of the 4th edition, it was modified and renamed 9P2000.
Plan 9 uses Unicode. UTF-8 was invented by Ken Thompson to be used as the native encoding in Plan 9 and the entire system was converted to general use in 1992.
GUI installation with rio
An installable runtime environment exists for the x86 architecture, and Plan 9 has been ported to MIPS, DEC Alpha, SPARC, PowerPC, ARM and other hardware platforms. The system is written in a dialect of ANSI C. Several applications were originally written in a language called Alef, but have since been rewritten in C. Plan 9 can support POSIX applications and can emulate the Berkeley socket interface through the ANSI/POSIX Environment APE. Recently,[when?] a new application called linuxemu was developed that can be used to run Linux binaries; it is, however, still a work in progress.
Plan 9 has been ported to the IBM Blue Gene/L Supercomputer.
Plan 9 demonstrated that a central concept of Unix – that every system interface could be represented as sets of files – could be successfully implemented in a modern distributed system. Some features from Plan 9, like the UTF-8 character encoding of Unicode, have been implemented in other operating systems. Unix-like operating systems such as Linux have implemented 9P, Plan 9's file system and limited forms of rfork-like system calls. Additionally, in Plan 9 from User Space, several of Plan 9's applications and tools, including the rc shell, have been ported to Unix and Linux systems and have achieved some level of popularity. Glendix is a project seeking to replace the GNU operating system programs surrounding the Linux kernel with the Plan 9 operating system programs, or, alternatively, replace the Plan 9 kernel with the Linux kernel.
However, Plan 9 has never approached Unix in popularity, and was primarily a research tool. Plan 9 has been criticized as "seem[ing] to function mainly as a device for generating interesting papers on operating-systems research." Eric S. Raymond in his book The Art of Unix Programming speculates on Plan 9's lack of acceptance:
Plan 9 failed simply because it fell short of being a compelling enough improvement on Unix to displace its ancestor. Compared to Plan 9, Unix creaks and clanks and has obvious rust spots, but it gets the job done well enough to hold its position. There is a lesson here for ambitious system architects: the most dangerous enemy of a better solution is an existing codebase that is just good enough.
Other critics of Plan 9 include those critical of Unix in general, where Plan 9 is considered the epitome of the "Worse is better" school of operating system design. Common criticisms include the relative lack of "polish" and development in Plan 9's windowing system and Plan 9's lack of maturity as a commercial-grade body of software.
Plan 9 proponents and developers claim that the problems hindering its adoption have been solved, and its original goals as a distributed system, development environment, and research platform have been met, and that it enjoys moderate but growing popularity. Inferno, through its hosted capabilities, has been a vehicle to bring Plan 9 technologies to other systems as hosted part of heterogeneous computing grids.
Plan9 Acme Intro - Part 1
Plan9 Acme Intro - Part 2
Plan9 Acme Intro - Part 3