A virtual machine is a simulated computer system which runs on a physical computer. In other words, a virtual machine is a computer inside a computer. Virtual machines allocate memory, a virtual CPU, disk storage space, and a network interface. This means that we can have a Windows computer that runs multiple virtual machines composed of Ubuntu Linux, macOS, Windows 10, Solaris, and CentOS, and they will all be completely separate from our parent Windows operating system.
The entire idea of a virtual machine revolves around having a system that distributes resources from our physical host to our virtual environment. The resource distribution is set up via a user’s needs so specific limits can be set in terms of CPU that can be used, or space allocated to our virtual machine. Usually, these settings are created and applied during the installation/setup of our virtual machine, with the hypervisor controlling the actual resource allocation.
This method allows us to run multiple virtual machines limited only by the available resources of the parent OS. When a VM is not running, resources are utilized by your host machine (the physical server that a VM runs on), so resources are not held in limbo or exclusively reserved for a VM when it is powered down.
How Do VMs Work?
Virtual machines operate using virtualization technology. As mentioned earlier, these virtualization applications use specialty software to effectively create an isolated virtual space in which different operating systems run and separate resources are distributed to each virtual instance.
We can have multiple VMs running on our host computer, and those OS's running under it are called guests VMs. Since a guest operating systems is isolated from the parent and other guest operating systems, any changes that are made do not impact the parent computer or the other VMs. To simplify, a virtualization software launches smaller scale computers that utilize allocated resources we assigned to them.
What is a Hypervisor?
A hypervisor is what makes virtualization possible as it is the control system of the created virtual machines. It is a software that can either sit on top of the operating system or be installed directly on the hardware. Its primary responsibility is to take that physical resources that are available and distribute them to one or more VMs. The hypervisor is a crucial part of virtualization since it acts as a barrier between the host operating system and the virtual machines, effectively making it two completely separate entities on one physical device. Its primary ability is to simulate hardware components in the host operating system that the VMs will run on.
Types of Hypervisors
There are two main types of hypervisors
- Bare Metal Hypervisors (Process VMs)
- Hosted Hypervisors (System VMs)
Sometimes, the difference between these virtualization types is not always crystal clear. For example, in the Linux's kernel, there is a module which was introduced in 2007 that effectively modifies the host operating system to a type-1 hypervisor. This allows it to be both a hardware and software based hypervisor.
Bare Metal Hypervisor (Process VM)
A bare metal hypervisor or a type 1 hypervisors runs directly on the host's hardware to control and manage the guest OS. Bare metal hypervisors are primarily used in enterprise environments as they allow for the "over-allocation" of physical resources. With a type 1 hypervisor, we can designate additional resources to a group of virtual machines.
You may be asking, "How can I add memory I don't have available?
Let's say our host server has 128 GB of RAM available. Now, if we create eight virtual machines and assign 24 GB of RAM to each. This totals 192 GB of RAM, however, the VMs themselves "will not actually consume all the 24 GB of RAM" assigned the host!. The VMs believe they have a full 24 GB of RAM but really, they will only use the amount of RAM needed to perform specific tasks. So, the hypervisor only allocates the amount of RAM needed for an instance to be fully functional.
One examples of a type 1 hypervisor common in a hosting environment is KVM (Kernel-based virtual machine). KVM allows the kernel to function as a hypervisor running unmodified Linux or Windows images. Using KVM, we can run numerous virtual machines, each having a unique amount of disk space, graphics adapter, network card, etc.
Hosted Hypervisor (System VM)
A Hosted Hypervisor or type 2 hypervisor will run inside the operating system on a physical host server. This is why they are called a "Hosted Hypervisor." The main difference between type 1 and type 2 hypervisors, is that type 1 runs on hardware, while type 2 runs within an operating system.
Type 2 hypervisors are commonly used in environments where a smaller number of servers are needed Additionally, in type 2 hypervisors, over allocation of resources is not possible since it will lock in the full amount of assigned RAM and crash the host machine. The management of a type 2 hypervisor is easier than type 1 hypervisor since tasks are performed on the host server where the management console is installed.
The management console also allows for other features to be utilized like monitoring, snapshot creation and use, or creating templates with pre-installed applications that will automatically be deployed when installing VMware or VirtualBox on our host machine.
What is Virtualization?
Virtualization is the process of running one or more virtual instances (VM’s) inside another computer. The idea was first put forth in the 1960s when systems analysts were looking for ways to logically divide the system resources inside a mainframe computer between different applications.
Today modern computers have significant more processing power and storage space. Still, for the great majority, these resources are not utilized to its full capacity. Virtualization technology helps with this under-utilizing resources issue by creating multiple virtual machines that run from a single hardware unit or server. The "cloud" is an example of how virtualization can improve resource utilization and processing power since it distributes resources making it very cost-efficient. We will look at the three main types of virtualization.
The idea behind full virtualization is that a virtual machine is completely isolated from the guest OS. The VM will simulate the hardware but is completely disconnected from the actual hardware by a virtualization layer. A few typical examples of full virtualization that we see in use today are KVM, VMware Fusion, Microsoft Virtual PC, and VirtualBox.
Hardware-Assisted Virtualization uses the hosts physical devices to support the software which creates and manages the virtual machines. They also allow VMs to execute privileged instructions directly on the processor without affecting the host. The hypervisor type is a fundamental component of this kind of virtualization.
OS Level Virtualization
In this type of virtualization, the kernel of an OS allows for numerous user-space instances that are separate and isolated from the others. This kernel-based virtualization module enables these instances to run on top of an existing host operating system to provide an image of a server.
This machine-level virtualization creates isolated containers or partitions on a single physical server. Each of these instances work independently of the others but share the same physical resources available on the host server. The shared resources for each instance are limited by the amount of total resources on the host. These instance types have multiple names depending on the OS itself. Some common names are Containers, Virtual Private Servers, or Virtual Environments, and this type of virtualization is quite common in general hosting.
What is the Difference Between VMs and Containers?
One of the main differences between VM and a container is that containers run on the underlying operating system while VM’s have their own operating system using hardware VM support. Hypervisors manage VM’s while a container system will provide services from the underlying host and isolate the applications using virtual memory hardware.
To simplify, a VM will virtualize the hardware thanks to a hypervisor while the container will virtualize the operating system. Containers are generally smaller, used in a more limited way (like for testing applications before deployment), and do not have a built-in operating systems like VM’s. In contrast, a VM can mimic and entire servers, networks, databases, etc.
Why use a Virtual Machine?
In terms of flexibility, virtualization of a VM will allow for the rapid deployment of different types of virtual machines. All of them can be customized in terms of the operating system, resource utilization, and other aspects. Most, if not all, hypervisor vendors will also allow us to create specific templates that can be deployed simply by the click of a button.
Let’s imagine that you have a server hosting multiple virtual machines. If by chance, one gets infected with malware. The entire recovery process would be straightforward since we have the option of merely redeploying the VM with all the software on it being already installed. This is again due to the fact we are deploying virtual machine from the template. This saves valuable time in setting up the machine, and since virtual machines exist within its own segregated environment, there is no risk of other VMs getting infected.
The continuous cost of hardware upgrades can be prohibitive in any business. While virtual machines may still need power and software licensing, VMs are a cost-effective solution since virtual machine resource usage can be better controlled and set to pull resources in a more disciplined manner than a multi-hardware based systems.
Again virtual machines run off a centralized management scheme which allows for the rapid deployment and control of all the VMs units from a single point. This is more efficient than managing multiple workstations, primarily if they are spread out across various locations.
There is little risk of data loss in case of a hardware failure since virtual machines make regular backups of their history. Everything can be redeployed quickly and easily, saving valuable time to recover and redeploy the VM.
Virtual machines can be less efficient than the dedicated servers since they do not access the hardware directly. In other words, they do not have the hardware of their own but must rely on the communication through the operating system, which can slow the response from the hardware.
VM’s can take up a significant amount of system resources from the host, especially if we are running multiple VM instances. Additionally, if the resource distribution is not set up correctly, it can crash the host and all other VMs with it.
While this issue can be debatable (since VM’s run isolated in regard to the rest of the operating system), they are still software solutions. They can be susceptible to malware that can potentially jeopardize security. If an attacker manages to get access to the hypervisor itself, then all the virtual instances could be in jeopardy. In such situations, if there was not a sufficient fail-safe option, there is no way of knowing that the VMs are compromised. This type of scenario is especially frightening if we imagine a large-scale virtualization operation running hundreds or thousands of virtual machines.
Virtualization and cloud systems are the future of computing. Simply put, virtual machines are a more cost-effective solution that allows us to control the entire workflow of an environment better, more cost effectively, and distribute resources between individual virtual machines more efficiently. There are many applications for virtualization from cloud computing to simply testing a new operating system. With the future of computers being in the cloud, virtual machines are a welcome adjunct. While both containers and VM’s have their pros and cons, the best choice for your business depends on your current project needs. However, both can be outstanding solutions to better cost-effectiveness computing.
We pride ourselves on being The Most Helpful Humans In Hosting™!
Our support staff is always available to assist with any issues related to this article, 24 hours a day, 7 days a week 365 days a year.
We are available, via our ticketing systems at email@example.com, by phone (at 800-580-4986) or via a LiveChat or whatever method you prefer. We work hard for you so you can relax.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.