Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Page Table Implementation
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Main Memory CS Memory Management1. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main.
Chapter 9: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 9: Memory Management Background.
Background A program must be brought into memory and placed within a process for it to be executed. Input queue – collection of processes on the disk that.
Memory Management.
03/10/2004CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 8: Memory Management Dr. Mohamed Hefeeda.
Memory Management Gordon College Stephen Brinton.
Chapter 7: Main Memory CS 170, Fall Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
A. Frank - P. Weisberg Operating Systems Simple/Basic Paging.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
Main Memory. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only.
03/17/2008CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
1 Tuesday, July 04, 2006 "Programs expand to fill the memory available to hold them." - Modified Parkinson’s Law.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Chapter 8: Main Memory.
 Background  Swapping  Contiguous Allocation  Paging  Segmentation  Segmentation with Paging.
Chap 8 Memory Management. Background Program must be brought into memory and placed within a process for it to be run Input queue – collection of processes.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 8: Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 24 Paging.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Background Program must be brought.
Memory Management -1 Background Swapping Memory Management Schemes
Chapter 8 Memory Management Dr. Yingwu Zhu. Outline Background Basic Concepts Memory Allocation.
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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
CS212: OPERATING SYSTEM Lecture 5: Memory Management Strategies 1 Computer Science Department.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
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.
Memory Management 1. Background Programs must be brought (from disk) into memory for them to be run Main memory and registers are only storage CPU can.
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.
CE Operating Systems Lecture 14 Memory management.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Paging Paging is a memory-management scheme that permits the physical-address space of a process to be noncontiguous. Paging avoids the considerable problem.
Chapter 8: Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Page Table Implementation. Readings r Silbershatz et al:
Memory Management. Background Memory consists of a large array of words or bytes, each with its own address. The CPU fetches instructions from memory.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Memory and Addressing It all starts.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 8: Main Memory.
Chapter 2: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts.
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.
1 Chapter 8: Main Memory. 2 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Basic Paging (1) logical address space of a process can be made noncontiguous; process is allocated physical memory whenever the latter is available. Divide.
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 8: Main Memory.
Paging and Segmentation
Operating System Concepts
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
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.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Lecture 3: Main Memory.
So far in memory management…
Chapter 8: Memory Management strategies
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Presentation transcript:

Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Outlines Paging Address Translation Page Table Page Table Structure Shared Pages

Paging Each process is divided into a number of small, fixed-size partitions called pages Physical memory is divided into a large number of small, fixed-size partitions called frames Page size = frame size Usually 512 bytes to 16K bytes ,lately tends to be 4K To run a program of size n pages, need to find n free frames and load program

Page Table Page Table : per process data structure that provides mapping from page to frame Logical address space: continuous Physical address space: fragmented

Page Table: Protection Process may not use the whole page table Unused portions of the page table are protected by valid/invalid bit Try to address these pages will result in a trap with “memory protection violation” Problem: size of page table Solution: Page-Table Length Register (PRLR) indicates size of the page table (discussed later)

Paging: Address Translation Logical address (Address generated by CPU) consists of page number and offset from beginning of the page Physical address consists of frame base address and offset from beginning of the frame Address Translation Architecture:

Page Table: Implementation Page table is kept in main memory. Problem: each page table must fit in one frame /page Page-Table Base Register (PTBR) points to the page table (physical address of the page table) Page-Table Length Register (PRLR) indicates size of the page table (# of current valid pages in the table) Problem: every data/instruction access requires two memory accesses One for the page table and one for the data/instruction Solution: fast-lookup hardware cache called associative memory or Translation Look-aside Buffer (TLB) What happens on context switch? clear TLB (destroying all info they hold)

TLB On page access: page # is first looked in TLB if found (cache hit) can immediately access page if not found (cache miss) have to look up the frame in the page table

Paging: Effective Access Time Associative TLB Lookup =  time unit Assume memory cycle time is 1 microsecond Hit ratio – percentage of times that a page number is found in the TLB Hit ratio =  Effective Access Time (EAT): EAT = (1 + )  + (2 + )(1 – ) = 2 +  – 

Page Table Structure Problem: Solution: Address space of modern computer system is 232 to 264 Each page table must fit in one frame /page However , size of page table is potentially large As a result , page table searching time is potentially large Solution: Hierarchical Paging Hashed Page Tables Inverted Page Tables

Page Table Structure Hierarchical Paging Hashed Page Tables Inverted Page Tables

Hierarchical Page Tables Break up the logical address space into multiple page tables A simple technique is a two-level page table

Hierarchical Page Tables A logical address (on 32-bit machine with 4K page size) is divided into: a page number consisting of 20 bits a page offset consisting of 12 bits Since the page table is paged, the page number is further divided into: a 10-bit page number a 10-bit page offset Thus, a logical address is as follows:

Hierarchical Page Tables

Hashed Page Tables Used with address spaces > 32 bits and < 64 Hashes logical page number. In case of hash collision, page references are linked structure

Inverted Page Table Used with address spaces > 64 bits Only one (global) page table for all processes One entry for each frame Need information about the process that owns that page Search table to find the frame that logical page refers to Use hash table to decrease the searching time

Inverted Page Table

Shared Pages Paging helps code reusing One copy of read-only (reentrant) code shared among processes (i.e., text editors, compilers, window systems) Shared code must appear in same location in the logical address space of all processes

Segmentation with Paging Problems of external fragmentation and lengthy search times can be solved by paging the segments