Imagine the Following Situation
You are part of a small IT department in a company with approximately 20 employees. Each employee has a Windows or Linux computer, depending on their needs, and some also have Android smartphones.
You want to deploy a data storage app across all of the company’s IT equipment. Several meet the company’s needs, but you want to make sure it works with Windows, Linux, and Android before making your choice.
The most direct way to check this would be to test them on each of the company’s devices, but they’re all being used, and there’s no way you can collect all of your colleagues’ equipment!
Luckily, a solution will allow you to run all of the tests on your own computer, using virtualization.
Here are some more reasons for virtualization:
Testing an operating system without installing it on your computer.
Using specific features of an operating system.
Checking an app’s compatibility with different operating systems.
Simulating multi-operating system environments.
Using an app in a particular environment.
Simulating a 2nd machine and running simple communication tests.
Creating a small-scale network between several machines.
Pooling physical servers to save resources.
Making architecture highly available by improving its resistance to outages.
Migrating virtual servers onto new physical servers.
As you can see from this (incomplete) list, virtualization serves many purposes. First, let’s look at the characteristics of a virtual machine.
What is a Virtual Machine?
A Virtual Machine, or VM, is a machine that is not physical – i.e., does not have dedicated physical resources. A computer needs four main types of resources to function:
CPU (Central Processing Unit)
Memory (RAM)
Storage (hard drive)
Network (optional)
So how can a virtual machine work without any physical resources?
Simple – it uses the physical (host) machine’s resources on which it is installed. The principle of virtualization is shared resources. The host machine may not need 100% of each resource to function. Therefore, it can lend or allocate part of these to one or several VMs.
In short, a VM is a computer within a computer (welcome to the matrix!).
Explore the Role of Hypervisors
How are the resources shared between virtual and physical machines?
Machines (Windows, Linux, or others) cannot share the physical resources they use, which is where a hypervisor comes in.
This rather strange-sounding word refers to a category of apps that can share the machine’s resources on which they are installed.
Hypervisors have two main roles:
Creating virtual resources specific to each VM.
Sharing its own resources.
Understand How Hypervisors Create Virtual Resources
First, it creates virtual resources for each VM.
VMs don’t try to use the host machine’s resources directly because they are unaware that they are VMs on a host. Therefore, they rely on their virtual resources. And, like any physical machine, a VM has its own hard drive, memory, processor, and peripherals. The only difference is that they are all virtual.
Understand How Virtual Machines Share Resources
Second, the hypervisor allocates the resources needed to each VM at the right time and in the right quantities (within certain pre-established limits).
It's like a living organism (such as a tree) that draws resources (water, nutrients) from the soil and sends them to its branches, according to its needs.
Distinguish Between Hypervisors
Now you understand the general concept of virtualization, let's go into more detail about types of hypervisors.
There are two main categories used in different cases. Let's dig in!
Type 2 Hypervisors
You will typically find type 2 hypervisors in smaller environments. They are good for cases where you have only one machine and need to run multi-platform tests (apps, operating systems, etc.).
You can also compare them to a shared Uber trip. You share limited resources with all of the other passengers. If the journey to another passenger's destination is a busy route, it will slow your trip down.
Type 1 Hypervisors
Type 1 hypervisors are particularly useful in large-scale business architecture. They provide secure, resilient, and high-performance virtualization to companies worldwide.
They are like a city train network, where the physical host is a train, and the virtual machines are the passengers.
Even though building a train is more expensive than one trip in a taxi, it becomes more cost-efficient with higher volumes of passengers and is large enough to handle traffic during peak hours.
Let’s Recap!
There are a large number of use cases for virtualization, including:
Testing an operating system without installing on a physical computer.
Pooling physical servers to save resources.
Creating a small-scale network between several machines.
And many more.
A virtual machine does not have dedicated physical resources.
Hypervisors have two main roles:
Creating virtual resources specific to each VM.
Sharing its own resources.
There are two main categories of hypervisor:
Type 2 - used on one specific computer in small environments.
Type 1 - used on dedicated hardware in larger organizations.
You made it through the first chapter and learned two of the most important terms you’ll need to know about virtualization: virtual machines and hypervisors. In the next chapter, we will take a closer look at type 2 hypervisors.