What is a Virtual Machine?
One of the biggest revolutions in the IT industry was Virtual Machines. The capability of using a machine to host different operating systems (and consequently parallelize workloads) opened a whole new world. But what is a Virtual Machine?
What is a Virtual Machine?
You might think it is complicated, but it is not. Virtual Machines are virtual Operating Systems (or application environment like JVM) running on virtual Hardware. A physical computer can only run one operating system at a time, that’s how computer works, but a specialized software called hypervisor can enable a single computer to run multiple different operating systems at the same time. That’s what Virtual Machine mean: literally Machines that don’t run on real hardware but run on virtual Hardware that is emulated using software. You can think of a Virtual machine as: an operating system on top of an operating system.
Virtual Machine 101 – Terminology
One really important thing to understand when studying Virtual Machines (from here on VM) is terminology. There are basically only a few terms to remember:
- Host system (or host): when speaking about virtualization it is the physical system that is used to host different VMs called guests. The host system is running some kind of hypervisor.
- Guest systems (or guests): are the operating system and the virtual hardware associated with it that is running on a physical computer (host). Guest and VM are usually interchangeable terms.
- Hypervisor: the software that enables the virtualization. It runs on the host system and supports the guest systems. There are two kind of hypervisors: Type-1 and Type-2.
Virtual Machine 102 – Hypervisor types
- Type-1 (or bare-metal): is a hypervisor that runs on a minimal operating system. The host system is entirely dedicated to virtualization and can’t be used for other tasks. The hypervisor interacts directly with the physical hardware to achieve faster execution.
- Type-2 (or hosted): the host system runs a full operating system and the hypervisor(s) run on top of that. This results in worse performance compared to Type-1 hypervisors.
Actually there is another type of hypervisor, it is sometimes called Type-3 or Type-1.5. This kind combines the power of a full operating system provided by Type-2 and the performance of Type-1. Even though they have different features, they are commonly considered Type-1 hypervisors. The most common example is KVM.
Virtual Machine 103 – Hardware-assisted virtualization
In the first days of virtualization the hardware was emulated completely via software. Around 2005 both Intel and AMD started working on a special set of processor extension that would later become known as Hardware-assited virtualization. This extension is related to the CPU and enables Virtual Machines to run with near-native performance on a hypervisor. Today this is the preferred way to run production environments. If you want to check a processor capability of performing hardware-assisted virtualization you have to search for VT-x technology for Intel (or Vt-i for Intel Itanium) and AMD-V for AMD.
Virtual Machine 104 – VM important facts
We have discussed about what Virtual Machines are up until now. But what can they do? What is important to keep in mind? Let’s summarize:
- Isolation: VMs are isolated from each other. Each workload is different and each component is different. Two virtual machines on the same host with the same software installed won’t create conflict and each software will function correctly in its own boundaries.
- Host isolation: VMs aren’t allowed to communicate with the host (except for their virtualization duties), so gaining control of a VM won’t allow you to run code on the host system (that unless there’s a huge exploit like Venom).
- Different hardware: each VM comes with its own virtualized hardware, meaning they don’t share (for example) a Network Interface Card, rather they have their own (with different MAC addresses).
- Performance: even with Hardware-assisted virtualization, it is mathematically impossible to achieve native-performance. Keep this in mind when designing solutions.
- Resource lock: Virtual Machines are (usually) assigned a certain share of the physical resources (CPU cores, RAM amount, Storage). They may also be assigned a range like: min 2cores max 4cores.
- Thin-provisioning: indicates the operation of providing more resources than physically possible. Let’s suppose I have a host with a 1TB disk then I create two VM: VM1 with 800GB disk and VM2 with 500GB. That’s clearly more than I have since I only own 1TB disk. I performed thin-provisioning, relying on the fact that both machines won’t soon reach the maximum size they’ve been assigned. This concepts also applies to CPU cores and RAM.
- You can’t emulate 64-bit with 32-bit: even though it may seem possible, it is not (unless you have a 64-bit processor and a 32-bit operating system). For more informations about 32 vs 64 bit read this article.
- Host and Guest can be different: one of the most common misconception is the need to have the same operating system on both host and guest systems. That’s not true: you can have Windows host multiple Linux systems and vice versa. Though there may be supported and unsupported operating systems.
Virtual Machines 105 – Hypervisor Solutions
There are actually quite a few solutions for virtualization today, here are the most common:
- VMware ESXi: and its predecessor ESX are the market leader in virtualization. VMware is literally everywhere and its flagship product vSphere is the most used virtualization platform. ESX used to use Linux as base, ESXi doesn’t.
- Microsoft Hyper-v: is Microsoft’s solution to virtualization and is included since Windows Server 2008.
- Xen: is a popular FOSS hypervisor that runs on *nix distributions, notably BSD and Linux.
- QEMU/KVM: KVM is a relatively new kernel module that transforms the Linux Kernel in a hypervisor. It mainly replaced Xen. It is usually used in conjunction with QEMU and Libvirt.
- VMware Workstation/Player/Workstation Player: is the solution for small workloads offered by VMware. Player is entirely free but less feature-ful than the paid Workstation. Lately a new Workstation Player replaced both and it is paid. Runs on Windows and Linux. For Mac use VMware Fusion.
- Oracle VirtualBox: is the most known among first-timers and used by many to try out Linux. It is FOSS and runs on Windows, Linux and Mac.
- QEMU: is a software emulator that runs on Linux and has been ported to Windows and Mac. Under Linux it is now commonly used in conjunction with KVM to achieve near native performance.
Virtual Machines 106 – Virtualization Platforms
There are a quite a few virtualization platforms out there, in the past there were only a few of them but in the last years there has been a growing number especially in the Open Source realm:
- VMware vSphere: is THE most used virtualization platform. It is hard to find a datacenter without vSphere (at least in some parts). vSphere is by far the most complete product with a good learning curve. In the past the vSphere client used to be bound to Windows, in vSphere 6 the web client is the preferred way to administer vSphere. vSphere uses ESXi hypervisor.
- Windows Server: is the closest competitor of VMware. Windows Server itself is only the operating system, while the Hyper-V hypervisor is used to achieve virtualization.
- Red Hat Enterprise Virtualization: (or the upstream project oVirt) is probably the most solid product in the open source world. In the past the aim of RHEV was to be an alternative to VMware vSphere, today it has its own goals and unique features.
- Citrix XenServer: is a platform based on the Xen hypervisor. It is pretty popular and used to be the preferred “open source” way.
- Proxmox: is an open source platform based on KVM and the Debian operating system. It is a solid application and the favourite of /r/homeserver (excluding vSphere).
Virtual Machines 107 – VMs and Cloud
Of course, Virtual Machines are the core of Cloud computing. Without Virtual Machines we wouldn’t have had Cloud. VMs are used in many ways depending on the Cloud type. This isn’t however a topic short enough to fit this blog post. In case you are interested you can read more about the Cloud here.
You now know what is a Virtual Machine and what they are capable of. You now also understand hypervisors and their function in virtualization. Your are also aware of the most common solutions in the industry. Let’s meet at the next revolution. Wait! It is already here? Take a look at containers today!
Thanks to Tal ETouch for the image.
Latest posts by mark (see all)
- Nvidia to acquire ARM for $40 billion - 16 September 2020
- All you need to know before buying a Raspberry Pi 4 - 9 September 2020
- How to set up Keepalived for High Availability and Load Balancing - 2 September 2020