There are some specialized terms that you need to know about when working with virtualization. This video covers terms like virtualization, hypervisor, host, and guest.
- [Narrator] Your laptop or desktop computer, has an operating system running on it, allowing the software you use, to communicate with the hardware in the system. In order to store information and memory, to run instructions on the processor, to play sound or video, and to transmit and receive data over the network. This operating system, if it's configured correctly, has full use of the resources that your computer offers. If you have 16 gigs of RAM, the operating system can use all of it. If you have two network adapters, the operating system can use both of them.
If you have four processor cores, the operating system can run instructions on all of them. For decades, this is how computers have run. With one operating system per physical computer. When an operating system is installed directly on a computer, we say that it's running natively, or on the bare metal. Referring to the fact, that there's nothing in between it, and the physical metal components of the computer. But, in many cases, one operating system doesn't constantly consume all of the resources available to it. Leaving idle processor cycles, unused memory, and so on.
How could we use these resources more efficiently? Perhaps, we could have two operating systems running on the computer at the same time. What if we wanted to have 10 operating systems running? We can't install more than one operating system, directly on a system. Directly on the metal. Instead, we need a way to make sure, that our operating systems can access specific portions of the computer's resources, keeping them separate from each other. In order to accomplish this, we use software called a Hypervisor, that manages access to resources on the computer, by giving an operating system a virtual platform to run on.
A protected space, with resources that look like a complete, real computer, to the operating system running inside of it. This operating system running in a virtual machine, is called a guest operating system. And the system that's running the Hypervisor, is called the host. Without virtualization, it would be impractical to run many modern services. Think for a moment, of how many clients a cloud provider, like Amazon, Google or Microsoft has. There isn't a separate physical computer, for every instance they run.
When you start up a web server or something, on Azure or EC2, a Hypervisor creates a virtual machine for you. Using some of the resources, of a large server, or cluster of servers. Your virtual machine runs alongside hundreds of others, all sharing the resources of that system. They all have a little bit of RAM made available to them, a little bit of processor power, a little bit of storage, and they all have a connection to the network. But that host server, doesn't have hundreds of processors, or hundreds of network ports.
It probably has a few, but certainly not one per virtual machine. So, how did these virtual machines get their resources? There are two primary types of virtualization, so there are two answers. These types are full virtualization, and paravirtualization. In a full virtualization scenario, sometimes called HVM, or hardware virtual machine, the hypervisor creates virtual devices. Including a virtual motherboard, virtual processor, virtual RAM, and virtual versions of all of the hardware, a system needs to operate.
For example, a virtual network adaptor. So, the virtual system, gets a device, that looks like a real network adaptor. But in reality, is simulated, or more precisely, emulated by the hypervisor. The guest operating sends and receives data through this virtual adaptor. And then, the emulator translates those requests, to the real hardware. Emulation software can provide almost any kind of device to a virtual machine. Even memory and a processor. Though, emulating the activity of processors, can be pretty slow.
To speed up virtual machine, the processor manufacturers, add a set of instructors to their chips, that allow a hypervisor to pass processor instructions directly from a VM to a real processor. Rather than emulating the processor, while keeping those instructors and their results, separate from other instructors from the host machine and from other guest operating systems. On Linux systems, a common software package, that's used to emulate hardware, is called QEMU, or Quick emulator. And the software that lets instructors pass through, to supported processor, is called KVM, or Kernel-based virtual machine.
Together, these packages handle the details of presenting a virtual environment for an operating system to use. We can use QEMU by itself, to emulate a whole system. And, if KVM is available, and the processor of the host machine supports these commands for hardware virtualization, QMEU will use KVM for direct access, instead of emulating a processor and memory. KVM used to be a separate package, but now it's part of QEMU. In the full virtualization scenario, you can install any operating system, and it doesn't need to be modified, in order to run correctly.
The other kind of virtualization you may see, is called paravirtualization. To run in a paravirtualization machine, the guest operating system must be modified to know, that it's running as a virtual machine. These modifications were added to the Linux kernel a while ago. So, Linux can run either, under a hardware virtualized system, or a paravirtualized system. But many other operating systems, notably Windows, can not. These modifications allow a guest, to communicate directly to some hardware resources on the host machine. Like, storage and network hardware.
This gives a performance boost, because the hypervisor doesn't have to take input from an emulated adapter, and then translate it physical hardware. But, in a paravirtualized machine, the memory and processor, are still emulated. QEMU and KVM, provide a hardware machine environment, for guest operating systems, with some paravirtualized hardware, to improve speed. In order to use full paravirtualization for a guest, you'd need to use the xen hypervisor. The Linux kernel has support both hypervisors, and both are widely used in industry.
Xen and some other hypervisors like Proxmox and ESX, run as the bare metal, or the native operating system on a host. KVM on the other hand, runs inside of a Linux installation, as a module within the kernel, leaving an operating system that can be used for other things. In addition to acting as a hypervisor for guest operating systems. In order to manage virtual machines, we can use QEMU directly, or we can use software that interfaces with a hypervisor, to make creation and manage a more visual experience.
Such as the tools that come with the libvirt package, or software like Virtual Machine Manager. Which is a graphical tool, that's also part of the libvert ecosystem. Managing a VM directly with a command line, can be relatively easy for a handful of VMs on one host. But if you prefer graphical tools, or have many hosts to manage, a graphical tools can make your life a lot easier. Virtual machines give you the ability, to scale the processing power, memory, storage, and other aspects of a guest, in order to respond to changes in business needs, or to provision identical nodes, in order to scale up, or out, as your app demands.
Many of the features of cloud services are based on this flexibility, though many of the cloud providers have their own tools and systems, to manage, monitor and track resource usage efficiently. So, when we create virtual machines, we have a few options in front of us. Do we use a dedicated hypervisor, like Xen or Proxmox, or ESX? Do we use containers, either natively, or with software like Docker? Do we take advantage of KVM on a Linux installation? It depends on what you need to do, but in this course, we'll focus on working with what KVM offers us. And when we create virtual machines on a Linux system, we have a few ways to do so.
We can create a VM directly with command line, or we can use some management tools that help make the process easier. We'll take a look at those, throughout the rest of the course.