Skip to content
Search

Virtual Machine

lastmod 2026-04-20created 2014-12-1039 edits

A virtual machine (VM) is a software implementation of a computing environment, i.e. software that emulates a computer. Operating systems and applications can be installed and run on a virtual machine.

Categories

Definition

A virtual machine was originally defined by Popek and Goldberg as an efficient, isolated duplicate of a real computer. Today it refers to a virtual computer with no direct communication with any real hardware.

Virtual machines are divided into two kinds based on their degree of communication with and use of a real computer. A system virtual machine provides a complete system platform, that is, it supports the execution of a complete operating system (OS). In contrast, a process virtual machine is designed to run a single program, that is, it supports a single process. An essential characteristic of a virtual machine is that the software running inside it is limited to the environment and resources the virtual machine provides and cannot break out of its virtual world.

List of projects

System virtual machine

A system virtual machine, sometimes called a hardware virtual machine, multiplexes the underlying physical computer among virtual machines, each running its own operating system. The software layer that provides the virtualization is called a virtual machine monitor or hypervisor. A hypervisor can run on bare hardware or on top of a host operating system.

Main advantages of system virtual machines:

  • Environments using multiple operating systems can coexist on the same computer, with the operating systems fully isolated from one another.
  • A virtual machine provides an instruction set architecture (ISA) different from the one the real computer provides.

Process virtual machine

A process VM, also called an application virtual machine, runs as a normal application inside an operating system and supports a single process. It is created when the process starts and destroyed when it exits. Its purpose is to provide a platform-independent programming environment that abstracts away the details of the underlying hardware or operating system and allows a program to run the same way on any platform.

Process virtual machines provide a high-level abstraction for high-level programming languages (compared with the low-level ISA abstraction of system virtual machines) — process virtual machines are implemented using an interpreter.

This kind of virtual machine became popular with Java, which is implemented using the Java virtual machine. Another example is the .NET Framework, which runs on a virtual machine called the Common Language Runtime.

VM Sandbox

  • Landrun - Sandbox any Linux process with Landlock, without root or containers
  • TinyKVM - A fast sandbox that runs on top of Varnish
  • uvm32 - A tiny VM sandbox written in C, supporting Rust, C and Zig apps
  • bubblewrap
  • shuru - An open-source, local-first Linux MicroVM sandbox for macOS

AI sandboxes

Sandboxes focused on use with AI

  • ForeverVM - A sandbox that safely runs and persists AI-generated code
  • ERA - A local sandbox for safely running AI-generated code
  • Yolobox - Run AI coding agents with full permissions while protecting your home directory
  • Cloudrouter - A skill that lets Claude Code/Codex spin up cloud VMs and GPUs
  • Matchlock - Protect AI agent workloads with a Linux-based sandbox
  • Cloudflare Dynamic Worker Loader - Faster AI agent sandboxes
  • jai - An easy isolation tool for AI agents

How to check whether the current OS is running on a VM

There are several ways to check whether a Linux server is running in a virtual machine (VM). While connected over SSH, you can check using one of the following methods.

  • systemd-detect-virt
    • kvm (KVM-based VM)
    • vmware (VMware)
    • oracle (VirtualBox)
    • qemu (QEMU)
    • lxc (LXC container)
    • none (physical server)
  • lscpu | grep -i hypervisor
  • sudo dmidecode -s system-manufacturer
  • sudo dmidecode | grep -i product
  • dmesg | grep -i virtual
  • cat /proc/cpuinfo | grep -i hypervisor
  • virt-what

How to check whether the current OS is running in a Container

How to check, while connected to a Linux server over SSH, whether the current environment is inside a Docker container or a Kubernetes Pod.

  • cat /proc/1/cgroup
    • On a physical machine, it typically shows 0::/init.scope.
  • hostname
    • Inside a Kubernetes Pod, the Pod name is usually set as the hostname.
    • A Docker container may show the container ID or a configured hostname.
  • mount | grep overlay
    • Containers usually use an overlay file system for root. The output looks like overlay on / type overlay (rw,relatime,lowerdir=...).
  • env | grep -E 'KUBERNETES|DOCKER'
    • Inside a Kubernetes Pod, environment variables like these usually exist:
      • KUBERNETES_SERVICE_HOST
      • KUBERNETES_PORT
    • Docker containers may have limited environment variables.
  • test -f /.dockerenv && echo "Running inside Docker"
    • Checks for a container-specific file.
      • Inside a Docker container, the /.dockerenv file exists.
      • It does not exist in Kubernetes.
  • ps -eo pid,comm | head
    • In a Docker container, the first process (PID 1) is usually the application process.
    • In a Kubernetes Pod, the pause process may appear as PID 1.
  • ls -l /sys/fs/cgroup/
    • In Kubernetes or Docker environments, several cgroup directories exist, and the paths likely contain docker or kubepods.

Three-line summary, in order of priority:

  1. cat /proc/1/cgroup (detects Docker and Kubernetes)
  2. test -f /.dockerenv (detects Docker)
  3. Check environment variables with env | grep KUBERNETES (detects Kubernetes)

See also

  • Minimal - A collection of container images with minimal CVE vulnerabilities

Favorite site

Articles

  • Cloud VM benchmarks 2026: performance / price | GeekNews
    • [Original] Cloud VM benchmarks 2026: performance / price
    • A CPU performance and price-performance benchmark of 7 clouds (44 VM types), covering single- and multi-threaded performance, reserved and spot instances, and more
    • AMD EPYC Turin took first place in almost every benchmark, emerging as the new top CPU in the x86 camp
    • In performance per on-demand price, Hetzner and Oracle Cloud swept the top spots, while AWS had the worst price-performance overall apart from Turin
    • Intel Granite Rapids fixes the performance instability of its predecessor Emerald Rapids and delivers consistent performance, but the gap with Turin remains wide
    • Spot instances deliver about twice the performance per dollar of 3-year reservations, making them a key tool for cloud cost optimization
author Zer0 sitemap