What is Virtual Machine?

What is Virtual Machine

A virtual machine is a kind of a software. In computing, a virtual machine is an emulation of a computer system. Virtual machine js an idea, to abstract the hardware of a single computer system into several different execution environments such that each seperate environment is running it own private computer.

Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination of both.

The virtual machine provides an interface that is identical to the underlying hardware. Each process is provided with a virtual copy of the computer.

Uses of Virtual Machine

  1. To test or try the newer versions of operating system. For example, testing windows 10 on windows 8.
  2. Virtual machine is useful in cases where you want to run a software which only runs on an outdated operating system like windows XP then you can install XP in virtual machine and use the software easily.
  3. To run the softwares made for other operating systems. For example, Mac and Linux users can run Windows in a virtual machine to run Windows software on their computers without the compatibility issues of and Crossover.
  4. To test out a single software on many different platforms using a single computer, virtual machine can be used in this scenario.
  5. To make your servers or systems secure virtual machines scan be used. As mentioned earlier, due to the isolation of virtual machines, an attack or a hack breach in one does not affect the others. The fault tolerance and security brought about by the isolation of each virtual machine is a major advantage of virtualization (use of virtual machine).

Advantages of Virtual Machine

  1. Resources are shared indirectly.
  2. Multiple OS environments can exist and work simultaneously on a same machine.
  3. Virtual machine can provide instruction set architecture different from the real computer.
  4. No protection is needed since each virtual machine is completely seperated from all others.
  5. Easy to maintain and recover.
  6. Software programmer can use their own virtual machine to develop system on a virtual machine.
Figure below shows non-virtual machine

In an non-virtual machine there is one kernel which handles processes running in a system. Figure below shows a virtual machine

Working of a Virtual Machine

How does a virtual machine work?

Since virtual machine is an exact duplicate copy of the underlying machine implementing a virtual machine is difficult.

Our usual non-virtual machine has two modes viz. user mode and kernel mode so virtual machine also must have two modes. But the virtual machine itself executes in user mode so how can it have two modes? Well a VM (Virtual machine) can have a virtual user mode and virtual kernel mode. Both running in a physical user mode. This causes a transfer from user mode to kernel mode on real phyical machine and transfer from virtual user mode to virtual kernel mode on a virtual machine.

This process is performed as follows:
  1. When a program running on a virtual machine in virtual user mode performs a system call, it causes a transfer of that call to the virtual machine monitor in the real machine.
  2. When control reaches back to the virtual machine, VM changes the program counterand register content for virtual machine.
  3. It then restarts the virtual machine which is now in virtual kernel mode.

Comments