Lecture 34 Syed Mansoor Sarwar

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Page Table Implementation
1 CMPT 300 Introduction to Operating Systems Virtual Memory Sample Questions.
Paging Hardware With TLB
4/14/2017 Discussed Earlier segmentation - the process address space is divided into logical pieces called segments. The following are the example of types.
Memory Management (II)
Chapter 3.2 : Virtual Memory
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Memory Management 2 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
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).
Memory Management Ch.8.
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.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 08 Main Memory (Page table questions)
Operating Systems Memory Management.
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.
Memory Management (Ch. 8).  Compilers generate instructions that make memory references.  Code and data must be stored in the memory locations that.
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.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.
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.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Implementation of Page Table Page table is kept in main memory Page-table base.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
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.
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:
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
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.
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.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
COMP 3500 Introduction to Operating Systems Paging: Translation Look-aside Buffers (TLB) Dr. Xiao Qin Auburn University
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
W4118 Operating Systems Instructor: Junfeng Yang.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Memory: Page Table Structure
Memory.
CS 140 Lecture Notes: Virtual Memory
Page Table Implementation
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Lecture 45 Syed Mansoor Sarwar
CS 140 Lecture Notes: Virtual Memory
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Paging Lecture November 2018.
Lecture 44 Syed Mansoor Sarwar
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 39 Syed Mansoor Sarwar
Lecture 32 Syed Mansoor Sarwar
Lecture 29: Virtual Memory-Address Translation
CPSC 457 Operating Systems
CS 140 Lecture Notes: Virtual Memory
Lecture 36 Syed Mansoor Sarwar
Lecture 33 Syed Mansoor Sarwar
Lecture 3: Main Memory.
CSE451 Memory Management Introduction Autumn 2002
Practical Session 9, Memory
Lecture 37 Syed Mansoor Sarwar
Lecture 35 Syed Mansoor Sarwar
Lecture 41 Syed Mansoor Sarwar
Page Table Implementations
CS 140 Lecture Notes: Virtual Memory
Virtual Memory 1 1.
Presentation transcript:

Lecture 34 Syed Mansoor Sarwar Operating Systems Lecture 34 Syed Mansoor Sarwar

© Copyright Virtual University of Pakistan Agenda for Today Review of previous lecture Protection in paging Structure of the page table Multi-level paging Hashed page tables Inverted page table Sharing in paging 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Review of Lecture 33 Addressing and logical to physical address translation Examples: Intel P4 and PDP-11 Page table implementation Performance of paging 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Example Tmem = 100 nsec TTLB = 20 nsec Hit ratio is 98% Teffective = ? Teffective = 0.98 (20 + 100) + 0.02 (20 + 2x100) = 122 nanoseconds 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Protection Memory protection in paging is achieved by associating protection bit with each page table entry Valid/Invalid bit (v)—page in the process address space or not Read, write, and execute bits (r, w, x) 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Protection 29 April 2019 © Copyright Virtual University of Pakistan

Structure of the Page Table Hierarchical / Multilevel Paging Hashed Page Table Inverted Page Table 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging Logical address = 32-bit Page size = 4K bytes (212 bytes) Page table entry = 4 bytes Maximum pages in a process address space = 232 / 4K = 1M 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging Maximum pages in a process address space = 232 / 4K = 1M Page table size = 4M bytes This page cannot fit in one page  Page the page table 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging Page table needed for keeping track of pages of the page table—called the outer page table or page directory No. of pages in the page table is 4M / 4K = 1K Size of the outer page table is 1K * 4 bytes = 4K bytes  outer page will fit in one page 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging 2-level paging 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging Addressing and address translation 32-bit logical address: p1 used to index the outer page table and p2 to index the inner page table page number page offset p1 p2 d 10 10 12 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging p1{ p2{ 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Multilevel Paging 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan DEC VAX Logical address = 32 bits Page size = 512 bytes = 29 bytes Process address space divided into four equal sections Pages per section = 230 / 29 = 221 = 2M Size of a page table entry = 4 bytes 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan DEC VAX Bits needed for page offset = log2 512 = 9 bits Bits to specify a section = log2 4 = 2 bits Bits needed to index page table for a section = log2 221 = 21 bits Size of a page table = 221 * 4 = 8 MB 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan DEC VAX 8 MB page table is paged into 8MB / 512 = 2 K pages Size of the outer page table (2K * 4 = 8 KB) is further paged, resulting in 3-level paging per section section page number page offset p s d 29 April 2019 2 21 © Copyright Virtual University of Pakistan 9

© Copyright Virtual University of Pakistan More Examples 32-bit Sun SPARC supports 3-level paging 32-bit Motorola 68030 supports 4-level paging 64-bit Sun UltraSPARC supports 7-level paging – too many memory references needed for address translation 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Hashed Page Table A common approach to handle address spaces larger then 32 bits Usually open hashing is used Each entry in the linked list has three fields: page number, frame number for the page, and pointer to the next element—(p, f, next) 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Hashed Page Table 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Inverted Page Table One entry per real page in memory Page table size is limited by the number of frames (i.e., the physical memory) and not process address space Each entry in the page table contains (pid, p) 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Inverted Page Table If a page ‘p’ for a process is loaded in frame ‘f’, its entry is stored at index ‘f’ in the page table We effectively index the page table with frame number; hence the name inverted page table Examples: 64-bit UltraSPARC and PowerPC 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Inverted Page Table Frame Number 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Recap of Lecture Structure of the page table Multi-level paging Hashed page tables Inverted page table 29 April 2019 © Copyright Virtual University of Pakistan

© Copyright Virtual University of Pakistan Operating Systems Lecture 34 Syed Mansoor Sarwar 29 April 2019 © Copyright Virtual University of Pakistan