Virtualization ... or what enables the cloud
Tags: virtualization, cloud, hypervisors
Published: 2021-04-18 12:00:04

---
title: Virtualization ... or what enables the cloud
published: true
description: …or what enables the cloud?
tags: virtualization, cloud, hypervisors
cover_image: https://bojana.dev/wp-content/uploads/2021/01/taylor-vick-aWslrFhs1w4-unsplash-930x620.jpg
---

<!-- wp:list -->
<ul><li><a href="#hypervisor">Hypervisor</a></li><li><a href="#fullvirtualization" data-type="internal" data-id="#fullvirtualization">Full virtualization</a></li><li><a href="#paravirtualization" data-type="internal" data-id="#paravirtualization">Paravir</a><a href="http://paravirtualization" data-type="URL" data-id="paravirtualization">t</a><a href="https://bojana.dev/wp-admin/post.php?post=44&amp;action=edit#paravirtualization">ualization</a></li><li><a href="#hvm" data-type="internal" data-id="#hvm">Hardware assisted virtualization</a></li><li><a href="https://bojana.dev/wp-admin/post.php?post=44&amp;action=edit#type1vstype2">Type </a><a href="http://type1vstype2" data-type="URL" data-id="type1vstype2">1</a><a href="#type1vstype2" data-type="internal" data-id="#type1vstype2"> vs Type 2</a></li></ul>
<!-- /wp:list -->

<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left">The term "virtualization" is an overloaded term that can describe many things, this is due to the way how technology evolved (competing vendors worked independently without benefit of standards).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>But what virtualization really is and where it came from?</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In the simple words, it's the technology that makes it possible to run multiple operating systems (concurrently) on the same physical hardware. Virtualization software parcels out CPU, memory, and I/O resources, dynamically allocating their use among several “guest” operating systems and resolving resource conflicts.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The technology itself can be tracked back to 1960s, with the development of hypervisors<sup>1</sup> (supervisor of the supervisor), however virtualization didn't took of up until 1990s when most enterprises had physical servers and "single vendor" IT stack, meaning legacy apps weren't able to run on different vendor's&nbsp; hardware.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Virtualization was natural solution to 2 problems:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Companies could partition their servers - reducing equipment and labor costs associated with equipment maintenance and energy consumption</li><li>Run legacy apps on multiple operating system types and versions</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>One of the reason for renewed interest in virtualization for modern systems was ever-growing size of server farms (datacentres).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://en.wikipedia.org/wiki/VMware">VMware</a> was one of the first providers that successfully virtualized x86 architecture. Server farms eventually led to the rise of on-demand, Internet-connected virtual servers, the infrastructure we now know as <strong>cloud computing</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="hypervisor">Hypervisor</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As stated in the beginning of the article, virtualization is an overloaded term, used in many contexts, and there are many types of virtualization and many concepts, phrases and acronyms. We will try to tackle a few of them in this article.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A hypervisor (also known as a virtual machine monitor) is a software layer that sits between virtual machines (VMs) and the underlying hardware on which they run. This software is responsible for sharing the resources (such as memory and processing) among the guest operating systems, which are running independently, and doesn't have to be of a same kind.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="fullvirtualization">Full virtualization</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Full Virtualization was introduced by IBM in the year 1966. Hypervisors, in the beginning, fully emulated underlying hardware having virtual replacements for all the basic resources such as : hard disks, network devices, interrupts, motherboard hardware, etc. In this mode guests are running without modifications, nothing is changed in the binary of the guest operating system itself , but because of the constant translation by the hypervisor between virtual and actual hardware, it incurs a performance penalty.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":46,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://bojana.dev/wp-content/uploads/2021/01/image-1.png" alt="Ring 3 
Ring 2 
Ring 1 
Ring O 
User Application 
Guest OS 
VM Manager 
Binary Translation 
System Hardware " class="wp-image-46"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Hypervisor utilize what is called "trap and emulate" strategy. Essentially, each guest operating system "thinks" it is running on "bare metal" hardware and therefore it does exactly what if would have done on bare-metal processor, meaning it would try to execute certain privileged instructions thinking it has right privilege (but it doesn't&nbsp; have since it's run as user-level process on top of a hypervisor). When this happens, it will result in a trap into the hypervisor and hypervisor will then *emulate* the intended functionality of the particular OS.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="paravirtualization">Paravirtualization</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We said in past paragraph when explaining the full virtualization,&nbsp; how guest operating system are run *unmodified* on top of the hypervisor.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Paravirtualization approach modifies guest OSes to include optimizations and avoid problematic instructions (ex. guest OS is able to see the real hardware resources). Basically, guest operating systems can detect their virtual state and actively cooperate with hypervisor to access hardware. This improves performance. The downside is that guest operating systems need substantial updates to run this way, and the way that guest operating systems need to be modified in great depends of the specific hypervisor in use. <a href="https://xenproject.org/">Xen</a> introduced this type of virtualization.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="hvm">Hardware assisted virtulization</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>This approach enables full virtualization using the help from the hardware, primarily from the host processors. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In this setup CPU has virtualization capabilities built into it. For instance CPU is able to "pretend" that is&nbsp; 2 or 3 or 4 independent separate computer systems to the OS running on it.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The benefits of the hardware assisted virtualization as oppose to paravirtualization is that the mentioned changes in the guest operating system are not needed, instead hypervisors are using extensions in the CPU itself to run some (or all) instructions directly on the hardware without a software emulation.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Hardware-assisted virtualization was added to <a href="https://en.wikipedia.org/wiki/X86">x86</a> processors (<a href="https://en.wikipedia.org/wiki/Intel_VT-x">Intel VT-x</a> or <a href="https://en.wikipedia.org/wiki/AMD-V">AMD-V</a>) in 2005 and 2006.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Nowadays most of the CPUs have this abilities.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":47,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://bojana.dev/wp-content/uploads/2021/01/image.png" alt="CPU 
% Utilisation 
60 seco 
Utilisation 
33% 
Processes 
354 
Up time 
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 
Speed 
2.84 GHz 
Threads Handles 
4808 171060 
Base speed: 
Sockets: 
Cores: 
10 iCal rocessors: 
Virtualisation. 
12 cache: 
cache: 
2.11 GHz 
4 
Enabled 
10 MB 
80 MB " class="wp-image-47"/></figure></div>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3 id="type1vstype2">Type 1 vs. Type 2 hypervisor</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Many references draws distinction between two main types of hypervisors, Type 1 and Type 2.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The former one ("Type 1" or often referred as "bare metal") is the one that runs directly on the hardware of the host, it doesn't need a supporting&nbsp; operating system, in fact it acts as a lightweight operating system. The physical machine were type 1 hypervisor is running serves for virtualization purposes only.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Because there is no overhead of the operating system, type 1 hypervisors are considered highly secure, and also very performant and stable. Usually they are used in enterprise environments.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Typical vendors for type 1 hypervisors are: VMWare vSphere with ESX/ESXi, KVM (Kernel-Based Virtual Machine), Microsoft Hyper-V, Oracle VM, Citrix Hypervisor (Xen Server), etc.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":45,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://bojana.dev/wp-content/uploads/2021/01/image.jpeg" alt="Types of Hypervisor 
App 
os 
App 
os 
App 
os 
APP 
os 
APP 
os 
APP 
os 
Hypervisor 
Hardware 
Typel Hypervisor 
Hypervisor 
Operating System 
Hardware 
Type2 Hypervisor 
www.mycloudwikicom " class="wp-image-45"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In contrast to Type 1, Type 2 hypervisors are user-space applications, running inside of an operating system. They are also called "hosted hypervisors". They are also managing calls for CPU, memory, disk, network etc. But they do it through the operating system of the host. They are convenient as they are installed on OS as any other applications.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The downside of this type of hypervisors are that if resources not carefully allocated they can overhaul the system, causing the crash. This something that bare-metal hypervisors are doing dynamically, depending on the needs of particular VM. However, hosted hypervisors are really nice for testing and research projects.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Typical vendors for type 2 hypervisors are: Oracle VM Virtual Box, Vmware Workstation, Microsoft Hyper-V, Oracle VM, Parallels Desktop, etc.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="containerization">Coming up next...</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In one of the next articles there will be word about containers and containerization as a major trend and a companion of virtualization.</p>
<!-- /wp:paragraph -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:paragraph -->
<p><sup>1 - </sup>The term <a href="https://en.wikipedia.org/wiki/Hypervisor">hypervisor </a>is a variant of supervisor, a traditional term for the kernel of an operating system: the hypervisor is the supervisor of the supervisors, with hyper- used as a stronger variant of super-. The term dates to circa 1970; in the earlier CP/CMS (1967) system, the term Control Program was used instead</p>
<!-- /wp:paragraph -->
<br>
<i>Article originally published on: <a href="bojana.dev">bojana.dev</a></i>