What Is a Virtual Machine?


Share facebook icon linkedin icon twitter icon email icon

Virtual Machine



  • Define virtual machine
  • Understand how virtualization and virtual hardware work
  • Outline several use cases for virtual machines

What is a virtual machine?

A virtual machine (VM) is a software-based computer that exists within another computer’s operating system, often used for the purposes of testing, backing up data, or running SaaS applications. To fully grasp how VMs work, it’s important to first understand how computer software and hardware are typically integrated by an operating system.

What is an operating system?

Traditional computers are built out of physical hardware, including hard disk drives, processor chips, RAM, etc. In order to utilize this hardware, computers rely on a type of software known as an operating system (OS). Some common examples of OSes are Mac OSX, Microsoft Windows, Linux, and Android.

The OS is what manages the computer’s hardware in ways that are useful to the user. For example, if the user wants to access the Internet, the OS directs the network interface card to make the connection. If the user wants to download a file, the OS will partition space on the hard drive for that file. The OS also runs and manages other pieces of software. For example, it can run a web browser and provide the browser with enough random access memory (RAM) to operate smoothly. Typically, operating systems exist within a physical computer at a one-to-one ratio; for each machine there is a single OS managing its physical resources.

Can you have two or more operating systems on one computer?

Some users want to be able to run multiple operating systems simultaneously on one computer, either for testing or one of the other reasons listed in the section below. This can be achieved through a process called virtualization. In virtualization, a piece of software behaves as if it were an independent computer. This piece of software is called a virtual machine, also known as a ‘guest’ computer. (The computer on which the VM is running is called the ‘host’.) The guest has an OS as well as its own virtual hardware.

‘Virtual hardware’ may sound like a bit of an oxymoron, but it works by mapping to real hardware on the host computer. For example, the VM’s ‘hard drive’ is really just a file on the host computer’s hard drive. When the VM wants to save a new file, it actually has to communicate with the host OS, which will write this file to the host hard drive. Because virtual hardware must perform this added step of negotiating with the host to access hardware resources, virtual machines can’t run quite as fast as their host computers.

With virtualization, one computer can run two or more operating systems. The number of VMs that can run on one host is limited only by the host’s available resources. The user can run the OS of a VM in a window like any other program, or they can run it in fullscreen so that it looks and feels like a genuine host OS.

What are virtual machines used for?

Some of the most popular reasons people run virtual machines include:

  • Testing - Oftentimes software developers want to be able to test their applications in different environments. They can use virtual machines to run their applications in various OSes on one computer. This is simpler and more cost-effective than having to test on several different physical machines.

How does cloud computing use virtual machines?


  • Running SaaS applications - Software-as-a-Service, or SaaS for short, is a cloud-based method of providing software to users. SaaS users subscribe to an application rather than purchasing it once and installing it. These applications are generally served to the user over the Internet. Often, it is virtual machines in the cloud that are doing the computation for SaaS applications as well as delivering them to users. If the cloud provider has a geographically distributed network edge, then the application will run closer to the user, resulting in faster performance.
  • Backing up data - Cloud-based VM services are very popular for backing up data, because the data can be accessed from anywhere. Plus, cloud VMs provide better redundancy, require less maintenance, and generally scale better than physical data centers. (For example, it’s generally fairly easy to buy an extra gigabyte of storage space from a cloud VM provider, but much more difficult to build a new local data server for that extra gigabyte of data.)

Cloudflare and virtual machines

Cloudflare helps protect and manage any type of cloud deployment, including cloud VMs. Additionally, for users who want the functionality of running code on the edge without all the overhead of virtual machines, we have Cloudflare Workers, a serverless platform that provides edge computation to customers in a completely scalable way, allowing developers to augment existing applications or create entirely new ones without configuring or maintaining infrastructure.