Controlling a UML Instance with Signals
So far, I've described the civilized ways to control UML instances from the host. However, sometimes an instance isn't
To send a UML instance a signal, you first need to know which process ID to send it to. A UML instance is comprised of a number of threads, so the choice is not obvious. Also, when the host has a number of instances, there is a real chance of misreading the output of
ps
and
To solve this problem, a UML instance
kill -TERM `cat ~/. uml/debian/pid`
When this main thread receives
SIGINT
,
SIGTERM
, or
SIGHUP
, it will run the UML-specific
|
Chapter 9. Host Setup for a Small UML Server
After having talked about UML almost exclusively so far, we will now talk about the host. This chapter and the
All of these things, which a large UML hosting provider cares about more than a casual in-house UML user does, will be discussed in the next chapter. There, we will cover tougher security measures, such as how to protect the host even if a
|
Host Kernel Version
Technically, UML will run on any x86 host kernel from a stable series (Linux kernel versions 2.2, 2.4, or 2.6) since 2.2.15. However, the 2.2 kernel is of historic interest onlyif you have such a machine that you are going run UML instances on, you should upgrade. The 2.4 and 2.6
UML makes use of the AIO and
O_DIRECT
facilities in the 2.6 kernels for better performance and lower memory consumption. AIO is kernel-level asynchronous I/O, where a number of I/O
The alternative, which is necessary on earlier kernels, is to either make normal read and write system calls, which are synchronous, and make the process sleep until the operation finishes, or to
glibc
has AIO support in all kernels, even those without AIO support, and it implements this using threads,
The AIO facility present in the 2.6 kernel series allows processes to do true AIO. UML uses this by having a separate thread handle all I/O requests, but now, this thread can have many operations pending at once. It issues operations to the host and waits for them to finish. As they finish, the thread interrupts the main UML kernel so that it can finish the operations and wake up anything that was waiting for them. This allows better I/O performance because more parallel I/O is possible, which allows data to be available earlier than if only one I/O request can be pending.
O_DIRECT
allows a process to ask that an I/O request be done directly to and from its own address space without being cached in the kernel, as shown in Figure 9.1. At first glance, the lack of caching would seem to hurt performance. If a page of data is read twice with
O_DIRECT
enabled, it will be read from disk twice, rather than the second request being satisfied from the kernel's page cache. Similarly, write requests will go straight to disk, and the request won't be
Figure 9.1.
O_DIRECT I/O
compared to buffered I/O. When a process does a buffered read, the data is first read from disk and stored in the kernel's page cache. Then it is copied into the address space of the process that initiated the read. Buffering it in the page cache provides faster access to the data if it is needed again. However, the data is
|