Page Tables. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Similar documents
Address Translation. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Paging. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Paging. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Paging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Paging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Virtual Memory I. Jo, Heeseung

CS 153 Design of Operating Systems Winter 2016

Virtual Memory. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

VIRTUAL MEMORY II. Jo, Heeseung

Memory Management. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

VIRTUAL MEMORY. Operating Systems 2015 Spring by Euiseong Seo

CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8)

Swapping. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

File System Implementation

Memory Management Topics. CS 537 Lecture 11 Memory. Virtualizing Resources

memory management Vaibhav Bajpai

EECS 482 Introduction to Operating Systems

Memory Management. Dr. Yingwu Zhu

CS370 Operating Systems

CS 318 Principles of Operating Systems

Address Translation. Tore Larsen Material developed by: Kai Li, Princeton University

CSE 120 Principles of Operating Systems

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

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

CSE 451: Operating Systems Winter Page Table Management, TLBs and Other Pragmatics. Gary Kimura

CS 134: Operating Systems

Virtual Memory 2. q Handling bigger address spaces q Speeding translation

Main Memory CHAPTER. Exercises. 7.9 Explain the difference between internal and external fragmentation. Answer:

Virtual Memory 2. To do. q Handling bigger address spaces q Speeding translation

Simple idea 1: load-time linking. Our main questions. Some terminology. Simple idea 2: base + bound register. Protection mechanics.

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

CS153: Memory Management 1

CSE 120 Principles of Operating Systems Spring 2017

Recap: Memory Management

Multi-level Translation. CS 537 Lecture 9 Paging. Example two-level page table. Multi-level Translation Analysis

Multi-level Page Tables & Paging+ segmentation combined

Virtual Memory 1. To do. q Segmentation q Paging q A hybrid system

Virtual Memory. Kevin Webb Swarthmore College March 8, 2018

Chapter 8 Memory Management

Operating Systems. Paging... Memory Management 2 Overview. Lecture 6 Memory management 2. Paging (contd.)

Virtual to physical address translation

Recall: Address Space Map. 13: Memory Management. Let s be reasonable. Processes Address Space. Send it to disk. Freeing up System Memory

CS162 - Operating Systems and Systems Programming. Address Translation => Paging"

Lecture 13: Virtual Memory Management. CSC 469H1F Fall 2006 Angela Demke Brown

Virtual Memory. CS 351: Systems Programming Michael Saelee

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation

Virtual Memory. Today. Handling bigger address spaces Speeding translation

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1

Memory Hierarchy. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Lecture 13: Address Translation

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables

Virtual Memory. Motivation:

Today: Segmentation. Last Class: Paging. Costs of Using The TLB. The Translation Look-aside Buffer (TLB)

Virtual Memory 2. Today. Handling bigger address spaces Speeding translation

Operating Systems, Fall

Operating Systems, Fall

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 13: Address Translation

2-Level Page Tables. Virtual Address Space: 2 32 bytes. Offset or Displacement field in VA: 12 bits

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Fast File System (FFS)

CS370 Operating Systems

Virtual Memory. Today. Segmentation Paging A good, if common example

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

Paging & Segmentation

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

ECE 571 Advanced Microprocessor-Based Design Lecture 12

CS 390 Chapter 8 Homework Solutions

Memory Management. An expensive way to run multiple processes: Swapping. CPSC 410/611 : Operating Systems. Memory Management: Paging / Segmentation 1

COS 318: Operating Systems. Virtual Memory and Address Translation

Chapter 8: Main Memory

Paging! 2/22! Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2012! " (0xE0)" " " " (0x70)" " (0x50)"

Chapter 8: Memory-Management Strategies

COSC3330 Computer Architecture Lecture 20. Virtual Memory

Page 1. Review: Address Segmentation " Review: Address Segmentation " Review: Address Segmentation "

20-EECE-4029 Operating Systems Spring, 2013 John Franco

Modeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems

Chapter 9 Memory Management

Main Memory: Address Translation

Main Memory (Part II)

CS162 Operating Systems and Systems Programming Lecture 12. Address Translation. Page 1

10/7/13! Anthony D. Joseph and John Canny CS162 UCB Fall 2013! " (0xE0)" " " " (0x70)" " (0x50)"

Virtual Memory. control structures and hardware support

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) !

Chapter 8: Main Memory. Operating System Concepts 9 th Edition

16 Sharing Main Memory Segmentation and Paging

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

How to create a process? What does process look like?

Chapter 8: Main Memory

EECS 470. Lecture 16 Virtual Memory. Fall 2018 Jon Beaumont

Memory management: outline

Memory management: outline

390 Chapter 8 Main Memory

Motivation. Memory Management. Memory Management. Computer Hardware Review

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory


Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015

Transcription:

Page Tables Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu)

The Problem Space overhead of page tables A 32-bit address space with 4KB pages (4 bytes/pte): 2 20 * 4 = 4MB (per process) A 64-bit address space with 8KB pages (8 bytes/pte): 2 51 * 8 = 2 54 = 32PB (per process) How can we reduce this overhead? Observation: Many invalid PTEs Only need to map the portion of the address space actually being used which is a tiny fraction of entire address space EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 2

(Typical) Linear Page Table Virtual address space Physical memory code data heap heap Huge waste! stack EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 3

Paging with Segmentation (1) A segment represents a region of valid address space Segmentation: Divide virtual address space into segments Each segment can have variable length Paging: Divide each segment into fixed-sized pages Each segment has a page table Each segment tracks base (physical address) and limit of the page table for that segment Virtual address divided into three portions Seg # Page number Page offset EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 4

Paging with Segmentation (2) Example: Multics address translation EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 5

Paging with Segmentation (3) Pros Can decrease the size of page tables Segments can grow without any reshuffling Can run process when some pages are swapped to disk Increases flexibility of sharing: share either single page or entire segment Cons Page tables potentially can be large e.g. A large but sparse-used heaps will have a lot of waste External fragmentation due to page tables Each page table should be allocated contiguously EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 6

Multi-level Page Tables (1) EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 7

Multi-level Page Tables (2) Allow each page table to be allocated non-contiguously Virtual addresses have 3 parts Outer page # Secondary page # Page offset Outer page table: outer page number à secondary page table Secondary page table: secondary page # à page frame # EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 8

Multi-level Page Tables (3) Example 32-bit address space, 4KB pages, 4 bytes/pte Want every page table fit into a page 10 10 Outer page # Secondary page # Page offset Outer page table Page frame Secondary page table 12 Page offset Physical address Physical memory Page frame N. Page frame 6 Page frame 5 Page frame 4 Page frame 3 Page frame 2 Page frame 1 Page frame 0 EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 9

Multi-level Page Tables (4) Address translation in Alpha AXP architecture Three-level page tables 64-bit address space divided into 3 segments (coded in bits 63/62) seg0 (0x): user code seg1 (11): user stack kseg (10): kernel Alpha 21064 Page size: 8KB Virtual address: 43 bits Each page table is one page long EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 10

Multi-level Page Tables (5) Address translation in Intel 64 architecture 48-bit linear address à 52-bit physical address (4KB page) Page Map Level 4 EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 11

Multi-level Page Tables (6) Pros Compact while supporting sparse-address space Page-table space in proportion to the amount of address space used Easier to manage physical memory Each page table usually fits within a page Easier for hardware to walk though page tables No external fragmentation Cons More memory accesses on a TLB miss More complex than a simple linear page-table lookup EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 12

Inverted Page Tables (1) Reverse mapping from PFN à <VPN, PID> One entry for each page frame in physical memory Entry consists of the virtual page number with information about the process that owns that page Need to search through the table to find match Use hashing to limit the search to one, or at most a few, page-table entries Pros & Cons Decrease memory needed to store page tables: No need to have per-process page tables Increase time needed to search the table on a TLB miss EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 13

Inverted Page Tables (2) EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 14

Paging Page Tables Store page tables in virtual address space Cold (unused) page table pages can be paged out to disk But, now addressing page tables requires translation Outer page table is usually pinned into physical memory Outer page table points to the virtual addresses (in the kernel address space) of secondary page tables Need to handle nested page faults What if we page kernel code and data too? EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 15

(cf.) IA-32 VM Architecture (optional) EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) 16