Virtual Machine (VM)
A Virtual Machine (VM) is a software-based emulation of a computer system that provides the functionality of a physical computer. It allows one computer system (the host) to run one or more separate environments (guests).
1960s
2
Definitions
System Virtual Machine
A System Virtual Machine (VM) is a software emulation of a complete physical computer system. It creates a virtualized hardware environment, including a virtual CPU, memory, storage, and network interfaces, allowing a full, unmodified guest operating system (like Windows, Linux, or macOS) to run on top of a physical host machine. The software that creates and manages these VMs is called a hypervisor or Virtual Machine Monitor (VMM).
Key Concepts:
- Host OS vs. Guest OS: The operating system running on the physical hardware is the host OS. The operating system running inside the virtual machine is the guest OS.
- Hypervisor: The layer of software that separates the virtual machine's software from the physical machine's hardware. There are two main types:
- Type 1 (Bare-metal): Runs directly on the host's hardware to control the hardware and to manage guest operating systems. Examples include VMware ESXi, Microsoft Hyper-V, and KVM.
- Type 2 (Hosted): Runs on a conventional operating system just as other computer programs do. Examples include VMware Workstation, Oracle VirtualBox, and Parallels Desktop.
- Isolation: Each VM is isolated from other VMs and from the host system. A crash or security breach in one VM does not affect others, making them ideal for sandboxing and security testing.
Usage & Examples:
- Server Consolidation: Running multiple virtual servers on a single physical server to increase hardware utilization, reduce power consumption, and save physical space.
- Development and Testing: Developers can maintain multiple OS environments on a single machine to test software compatibility.
- Running Legacy Applications: Encapsulating an old application with its required older operating system inside a VM to run on modern hardware.
- Cloud Computing (IaaS): Cloud providers like AWS (EC2), Google Cloud (Compute Engine), and Azure (Virtual Machines) offer VMs as a fundamental service.
Process Virtual Machine
A Process Virtual Machine, also known as an application virtual machine or Managed Runtime Environment (MRE), is designed to execute a single computer program by providing a platform-independent programming environment. It does not emulate an entire operating system. Instead, it abstracts the underlying operating system and hardware details from the application.
Key Concepts:
- Platform Independence: The primary goal is the "write once, run anywhere" principle. Code is compiled into an intermediate format called bytecode, which can then be executed by the process VM on any platform where the VM is supported.
- Abstraction Layer: The VM handles tasks like memory management and threading, translating the application's requests into native calls to the host operating system.
- Just-In-Time (JIT) Compilation: Many modern process VMs use JIT compilation to translate bytecode into native machine code at runtime, significantly improving performance.
Usage & Examples:
- Java Virtual Machine (JVM): Executes Java bytecode. It's the foundation of the Java platform.
- .NET Common Language Runtime (CLR): Manages the execution of .NET programs. It handles memory management, security, and exception handling.
- Parrot Virtual Machine: Designed to run dynamic languages like Perl and Python.
Origin & History
Etymology
The term combines 'Virtual', from Latin 'virtualis' meaning 'in effect or essence, though not in fact', and 'Machine', from Latin 'machina' for 'engine' or 'device'. It describes a machine that exists in essence through software emulation rather than as a physical entity.
Historical Context
The concept of virtual machines originated in the 1960s with IBM's research projects, notably the CP-40 and later the CP-67/CMS. These systems allowed a mainframe computer to be partitioned into multiple, separate virtual machines, enabling efficient time-sharing among many users, each with the illusion of having their own dedicated computer. This was a cost-effective way to maximize the use of extremely expensive mainframe hardware. During the 1980s and 1990s, the popularity of VMs waned with the rise of inexpensive personal computers and client-server architectures, which made resource sharing on a single machine less critical. The resurgence of virtual machines began in the late 1990s, spearheaded by VMware. They introduced virtualization to the commodity x86 server market. This shift was driven by the problem of server sprawl and underutilization in data centers. A **VM** allowed for server consolidation, where multiple underutilized physical servers could be replaced by a single, more powerful server running multiple virtual machines. This led to significant savings in hardware costs, power, and cooling. In the 2000s, the maturation of VM technology became a cornerstone of the cloud computing revolution. Infrastructure as a Service (IaaS) providers built their offerings around the ability to rapidly provision and scale isolated **virtual machines** for customers on demand.
Usage Examples
To test the new Linux distribution without reformatting my hard drive, I installed it inside a Virtual Machine on my Windows laptop. (Context: Desktop Virtualization)
Our cloud provider provisions a new VM for each web server instance, allowing us to scale horizontally by simply spinning up more guest machines. (Context: Cloud Computing/IaaS)
The developer ran the untrusted application in a sandboxed Virtual Machine to prevent it from accessing the host system's files. (Context: Security/Sandboxing)
Unlike a full Virtual Computer, a container shares the host OS kernel, making it more lightweight and faster to start. (Context: Comparison with Containers)
Frequently Asked Questions
What is the primary software that creates and runs virtual machines?
A hypervisor, also known as a Virtual Machine Monitor (VMM).
What is the main difference between a System Virtual Machine and a Process Virtual Machine?
A System VM virtualizes a full hardware platform to run an entire guest operating system, while a Process VM provides a platform-independent environment to execute a single program (e.g., JVM for Java applications).
Name one key advantage of using Virtual Machines in a data center.
Server consolidation, which improves hardware utilization, reduces physical space requirements, and lowers power and cooling costs. Other valid answers include improved disaster recovery, easier provisioning, and sandboxing for security.
What is the difference between a Type 1 and Type 2 hypervisor?
A Type 1 (or bare-metal) hypervisor runs directly on the host's hardware, while a Type 2 (or hosted) hypervisor runs as an application on top of an existing host operating system.