DEV Community

Cover image for Virtualization - The Basics
Sutrishna Anjoy
Sutrishna Anjoy

Posted on

Virtualization - The Basics

Virtualization in computing means creating a virtual version of something instead of a physical one. This includes virtual versions of computer hardware, storage devices, and network resources.
In this post, I will focus on discussing virtual machines on bare metal or a host machine, specifically in terms of Linux.

Virtual Machine: A VM is a software version of a physical computer. It allows you to run an operating system and applications just like on a real computer, but it works within another computer (the host), sharing its resources like CPU, memory, and storage. In fact, each VM believes it is the only system running on the hardware.

Hypervisor: A hypervisor is software that lets you run multiple VMs on one physical computer. It manages the computer's resources and makes sure each VM operates independently.

Type-1: A Type-1 hypervisor, also known as a bare-metal hypervisors, are installed directly onto the physical hardware without needing a separate operating system. It manages the VMs directly, providing them with access to the hardware resources.
Examples include KVM (Kernel-based Virtual Machine), Proxmox, VMware ESXi, Microsoft Hyper-V Server and Citrix Hypervisor (formerly XenServer).

Image description

Type-2: A Type-2 hypervisor is like a software application that you install on your computer's operating system (like Windows, macOS, or Linux). It creates VMs that can run different operating systems alongside your main operating system.
Examples include VirtualBox, VMware Workstation, and QEMU.

Image description

Different virtualization techniques used in VMs are as follows:

Fully Virtualized: When a guest OS running in a VM attempts to access hardware (like CPU, memory, or network), it interacts with virtual hardware interfaces provided by the hypervisor. The hypervisor translates these hardware calls into commands that the physical hardware can execute. This process involves emulating the actual hardware interfaces and translating the commands to ensure they are compatible with the host hardware. The guest OS are unaware that they are running on virtualized hardware.

Image description

Paravirtualization: In paravirtualization, the guest OS is modified to replace certain privileged instructions with hypercalls, which are calls directly to the hypervisor. Hypercalls are specific function calls that the guest OS uses to request services from the hypervisor, such as memory management, I/O operations, or scheduling. It reduced overhead and improve efficiency compared to traditional fully virtualized approaches.

Image description

Emulation: When a guest software running on an emulated environment makes a hardware call, such as accessing memory or processing data, the emulated software (QEMU) translates these calls into instructions that the host system can understand and execute.

Image description

Shared Hardware Virtualization: Suppose a VM running a high-performance application requires direct access to a specialized GPU for computational tasks. The hypervisor identifies the GPU and assigns it to the VM using pass-through. When the VM makes hardware calls related to GPU operations those calls are handled directly by the GPU without involving the hypervisor's virtualization layer.

Image description

Conclusion: virtualization improves efficiency by maximizing hardware use(overcommiting). This optimizes hardware use, reduces costs, enhances security by isolating each VM, and makes IT systems more flexible and easier to manage. It also speeds up deploying new software and recovering from failures.

Top comments (3)

Collapse
 
raajaryan profile image
Deepak Kumar

Hello everyone,

I hope you're all doing well. I recently launched an open-source project called the Ultimate JavaScript Project, and I'd love your support. Please check it out and give it a star on GitHub: Ultimate JavaScript Project. Your support would mean a lot to me and greatly help in the project's growth.

Thank you!

Collapse
 
himadri_anjoy_fd78922cdd4 profile image
HIMADRI ANJOY

Informative

Collapse
 
xpertr2 profile image
Abhishek Adhikari

It's good to see the professionals sharing their knowledge learnt through their experience to the people who want to learn about these topics.