Before diving into VMs (Virtual Machines) and how they work, here are a few basics we need to know.
Computer– A computer is an electronic device that takes input from the user and processes the data under the control of a set of instructions (called program) and gives the result (output). It can be programmed to carry out sequences of arithmetic or logical operations automatically. All this is achieved by the perfect interaction of hardware and software.
Hardware– This refers to the physical and/or tangible parts of a computer system such as CPU, hard disk, monitor, mouse etc.
Software– This is the set of instructions that is stored to run the hardware.
Just like a normal computer, a VM has its own CPU, memory, disks to store files and can connect to the internet if needed. However, it runs on a virtual environment and can be thought of as a computer within a computer i.e. VMs are often thought of as virtual computers or software-defined computers within physical servers, existing only as code. Software called a hypervisor separates the machine’s resources from the hardware and provisions them appropriately so they can be used by the VM. It runs on an isolated partition of its host computer with its own CPU power, memory, operating system (such as Windows, Linux, macOS), and other resources. End users can run applications on VMs and use them as they normally would on their workstation. VM memory space is normally borrowed from the host machine which can be a PC or a server.
How does a virtual machine work?
Virtualization is the process of creating a software-based, or “virtual” version of a computer, with dedicated amounts of CPU, memory, and storage that are “borrowed” from a physical host computer—such as your personal computer— and/or a remote server—such as a server in a cloud provider’s datacentre. The virtual machine is partitioned from the rest of the system, meaning that the software inside a VM can’t interfere with the host computer’s primary operating system. Hypervisor VM manger enables users to run an OS (Operating system) within another OS. Examples of VM mangers are VirtualBox and VMware.
Reasons for using a VM are:
- Trying a new OS
- Testing an application
- Backing up existing OS
- Building and deploying apps to the cloud
- Trying to access and isolate virus infected data
Advantages of VM
- Reduction of physical infrastructure and thus saving on cost
- Easier and faster access to data
- Virtualization makes the process of running dev-test scenarios a lot quicker
- They are great solution for backup incase the host machine goes down