Virtual vs Physical Addresses



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

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

COS 318: Operating Systems. Virtual Memory and Address Translation

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

W4118: segmentation and paging. Instructor: Junfeng Yang

OPERATING SYSTEM - VIRTUAL MEMORY

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

Board Notes on Virtual Memory

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

OPERATING SYSTEM - MEMORY MANAGEMENT

Virtual Machines. COMP 3361: Operating Systems I Winter

1. Computer System Structure and Components

CS5460: Operating Systems

Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing

Hypervisor: Requirement Document (Version 3)

Memory Management CS 217. Two programs can t control all of memory simultaneously

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

How To Write A Page Table

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

Operating Systems, 6 th ed. Test Bank Chapter 7

W4118 Operating Systems. Instructor: Junfeng Yang

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

Have both hardware and software. Want to hide the details from the programmer (user).

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

Presentation of Diagnosing performance overheads in the Xen virtual machine environment

CS161: Operating Systems

Computer-System Architecture

OPERATING SYSTEMS MEMORY MANAGEMENT

Outline: Operating Systems

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Chapter 7 Memory Management

Lecture 25 Symbian OS

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

Chapter 12. Paging an Virtual Memory Systems

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

Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

Chapter 6, The Operating System Machine Level

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

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

Memory management. Chapter 4: Memory Management. Memory hierarchy. In an ideal world. Basic memory management. Fixed partitions: multiple programs

CS 695 Topics in Virtualization and Cloud Computing. More Introduction + Processor Virtualization

IOMMU: A Detailed view

Virtual Memory Paging

The Xen of Virtualization

Computer Architecture

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

Full and Para Virtualization

Chapter 5 Cloud Resource Virtualization

Memory Management 1. Memory Management. Multitasking without memory management is like having a party in a closet.

General Purpose Operating System Support for Multiple Page Sizes

Virtualization. Explain how today s virtualization movement is actually a reinvention

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

Virtual Machines. Virtualization

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Virtual machines and operating systems

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Virtual Memory. Chapter 4

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

Memory Management under Linux: Issues in Linux VM development

OSes. Arvind Seshadri Mark Luk Ning Qu Adrian Perrig SOSP2007. CyLab of CMU. SecVisor: A Tiny Hypervisor to Provide

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

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Storage in Database Systems. CMPSCI 445 Fall 2010

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Virtualization. Clothing the Wolf in Wool. Wednesday, April 17, 13

Operating System Overview. Otto J. Anshus

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction

6.033 Computer System Engineering

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

CSC 2405: Computer Systems II

Paging: Introduction A Simple Example And Overview

ELEC 377. Operating Systems. Week 1 Class 3

Virtualization in Linux KVM + QEMU

Virtual Shared Memory (VSM)

Devices and Device Controllers

I/O Device and Drivers

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

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

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

KVM & Memory Management Updates

Performance Monitoring User s Manual

Hardware Assisted Virtualization

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Segmentation Segmentation: Generalized Base/Bounds

Lecture 36: Chapter 6

Red Hat Linux Internals

Midterm Exam #2 November 10, 1999 CS162 Operating Systems

Intel DPDK Boosts Server Appliance Performance White Paper

Chapter 7 Memory Management

Xen and the Art of. Virtualization. Ian Pratt

b. A program calls malloc to request more memory from the operating system. i.what system call would malloc use to request more memory of the OS?

Chapter 11 I/O Management and Disk Scheduling

Data Storage - I: Memory Hierarchies & Disks

COS 318: Operating Systems

Kernel Virtual Machine

Chapter 3 Operating-System Structures

Transcription:

Virtual vs Physical Addresses Physical addresses refer to hardware addresses of physical memory. Virtual addresses refer to the virtual store viewed by the process. virtual addresses might be the same as physical addresses might be different, in which case virtual addresses must be mapped into physical addresses. Look at Fig 4-9. Mapping is done by Memory Management Unit (MMU). virtual space is limited by size of virtual addresses (not physical addresses) virtual space and physical memory space are independent How can it work if a 32-bit virtual address allows 4GB of space to be addressible for a single process and multiple processes run on machines with less than this amount of physical memory? 1. processes don t use all of the 4GB of space. 2. only a portion of the address space that processes do use is loaded into physical memory at a time. CS 3013 1 week4-paging.tex

Virtual Memory with Paging Paging is the most common memory management technique: virtual space of process divided into fixed-size pages virtual address composed of page number and page offset physical memory divided into fixed-size frames page in virtual space fits into frame in physical memory Mapping of VA to PA is done with a page table. Fig 4-10, 4-11. Each process has an associated page table. Page tables can be quite large. Thus have multiple levels of page tables. Many examples given in Tanenbaum. Just using additional bits of the virtual address and actually write out page tables to disk. Present an overall picture of paging. Draw: Disk Page table: Frame number, permissions, present/absent, modified (dirty), (add referenced bit later). Two processes, each with own page table. physical memory (1K frames). Frame table (supported by Operating System). Fields: status (free/used add, copied in or out later), pid, page, free frame index. Frame list. Queue of free frames. CS 3013 2 week4-paging.tex

Address Translation Start execution, causing address translation to be used. 1. extract page number from virtual address (show page offset). If we assume 1K page then 1024 bytes then offset is 10 bits. 2. if page number is greater than number of pages, generate an illegal page trap 3. access appropriate page table entry 4. if page is not in memory, trap missing page 5. if access violation, trap protection violation (segmentation violation in Unix) 6. finally, return physical address (frame number * page size + page offset) Choosing a page size: overhead space small page size means larger page tables internal fragmentation large pages result in more internal fragmentation larger pages generally better for transferring to/from backing store typical sizes run from.5k to 4K bytes to 8K bytes CS 3013 3 week4-paging.tex

What happens on a page fault Trap is handled by a Page Fault Handler(). This routine is responsible for swapping a page from disk into memory. 1. GetFreeFrame 2. Determine location of page. If on disk (such as text, initialized data or previously saved page) then get disk location: (a) Disk mapping table (pid, page, disk addr) (b) Routine bsloc(pid, page) returns disk addr. 3. Schedule reading in page from disk into physical memory (introduce copyin status here). Is the process ready for execution? Don t want to wait. This is a major fault because it requires disk access to satisfy. 4. Stack and uninitialized data page would not need to be initially read from disk, but would be zero-filled and used (why zero-fill?). A minor fault. What to do when the read is complete. Disk driver will generate an interrupt, what will the memory manager do in response? 1. mark frame entry as copied in. 2. make process needing the frame eligible for execution CS 3013 4 week4-paging.tex

What happens when there are no free frames? Must remove one or more entries from physical memory. Which ones? Page replacement policy is used talk about in a bit. Given that a page has been selected for replacement what to do? mark the page as no longer present in page table if not modified then can simply put free frame back in the pool if modified then must schedule page for writing. Again we must consider what to do when the page is done being written. Modified page is written to swap space or a special swap file on disk these include modified data, stack and heap pages. what to do if the frame that is being written is accessed again (would like to reclaim it another type of minor fault) Translation Lookaside Buffer To speed translations, hardware maintains a cache called the translation lookaside buffer (TLB). Part of the MMU. Look at Fig 4-14. Thus, virtual memory accesses: 1. check TLB for desired mapping; if present, we are done 2. if not present in TLB, consult mapping tables in (slower) memory 3. place virtual/physical address pair in cache Note: there is an additional hidden cost to context switching. The cache must be flushed at every context switch! Once the cache has been filled, typical hit rates approach 95%. CS 3013 5 week4-paging.tex