Virtualization: Creating a Digital Twin of Physical Machines, Study notes of Operating Systems

An introduction to virtualization, explaining it as the process of creating a virtual version of a physical object, specifically in the context of computing where hardware virtualization allows for running a complete operating system on virtual hardware. terminology, types of virtualization, and uses of virtualization, as well as the history and requirements for virtualization. It also touches upon methods of virtualization and virtual machine access to resources.

Typology: Study notes

2021/2022

Uploaded on 09/27/2022

rechel--
rechel-- 🇬🇧

4.6

(10)

229 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Virtualisation
Tom Spink
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Virtualization: Creating a Digital Twin of Physical Machines and more Study notes Operating Systems in PDF only on Docsity!

Virtualisation

Tom Spink

Introduction

● Virtualisation is the process of creating a virtual version of a physical

object.

● In computing, hardware virtualisation is the process of creating a virtual

version of real hardware.

● This virtual hardware can be used to run a complete operating system.

Physical Machine

Virtual Machine Virtual Machine

OS OS

Virtual Machine Diagram

Physical Machine (Host)

Hardware

Operating System

Hypervisor

Operating System

Virtual Machine (Guest)

Applications

Operating System

Virtual Machine (Guest)

Applications

Applications

Virtual Machine Monitor (Hypervisor)

● The VMM is in charge of running the virtual machines.

● There are two main types of VMM:

Type 1: Native ○ Type 2: Hosted

● Type 1: Native Hypervisors run directly on the host machine, and share

out resources (such as memory and devices) between guest machines.

○ e.g. XEN, Oracle VM Server

● Type 2: Hosted Hypervisors run as an application inside an operating

system, and support virtual machines running as individual processes.

○ e.g. VirtualBox, Parallels Desktop, QEMU

Uses of Virtualisation

● Personal (e.g. Parallels Desktop/VirtualBox)

○ Running multiple operating systems on one host, without the inconvenience of rebooting. ○ e.g. Running Windows inside OS X. ○ Some hypervisors support “seamless integration”.

● Technical (e.g. QEMU as used in the coursework)

○ Operating System/Hardware Design. ○ Kernel Debugging/Testing. ○ Prototyping new architectures/architectural features.

● Commercial (e.g. XEN/VMWare)

○ Data centre server consolidation. ○ High availability/Migration.

OS-X

Windows

Linux

InfOS

Many Servers One Big Server

Types of Virtualisation

● Software Emulation

○ Maximum flexibility for virtualisation, but very slow to run (high overhead). ○ Each guest instruction is emulated (can use binary translation for speed-up)

● Containers/Namespaces

○ Isolate processes/groups of processes within a single operating system, e.g. Docker.

● Full System or Hardware Virtualisation

○ Isolate multiple operating systems from each other, within a single physical machine.

● Same-architecture Virtualisation

○ Guest Machine is the same architecture as the Host Machine, e.g. Intel x86 on Intel x86.

● Cross-architecture Virtualisation

○ Guest Machine has a different architecture than the Host Machine, e.g. ARM on Intel x86. ○ Must use software emulation to do this.

Efficiency

➔ “All innocuous instructions are executed by the hardware directly, with no

intervention at all on the part of the control program.”

Normal guest machine instructions should be executed directly on the

processor. System instructions need to be emulated by the VMM.

Resource Control

➔ “It must be impossible for that arbitrary program to affect the system

resources, i.e. memory, available to it; the allocator of the control program

is to be invoked upon any attempt.”

The virtual machine should not be able to affect the host machine in any

adverse way. The host machine should remain in control of all physical

resources, sharing them out to guest machines.

Methods of Virtualisation

● Full Software Emulation

○ Not permitted by Popek and Goldberg because it violates the efficiency property. ■ Although, this no longer holds due to the advent of efficient binary translation. ○ Required for cross-architecture virtualisation, as guest instructions cannot execute natively on the host.

● Trap-and-Emulate

○ The guest operating system runs “de-privileged”, all non-privileged instructions execute natively on the host. ○ All privileged instructions trap to the VMM. ○ VMM emulates these privileged operations. ○ Guest resumes execution after emulation.

... push %rax mov (%rbp), %rax mov %rax, %cr pop %rax ...

VMM

Emulates instruction

It’s a trap!

Virtualising x

● Originally x86 was not “classically” virtualisable.

○ Some privileged instructions did not “trap”, and so could not be emulated correctly.

● Interpretation is too slow (violates efficiency)

● Code Patching leaves traces of virtualisation (violates equivalency)

● Binary Translation is better, but still incurs overhead.

● Since 2005, x86 processors now support virtualisation in hardware.

○ Intel-VT ○ AMD-V

● This enables trap-and-emulate style virtualisation.

● Unmodified operating systems can run natively on host machines.

Hardware Acceleration for Virtualisation

● Modern processors include hardware support for running virtual machines.

○ Intel VT-X and AMD-V for x86 processors. ○ ARM Virtualization Extensions for ARM processors.

● Hardware extensions allow all guest instructions (including system

instructions) to run natively on the processor.

● This works by providing an isolated view of the processor to virtual

machines.

● Operating Systems can then run directly on the processor, believing they

are running on physical hardware.

● Certain privileged operations “trap” back to the hypervisor.

Virtual Machine Access to Resources

● Virtual Machines need to be given access to resources such as:

○ Memory ○ Storage ○ Networking ○ Graphics

● It is the responsibility of the VMM to share out these resources.

● Access to physical memory is managed by the VMM.

● For an unmodified operating system, expecting a “real” storage device

(such as a hard disk), the VMM must provide an emulation of that device.

● Some devices may be passed straight through to the virtual machine, e.g.

dedicated network cards.