LWN.net Logo

MINIX 3.2: A microkernel with NetBSD applications

March 7, 2012

This article was contributed by Koen Vervloesem

After almost a year and a half of development, MINIX saw a new stable release on 2012's leap day. MINIX 3.2.0 has been updated with a lot of code from NetBSD, it now uses Clang as its default compiler, and the developers have migrated to Git for version control.

The MINIX operating system was originally developed by computer science professor Andrew Tanenbaum at Vrije Universiteit Amsterdam for educational use. He used the code as examples in his textbook "Operating Systems: Design and Implementation". MINIX has a microkernel architecture with a kernel of about 10,000 lines of code. The result is that device drivers and services like filesystems, memory management, process management, and so on are running as user-space processes. This resembles the approach taken by GNU Hurd.

These days, MINIX is not only an academic project, but it's also focused on achieving high reliability for embedded systems through fault tolerance and self-healing techniques. It is distributed with a BSD-type license. A downside of that choice is that it's harder to find out how it is being used, so we don't know much about the use of MINIX outside academia. However, in a FOSDEM interview in 2010, Tanenbaum said: "I believe it was used in one embedded system for managing commercial parking garages."

NetBSD code

The most obvious message in the release notes of MINIX 3.2.0 are the many mentions of NetBSD. Because the MINIX userland grew outdated, many of its tools have been replaced by their counterparts from NetBSD. This project (a Google Summer of Code project in 2011 done by Vivek Prakash) was also an opportunity to expand the MINIX userland by porting additional utilities from NetBSD.

As can be seen from Vivek's GSoC status report, many of the simpler tools just required some trivial changes to their Makefiles to port them to MINIX. However, some of the tools required libraries that were not present in MINIX, so Vivek had to port these too. Moreover, if a NetBSD tool lacked an important flag that its MINIX counterpart had, he had to port this missing functionality from the MINIX tool. Of course Vivek also submitted the changes upstream. As part of this userland porting effort, MINIX also migrated its /etc/passwd file to the NetBSD format.

Vivek's minix-userland Git repository shows the result of this porting effort. The /usr/src/commands directory contains the sources for the MINIX tools, while the tools that are ported from NetBSD go into /usr/src/bin, /usr/src/sbin, /usr/src/usr.bin, and /usr/src/usr.sbin, which are the corresponding locations in the NetBSD source tree. This way you can clearly see which tools are originally from the MINIX userland and which ones are ported from NetBSD. The plan is to track the development of the NetBSD stable releases for the ported tools. MINIX 3.2 also has adopted NetBSD's C library and boot loader.

Other features

MINIX now has also experimental support for SMP (symmetric multiprocessing), as well as multi-threading and NCQ (Native Command Queuing) support in the AHCI (Advanced Host Controller Interface) driver for SATA adapters. The virtual filesystem (VFS) server is now asynchronous and multi-threaded. The developers also added a /proc file system and a proper /etc/fstab file. Because of the integration of ext2, you can install MINIX on an ext2 file system now. There's also FUSE support for user-space file systems, which was implemented by Evgeniy Ivanov as part of the Google Summer of Code (GSoC) 2011.

Reliability also has been improved. When block device I/O fails in a filesystem, for instance when reading a file from a hard drive, MINIX will transparently retry. In the same way, it can transparently recover from the crash of a block device driver. These improvements are examples of the self-healing nature of MINIX. Moreover, servers and drivers now run as unprivileged users, which should further lessen the damage when something goes wrong. The kernel mediates whether particular servers and drivers can access the hardware.

Development

There are also a lot of changes for developers. The most visible is that the project's code base has been moved to Git. The project also has set up extensive documentation for developers about using Git and an explanation of the MINIX 3 git workflow.

LLVM's Clang frontend has been adopted as the default compiler for MINIX 3.2, although GCC is still supported by setting the environment variable CC=gcc. Currently Clang runs slower than GCC for building the MINIX source and its packages, but it reports more build warnings on the MINIX code base. The plan is to fix all potential bugs found by Clang's more extensive warnings.

The default executable format in MINIX is now ELF (Executable and Linkable Format). Debugging also has been improved: MINIX 3.2 supports GDB and core dumps, which was a GSoC project by Adriana Szekeres. Moreover, tracing support for block devices has been added.

Getting started

MINIX 3.2 is available as a CD image. The command line installer is spartan, but it does the job. Most of the automatically suggested answers to questions are fine, such as the network cards detected by MINIX, the use of DHCP, and so on. When the installation is finished, it's striking how fast MINIX boots. One of the reasons is that MINIX is a really bare-bones installation, which doesn't even include OpenSSH.

When the login prompt shows up, log in as root without a password. After this, you have to do some manual post-installation steps: set your root password and time zone, add users, and so on. You can update the package database with pkgin update and then install a package with pkg install foobar. Probably some of the first packages to install would be openssh, vim, and x11. Pkgin is an apt/yum-like front-end to NetBSD's pkgsrc package management system.

There's a Getting started document on the website that guides you through all of this. The project also has a lot of documentation and a wiki, which has a User Guide, including pages about the installation, post-installation steps, and an introduction to X.

Developers are not left out in the cold either: there's documentation about the MINIX community, a Developers Guide, a list of who is working on what, and suggestions about how to contribute.

However, hardware support seems to be quite limited in MINIX. Currently, only IDE and SATA disks are supported, and there's no support for USB or FireWire peripherals. Moreover, only a limited number of Ethernet cards work. None of my systems had all the required hardware to be able to either install or run X, so I wasn't able to get a graphical desktop on MINIX. Even in a virtual machine in VirtualBox, I couldn't configure the X server of MINIX, although I followed the configuration tips for running MINIX in VirtualBox.

From academic exercise to general-purpose operating system

The migration to the NetBSD userland and C library is part of an ongoing effort to make MINIX more usable outside academia. This started with the release of MINIX 3.0 in 2005, which added X11 and over 400 common UNIX tools. In the previous release (3.1.8), the MINIX developers adopted NetBSD's package management system pkgsrc, which was implemented as a GSoC project in 2010. Thanks to pkgsrc, MINIX users potentially have access to over 8000 packages. Currently only 250 seem to be available as binary packages through pkgin, but you can build many more from source (although not all of the 8000 packages in pkgsrc will compile on MINIX).

The result of these ongoing efforts is that MINIX is much more of a general-purpose operating system than a few years ago. This should also make porting MINIX to other architectures easier. There have been efforts to port MINIX to PowerPC and ARM in the past, but these were not successful because the developers lost interest. However, currently the Vrije Universiteit Amsterdam is looking for a full-time programmer with embedded systems experience to port MINIX to ARM. So maybe in a few years we'll see MINIX on embedded systems that are currently the playing field of Linux and the BSDs.


(Log in to post comments)

Minix no longer quite so mini

Posted Mar 8, 2012 11:35 UTC (Thu) by epa (subscriber, #39769) [Link]

I remember when Minix consciously limited itself to compatibility with Unix Seventh Edition, which was "an improvement on all previous and subsequent versions". The new userland completes Minix's transition from a toy system which was the most Unix-like you could get on horribly limited hardware (a 16-bit PC with 640Kbyte RAM, no MMU and perhaps even no hard disk) to an OS focused on real-world use.

It is no longer necessary for every process to fit in 64 kilobytes of user memory!

Minix no longer quite so mini

Posted Mar 8, 2012 18:00 UTC (Thu) by smoogen (subscriber, #97) [Link]

Sigh.. in the good old days you learned a lot trying to keep your program in 64k. How are the kids these days going to learn :).

Minix no longer quite so mini

Posted Mar 8, 2012 20:32 UTC (Thu) by iabervon (subscriber, #722) [Link]

That class of computer is actually quite popular with certain groups these days. There's a popular series of machines produced by the original designer, as well as a huge variety of compatible clones, and lots of peripherals available. Actually, you've got a high-end device if you've got 64k to play with; most of them just have 32k. Of course, I've yet to hear of people trying to run something Unix-like on an Arduino, but it's certainly a platform which needs low-resource programs and provides unusual benefits over platforms that aren't so constrained.

Minix no longer quite so mini

Posted Mar 12, 2012 4:25 UTC (Mon) by cmccabe (guest, #60281) [Link]

You could always run LUnix [ http://hld.c64.org/poldi/lunix/lundoc/lng.html ]. According to the website (updated 1997), "90% of the kernel are DONE !! :-)"

Minix no longer quite so mini

Posted Mar 12, 2012 19:23 UTC (Mon) by andreasb (subscriber, #80258) [Link]

Please, get with the times ;-) The *current* website (http://lng.sourceforge.net/lunix/lunix.html) was last updated in 1999 and LUnix has since been rewritten as LNG (http://lng.sourceforge.net/ last updated 2004).

It won't run on the mentioned Arduino of course since it's written for the 6510 CPU and peripherals in a C-64 or C-128.

Minix no longer quite so mini

Posted Sep 10, 2013 8:53 UTC (Tue) by justincormack (subscriber, #70439) [Link]

Minix no longer quite so mini

Posted Mar 12, 2012 18:12 UTC (Mon) by leoc (subscriber, #39773) [Link]

Arduino. A low cost Uno board has 32kb of ram and is nonetheless quite popular.

Minix no longer quite so mini

Posted Mar 12, 2012 19:21 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link]

Arduino is hardly 'low cost'. For the price of an Arduino board with stone-age technology CPU one can get a nice real modern CPU with at least 4-16Mb of RAM.

Minix no longer quite so mini

Posted Mar 12, 2012 19:36 UTC (Mon) by andreasb (subscriber, #80258) [Link]

The µC on an Arduino Uno has only 2 kB of RAM. It does have 32 kB of on-chip program flash memory.

There's no real dynamic program loading possible (from connected storage or whatever) since it can't execute instructions from RAM. Unless you take the indirection of a script/bytecode interpreter or outright emulation of a different CPU (there's an AVR based CP/M project out there that emulates a 8080 with external DRAM).

MINIX 3.2: A microkernel with NetBSD applications

Posted Dec 13, 2012 15:18 UTC (Thu) by mirabilos (subscriber, #84359) [Link]

This turned out to be the death of Minix. I call this system Ninix, for it’s substantially different from Minix 3 before this version, and it’s a porting nightmare.

Really, if you’re going to run this, better just use NetBSD® directly.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds