next up previous
Next: UML as a development Up: Ports Previous: Architecture ports

Operating system ports

As already stated, this is interesting because UML running on another operating system would provide it with a completely authentic Linux environment. UML is fairly Linux-specific at this point, but not so much so that ports are out of the question. It uses only Linux system calls, with no special kernel hooks required. However, some of those system calls are not found on all other platforms.

The principal one is the system call interception and modification capability of ptrace. That is essential for UML to run. If UML is to be ported to another operating system, it needs to provide the ability to intercept the system calls that Linux binaries make on that architecture.

Linux has a very general mmap, which UML takes advantage of. It is helpful if the target platform allows mmap with page granularity and multiple mappings of the same page into the same address space. UML also unmaps portions of its executable image and replaces them with shared pages containing the same data.

A little-used, but very useful feature of Linux is the ability to create a new process and choose which pieces of the parent process will be shared with the child. UML uses this capability to share file descriptors, but nothing else, between all UML processes. This is useful because communication with the host is done largely through file descriptors which are opened by one process and accessed by another. A good example of this is the file descriptor to a file containing a UML filesystem. It is opened in the context of the mount which mounts the filesystem inside UML. That process will have died by the time an ls tries to read it. With the ability to share file descriptors, the descriptor opened by the mount process is preserved in all the other processes, and is ultimately inherited by the ls that comes along to read the filesystem.

This can be done by making UML processes be threads. In this case, everything, including address spaces will be shared by all UML threads. This will work, but it will kill context switch performance, since the address space would have to be completely remapped for the incoming process. It would also make SMP support problematic since two or more threads will be running entirely different processes simultaneously, and that can't be done in a single address space.


next up previous
Next: UML as a development Up: Ports Previous: Architecture ports
Jeff Dike 2001-05-04