General view of Computers
If you need to use another OS, you might need a new system and have a operating system on it. It becomes a big task. The concept of virtualization comes into rescue. Virtualization creates virtual machines using an existing hardware using the hypervisor. A hypervisor acts as a bridge between the virtual machine and the operating system.
One of the famous hypervisor is Oracle VM Virtual box. The virtual box takes the hardware resources such as CPU, RAM and creates virtual CPU, virtual RAM for the virtual machines. You are basically sharing the hardware resources with the virtual machines.
A virtual machine is not aware that there is another Operating system. This becomes advantageous when someone hacks into the VM, it doesn't affect the host machine.
Why do we need to use Virtual Machine?
To learn a new OS without really buying buying a new hardware for it. You test your app like web applications on different OS using VM.
Differences between TYPE-1 and TYPE-2 Hypervisor
When you create a virtual machine on top of the hardware directly using the hypervisor, it is known as type 1 hypervisor. This is also known as bare metal hypervisor. VMware ESXi and Microsoft Hyper-V are examples of such hypervisor. Big organizations uses such hypervisors for efficient usage of hardware resources. You can secure your files very easily and it is portable.
Creating a virtual machine on top of an existing operating system(i.e host operating system) is known as TYPE 2 hypervisor.