• No results found

Operating Systems Design 20. Virtualization

N/A
N/A
Protected

Academic year: 2021

Share "Operating Systems Design 20. Virtualization"

Copied!
19
0
0

Loading.... (view fulltext now)

Full text

(1)

Operating Systems Design

20. Virtualization

Paul Krzyzanowski [email protected] 11/30/2010 1 © 2010 Paul Krzyzanowski

(2)

Virtualization

• Memory virtualization

– Process feels like it has its own address space – Created by MMU, configured by OS

• Storage virtualization

– Logical view of disks “connected” to a machine – External pool of storage

• CPU/Machine virtualization

– Each process feels like it has its own CPU – Created by OS preemption and scheduler

(3)

Storage Virtualization

• Dissociate knowledge of physical disks

• Software between the computer and the disks manages the view of storage

• Examples:

– Make four 500 GB disks appear as one 2 TB disk

– Make one 500 GB disk appear as two 200 GB disks and one 100 GB disk, with each of the 200 GB virtual disks available to different servers while the 100 GB disk can be shared by all.

– Have all writes get mirrored to a backup disk

• Virtualization software translates read-block/write-block requests for logical devices to read-block/write-block requests for physical

devices

11/30/2010 3

(4)

Storage Virtualization

• Logical view of disks “connected” to a machine • Separate logical view from physical storage • External pool of storage

Virtualization appliance Fibre-channel switch Host 1 Host 2 Host n

...

Replication Snapshots Pooling Partitioning

(5)

Virtual CPUs (sort of)

• Each process feels like it has its own CPU

– But cannot execute privileged instructions

(e.g., modify the MMU or the interval timer, halt the processor, access I/O)

• Created by OS preemption and scheduler

11/30/2010 5

(6)

Process Virtual Machines

• CPU interpreter running as a process

• Pseudo-machine with interpreted instructions

– 1966: O-code for BCPL – 1973: P-code for Pascal

– 1995: Java Virtual Machine (JIT compilation added) – 2002: Microsoft .NET CLR (pre-compilation)

– 2008: Dalvik VM for Android

(7)

Machine Virtualization

• Machine virtualization

– Partition a physical computer to act like several real machines – Migrate an entire OS + applications from one machine to another

• 1972: IBM System 370

11/30/2010 7

(8)

Machine Virtualization

• Privileged

vs.

unprivileged

instructions

• Regular applications use unprivileged instructions

– Easy to virtualize

• If regular applications execute privileged instructions,

they

trap

(9)

Intel Ugliness

• Intel x86 arch < Core 2 Duo doesn’t support trapping

privileged instructions

• Two approaches

– Binary translation (BT)

• Scan instruction stream and replace privileged instructions with something the VM can intercept.

(VMware approach)

– Paravirtualization

• Don’t use non-virtualizable instructions (Xen approach)

11/30/2010 9

(10)

Virtual Machine Monitor

• Program in charge of virtualization

– Aka Hypervisor

– Arbitrates access to physical resources

– Presents a set of virtual device interfaces to each host

• Guest OS runs until:

– Privileged instruction traps – System interrupts

– Exceptions (page faults)

(11)

Two Approaches

• Hosted VM

– Primary OS responsible for access to the raw machine – Guest operating systems run under a VMM

– VMM invoked by host OS

• Serves as a proxy to the host OS for access to devices

• Native VM

– No primary OS

– Hypervisor is in charge of access to the devices and scheduling

11/30/2010 11

(12)

Architectural Support

• Intel Virtual Technology (Intel Core 2 Duo)

• AMD Opteron

• Certain privileged instructions are intercepted as VM

exits to the VMM

• Exceptions, faults, and external interrupts are

intercepted as VM exits

(13)

Hypervisor in a hosted VM

• Responsible for managing access to all system

resources

– Memory, disks, buses, I/O adapters – CPU scheduling

• Guest OS gets device drivers that interface to an

abstract device implementation provided by the VMM

11/30/2010 13

(14)

Hypervisor in a hosted VM

• Each VM competes for a physical CPU

– Typically # VMs > # CPUs

• VMs need to get scheduled

– Allocate CPU to a single-CPU VM

– Allocate multiple CPUs to multi-CPU VMs: co-scheduling

• Strict co-scheduler: VM with two virtual CPUs gets two real CPUs • Relaxed co-scheduler: if two CPUs are not available, use one

– CPU affinity: try to run the VM on the same CPU

(15)

Scheduling VMs (IBM z/VM example)

VM VM VM VM VM VM VM VM

Dispatch List Eligible List

VM VM VM VM Dormant List blocked/idle ready time exceeded resources available RUNNING RUNNING Context switch • Run until a VM accumulates a dispatch time slice • Readjust priority • When a VM accumulates

elapsed time slice, it is

moved to the eligible list and a VM is taken from the eligible list

11/30/2010 15

(16)

OS-Level Virtualization

• Not full machine virtualization

• Multiple instances of the same operating system

– Each has its own environment

• Process list, mount table, file descriptors, virtual network interface

• Advantage: low overhead: no overhead to system calls

• Examples:

– Linux Vserver, Solaris Containers, FreeBSD Jails – Altris Software Virtualization Services

• Windows registry & directory tweaking

(17)

Popular VM Platforms

• VMWare

• Xen

– Runs under an OS and provides virtual containers for running other operating systems. Runs a subset of x86. Routes all hardware accesses to the host OS.

• VirtualBox

• Microsoft Virtual Server

• Parallels

• IBM z/VM (mainframe)

• Sun xVM

11/30/2010 17

(18)

Security Threats

• Hypervisor-based rootkits

• A system with no virtualization software installed but with

hardware-assisted virtualization can have a

hypervisor-based rootkit installed.

• Rootkit runs at a higher privilege level than the OS.

– It’s possible to write it in a way that the kernel will have a limited ability to detect it.

(19)

The End

11/30/2010 19

References

Related documents

The HP 80 GB, 128 GB, and 160 GB Solid State Drives are a drop-in replacement for the 2.5-inch or 3.5-inch (with bracket) hard disk drive of some HP Compaq Business Desktop

Processors # GB of Memory Available Disk Space – Existing Partition (GB) Available Disk Space – New Partition (GB) Minimum Configuration 2 (1 CPM) 2 60 90 Recommended

Free Storage 5 GB 5 GB 7 GB 2 GB 5 GB Cost for 25 GB/moth $0.75 $2.49 0.83 (27 GB) $9.99 $3.33 Cost for 50 GB/month $1.50 $4.99 $2.08 (52 GB) $9.99 $8.33 Advantages Cheap,

Processor Speed Memory* Hard Disk Space Required Windows/Linux 1.8 Ghz 2 GB RAM­ ManagedServer

Operating system Microsoft Windows Server 2008 or higher Processor Single Xeon 2 GHz Quad Core or equivalent Disk 20 GB free space minimum. RAM 4 GB

Operating system Microsoft Windows Server 2008 or later Processor Single Xeon 2 GHz Quad Core or equivalent Disk 20 GB free space minimum. RAM 4 GB

Large Size Configuration: Mixed Linux and Windows Shared Hosting 9 Parallels Cloud Server VM RAM: 16 GB; Disk: 200 GB OS: Windows 2008 R2 SmarterMail. Server Parallels

Page 2 IEEE P802.3db 100 Gb/s, 200 Gb/s, and 400 Gb/s Short Reach Fiber Task Force March 16, 2021 Plenary Teleconference..