Memory: Page Table Structure

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Page Table Implementation
Paging Hardware With TLB
Memory Management (II)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Memory Management.
Chapter 3.2 : Virtual Memory
Translation Buffers (TLB’s)
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
1 Tuesday, July 04, 2006 "Programs expand to fill the memory available to hold them." - Modified Parkinson’s Law.
CS 241 Section Week #12 (04/22/10).
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 24 Paging.
Chapter 8 Memory Management Dr. Yingwu Zhu. Outline Background Basic Concepts Memory Allocation.
Computer Architecture Lecture 28 Fasih ur Rehman.
Lecture 19: Virtual Memory
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Implementation of Page Table Page table is kept in main memory Page-table base.
Memory Management Fundamentals Virtual Memory. Outline Introduction Motivation for virtual memory Paging – general concepts –Principle of locality, demand.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
Virtual Memory 1 1.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
Operating Systems Unit 7: – Virtual Memory organization Operating Systems.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Paging Paging is a memory-management scheme that permits the physical-address space of a process to be noncontiguous. Paging avoids the considerable problem.
Page Table Implementation. Readings r Silbershatz et al:
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
Silberschatz, Galvin and Gagne  Operating System Concepts Paging Logical address space of a process can be noncontiguous; process is allocated.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Operating Systems, Winter Semester 2011 Practical Session 9, Memory 1.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
Memory.
CMSC 611: Advanced Computer Architecture
Memory Hierarchy Ideal memory is fast, large, and inexpensive
Memory Management Virtual Memory.
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
CS703 - Advanced Operating Systems
Day 21 Virtual Memory.
Day 22 Virtual Memory.
Paging and Segmentation
Operating System Concepts
EECE.4810/EECE.5730 Operating Systems
Main Memory Session -15.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Lecture 29: Virtual Memory-Address Translation
Virtual Memory Hardware
Practical Session 9, Memory
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Chapter 8: Memory Management strategies
CSE 451: Operating Systems Autumn 2004 Page Tables, TLBs, and Other Pragmatics Hank Levy 1.
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Paging and Segmentation
CSE 451: Operating Systems Winter 2005 Page Tables, TLBs, and Other Pragmatics Steve Gribble 1.
Translation Buffers (TLBs)
Review What are the advantages/disadvantages of pages versus segments?
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology 1

Memory management unit Translates Virtual Addresses page tables translation lookaside buffer (TLB) Page tables One for kernel addresses one or more for user space processes Page Table Entry (PTE) for user space processes Typically 32 bits page frame, protection, valid, modified, referenced The TLB is a cache for PTEs. There is one page table for kernel addresses and one or more for user processes. 2

Address translation Finds PTE for virtual page number A logical address Virtual page number + offset Finds PTE for virtual page number Extract frame number and append offset Fail (MMU raises an exception - page fault): bounds error - outside address range validation error - non-resident page protection error - not permitted access Reasons for failure and raising of an exception. 3

Imagine you have a computer that has 32 bit logical addresses Imagine you have a computer that has 32 bit logical addresses. Given that a page is 4KB (212 bytes) … a) what is the minimum size of a page table entry, assuming physical addresses in this system are 32 bits? b) How big (in total) must the page table for each process be, assuming each page table entry was 4 bytes?

Structure of the page table Hierarchical Paging Inverted Page Tables Inverted Page Tables with Hashing Because of a very large virtual address space, the page # field in a virtual address is typically larger than the frame # field in the corresponding physical address. 5

Hierarchical page tables Break up the logical address space into multiple page tables A simple technique is a two-level page table Ideal for large page tables or for processes that are larger than main memory. 6

Two-level page-table scheme The outer page table is also called the root page table. 7

Two-level paging example A logical address (on 32-bit machine with 1K page size) is divided into: a page number consisting of 22 bits a page offset consisting of 10 bits Since the page table is paged, the page number is further divided into: a 12-bit page number a 10-bit page offset Thus, a logical address is as follows: where pi is an index into the outer page table, and p2 is the displacement within the page of the outer page table page number page offset The outer page table is also called the root page table. pi p2 d 12 10 10 8

Two-level page table example (2) Consider a process as described here: Logical address space is 4-GB (232 bytes) Size of a page is 4KB (212 bytes) There are ___ pages in the process. This implies we need ____ page table entries in the process page table. If each page table entry occupies 4-bytes, then we need a ______ byte large page table The page table will occupy __________ pages. Root table will consist of ____ entries one for each page that holds part of the process page table Root table will occupy ____ bytes 4KB of space will be kept in main memory permanently A page access could require two disk accesses Solve this together. Solution on hidden slide Note, one entry per process page. 9

Two-level page table example (3) Consider a process as described here: Logical address space is 4-GB (232) Size of a page is 4KB (212 bytes) There are 220 pages in the process. (232/212) This implies we need 220 page table entries in the process page table, one entry per page. If each page table entry occupies 4-bytes, then we need a 222 byte (4MB) large page table. The page table will occupy 222/212 i.e. 210 pages. Root table will consist of 210 entries one for each page that holds a part of the process page table Root table will occupy 212 bytes 4KB of space will be kept in main memory permanently A page access could require two disk accesses [Hidden slide] Note, there is an entry per page in the process page table. This was confusing the students before it was edited 10

11 Always in main memory Brought into main memory as needed First 10 bits are used to index into the root page table to find a page-table-entry (PTE) for a page of the user page table. Page fault occurs if not in main memory If in main memory, next 10 bits used to index into user PTE page for the page that is referenced by the virtual address Answer question “Multi-level indexing” together or direct students to that question in the homework assignment. Brought into main memory as needed 11

Inverted page table The page table can get very large An inverted page table is another solution An inverted page table has an entry for every frame in main memory and hence is of a fixed size This is why it is called an inverted page table Also contains info to identify process A hash function is used to map the page number (and process ID) to the frame number A PTE has a page number, process id, valid bit, modify bit, chain pointer This is an alternative to “multilevel page table”. Note: an entry for every memory frame; not an entry for every process page. Hence, the name – inverted page table. 12

Inverted page table Program Paging Hardware Memory Virtual Address Physical Address Frame # Offset Page # Offset Inverted Page Table Page Frame Frame # <PID, Page #> Search V M PID,Page # matches Page # and PID Power PC Example Program Paging Hardware Memory

Inverted page table with hashing Virtual Address Physical Address Frame # Offset Page # Offset Hash Table Hash <PID, Page #> Inverted Page Table Page Frame Frame # Synonym Chain Answer question “Hashing into an inverted page table” together (Only hardware connection and a simple example) if time permits or direct students to question V M PID,Page # Search matches Page # and PID Program Memory Paging Hardware

Hashing techniques Hashing function: X mod 8 (b) Chained rehashing 15

Memory management concerns Problem: Page tables require at least 2 memory access per instruction One to fetch the page table entry One to fetch the data Solution: Translation Lookaside Buffer (TLB) A high-speed HW associative cache set up for page table entries Cache the address translations themselves Entries may contain a tag identifying the process as well as the virtual address. Why is this important?

Associative cache Direct page lookup Associative page lookup

Typical TLB use Answer question “Associative lookup in a cache called the translation lookaside buffer(TLB)” together or direct students to question

Effective access time with TLB In tlb = 10ns (TLB) + 100ns (data) not in TLB: 10ns (TLB) + 100 (PT) + 100ns (data) Effective access time = 110ns (.90) + (1-.90) * 210ns = 120ns

Typical TLB parameters Block Size 4 to 8 bytes (1 page table entry) Hit Time 2.5 to 5 nsec (1 clock cycle) Miss Penalty 50 to 150 nsec TLB Size 32 bytes to 8 KB Desired Hit Rate 98% to 99.9%