Docsity

Virtualization and Caching in Computer Systems, Lecture notes of Operating Systems

Toggle sidebar
bg1
Principles of Computer Systems
Autumn 2019
Stanford University
Computer Science Department
Lecturer: Chris Gregg
๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ ๎™ฃ Philip Levis
PDF of this presentation
Lecture 14: Virtualization and CachingLecture 14: Virtualization and Caching
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download Virtualization and Caching in Computer Systems and more Lecture notes Operating Systems in PDF only on Docsity!

Principles of Computer Systems

Autumn 2019 Stanford University Computer Science Department Lecturer: Chris Gregg Philip Levis PDF of this presentation

Lecture 14: Virtualization and CachingLecture 14: Virtualization and Caching

Abstraction Modularity and Layering Naming and Name Resolution Caching Virtualization Concurrency Client-server request-and-response Two of SevenTwo of Seven

Caching Virtualization Two of SevenTwo of Seven

Through a layer of indirection, make one look like many or many look like one Virtualizing the CPU (e.g., processes): one like many Virtual machines: one like many Virtual memory: one like many RAID (Redundant Array of Inexpensive Disks): many like one Logical volumes: one like many Virtual private networks: one like many Decouples program from physical resources

VirtualizationVirtualization

Disks have limited space: biggest disk today is ~15TB What if you need more than 15TB? Could make bigger and bigger disks -- but cost is non-linear Use virtualization : put multiple physical disks together to look like one bigger virtual disk

RAID (Redundant Array of Inexpensive Disks)RAID (Redundant Array of Inexpensive Disks)

Disks have limited space: biggest disk today is ~15TB What if you need more than 15TB? Could make bigger and bigger disks -- but cost is non-linear Use virtualization : put multiple physical disks together to look like one bigger virtual disk

RAID (Redundant Array of Inexpensive Disks)RAID (Redundant Array of Inexpensive Disks)

Stripe data across disks n disks of size S, have n S bytes!

RAID 0RAID 0

If one disk fails, the entire RAID array fails Suppose each disk has a probability p of failing per month Probability each disk does not fail is (1-p) Probability all n disks do not fail is (1-p) Suppose p = 0.001; if n=20, there's a 2% chance the RAID array will fail each month

RAID 0 ProblemsRAID 0 Problems

n

There are better ways to have recovery data than simple replication Exclusive OR (XOR) Suppose we have two drives, A and B One extra drive C: C = A B If B fails, then you can recover B: B = A C

The Power of XORThe Power of XOR

A B C

A B C

RAID 5 stripes the data across disks, sets aside 1 disk worth of storage as parity Parity is the XOR of all of that sector on all of the other drives Writes write two drives: data and parity; parity is spread: lose 1/n of storage Requires two drives to fail: n=6, p=0.001, failure โ‰ˆ 0. If one drive fails, it can be recovered from the parity bits (just XOR other disks)

RAID 5: Resiliency With Less CostRAID 5: Resiliency With Less Cost

What if chances more than can fail becomes dangerous (thousands of drives)? Reed-Solomon coding: turn k data blocks into n , can recover from any (n-k) failures E.g., turn 223 data blocks into 255, can recover from any 32 failures Used in CDs, DVDs, QR codes, Mars Rovers, and most cloud storage systems RAID 6: use Reed-Solomon to have two parity drives

Reed-Solomon CodingReed-Solomon Coding

RAID invented in 1988 (4 years after first Macintosh)RAID invented in 1988 (4 years after first Macintosh)

Described up to RAID 5 (also, RAID 2, RAID 3, RAID 4)

Software that makes code (running in a process) think that it's running on raw hardware A virtual machine monitor runs in the host operating system It loads and run disk images for guest operating systems Operations in the guest operating system that are normally not allowed trap into the virtual machine monitor Guest operating system tries to change page tables Guest operating system tries to disable interrupts Virtual machine monitor emulates the hardware

Virtual MachineVirtual Machine

Host OS

VMM

guest OS

guest OS

guest OS

vi bash

Amazon computing service: a virtual computer is called an instance Many different kinds of instance: general purpose, memory-optimized, compute- optimized, GPUs, etc. There's generally a full instance size, and you can have 1/2 of it Four a1.large is the same as one a1.2xlarge Two a1.2x large is the same as one a1.4xlarge

Amazon Elastic Compute Cloud (EC2)Amazon Elastic Compute Cloud (EC2)

n