Multi-level Page Tables & Paging+ segmentation combined

Similar documents
15 Sharing Main Memory Segmentation and Paging

16 Sharing Main Memory Segmentation and Paging

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

EECS 482 Introduction to Operating Systems

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

Memory Management. Goals of Memory Management. Mechanism. Policies

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck

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

Page Tables. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

CS399 New Beginnings. Jonathan Walpole

Chapter 8 Virtual Memory

COS 318: Operating Systems. Virtual Memory and Address Translation

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

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

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

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

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

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

Virtual to physical address translation

Memory Management. Dr. Yingwu Zhu

COSC3330 Computer Architecture Lecture 20. Virtual Memory

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

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Virtual Memory. Kevin Webb Swarthmore College March 8, 2018

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

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

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

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 23

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 27, SPRING 2013

Principles of Operating Systems

Memory Management Virtual Memory

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 27, FALL 2012

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

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018

Paging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

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

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 23

Requirements, Partitioning, paging, and segmentation

Virtual Memory. control structures and hardware support

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

Process size is independent of the main memory present in the system.

Virtual Memory. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CS 333 Introduction to Operating Systems. Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University

Operating Systems Design Exam 2 Review: Spring 2011

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

CS 416: Opera-ng Systems Design March 23, 2012

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

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

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

Virtual Memory. Chapter 8

CS420: Operating Systems. Paging and Page Tables

CS 134: Operating Systems

Address spaces and memory management

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

Module 29: Operating System Memory Protection

Past: Making physical memory pretty

Memory Management. Dr. Yingwu Zhu

a process may be swapped in and out of main memory such that it occupies different regions

Paging. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Virtual Memory Management

CS307 Operating Systems Main Memory

Virtual Memory. Samira Khan Apr 27, 2017

8.1 Background. Part Four - Memory Management. Chapter 8: Memory-Management Management Strategies. Chapter 8: Memory Management

Virtual memory - Paging

The process. one problem

CS 3500 Final Exam Sample Questions

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program!

Memory Management Part 1. Operating Systems in Depth XX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

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

1. With respect to space, linked lists are and arrays are.

UC Berkeley CS61C : Machine Structures

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

File-System Structure. Allocation Methods. Free-Space Management. Directory Implementation. Efficiency and Performance. Recovery

Agenda. CS 61C: Great Ideas in Computer Architecture. Virtual Memory II. Goals of Virtual Memory. Memory Hierarchy Requirements

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Virtual Memory: From Address Translation to Demand Paging

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

Chapter 9 Memory Management

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

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

memory management Vaibhav Bajpai

CS370 Operating Systems

Virtual Memory Virtual memory first used to relive programmers from the burden of managing overlays.

File Management By : Kaushik Vaghani

MEMORY: SWAPPING. Shivaram Venkataraman CS 537, Spring 2019

ECE519 Advanced Operating Systems

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2

Part Three - Memory Management. Chapter 8: Memory-Management Strategies

Operating Systems, Fall

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others

Operating Systems, Fall

Memory management: outline

Memory management: outline

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

Transcription:

Multi-level Page Tables & Paging+ segmentation combined Basic idea: use two levels of mapping to make tables manageable o Each segment contains one or more pages Segments correspond to logical units: code, data, stack Segments vary in size and are often large, while pages are fixed size Pages are for the use of the OS; they are fixed-sized to make it easy to manage memory Going from paging to P+S is like going from single segment to multiple segments, except at a higher level Instead of having a single page table, have many page tables with a base and bound for each (base and bounds now refer to page table s base and bound) Call the stuff associated with each page table a segment Show System 370 example: 24-bit virtual address space as follows: segment # (4 bits) page # (8 bits) offset (12 bits) Segment table contains real address of page table along with the length of the page table (a sort of bounds register for the segment) Page table entries are only 12 bits, real addresses are 24 bits Example of S/370 paging (all numbers in hexadecimal): Segment table (base bounds protection): 2000 14 R, 0 0 0, 1000 D RW

Segement # Base Bound RW bits 0 2000 14 10 1 0 0 00 2 1000 D 01 Assume page table entries are each 2 bytes long What is the physical address of the page table entry for translating virtual address 2070? Suppose the physical memory where the page tables for the above segments reside contain the following: Physical Contents address 1000 06 1002 0B 1004 04 1020 07 1022 0C 2000 13 2002 2A 2004 03 2020 11 2022 1F

Map the following addresses from virtual to physical: 2070 read: 202016 read: 104C84 read: 11424 read: 210014 write: Pros: If a segment isn't used, then there's no need to even have a page table for it Can share at two levels: single page, or single segment (whole page table) Pages eliminate external fragmentation, and make it possible for segments to grow without any reshuffling If page size is small compared to most segments, then internal fragmentation is not too bad Cons: If translation tables are kept in main memory, overheads could be very high: 1 or 2 overhead references for every real reference Page tables can still be large Dealing with very large page tables Another problem with large address spaces is very large page tables Solution: Don t keep the entire page table in memory Use virtual memory for the page tables as well Multi-level paging

Basically, like segmentation+paging, except it could be 2 or more levels There is no notion such as segments mapping to logical entities Show picture: Only the top level page table needs to be resident in memory If the present bit for the next-level page table is false, then it can be paged in At a given time, only a small part of entire set of page tables needs to be resident in memory

Alternative way of dealing with large page tables: Map user page tables via an in-memory system page table VAX 11/780 used this Address is 32 bits, top two select segment Four base-bound pairs define page tables (system, P0, P1, unused) Pages are 512 bytes long First segment contains operating system stuff, two contain stuff of current user process: Segment 0 page table is always kept in memory (system stuff, shared between processes) P0 and P1 point to user addresses The page tables for P0 and P1 are kept in system s virtual memory Show a picture Effectively, we are using the system page table to map the user page tables so that the user page tables can be scattered or even moved to disk Translating a user

address requires: Compute the address of the user page table entry This is a virtual address that is guaranteed to be in segment 0 (system s space) Translate the PTE address to a physical address This is normal translation, via the system s page table A page fault could occur here, in which it needs to be serviced to bring the PTE into memory Look up the PTE and complete the translation A page fault could also occur here, in which case it needs to be serviced to bring the page being accessed by the user into physical memory System base-bounds pairs are physical addresses, system tables must be contiguous The result is a two-level scheme Problem with multi-level paging: Extra memory references to access translation tables can slow programs down by a factor of two or more Solution: Use translation look-aside buffers (TLB) to speed up address translation (EECS 370 material) Kernel vs user mode Who is allowed to modify the base+bound registers? Or more generally, the translation data used by the translation box? Can user processes be allowed to modify the translation data?

If only kernel is allowed to modify the translation data, where is the translation data stored (whose address space?) and how does kernel modify the data? How does machine know that the kernel is running? How do we change from user mode to kernel mode? Can the user process change it? How do we switch from user process to kernel?

How does the OS regain control once it has given control to the user process? How do we create and start a process? (As opposed to just starting a thread) Is hardware support needed for any of the above steps?