If you work in or around the software industry, you have probably heard of virtual machines. If not, you may be wondering what they are and what they are used for.
As a software engineer, I use virtual machines daily. They’re potent tools in software development, but they have other uses as well. Also known as VMs, many businesses use them because of their flexibility, reliability, and cost-effectiveness; they also prevent disasters from runaway software testing.
Let’s take a look at what virtual machines are and why they are used.
Table of Contents
What is a Virtual Machine?
A virtual machine is an instance of an operating system (OS) such as Windows, Mac OS, or Linux running within the main OS of a computer.
Typically, it runs in an app window on your desktop. A virtual machine has full functionality and acts like a separate computer or machine. In essence, a virtual machine is a virtual computer running inside another computer known as the host machine.
A virtual machine doesn’t have hardware (memory, hard drive, keyboard, or monitor). It uses simulated hardware from the host machine. Because of this, multiple VMs, also referred to as “guests,” can be run on a single host machine.
The host can also run multiple VMs with different operating systems, including Linux, Mac OS, and Windows. This capability depends on software called a hypervisor (see Image 1 above). The hypervisor runs on the host machine and allows you to create, configure, run, and manage virtual machines.
The hypervisor allocates disk space, schedules processing time, and manages memory usage for each VM. This is what applications like Oracle VirtualBox, VMware, Parallels, Xen, Microsoft Hyper-V, and many others do: they are hypervisors.
A hypervisor can run on a laptop, PC, or server. It makes virtual machines available to the local computer or users distributed across a network.
Different types of virtual machines and environments require different types of hypervisors. Let’s take a look at some of them.
Types of Virtual Machines
System Virtual Machines
System VMs, sometimes called full virtualization, are run by a hypervisor and provide the functionality of an actual computer system. They use the host’s native operating system to manage and share system resources.
System virtual machines often require a powerful host with fast or multiple CPUs, large amounts of memory, and tons of disk space. Some, which run on personal or laptop computers, may not require the computing power that big enterprise virtual servers need; however, they’ll run slow if the host system is not adequate.
Process Virtual Machines
Process Virtual Machines are quite different from SVMs—you may have them running on your machine and not even know it. They are also known as application virtual machines or managed runtime environments (MREs). These virtual machines run inside a host operating system and support applications or system processes.
Why use a PVM? They perform services without being dependent on specific operating systems or hardware. They have their own little OS with only the resources they need. The MRE is in a separate environment; it doesn’t matter if it runs on Windows, Mac OS, Linux, or any other host machine.
One of the most common Process Virtual Machines is one that you have probably heard of and may have seen running on your computer. It is used to run Java applications and is called the Java Virtual Machine or JVM for short.
Types of Hypervisors
Most of the virtual machines that we are concerned with use a hypervisor because they emulate an entire computer system. There are two different types of hypervisors: Bare Metal Hypervisors and Hosted Hypervisors. Let’s take a quick look at both of them.
Bare Metal Hypervisor
BMHs may also be called native hypervisors, and they run directly on the host’s hardware instead of running within the host’s operating system. In fact, they take the place of the host’s operating system, scheduling and managing hardware use by each virtual machine, thus cutting out the “middle man” (the host’s OS) in the process.
Native hypervisors are normally used for large-scale enterprise VMs, which companies use to provide employees with server resources. Microsoft Azure or Amazon Web Services are VMs hosted on this type of architecture. Other examples are KVM, Microsoft Hyper-V, and VMware vSphere.
Hosted hypervisors run on standard operating systems—just like any other application that we run on our machines. They use the host’s OS to manage and distribute resources. This type of hypervisor is better suited for individual users who need to run multiple operating systems on their machines.
These include applications like Oracle VirtualBox, VMware Workstations, VMware Fusion, Parallels Desktop, and many others. You can find more detailed information about hosted hypervisors in our article, Best Virtual Machine Software.
Why Use Virtual Machines?
Now that you have a basic understanding of what a virtual machine is, you can probably think of some excellent applications. Here are some of the top reasons people use virtual machines.
Virtual machines are cost-effective in numerous situations. One of the most prominent is in the corporate world. Using physical servers to provide resources for employees can be very expensive. The hardware is not cheap, and maintaining it is even more costly.
The use of virtual machines as enterprise servers has now become the norm. With VMs from a provider like MS Azure, there are no initial hardware purchases and no maintenance fees. These VMs can be set up, configured, and used for just pennies an hour. They can also be shut down when not being used and incur no cost at all.
Using a VM on your machine can also be a huge money saver. If you need to do work in multiple operating systems or different hardware configurations, you can
use multiple virtual machines on one host—no need to go out and purchase a separate computer for each task.
2. Scalable and Flexible
Whether they are enterprise servers or VMs running on your laptop, virtual machines are scalable. It’s easy to adjust the resources to fit your needs. If you need more memory or hard disk space, just go into the hypervisor and reconfigure the VM to have more. There’s no need to purchase new hardware, and the process can be completed rapidly.
3. Quick setup
A new VM can be set up quickly. I have had cases where I needed a new VM setup, called my co-worker who manages them, and had them ready to use in less than an hour.
4. Disaster Recovery
If you are trying to prevent data loss and prepare for disaster recovery, VMs can be a terrific tool. They are easy to back up and can be distributed in different locations if needed. If a third party like Microsoft or Amazon hosts the virtual machines, they will be off-site—which means your data is safe if your office burns down.
5. Easy to Reproduce
Most hypervisors allow you to make a copy, or image, of a VM. Imaging lets you easily spin up exact reproductions of the same base VM for any situation.
In the environment that I work in, we give every developer a VM to use for development and testing. This process allows us to have an image configured with all the needed tools and software. When we have a new developer onboarding, all we have to do is make a copy of that image, and they have what they need to get working.
6. Perfect for Dev/Test
One of the best advantages of using virtual machines is that they are a perfect tool for software development and testing. VMs allow developers to develop on multiple platforms and environments on one machine. If that VM gets corrupted or destroyed, a new one can quickly be created.
They allow a tester to have a clean new environment for every test cycle. I have worked on projects where we set up automated test scripts that create a new VM, install the latest software version, run all required tests, then delete the VM once the tests have completed.
VMs work splendidly for product testing and reviews like the ones we do here at SoftwareHow.com. I can install apps in a VM running on my machine and test them without cluttering my primary environment.
When I am done testing, I can always delete the virtual machine, then create a new one when I need it. This process also allows me to test on multiple platforms even though I only have a Windows machine.
As you can see, virtual machines are a cost-efficient, versatile tool that can be used for many applications. No longer do we need to purchase, setup, and maintain expensive hardware to provide server access for testers, developers, and others. VMs give us the flexibility to easily and quickly create the operating systems, hardware, and environments we need—at any time.