What is a virtual machine?

svg viewer

A virtual machine is an emulated environment running on a machine with its CPU, memory, and storage. With the help of a virtual machine, we can run additional operating systems on top of the current operating system. For example, we want to run Ubuntu in a Windows environment. A virtual machine is wholly isolated from the host machine and operates as a completely independent entity. There are two types of virtual machines:

  1. System virtual machine: It is used to emulate the entire operating system, which simulates an entire physical computer, such as running a Ubuntu operating system in a virtual machine.

  2. Process virtual machine: It emulates a process independent of the host environment. This means we run a single application in the virtual environment instead of a whole operating system.

Layers in a virtual machine

A virtual machine's environment can be broken down into 5 different layers, as shown in the diagram below:

Below, we can see a brief explanation of the different layers of a virtual machine.

Infrastructure

The infrastructure consists of the host hardware and the host operating system. The host hardware is the computer or the server on which all hypervisors run. Its job is to provide the hardware resources required to run the virtual machines. The host operating system runs directly on the host hardware and is used to manage the hypervisor and allocate hardware resources.

Hypervisor

A hypervisor acts as a bridge between the virtualized OS and the hardware. It pools the hardware resources and allocates them to the host and the guest. Some of the components that a hypervisor needs to do its job are a memory manager, process scheduler, I/O stack, device drivers, security manager, and network stack.

Virtual machine

The virtual machines use the resources allocated to the by the hypervisor to run a guest operating system and applications on top of that operating system.

Operating system

This is referred to as the guest operating system running in the environment created by the virtual machine; its job is to run applications that a user may want to run in a virtual environment.

Applications

These are the various applications that we may want to run on a virtual environment emulated by a virtual machine, for example, running an application on a Ubuntu operating system running in a virtual machine.

Advantages and disadvantages



Multiple Operating Systems can be run on one.

Running multiple Operating System on one computer/server imposes a toll on its components and uses up more memory and CPU.

Fewer hardware components needed to operate multiple Operating Systems.

Having multiple Virtual Machines running on one computer/server can lead to sub-optimal performance.

Quick disaster recovery lets you smoothly redeploy.

Since hardware is shared across all Virtual Machines, failure of a component will have an ​adverse effect on all the machines.

Virtual machine can be used to save us costs of additional hardware resouces.

For applications that require direct hardware access, they can not be ran in a virtual enviroment.

Virtualization offers scalability as we can add numerous virtual enviroments to a single host machine.

Numerous virtual machines on a single host system make memory management difficult and can waste hardware resources.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved