A sample data structure for N-level page tables. Sample Data Structure PageTable – Contains information about the tree Level – A structure describing.

Slides:



Advertisements
Similar presentations
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Advertisements

1 CMPT 300 Introduction to Operating Systems Virtual Memory Sample Questions.
 Definition of B+ tree  How to create B+ tree  How to search for record  How to delete and insert a data.
The Linux Kernel: Memory Management
Hashing. CENG 3512 Motivation The primary goal is to locate the desired record in a single access of disk. – Sequential search: O(N) – B+ trees: O(log.
Department of Computer Science and Engineering, HKUST Slide 1 Dynamic Hashing Good for database that grows and shrinks in size Allows the hash function.
Multidimensional Indexing
Paging Hardware With TLB
Data Structures: A Pseudocode Approach with C
Memory Management Design & Implementation Segmentation Chapter 4.
1 Hash-Based Indexes Chapter Introduction : Hash-based Indexes  Best for equality selections.  Cannot support range searches.  Static and dynamic.
Insertion into a B+ Tree Null Tree Ptr Data Pointer * Tree Node Ptr After Adding 8 and then 5… 85 Insert 1 : causes overflow – add a new level * 5 * 158.
Tirgul 7 Heaps & Priority Queues Reminder Examples Hash Tables Reminder Examples.
Chapter 12 Trees. Copyright © 2005 Pearson Addison-Wesley. All rights reserved Chapter Objectives Define trees as data structures Define the terms.
Spatial Indexing I Point Access Methods. Spatial Indexing Point Access Methods (PAMs) vs Spatial Access Methods (SAMs) PAM: index only point data Hierarchical.
Spatial Indexing I Point Access Methods. Spatial Indexing Point Access Methods (PAMs) vs Spatial Access Methods (SAMs) PAM: index only point data Hierarchical.
1 Tuesday, July 04, 2006 "Programs expand to fill the memory available to hold them." - Modified Parkinson’s Law.
Self Referential Structure. A structure may not contain a member of its own type. struct check { int item; struct check n; // Invalid };
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
CS 241 Section Week #12 (04/22/10).
Maps A map is an object that maps keys to values Each key can map to at most one value, and a map cannot contain duplicate keys KeyValue Map Examples Dictionaries:
Chapter 61 Chapter 6 Index Structures for Files. Chapter 62 Indexes Indexes are additional auxiliary access structures with typically provide either faster.
Memory Management Ch.8.
IntroductionIntroduction  Definition of B-trees  Properties  Specialization  Examples  2-3 trees  Insertion of B-tree  Remove items from B-tree.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 08 Main Memory (Page table questions)
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Arrays and ArrayLists in Java L. Kedigh. Array Characteristics List of values. A list of values where every member is of the same type. Each member in.
CS212: OPERATING SYSTEM Lecture 6: Virtual-Memory Management 1 Computer Science Department.
1 CMSC 341 Extensible Hashing Chapter 5, Section 6 (pp. 200 – 203)
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Paging Example What is the data corresponding to the logical address below:
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
CE Operating Systems Lecture 14 Memory management.
1 Jeff Edmonds York University COSC 2011 Lecture 2 Abstract Positions/Pointers Positions in an Array Pointers in C References in Java Implementing Positions.
Computing & Information Sciences Kansas State University Wednesday, 22 Oct 2008CIS 560: Database System Concepts Lecture 22 of 42 Wednesday, 22 October.
1.1 CS220 Database Systems Indexing: Hashing Slides courtesy G. Kollios Boston University via UC Berkeley.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Hardware.
Paging Paging is a memory-management scheme that permits the physical-address space of a process to be noncontiguous. Paging avoids the considerable problem.
CS 3204 Operating Systems Godmar Back Lecture 16.
BINARY TREES A BINARY TREE t IS EITHER EMPTY OR CONSISTS OF AN ITEM, CALLED THE ROOT ITEM, AND TWO DISTINCT BINARY TREES, CALLED THE LEFT SUBTREE AND.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
1 Data Structures and Algorithms Outline This topic will describe: –The concrete data structures that can be used to store information –The basic forms.
Linked Lists Chapter Introduction To The Linked List ADT Linked list: set of data structures (nodes) that contain references to other data structures.
Copyright © 2012 Pearson Education, Inc. Chapter 17: Linked Lists.
Pointers as arrays C++ Programming Technologies. Pointers vs. Arrays Pointers and arrays are strongly related. In fact, pointers and arrays are interchangeable.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Lecture 11: Pointers B Burlingame 13 Apr Announcements Rest of semester  Homework Remaining homework can be done in pairs, turn in one paper with.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Memory Management Virtual Memory.
CS522 Advanced database Systems
Indexing ? Why ? Need to locate the actual records on disk without having to read the entire table into memory.
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
Revised based on textbook author’s notes.
CS222P: Principles of Data Management Notes #6 Index Overview and ISAM Tree Index Instructor: Chen Li.
Paging Lecture November 2018.
Virtual Memory Hardware
Main Memory Session - 16.
Chapter 9: Virtual Memory
Random inserting into a B+ Tree
Database Design and Programming
CSE 544: Lecture 11 Storing Data, Indexes
CSCI 380: Operating Systems William Killian
CMSC 341 Extensible Hashing.
Module IV Memory Organization.
Presentation transcript:

A sample data structure for N-level page tables

Sample Data Structure PageTable – Contains information about the tree Level – A structure describing a specific level of the page table. NextLevel – Array of pointers to the next level. Map – Array which maps from a logical page to a physical frame.

PageTable Contains information about the tree: –LevelCount: Number of levels –BitmaskAry[i]: bit mask for level i –ShiftAry[i]: # of bits to shift level i page bits –EntryCount[i]: # of possible pages for level i

Levels of the page table Each level of the page table is represented by a pair of structures: –Interior levels use Level & *NextLevelPtr –Leaf levels use Level and *MapPtr –Conceptually, Level contains an array of pointers to the next level (Level *) or Map entries C/C++ does not permit variable size structures. We circumnavigate this by using a pointer to a runtime allocated structure. See the course FAQ for allocating arrays at runtime. Useful information to have in Level –Current depth –Pointer to the PageTable structure/object to access information Conceptual organization

Initialization Suppose we wanted to create a 3 level page table with 8 bits per level on a 32 bit address space. We would allocate a PageTable structure and populate it with the following values: –LevelCount = 3 –BitmaskAry = {0xFF000000, 0x00FF0000, 0x0000FF00} –ShiftAry = {24, 16, 8} –EntryCount = {2^8, 2^8, 2^8}

Initialize Data Structure In addition, we would allocate the level 0 information: –Allocate a Level structure Set its depth to 0 Have it point back to the PageTable Allocate an array of 256 pointers to Level structures. –Initialize all to NULL (no level 1 entries) –If this had been a 1 level page table we would have allocated map structures instead of pointers to Levels

3 level example Empty table

Page Insertion

Inserting leaf nodes Next, we insert the level 2 node which is a leaf in a 3 level page table. This time, we allocate Maps instead of pointers to NextLevel. Initialize the pages to invalid. Set the level 2 page to valid and store the frame.

Page Insertion

Another example Next, add a mapping between the page associated with address 0xFE0123C2 and frame 4. Pay attention to the fact that the level 0 page, 0xFE, already exists and note how the new entries are added.

Adding a second page

Page Insertion Pseudo-Code PageInsert(PageTablePtr, Address, Frame) { // C users, you would have to rename the 2 nd PageInsert // function since C cannot distinguish two functions with // the same name and different signatures. PageInsert(RootNodePtr, Address, Frame) } PageInsert(LevelPtr, Address, Frame) { Find index into current page level if leaf node(LevelPtr) { Set appropriate page index to valid and store Frame } else { Create a new Level and set level to current depth + 1 Create an array of Level * or Map entries based upon the number of entries in the new level and initialize to null/invalid as appropriate PageInsert(pointer to new Level, Address, Frame) }