Dan Noé University of New Hampshire / VeloBit

Similar documents
Xen and the Art of Virtualization. CSE-291 (Cloud Computing) Fall 2016

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

SNS COLLEGE OF ENGINEERING

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Anne Bracy CS 3410 Computer Science Cornell University

Address spaces and memory management

Review: Hardware user/kernel boundary

Operating System Security

Lecture 7. Xen and the Art of Virtualization. Paul Braham, Boris Dragovic, Keir Fraser et al. 16 November, Advanced Operating Systems

Hakim Weatherspoon CS 3410 Computer Science Cornell University

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Anne Bracy CS 3410 Computer Science Cornell University

Translation Buffers (TLB s)

Chapter 5 C. Virtual machines

Chapter 10: Virtual Memory. Lesson 05: Translation Lookaside Buffers

Lecture 2: September 9

Syscalls, exceptions, and interrupts, oh my!

Virtualization. Operating Systems, 2016, Meni Adler, Danny Hendler & Amnon Meisels

COMPUTER ARCHITECTURE. Virtualization and Memory Hierarchy

Virtual Memory Review. Page faults. Paging system summary (so far)

CSE 153 Design of Operating Systems Fall 18

CS370 Operating Systems

Virtualization and memory hierarchy

-Device. -Physical or virtual thing that does something -Software + hardware to operate a device (Controller runs port, Bus, device)

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

24-vm.txt Mon Nov 21 22:13: Notes on Virtual Machines , Fall 2011 Carnegie Mellon University Randal E. Bryant.

CIT 480: Securing Computer Systems. Operating System Concepts

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

Virtualization. Pradipta De

Following are a few basic questions that cover the essentials of OS:

CS370 Operating Systems

Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management

Virtual Memory COMPSCI 386

Chapter 5 B. Large and Fast: Exploiting Memory Hierarchy

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management

Virtual Memory. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

CS370 Operating Systems

CS 350 Winter 2011 Current Topics: Virtual Machines + Solid State Drives

Xen and the Art of Virtualization. Nikola Gvozdiev Georgian Mihaila

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Intel s Virtualization Extensions (VT-x) So you want to build a hypervisor?

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Princeton University. Computer Science 217: Introduction to Programming Systems. The Memory/Storage Hierarchy and Virtual Memory

Caching and Demand-Paged Virtual Memory

CLASS: II YEAR / IV SEMESTER CSE SUBJECT CODE AND NAME: CS6401 OPERATING SYSTEMS UNIT I OPERATING SYSTEMS OVERVIEW

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

CS 5460/6460 Operating Systems

Advanced Operating Systems (CS 202) Virtualization

Chapter 5 (Part II) Large and Fast: Exploiting Memory Hierarchy. Baback Izadi Division of Engineering Programs

CIS Operating Systems Memory Management Address Translation for Paging. Professor Qiang Zeng Spring 2018

Administrivia. Lab 1 due Friday 12pm. We give will give short extensions to groups that run into trouble. But us:

Virtual memory Paging

Virtual Machines. To do. q VM over time q Implementation methods q Hardware features supporting VM q Next time: Midterm?

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts

CHAPTER 16 - VIRTUAL MACHINES

13-2 EE 4770 Lecture Transparency. Formatted 8:18, 13 March 1998 from lsli

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture


Memory management, part 2: outline

Virtual Memory. Computer Systems Principles

Lecture 5: February 3

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.

CS370 Operating Systems

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

Chapter 2. Parallel Hardware and Parallel Software. An Introduction to Parallel Programming. The Von Neuman Architecture

MARUTHI SCHOOL OF BANKING (MSB)

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.

Definition: An operating system is the software that manages resources

ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems ( ) Chapter 6: Demand Paging

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1

CS533 Concepts of Operating Systems. Jonathan Walpole

Virtual Machines. Part 2: starting 19 years ago. Operating Systems In Depth IX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

Chapter 6: Demand Paging

CS 152 Computer Architecture and Engineering

Virtual Memory Oct. 29, 2002

CSE 120 Principles of Operating Systems

Chapter 8: Main Memory

Virtualization with XEN. Trusted Computing CS599 Spring 2007 Arun Viswanathan University of Southern California

1. Creates the illusion of an address space much larger than the physical memory

Overview of System Virtualization: The most powerful platform for program analysis and system security. Zhiqiang Lin

Operating System Review

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels

Protection. - Programmers typically assume machine has enough memory - Sum of sizes of all processes often greater than physical memory 1 / 36

CSE 153 Design of Operating Systems

[537] Virtual Machines. Tyler Harter

Virtual or Logical. Logical Addr. MMU (Memory Mgt. Unit) Physical. Addr. 1. (50 ns access)

Chapter 8 Virtual Memory

CS 550 Operating Systems Spring Introduction to Virtual Machines

An Overview of the BLITZ Computer Hardware

Memory Addressing. Pradipta De

CS/COE 1550

Chapter 8: Memory-Management Strategies

Lec 22: Interrupts. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency

Transcription:

Dan Noé University of New Hampshire / VeloBit

A review of how the CPU works The operating system kernel and when it runs User and kernel mode Device drivers Virtualization of memory Virtual memory Paging Virtualization of CPU Threads, processes, programs, tasks and Cores Virtualization of Disk Filesystems

Memory (RAM) contains instructions coded in binary and space for data storage The CPU has multiple registers for temporary store The instruction pointer register points to the next instruction to be executed Interrupts When a piece of hardware needs something it causes an interrupt which makes execution jump to a predetermined location

In order to continue execution after an interrupt the machine context is saved: Save the contents of all registers (including special registers) into memory: the Machine Context Update the program counter so the next instruction is a predetermined location ( Interrupt Handler ) If execution is interrupted and the context is saved execution can be resumed later without even knowing! When an interrupt occurs the interrupt handler runs in kernel mode

Application code runs in this mode Limited privileges Cannot execute all instructions, memory access limited Cannot transition into kernel mode without an interrupt This interrupt is called a context switch User Mode System starts in this mode Interrupt handlers run in this mode Unlimited privileges Access all memory and hardware devices Execute any CPU instruction Can transition into user mode with an instruction Kernel Mode

Term for the collection of code which forms the core of the Operating System Kernel code runs first at system boot time After the first user mode code runs, the kernel runs only as a result of interrupts Operating System also includes user mode components User Interface components: Shells, explorer System services

Kernel code that interacts with hardware devices Sends commands to device Network driver: Send data to remote computer Disk driver: Begin write or read or read operation Video driver: Display something on screen Handles interrupts by that device Network driver: Interrupt occurs when incoming data arrives Disk driver: Interrupt occurs when operation is complete Human interface device: Keyboard press causes interrupt

But how does a user application request something from the kernel? It causes an interrupt! Old way: Software interrupt instruction A software interrupt (also called a trap ) is triggered by a special instruction Newer way: Special sysenter or syscall instruction Allows some shortcuts by the CPU and kernel for better performance

A key concept: Each user application runs on the CPU as though it has full access to the system through virtualization of resources

Each program acts as though it has universal access to the memory Without this life would be difficult! Virtual Memory is the solution Address spaces Physical addresses size is the amount of physical RAM Virtual addresses size depends on the size of a pointer (32 or 64 bits) 32-bit system: 4GB of virtual address space 64-bit system: 16 Exabytes!

Physical address space is divided into 4 kilobyte Page Frames Virtual address space is divided into 4 kilobyte Pages 32 bit virtual address 0xdeadbeef Page number Offset within page A page table is maintained in memory for each program. It maps virtual Page Frame -> Physical Page For each memory access the CPU looks up the virtual address and translates it into a physical address

The Page Fault (a trap/interrupt) A virtual memory address is accessed which does not have a valid or resident physical page Demand Paging and nonresident pages File backed pages Shared pages Copy on Write Making it fast: Caching and the Translation Lookaside Buffer (TLB)

If a page has been resident in memory and modified then it is marked dirty If a dirty page is backed by a disk file then it must be written out (flushed) eventually If there are no free page frames the kernel can old flush pages to disk and evict them making them nonresident. Insufficient memory prompts thrashing and extremely poor performance

Tasks: Threads, Processes, Programs, Applications Cores: Multiprocessing, Multiple Cores, Multithreading CPU Scheduling maps Tasks to Cores Much like virtual memory maps virtual addresses to physical! The Scheduler decides what task will run next after servicing an interrupt or system call

Time to execute one CPU instruction: 0.4 nanoseconds Time to retrieve data from main memory: 18 nanoseconds Time to retrieve data from disk: 8+ milliseconds (8,000,000 nanoseconds) Time to retrieve data from California server: 70 ms (70,000,000 nanoseconds) A CPU which executes one instruction per second would take about 231 days to seek the hard drive!

Most tasks spend most of their time waiting for IO The scheduler will allow CPU bound (or other IO bound tasks) to run while waiting A typical program might only run hundreds of instructions before blocking on more IO If no tasks are ready to run the CPU will instruct the processor to save power A timer interrupt fires regularly to interrupt any CPU bound tasks

User applications cannot write directly to the disk hardware Instead, the OS organizes files using a filesystem and allows programs to access the disk through system calls User programs use a standard interface to name, read, and write files. The filesystem translates this into actual disk block operations.

The difference between main memory and disk access latency means that the OS must cache disk data aggressively Leverage virtual memory with a Page cache: Each file opened by a user program is loaded by mapping file backed pages Pages from the file are loaded on demand when a page fault occurs Reads and writes are memory operations. The pages will be marked dirty if modified

Hypervisors, mobile devices, etc.

VMWare, Parallels, VirtualBox, Xen, KVM, and Hyper-V are examples of hypervisors which are Operating System kernels which can run other operating systems Same concepts apply! Interrupts are initially serviced by the Hypervisor then control is passed to guest operating system kernel

Desire for low power consumption means the CPU should be powered off as much as possible Memory pressure means that while there may be multitasking applications can be killed at any time Cooperative multitasking/state saving helps Callbacks to save state Save to persistent storage immediately Different paradigms for file storage

An Operating System is composed of the Kernel and user space utilities The Kernel is the core code which provides virtualization of resources. It has several key components: Virtual memory manager CPU scheduler Filesystems / block layer Networking

Wikipedia Learn about Linux Kernel: LWN.net, kernelnewbies.org Install Linux (free) in VirtualBox (free runs on top of Windows) Make modifications to the kernel and the worst you do is crash your virtual machine! Explore the Linux kernel source: http://lxr.linux.no