Check out the new USENIX Web site. next up previous
Next: Process creation and destruction Up: Design and implementation Previous: Overview

Virtual machine initialization and shutdown

Before the kernel itself starts booting, some initialization needs to be done in order to make the process look enough like a real machine that the kernel can boot it up. This is analogous to the boot loader on a physical machine doing some hardware setup before running the kernel.

The process arguments are concatenated into the buffer in which the kernel expects to find its command line. Some arguments, which affect the configuration of the virtual machine and how it's to be debugged, are parsed at this point. The physical memory area is set up, some initialization of the task structure and stack of the idle thread is done, the idle thread is started, and the initial thread settles down to its permanent job as the tracing thread.

The idle thread calls start_kernel and the virtual machine boots itself up. There is some more architecture-specific initialization that needs to be done. mem_init makes memory available to the initial boot process, paging_init makes all free memory available to kmalloc, and the various drivers are registered and initialized.

At the other end of the virtual machine's lifespan, when halt or reboot are run, an architecture-specific routine is eventually called to do the actual machine halt or restart. In this port, that involves killing all processes which are still alive, including any helper threads which weren't associated with any virtual machine processes, and asking the tracing thread to finish the shutdown.

If the machine is being halted, the tracing thread simply exits. If it's being rebooted, it loops back to calling the machine initialization code. At that point, the machine boots back up just as it did when it was first run.


next up previous
Next: Process creation and destruction Up: Design and implementation Previous: Overview
Jeff Dike 2000-08-23