Qemu:
QEmu is a complete and standalone software of its own. You use it to emulate machines, it is very flexible and portable. Mainly it works by a special 'recompiler' that transforms binary code written for a given processor into another one (say, to run MIPS code on a PPC mac, or ARM in an x86 PC).
To emulate more than just the processor, Qemu includes a long list of peripheral emulators: disk, network, VGA, PCI, USB, serial/parallel ports, etc.
KQemu:
In the specific case where both source and target are the same architecture (like the common case of x86 on x86), it still has to parse the code to remove any 'privileged instructions' and replace them with context switches. To make it as efficient as possible on x86 Linux, there's a kernel module called KQemu that handles this.
Being a kernel module, KQemu is able to execute most code unchanged, replacing only the lowest-level ring0-only instructions. In that case, userspace Qemu still allocates all the RAM for the emulated machine, and loads the code. The difference is that instead of recompiling the code, it calls KQemu to scan/patch/execute it. All the peripheral hardware emulation is done in Qemu.
This is a lot faster than plain Qemu because most code is unchanged, but still has to transform ring0 code (most of the code in the VM's kernel), so performance still suffers.
KVM:
KVM is a couple of things: first it is a Linux kernel module—now included in mainline—that switches the processor into a new 'guest' state. The guest state has its own set of ring states, but privileged ring0 instructions fall back to the hypervisor code. Since it is a new processor mode of execution, the code doesn't have to be modified in any way.
Apart from the processor state switching, the kernel module also handles a few low-level parts of the emulation like the MMU registers (used to handle VM) and some parts of the PCI emulated hardware.
Second, KVM is a fork of the Qemu executable. Both teams work actively to keep differences at a minimum, and there are advances in reducing it. Eventually, the goal is that Qemu should work anywhere, and if a KVM kernel module is available, it could be automatically used. But for the foreseeable future, the Qemu team focuses on hardware emulation and portability, while KVM folks focus on the kernel module (sometimes moving small parts of the emulation there, if it improves performance), and interfacing with the rest of the userspace code.
The kvm-qemu executable works like normal Qemu: allocates RAM, loads the code, and instead of recompiling it, or calling KQemu, it spawns a thread (this is important). The thread calls the KVM kernel module to switch to guest mode and proceeds to execute the VM code. On a privileged instruction, it switches back to the KVM kernel module, which, if necessary, signals the Qemu thread to handle most of the hardware emulation.
One of the nice things of this architecture is that the guest code is emulated in a posix thread which you can manage with normal Linux tools. If you want a VM with 2 or 4 cores, kvm-qemu creates 2 or 4 threads, each of them calls the KVM kernel module to start executing. The concurrency—if you have enough real cores—or scheduling—if not—is managed by the normal Linux scheduler, keeping code small and surprises limited.
.bash_profile
and .bashrc
are specific to bash
, whereas .profile
is read by many shells in the absence of their own shell-specific config files. (.profile
was used by the original Bourne shell.) .bash_profile
or .profile
is read by login shells, along with .bashrc
; subshells read only .bashrc
. (Between job control and modern windowing systems, .bashrc
by itself doesn't get used much. If you use screen
or tmux
, screens/windows usually run subshells instead of login shells.)
The idea behind this was that one-time setup was done by .profile
(or shell-specific version thereof), and per-shell stuff by .bashrc
. For example, you generally only want to load environment variables once per session instead of getting them whacked any time you launch a subshell within a session, whereas you always want your aliases (which aren't propagated automatically like environment variables are).
Other notable shell config files:
/etc/bash_profile
(fallback /etc/profile
) is read before the user's .profile
for system-wide configuration, and likewise /etc/bashrc
in subshells (no fallback for this one). Many systems including Ubuntu also use an /etc/profile.d
directory containing shell scriptlets, which are .
(source
)-ed from /etc/profile
; the fragments here are per-shell, with *.sh
applying to all Bourne/POSIX compatible shells and other extensions applying to that particular shell.
Best Answer
I believe Lucas may be a bit off with his explanation. The virtual kernel comes with a specific set of modules designed to run on common VM setups (vmware, virtualbox, xen, etc.). VM setups have very specific sets of supported "virtual" hardware, and thus do not require, nor are able to make use of a lot of the standard modules. If the virtual kernel lacks a module you need, that's when the virtual-extras comes in. It includes the modules missing from the virtual kernel; installing it adds the missing modules.