introduction to MINIX 3

 

How often have you rebooted your TV in the past year? Probably much smaller than your computer. Of course, there are many “reasons” for this, but more and more users who are far from technology do not want to hear about them. They only want their computer to work perfectly all the time and never fail. MINIX 3 is a project to develop an operating system as reliable as a TV for embedded systems and critical applications, as well as for future 50-dollar single-chip laptop computers and desktop systems of general use. Today, this small, simple and reliable operating system already exists.

historical digression

MINIX 3 has a clear future, but a somewhat obscured past. The first version, MINIX 1, was created in 1987 and was the first fully open source UNIX clone. It was developed quickly and soon found its own USENET group (comp.os.minix) with 40,000 subscribers within 3 months – this is a big figure for a time when the Internet was available only to university researchers and students. One of the first adherents of MINIX was a Finnish student named Linus Torvalds, who went and bought a PC specifically to launch MINIX, studied it very carefully and then, inspired by MINIX, decided to write his own operating system. Although Linus knew MINIX very well, he did not borrow any code from it, as some people attribute to him. The Linus system has grown into a modern Linux operating system. The author of MINIX is Andrew Tanenbaum. By the way, Tanenbaum and Torvalds held several beautiful public discussions on the device of operating systems, the first of them in 1992, and the most recent in 2006.

revival

Although MINIX was (and still is) a widely used tool for operating system courses at universities, it received a new impetus in 2005 when Tanenbaum assembled a new development team to completely redesign it into an ultra-reliable system. Although MINIX 3 shares historical roots with MINIX 1 and MINIX 2 (implemented in 1997 as a POSIX-compatible OS), it is actually a new system (the situation is similar to how Windows XP and Windows 3.1 relate).

Various studies show that software generally contains about 0.3 errors per 1000 lines of code and that device drivers have 0.4 times more errors than the rest of the operating system. If we add the fact that 70% of a typical operating system consists of device drivers, it becomes clear that device drivers are the biggest source of errors. For Windows XP, for example, 85% of crashes are due to errors in device drivers. Obviously, in order to make the OS reliable, you need to do something with these “malicious” device drivers. Building a reliable system, despite the inevitable existence of errors in the drivers, was the main reason for the appearance of MINIX 3.

construction

The approach used in MINIX 3 to achieve high reliability is based on error isolation. In particular, unlike traditional operating systems, where all the code is combined into a single huge executable program running in kernel mode, in MINIX 3 only a tiny part of the code works in kernel mode – only about 4000 lines of code. This code handles interrupts, process dispatching, and interprocess communication (IPC). The rest of the operating system operates as a set of processes in user space, with each of them protected by a hardware memory manager (MMU) and none of them has superuser privileges. One of these processes, named the reincarnation server, stores tables of all other processes, and when one of these processes starts working incorrectly or fails, the reincarnation server automatically replaces it with a new copy. Since many errors are unstable and occur unexpectedly, in most cases restarting the failed component solves the problem and allows the system to restore itself without restarting and without the user noticing it at all. This property is called “self-healing” (or “self–medication” – who likes what more – approx. translator) and it is absent in traditional systems.

The structure of MINIX 3 is shown in Fig. 1. It is designed as a multi-level structure. At the bottom is a microkernel running in kernel mode and consisting of approximately 3,000 lines of C code and 800 lines of assembly code. Above it is the device driver layer, with each driver being a separate process in user space to facilitate its replacement in case it fails. Then there are the servers that form the basis of the operating system. They include the reincarnation server mentioned above, the file server, the process manager, etc., including the X server, the data store and many others. And finally, the user processes are located on top. Although MINIX 3 is completely different from the rest of UNIX-like systems from the inside, it supports the standard POSIX application interface, so ordinary UNIX software can be ported to it quite easily.

The components interact with each other by sending fixed-length messages. For example, a user process requests a file by sending a message to the file server, which in turn checks its cache and, if the required block is missing, sends a message to the disk driver process to start receiving the block. And although sending a message adds a little extra time to the duration of the exchange process (about 500 ns at 3 GHz Pentium 4), the system remains quite fast. For example, a complete system build that requires more than 120 compilations fits in 10 seconds.

user’s point of view

From a user’s point of view, MINIX 3 looks like UNIX, but not so bloated. It contains the X Window System and more than 400 standard UNIX programs, including:

– command processors (shells): ash, bash, pdksh, rsh;

– editors: emacs, nvi, vim, elvis, elle, mined, sed, ed, ex;

– programming languages (language tools): cc, gcc, g++, bison, flex, perl, python, yacc;

– programming tools: cdiff, make, patch, tar, touch /* in general, the presence of tar and touch in this section is not entirely clear to me… – approx. ed */;

– network tools (networking): ssh, telnet, ftp, lynx, mail, rlogin, wget, pine;

– file utilities: cat, cp, bzip2, compress, mv, dd, uue, GNU utilities;

– text utilities: grep, head, paste, prep, sort, spell, tail;

– administration: adduser, cron, fdisk, mknod, mount, cvs, rcs;

– games: dungeon, nethack.

Currently, the user interface is only X, but over time, another graphical user interface (GUI) may be added if a suitable lightweight GUI is found.

availability

MINIX 3 is an open source software distributed under the BSD license. She has her own website (www.minix3.org ), from which a downloadable CD-ROM image containing all the source and executable files can be downloaded /* readers can also find all this on the website of the Russian-speaking MINIX 3 OS development group – www.minix3.ru – approx. translator */. To install it, simply download the CD-ROM, log in as root and type setup. The installation will take about 10 minutes. After installing the system from a CD-ROM or from an Internet site, a large number of packages can be downloaded with a simple packman set followed by a selection. Currently, MINIX 3 runs on the x86 platform, but work on ports on PowerPC and Xscale is already underway. It also works great on virtual machines such as VMware and Xen. Since MINIX 3 was publicly announced in early 2005, more than 300,000 different visitors have visited the website, and the CD-ROM image has been downloaded 75,000 times. Currently, more than 1,000 visitors a day visit the site. There is also an active thematic conference on Google USENET, comp.os.minix, where people ask questions and get answers, report new software and discuss MINIX 3. MINIX 3 is the result of teamwork and your help will be welcome. Take the system, experiment with it and step into the future.