DEV Community

Cover image for Virtualization ... or what enables the cloud
Bojana Dejanović
Bojana Dejanović

Posted on

Virtualization ... or what enables the cloud

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).

But what virtualization really is and where it came from?

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.

The technology itself can be tracked back to 1960s, with the development of hypervisors1 (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  hardware.

Virtualization was natural solution to 2 problems:

  • Companies could partition their servers - reducing equipment and labor costs associated with equipment maintenance and energy consumption
  • Run legacy apps on multiple operating system types and versions

One of the reason for renewed interest in virtualization for modern systems was ever-growing size of server farms (datacentres).

VMware 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 cloud computing.

Hypervisor

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.

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.

Full virtualization

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.

Ring 3 <br>
Ring 2 <br>
Ring 1 <br>
Ring O <br>
User Application <br>
Guest OS <br>
VM Manager <br>
Binary Translation <br>
System Hardware

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  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.

Paravirtualization

We said in past paragraph when explaining the full virtualization,  how guest operating system are run *unmodified* on top of the hypervisor.

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. Xen introduced this type of virtualization.

Hardware assisted virtulization

This approach enables full virtualization using the help from the hardware, primarily from the host processors.

In this setup CPU has virtualization capabilities built into it. For instance CPU is able to "pretend" that is  2 or 3 or 4 independent separate computer systems to the OS running on it. 

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.

Hardware-assisted virtualization was added to x86 processors (Intel VT-x or AMD-V) in 2005 and 2006.

Nowadays most of the CPUs have this abilities.

CPU <br>
% Utilisation <br>
60 seco <br>
Utilisation <br>
33% <br>
Processes <br>
354 <br>
Up time <br>
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz <br>
Speed <br>
2.84 GHz <br>
Threads Handles <br>
4808 171060 <br>
Base speed: <br>
Sockets: <br>
Cores: <br>
10 iCal rocessors: <br>
Virtualisation. <br>
12 cache: <br>
cache: <br>
2.11 GHz <br>
4 <br>
Enabled <br>
10 MB <br>
80 MB

Type 1 vs. Type 2 hypervisor

Many references draws distinction between two main types of hypervisors, Type 1 and Type 2.

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  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.

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.

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.

Types of Hypervisor <br>
App <br>
os <br>
App <br>
os <br>
App <br>
os <br>
APP <br>
os <br>
APP <br>
os <br>
APP <br>
os <br>
Hypervisor <br>
Hardware <br>
Typel Hypervisor <br>
Hypervisor <br>
Operating System <br>
Hardware <br>
Type2 Hypervisor <br>
www.mycloudwikicom

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.

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.

Typical vendors for type 2 hypervisors are: Oracle VM Virtual Box, Vmware Workstation, Microsoft Hyper-V, Oracle VM, Parallels Desktop, etc.

Coming up next...

In one of the next articles there will be word about containers and containerization as a major trend and a companion of virtualization.


1 - The term hypervisor 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



Article originally published on: bojana.dev

Top comments (0)