Imagine a world just like we are in now, where we interact with everyday objects. We can touch and sense things but there is a twist. The things we are interacting with, don't exist they are simulated but we don't know this. This is what a computer set up to do virtualization experiences.
In this article, we have explained in depth the idea of Virtualization in computing, what it means and how we can utilize it along with core ideas like Hypervisor.
Table of Content
- How a Normal Computer/Server Operates
- What is Virtualization
- Virtual Machines
- Benefits of Virtualization
How a Normal Computer/Server Operates
We know that a computer is made up of layers. We have the Physical/Hardware layer that consists of things like the ram, devices and drivers and storage. We have the Operating System(OS) Software layer that runs on top of the physical layer. It is responsible for managing all the physical resources that belong to the computer and allocating them accordingly. Some examples of operating systems include Windows, Linux and macOS. Finally, we have the application layer. This is the layer we typically interact with most of the time. All the other software we run on our computer exist at the application layer. This layer relies on the operating system. It does not have direct access to the underlying hardware and must ask for it from the operating system.
These 3 layers are what makes a computer. The Hardware(layer 1) and the Software(layer 2 and 3).
What is Virtualization?
Virtualisation is the process of creating a software-based (virtual) version of something. We have multiple types of virtualization like storage, networking or hardware. When most people talk about virtualization they are referring to hardware or server virtualization. So we will be using the word in that context.
Put succinctly Virtualization is an abstraction layer over computer hardware that works by creating virtual computers that can all run on one host machine simultaneously. In order words, now we have an extra virtualization layer that the virtual machines sit on top of.
A virtual machine is made up of virtual hardware and normal software. To the operating system, the virtual hardware is equivalent to physical hardware so everything runs the same as it would run with physical hardware. These virtual machines are known as guest computers and they operate within the Host which is the physical server. To illustrate the point. We could virtualize a single server and create 3 virtual machines 2 of them could be running Linux and the other one could be running windows and they would all be running on the same server in isolation. If one of the guests crashed or got corrupted nothing would happen to the remaining two they would still go on running on the host.
3 Virtual machines each running a different OS
The Hypervisor is the software that facilitates virtualization. The hypervisor is what runs on the virtualization layer, it interfaces between the virtual computers and the hardware. The hypervisor is responsible for creating the virtual hardware for the VMs. The hypervisor is what actually responds to the requests that operating systems make to their virtual hardware and allocates the physical resources accordingly.
Types of Hypervisors
There are two types of hypervisors. Type1 and Type2 hypervisors.
A Type 1 hypervisor is often referred to as a bare-metal hypervisor as it is embedded directly on the hardware. Using the 3 VM example above, suppose the host computer had about 16Gb of RAM on its CPUs. A bare-metal hypervisor would split this resource when it is creating the virtual hardware. So all the 3 virtual machines could have a virtual CPU of 4 Gb each. Each of the VMs is only aware of the virtual RAM it has so it is sort of like having 3 computers that have 4Gb RAMs running on the same hardware. The operating systems in the VMs do not know the difference, they request resources from the virtual hardware the same way they would if it was physical.
Type 2 hypervisors are different. They are hosted hypervisors that run at the application layer of a host OS. They are installed on an operating system and have to rely on the operating system to give them underlying access to the hardware. For example, if you had a system running on windows 10 and you wanted to use the Linux os too. You could download and install a hosted hypervisor program and use it to create a virtual computer that ran on Linux and you would be able to do everything you could do on a native Linux machine.
Benefits of virtualization
We have talked about virtualization but we haven't explained why it is so important. Virtualization is used widely especially by big firms and cloud providers. So why do need virtualization?
Individual Servers especially in recent times have a lot of computational power and storage. Let's say you own a big firm and you need specialized servers, maybe a mail server and a web server. You would need to run both on separate servers because we need to isolate the 2 services. So for every specialized server, we needed to run there would be a one to one mapping to a physical server. This approach will not be efficient because most times these services do not fully utilize all the resources on the hardware. For example, the mail server might just need 30% percent of resources that the hardware provides while the webserver might need only 40%. With Virtualization, we could run both these services on a host server in separate virtual machines running independently and still have some computational power to spare. That's the power of virtualization, now we can use only one physical server instead of two and get to save on electricity, hardware costs and space. One host server can support as many virtual machines as feasibly possible. In essence, we can maximise the use of our hardware.
Portability and Availability
Virtual machines are extremely portable because it's all software they are essentially a bunch of files. This means we can move VMs around from one host to another without the guest machines being any wiser. Virtual machines also support what is known as snapshots which are saved states of a VM. With snapshotting, we could easily duplicate our virtual machines and run multiple instances all at the same time. Meaning that if any VM instance crashes we still have the other instances running and we will not suffer any downtime. Cloud Computing companies utilise these features of virtualization which results in them being able to serve their customers and offer a high level of flexibility.
Virtual machines by definition are isolated these offers us a lot of security. If malicious software infects a particular virtual machine it cannot affect the other VMs running on the host. This is a very useful feature because whenever we have doubts about a particular application, We can always spin up a new virtual machine and install it there.
Virtualization is an important concept to understand. It facilitates a large part of the web and it allows us to utilise hardware much more efficiently
With this article at OpenGenus, you must have the complete idea of Virtualization.