Computer Running Inside Our Computer (Virtual Machine)

Computer Running Inside Our Computer (Virtual Machine)

WHAT IS A VIRTUAL MACHINE

  • Imagine you have a computer with hardware and their is an operating system on top of it let's take it MacOS. So, the macOS will control how the hardware will be used for different operations, we will also run different application on top the operating system for our use. But now you have to work on different operating system like Linux, so for that you will need a separate computer on which you will run Linux and different applications on top of Linux. Here comes the concept of Virtual Machines into the picture.

hyper.jpeg

  • By this idea we don't need a separate computer to run a different operating system, we can run our Linux operating system on top of our windows and for that we need Hypervisor. Hypervisor is a tool which helps to run multiple virtual computers on top your a physical computer (your host operating system). Virtual Box is one the popular hypervisors in the market because it is open source and it runs on all operating systems.

  • A VM creates all virtual hardware resources like CPU, RAM etc. It uses a part of actual hardware resources of our Host OS. So, we can say that hardware resources of our host OS is shared to run multiple VM's on top of it. Hypervisor asks host OS to borrow required hardware resources to run the guest OS.

  • A VM is completely isolated such that it does not know that it is hosted on another OS. By this isolation if something wrong happens inside the VM it will affect the host OS.

Type 1 HYPERVISORS (Used by companies and big organizations)

what-is-a-hypervisor-server_5f5ed47e2d2aa.jpeg

  • The type of hypervisor which we saw above in which we create VM on top of existing OS is called Type 2. This type is used for personal use and development purpose.

  • In Type 1 Hypervisors we do not install hypervisor on top of a host OS instead we install it directly on the hardware because of which hypervisor in this case directly talks with the hardware resources for VM's, their is no need of host OS in between. This type is used by big servers used by companies. Microsoft Hyper-v is a popular type 1 hypervisor. Type-1 hypervisors are also called bare metal hypervisors.

USES AND BENEFITS of Type 1

  • Imagine we have a virtual server on a cloud platform like Digital Ocean. And on that server you are running a VM and also an another user is also running its VM. These VM's will be completely isolated, if someone's VM got hacked it will have zero impact on the other.

  • The one benefit of this virtualization of servers is that they can use all the resources of a very efficient big server and can use these hardware resources as their needs.

COMPANIES MOVING TO VIRTUALIZATION

Before Virtualization

  • Imagine a company is running its application on their server, let's say they are running Jenkins or any database or proxy etc. on top Linux OS. Important point here is this Linux OS is directly installed on the hardware without any hypervisor which makes it tightly coupled to the hardware. So, now if hardware failed then it will destroy our OS and all of our work, configuration and setup inside the application running will be gone in split of a second. This problem is solved by virtualization

After Virtualization

  • In case of virtualization we have virtual images which is a file in which we specify our OS and our applications and configurations etc. We can keep copy's of that file as a backup. So if the hardware crashes now we can run our virtual image on any other system(hardware) on top of a hypervisor.

  • So, by this method we can secure our work, we have a portable OS and we are server independent. Because of these benefits companies today are moving to virtualization.