Next
Previous
Contents
Welcome to User Mode Linux. It's going to be fun.
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.
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:
- 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.
- 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.
- 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.
- 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.
- 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.
- Free Software. UML is under the GPL (as it must be, being
part of the Linux kernel.)
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 |
+----------------------------+
- If UML crashes, your host kernel is still fine.
- You can run a usermode kernel as a non-root user.
- You can debug the UML like any normal process.
- You can run gprof (profiling) and gcov (coverage testing).
- You can play with your kernel without breaking things.
- You can use it as a sandbox for testing new apps.
- You can try new development kernels safely.
- You can run different distributions simultaneously.
- It's extremely fun.
Next
Previous
Contents