What Is a Virtual Machine?
What Is a Virtual Machine?
A virtual machine is a virtual environment that functions as a virtual computer system with its own CPU, memory, network interface, and storage.
Join the DZone community and get the full member experience.Join For Free
A virtual machine (VM) is a virtual environment that functions as a virtual computer system with its own CPU, memory, network interface, and storage, created on a physical hardware system. Software called a hypervisor separates the machine’s resources from the hardware and distributes them appropriately so they can be used by the VM.
The physical hardware, equipped with a hypervisor such as Kernel-based Virtual Machine (KVM), is called the host, while the many VMs that use its resources are guests. The hypervisor treats compute resources — like CPU, memory, and storage — as a pool of resources that can easily be relocated between existing guests or to new virtual machines.
VMs are isolated from the rest of the system, and multiple VMs can exist on a single piece of hardware, like a server. They can be moved between host servers depending on demand or to use resources more efficiently.
The operating system in a VM runs in the same way that an operating system or application normally would on the host hardware, so the user experience with a VM will be similar.
You might also be interested in: Inside the Java Virtual Machine (Part 2)
How Do VMs Work?
Virtualization technology allows you to share a system with many virtual environments. The hypervisor manages the hardware and separates the physical resources from the virtual environments. Resources are partitioned as needed from the physical environment to the VMs.
When the VM is running and a user or program issues an instruction that requires additional resources from the physical environment, the hypervisor schedules the request to the physical system’s resources so that the virtual machine’s operating system and applications can access the shared pool of physical resources.
Types of Hypervisors
There are 2 different types of hypervisors that can be used for virtualization.
A type 1 hypervisor is on bare metal. VM resources are scheduled directly to the hardware by the hypervisor. KVM is an example of a type 1 hypervisor. KVM was merged into the Linux® kernel in 2007, so if you’re using a modern version of Linux, you already have access to KVM.
A type 2 hypervisor is hosted. VM resources are scheduled against a host operating system, which is then executed against the hardware. VMware Workstation and Oracle VirtualBox are examples of type 2 hypervisors.
Why Use a VM?
Server consolidation is a top reason to use VMs. Most operating systems and application deployments only use a small amount of the physical resources available when deployed to bare metal. By virtualizing your servers, you can place many virtual servers onto each physical server to improve hardware utilization.
This keeps you from needing to purchase additional physical resources, as well as reducing the need for power, space, and cooling in the datacenter. VMs enable failover and redundancy that could previously only be achieved through additional hardware.
A VM provides an environment that is isolated from the rest of a system, so whatever is running inside a VM won’t interfere with anything else running on the host hardware.
Because VMs are isolated, they are a good option for testing new applications or setting up a production environment. You can also run a single purpose VM to support a specific process.
Published at DZone with permission of Aditya Bhuyan . See the original article here.
Opinions expressed by DZone contributors are their own.