Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 26

Hardware vs. OS-Level Virtualization

Recommended resources

Introduction

Welcome to your next lesson. In our previous session, we established a strong foundation by examining server-level virtualization, focusing on its architecture and the critical distinction between Type 1 (bare-metal) and Type 2 (hosted) hypervisors. We identified this approach—creating a complete virtual machine with its own guest OS—as the most common form of virtualization in data centers.

This lesson builds directly on that knowledge. The method we studied, which uses a hypervisor to create virtual machines, is formally known as hardware virtualization. Today, we will define this concept more formally and contrast it with an alternative, lighter-weight approach called operating-system-level virtualization.

The learning outcome for this lesson is to: Explain the concepts of hardware virtualization and operating-system-level virtualization, noting key differences.

Mastering this topic is essential for your exams, as "Virtual Machines vs. Containers" is a fundamental and frequently asked comparison in cloud computing. It also serves as the perfect bridge to our next major topic: Containerization.


1. Hardware Virtualization: Creating Virtual Machines

Hardware virtualization is the technique of creating a software-based representation of a physical computer, known as a Virtual Machine (VM). The goal is to emulate an entire hardware environment, including a virtual CPU, memory, storage, and network interfaces, allowing a complete, unmodified guest operating system to run in full isolation.

As we discussed, the core component that makes this possible is the hypervisor, or Virtual Machine Monitor (VMM).

[PDF] UNIT – I – VIRTUALIZATION TECHNIQUES SCSA7022

For a precise, exam-oriented definition, let's refer to the Sathyabama University notes. This resource defines hardware virtualization clearly.

In the PDF, locate the heading 'Hardware virtualization'. Read the first paragraph, which starts with 'Hardware virtualization is accomplished by abstracting the physical hardware layer...'. This provides a concise definition for your notes.

How it Works: The Role of the Hypervisor

The hypervisor creates a complete illusion of physical hardware for the guest operating system. To achieve this, it manages how the guest OS interacts with the real, underlying hardware.

A key aspect of this is CPU virtualization. An operating system typically executes certain privileged instructions that interact directly with hardware (e.g., to manage memory or handle interrupts). In a virtualized environment, when a guest OS tries to execute such an instruction, the hypervisor traps it, emulates the required hardware behavior, and returns the result to the guest OS. This ensures the guest OS can operate without "knowing" it is virtualized, while the hypervisor maintains full control and isolation.

This process ensures that each VM is a self-contained, fully isolated system, capable of running its own distinct operating system (e.g., one VM running Windows Server, another running Ubuntu Linux) on the same physical host.


2. Operating-System-Level Virtualization: Creating Containers

Now, let's explore a different approach. Instead of virtualizing the hardware, what if we could virtualize the operating system itself? This is the core idea behind operating-system-level virtualization.

This technique partitions a single host operating system's kernel to run multiple isolated user-space instances. These instances, known as containers, share the host OS kernel but have their own private view of the file system, processes, and network stack.

[PDF] UNIT – I – VIRTUALIZATION TECHNIQUES SCSA7022

The Sathyabama University notes also provide a good definition for this concept, which you can contrast with the one for hardware virtualization.

Find the heading 'Operating System Level virtualization' and read the first few sentences. This explains the concept of creating isolated 'containers' that share a single OS instance.

How it Works: Sharing the Kernel

Unlike VMs, containers do not bundle a full guest OS. They are lightweight packages that contain only an application and its specific dependencies (libraries and binaries). This is made possible by features within modern operating systems (primarily Linux) like namespaces (which provide isolation for processes, networking, etc.) and control groups (cgroups) (which limit and monitor resource usage like CPU and memory).

The result is that from inside a container, an application appears to have its own dedicated operating system, but in reality, all containers are sharing the same kernel of the host machine.

The following video provides an excellent visual and conceptual explanation of these two distinct levels of virtualization.

Containers vs VMs: What's the difference?

This video from IBM Technology clearly distinguishes the two virtualization levels we are discussing.

Watch the segment from 00:56 to 02:26. Pay close attention to how the presenter explicitly labels VMs as 'hardware virtualization' and containers as 'operating system level virtualization', and note the difference in their architectural diagrams.


3. Key Differences: Virtual Machines vs. Containers

For your exams, being able to articulate the differences between these two models in a structured way is critical. The most common way to frame this comparison is Virtual Machines (VMs) vs. Containers.

This diagram provides a high-level architectural overview that you should be able to reproduce.

Comparison of Virtualization and Containerization Architectures
A comparison of Hardware-Level Virtualization (Virtual Machines) and OS-Level Virtualization (Containers). VMs each have their own guest OS, running on a hypervisor. Containers share the host OS kernel and run on a container engine. This makes containers more lightweight.

Now, let's dive into a detailed comparison. The following resource provides an excellent summary table that we can use as a foundation.

Containers vs. virtual machines (VMs) | Google Cloud

The Google Cloud article 'Containers vs. virtual machines (VMs)' contains a concise comparison chart that is perfect for exam preparation.

Scroll down to the 'Difference between containers and VMs' section and study the comparison chart carefully. This table directly contrasts the two technologies across several important metrics.

Synthesizing the information from our resources, here is a comprehensive comparison table designed for your exam notes.

Feature Hardware Virtualization (Virtual Machines) OS-Level Virtualization (Containers)
Virtualization Level Hardware layer is virtualized. Operating System kernel is shared and virtualized.
Unit of Abstraction A full machine (virtual hardware + guest OS + app). An application and its dependencies.
Operating System Each VM contains a full, isolated guest OS. All containers share the single Host OS kernel.
Isolation Strong, hardware-level isolation between VMs. A failure in one VM does not affect others. Strong process-level isolation, but all containers share a single point of failure (the host kernel).
Size Large, typically measured in Gigabytes (GBs) due to the guest OS. Lightweight, typically measured in Megabytes (MBs).
Boot Time Slow, as it involves booting a complete OS (minutes). Fast, as it only starts an application process (seconds).
Resource Overhead High. Each VM runs a full OS, consuming significant CPU, RAM, and storage. Low. Resources are shared efficiently, with minimal overhead from the container engine.
Performance Near-native, but with performance penalty from hypervisor activity (e.g., trapping instructions). Native or near-native, as code executes directly on the host OS kernel without emulation.
Portability Less portable. A VM is tied to its hypervisor and contains a full OS image. Highly portable. A container can run on any OS with a compatible container engine.
Core Technology Hypervisor (e.g., VMware ESXi, KVM) Container Engine (e.g., Docker) using OS features like namespaces and cgroups.
Typical Use Case Running applications requiring a full OS, different OS versions, or very strong security isolation. Microservices, packaging applications for CI/CD, and maximizing server density.

Conclusion

In this lesson, we differentiated between the two primary methods of virtualization used in cloud computing. Understanding this distinction is fundamental to grasping modern cloud architectures.

Key Takeaways:

  • Hardware Virtualization uses a hypervisor to create fully independent Virtual Machines (VMs), each with its own virtual hardware and guest operating system. This provides very strong isolation but incurs significant resource overhead.
  • Operating-System-Level Virtualization uses a container engine to create isolated containers that share the host machine's operating system kernel. This is extremely lightweight and fast but offers process-level isolation rather than full hardware isolation.
  • The trade-off is clear: VMs offer stronger isolation at the cost of being heavyweight, while containers offer lightweight efficiency and speed with a different, slightly weaker isolation model.
  • The keywords to remember are Hypervisor for hardware virtualization and Container Engine (using namespaces and cgroups) for OS-level virtualization.

Preview of the Next Lesson:

Having established this crucial comparison, we are now ready to dive deep into the world of containers. In the next lesson, we will begin Module 3, "Containerization." The first topic will be: Define containerization and explain the architecture of a container, illustrating it with a labeled diagram. We will explore Docker, the most popular container platform, and its core concepts.