Next Previous Contents

1. Introduction

Welcome to User Mode Linux. It's going to be fun.

1.1 What is User Mode Linux?

User Mode Linux lets you run Linux inside itself! With that comes the power to do all sorts of new things. It virtualises (or simulates, as some people call it) Linux so that you can run an entire Linux where once you would have only run a program.

You might have heard of functionality like this before. There are quite a few projects whose goal is to nest operating systems in one way or another: Linux on Linux, Windows on Linux, Linux on Windows, Linux/s390 on Linux/anythingelse, and so on. Or even just x86 on anything, where the 'x86' program can boot operating systems including Linux.

Where x86 is involved there is the greatest concentration of efforts. At the end of this HOWTO you'll find a list of alternative projects. If all you want to do is run a copy of x86 Linux on another copy of x86 Linux as fast as possible with little control then quite possibly one of these other projects will so better than UML.

1.2 How is User Mode Linux Different?

User Mode Linux (UML) is rather different from every other Linux virtualisation project, either free or commercial. UML strives to present itself as an ordinary program as much as possible. Here are some of the outcomes of that philosophy:

  1. Good speed with few compromises. UML compiles to native machine code that runs just like any other compiled application on the host. This makes it very much faster than portable virtualisation schemes that implement an entire hardware architecture in software. On the other hand, UML does not suffer from the extreme hardware specificity of virtualisation systems that rely on particular CPU features. UML runs applications inside itself with normally at worst a 20% slowdown compared to the host system, which modern hardware and clever system design can render negligable in real terms.
  2. Futureproof. Every time Linux gets improved so it can do something new and clever that benefits the programs it runs, UML automatically gets that facility. Software suspend, fine-grained security control such as SE Linux, new filesystem features, support for bigger/faster hardware... the same is not true with those virtualisation systems that require major changes on the host computer.
  3. Flexible code. Normally an OS kernel is just that... a kernel. It talks to hardware or maybe some virtualised hardware. But UML can be viewed in many other ways. It would be possible to turn it into a shared library, for example, so that other programs could link to it to take advantage of things that Linux does very well. It can be started as a subshell of an existing application. It can use stin/stdout like any other program.
  4. Portable. Really portable. UML has only just started to be exploited for its portability, but there is promising evidence that ports to x86 Windows, PowerPC Linux, x86 BSD and other systems are very practical.
  5. Mature. UML has been in development since 1999. One indication of its robustness is that UML can be compiled to run within UML, making it 'self-hosting'. Production systems are running on UML.
  6. Free Software. UML is under the GPL (as it must be, being part of the Linux kernel.)

1.3 How does UML Work?

Normally, the Linux Kernel talks straight to your hardware (video card, keyboard, hard drives, etc), and any programs which run ask the kernel to operate the hardware, like so:

  +-----------+-----------+----+
  | Process 1 | Process 2 | ...|
  +-----------+-----------+----+
  |       Linux Kernel         |
  +----------------------------+
  |         Hardware           |
  +----------------------------+

The UML Kernel is different; instead of talking to the hardware, it talks to a `real' Linux kernel (called the `host kernel' from now on), like any other program. Programs can then run inside User-Mode Linux as if they were running under a normal kernel, like so:

              +----------------+
              | Process 2 | ...|
  +-----------+----------------+
  | Process 1 | User-Mode Linux|
  +----------------------------+
  |       Linux Kernel         |
  +----------------------------+
  |         Hardware           |
  +----------------------------+

1.4 Why Would I Want UML?

  1. If UML crashes, your host kernel is still fine.
  2. You can run a usermode kernel as a non-root user.
  3. You can debug the UML like any normal process.
  4. You can run gprof (profiling) and gcov (coverage testing).
  5. You can play with your kernel without breaking things.
  6. You can use it as a sandbox for testing new apps.
  7. You can try new development kernels safely.
  8. You can run different distributions simultaneously.
  9. It's extremely fun.


Next Previous Contents