What is a Virtual Machine?
To understand what a Virtual Machine(VM) is, let’s first understand what a machine is in this context. To put it in simple words, a machine is simply your computer or a server. A virtual machine is a pretend computer that you can create inside your computer/server. It’s not a physical thing that you can touch, but it behaves like a real computer, because it has its own programs and operating system and it shares the resources of your computer. You need to allocate some resource to a VM. These resources are exclusive to the VM and cannot be used by other VMs or the host machine. For example, let’s say your computer has 4 core CPU and 16 GB RAM. If you allocate 2 cores and 4 GB RAM to the VM, you are left with 2 cores CPU and 12 GB RAM for the host machine and/or other VMs. You can create multiple VMs each having its own Operating System. A Virtual Machine is created by using a hypervisor that gives each VM its own virtual CPU, virtual memory, virtual hard disk, virtual network interface - like having all the physical parts in a digital format. This might have raised a question
What is a hypervisor?
A hypervisor is a special piece of software that creates and manages the Virtual Machines. It allocates resources to the VMs. There are 2 types of hypervisors :
Type 1 hypervisor : It runs directly on the hardware without the need of an host Operating System. Hence it is also called Bare Metal hypervisor. It’s used in big data centers and big companies. Ex. : VMware EXSi, Microsoft Hyeper-V
Type 2 hypervisor : It runs on a host Operating System. It is great for personal and smaller use. Ex. : Oracle VirtualBox, VMware Workstation.
So, Virtual Machines are great but
Why do we need Virtual Machines?
Let’s say you have one computer but you want to :
Test different operating systems like Windows, Linux, or Mac without buying separate computers.
Run apps that only work on a specific system.
Save money and space by using fewer powerful machine instead of multiple ones.
Share one computer with multiple people or companies without letting them interfere with each other.
Virtual Machines are isolated. Hence, they improve security as virus in one VM cannot affect the other VM.
VMs make all this possible!
Difference between Type 1 hypervisor and Dual booting
Type 1 hypervisor allows you to run multiple Virtual Machines (VMs) at the same time, each with its own operating system. Unlike dual booting no reboot is required to switch between machines and the resources are shared between the VMs. Dual booting allows using only one OS at one time and it gets to use the entire resources.