Board Notes on Virtual Memory

Similar documents
Lecture 17: Virtual Memory II. Goals of virtual memory

COS 318: Operating Systems. Virtual Memory and Address Translation

Virtual vs Physical Addresses

We r e going to play Final (exam) Jeopardy! "Answers:" "Questions:" - 1 -

How To Write A Page Table

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

18-548/ Associativity 9/16/98. 7 Associativity / Memory System Architecture Philip Koopman September 16, 1998

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont.

OPERATING SYSTEMS MEMORY MANAGEMENT

Chapter 10: Virtual Memory. Lesson 03: Page tables and address translation process using page tables

The Xen of Virtualization

The Quest for Speed - Memory. Cache Memory. A Solution: Memory Hierarchy. Memory Hierarchy

The Classical Architecture. Storage 1 / 36

361 Computer Architecture Lecture 14: Cache Memory

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

Bindel, Spring 2010 Applications of Parallel Computers (CS 5220) Week 1: Wednesday, Jan 27

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Outline: Operating Systems

This Unit: Virtual Memory. CIS 501 Computer Architecture. Readings. A Computer System: Hardware

Introduction to RISC Processor. ni logic Pvt. Ltd., Pune

Computer Organization and Architecture. Characteristics of Memory Systems. Chapter 4 Cache Memory. Location CPU Registers and control unit memory

The Big Picture. Cache Memory CSE Memory Hierarchy (1/3) Disk

W4118: segmentation and paging. Instructor: Junfeng Yang

Paging: Introduction A Simple Example And Overview

OPERATING SYSTEM - MEMORY MANAGEMENT

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Virtual Memory Paging

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Memory ICS 233. Computer Architecture and Assembly Language Prof. Muhamed Mudawar

Storage in Database Systems. CMPSCI 445 Fall 2010

Data Storage - I: Memory Hierarchies & Disks

OpenSPARC T1 Processor

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

Full and Para Virtualization

Virtual Memory. Virtual Memory. Paging. CSE 380 Computer Operating Systems. Paging (1)

Using Synology SSD Technology to Enhance System Performance Synology Inc.

SOC architecture and design

COMPUTER ORGANIZATION ARCHITECTURES FOR EMBEDDED COMPUTING

x64 Servers: Do you want 64 or 32 bit apps with that server?

Chapter 12. Paging an Virtual Memory Systems


Operating Systems, 6 th ed. Test Bank Chapter 7

Chapter 13. PIC Family Microcontroller

Midterm Exam #2 Solutions November 10, 1999 CS162 Operating Systems

System Requirements Table of contents

Midterm Exam #2 November 10, 1999 CS162 Operating Systems

Secure Cloud Storage and Computing Using Reconfigurable Hardware

Discussion Session 9. CS/ECE 552 Ramkumar Ravi 26 Mar 2012

Virtualizing a Virtual Machine

WHITE PAPER. AMD-V Nested Paging. AMD-V Nested Paging. Issue Date: July, 2008 Revision: 1.0. Advanced Micro Devices, Inc.

Peter J. Denning, Naval Postgraduate School, Monterey, California

Memory Hierarchy. Arquitectura de Computadoras. Centro de Investigación n y de Estudios Avanzados del IPN. adiaz@cinvestav.mx. MemoryHierarchy- 1

HY345 Operating Systems

Hardware Configuration Guide

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Slide Set 8. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

All Tech Notes and KBCD documents and software are provided "as is" without warranty of any kind. See the Terms of Use for more information.

CS/COE1541: Introduction to Computer Architecture. Memory hierarchy. Sangyeun Cho. Computer Science Department University of Pittsburgh

Database Fundamentals

Computer Architecture

GPU File System Encryption Kartik Kulkarni and Eugene Linkov

Operating Systems. Virtual Memory

Storing Data: Disks and Files. Disks and Files. Why Not Store Everything in Main Memory? Chapter 7

KVM & Memory Management Updates

Computer Architecture

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

Systemverwaltung 2009 AIX / LPAR

COMP 422, Lecture 3: Physical Organization & Communication Costs in Parallel Machines (Sections 2.4 & 2.5 of textbook)

I/O. Input/Output. Types of devices. Interface. Computer hardware

COSC 6374 Parallel Computation. Parallel I/O (I) I/O basics. Concept of a clusters

CPU Organisation and Operation

Price/performance Modern Memory Hierarchy

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

What to do about Fiber Skew?

AMD PhenomII. Architecture for Multimedia System Prof. Cristina Silvano. Group Member: Nazanin Vahabi Kosar Tayebani

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Let s put together a Manual Processor

Chapter 1 Computer System Overview

OPERATING SYSTEM - VIRTUAL MEMORY

Network File System (NFS) Pradipta De

SharePoint Performance Optimization

EC 362 Problem Set #2

How To Test For Performance And Scalability On A Server With A Multi-Core Computer (For A Large Server)

A3 Computer Architecture

Outline. Cache Parameters. Lecture 5 Cache Operation

Stack Allocation. Run-Time Data Structures. Static Structures

VIRTUAL MEMORY IN CONTEMPORARY MICROPROCESSORS

Understanding Memory Resource Management in VMware ESX 4.1

ELE 356 Computer Engineering II. Section 1 Foundations Class 6 Architecture

Putting it all together: Intel Nehalem.

FAST 11. Yongseok Oh University of Seoul. Mobile Embedded System Laboratory

Understanding Memory Resource Management in VMware vsphere 5.0

Virtual Memory. Chapter 4

Transcription:

Board Notes on Virtual Memory Part A: Why Virtual Memory? - Letʼs user program size exceed the size of the physical address space - Supports protection o Donʼt know which program might share memory at compile time. Consider the following: - Above: o Assume 4KB pages therefore, think about groups of 2 12 pieces of data - Usually, virtual address space is much greater than physical address space o (Mapping allows code with virtual address to run on any machine.) Part B: How do we translate a Virtual Address to a Physical Address (or alternatively, How do we know where to start looking in memory? ) - Good analogy: Itʼs like finding what cache block a physical address maps to. Example: - What if 32-bit virtual address (2 32 virtual addresses), 4KB pages (like above), 64 MB of main memory (2 26 physical addresses) How is this mapping done? VPN (Virtual Page Number) PFN (Physical Frame Number) OFFSET OFFSET How do we do VPN PFN mapping? - Leverage structure called page table - To make analogy to cache, data = PFN - To make analogy to cache, also have valid, dirty bits -

- If no valid mapping, get page fault: o Try to avoid o Involves lots of disk traffic o Placement in memory done fully associative, LRU to minimize o Placement = some extra overhead, but small percent and worth it to avoid M CC penalty Offset still the same because we go down the same distance More specifically: The process works like this Even more specifically - The page table is stored in memory - The beginning of the page table is stored in the page table register - OS knows where PT for each program begins; interfaces with architecture to find

Part C: How big is the page table? - Page table can actually become pretty big - Example #1: o 4 KB pages Therefore need 2 12 (or 12 bits of offset) (Offset does same thing that it does in cache block not just picks page entry) o 32-bit virtual address 32 12 = 20 bits of VPN o 4 Byte / page table entry Holds LRU status, valid, dirty, PFN (~32 bits) - Therefore, 2 20 entries in page table, each ~ 4 bytes each 4 Mbytes o Not as big as memory, but what about cache? Another Example - Assume o Virtual address = 64 bits o 4 KB pages o 4 bytes/page VPN (52 bits) Offset (12 bits) - PT would be: o 4.5 x 10 15 x 4 ~ 10 16 bytes 10 petabytes! - Soluton(s): o Multi-level, inverted page tables youʼll learn about in OS Part D: Is page table / virtual address translation slow? - It can be have maybe 2 references / translation - Solution: TLB = Translation Lookaside Buffer o Fast cache for page table What does the TLB look like? - Itʼs a really small, fully associative cache Virtual Page # Physical Frame # Dirty LRU Valid 1. All of the virtual page numbers would be searched for a match 2. The physical frame number is the data that is supplied 3. The physical frame number is concatenated with an offset to form a physical address

Where is the TLB on the critical path? See flow chart below / in notes:

Part E: Example 1: Assume a machine with the following characteristics: - The CPU supplies a 64 bit virtual address. - The 64 bit virtual address must be translated into a 64 bit physical address. - This single core machine has 2 levels of cache. - The clock rate is 1 GHz. Question A: The page table has 2 32 entries. Determine the physical address associated with the virtual address using portions of the memory state of the machine provided below. (Addresses hex.) Page Table Register: AAAA 0000 0000 0000 Virtual Address: 0000 BBBB 0000 AAAA Address (least significant to most significant) Data 1 0000, 0000, 0000, 0000 FEDC, BA98, 7654, 3210 2 0000, 0000, 1111, 1111 0123, 4567, 89AB, CDEF 3 0000, 0000, AAAA, 0000 0000, 0000, 3333, 7777 4 0000, 0000, DDDD, 9988 2222, 7777, 8888, 4444 5 0000, 000F, 0000, 0000 E1E1, 0E1E, 10E1, E100 6 0000, BBBB, 0000, AAAA 0000, 0000, EEEE, FFFF 7 0000, BBBB, AAAA, AAAA 0000, 0000, 9999, 2222 8 000A, AAA0, 0000, 0000 0000, 0000, 2222, 2222 9 0BBB, AAAA, 0000, AAAA 0000, 0000, 5555, 4444 10 AAAA, 0000, 0000, 0000 0000, 0000, BBBB, CCCC 11 AAAA, 0000, 0000, BBBB 0000, 0000, FFFF, EEEE 12 AAAA, BBBB, BBBB, AAAA 1111, 0000 AAAA, 0000 13 BBBB, AAAA, 0000, 0000 0000, 0000, 9999, 1111 14 BBBB, BBBB, BBBB, AAAA 0000, 0000, 9999, 8888 15 CCCC, CCCC, DDDD, DDDD 8888, 9999, 0000, 1111 16 FFFF, CCCC, DDDD, AAAA 1111, 1111, 0000, AAAA Goto memory location AAAA 0000 0000 0000 + 0000 BBBB AAAA 0000 0000 BBBB Get: 0000 0000 FFFF EEEE Physical address is: FFFF EEEE 0000 AAAA

Question B: The physical address generated above is then sent to a direct mapped, L1 cache. The L1 cache has the following characteristics: - The cache has 4096 blocks. - There are 256, 32-bit words in each block. Addresses are to the word. - The cache can hold 4 MB (i.e. 4,194,304 bytes) of data. Using the physical address found in Part A, fill in the following table: Index Offset 0AA AA Tag FFFF EEEE 000 Physical address: FFFF EEEE 0000 AAAA 4096 Blocks 2 12 12 bits of index 0AA 256 words/block 2 8 words/block 8 bits of offset AA Therefore there are 64 12 8 = 44 bits of tag FFFF EEEE 000 Question C: Assume that you have a sequence of 3 virtual addresses that you need to convert to physical addresses. The first virtual address takes 3 nanoseconds to translate to a physical address. The second virtual address takes 300,000 nanoseconds to translate to a physical address. The third virtual address takes 100 nanoseconds to translate to a physical address. For each virtual address, briefly comment on the critical path of translation. 3 ns TLB hit + cache hit 300000 ns TLB miss + page fault 100 ns (1) TLB Miss + Page Table Hit OR (2) TLB Hit + Cache Miss

Part E: Example 2: Assume that the 1 st three lines of code for Microsoft Word are as follows really! Address 1: 10000 # static variable 10000 Address 2: 20000 # static variable 20000 Address 3: Load R17 Address 1 # Load 10000 into R17 Thus, we want to load the data at address 1 of the Microsoft Word assembly code into register #17. Question A: Using a modern superscalar machineʼs datapath as context (with two levels of on-chip cache), list all of the steps involved with loading this initial value stored in the program code written by Microsoft into physical register #17. You have just turned your machine on and are loading Microsoft Word for the first time. TLB Miss, Page Table Lookup, TLB Update, L1 $ Miss, L2 $ Miss, Memory Reference, L2 Update, L1 Update, data into R17. Question B: Provide a rough estimate of the amount of time that this would take. Seconds!