ICOM 5007 - Noack Memory management Virtual memory Paging and segmentation Demand paging Memory management hardware.

Slides:



Advertisements
Similar presentations
Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
Advertisements

16.317: Microprocessor System Design I
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Chapter 3.2 : Virtual Memory
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
Computer Organization and Architecture
Memory Management April 28, 2000 Instructor: Gary Kimura.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
CS 241 Section Week #12 (04/22/10).
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Memory Management in Windows and Linux &. Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory.
Operating Systems Chapter 8
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 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
IT253: Computer Organization
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
© 2004, D. J. Foreman 1 Virtual Memory. © 2004, D. J. Foreman 2 Objectives  Avoid copy/restore entire address space  Avoid unusable holes in memory.
Lecture 11 Page 1 CS 111 Online Memory Management: Paging and Virtual Memory CS 111 On-Line MS Program Operating Systems Peter Reiher.
CE Operating Systems Lecture 14 Memory management.
Chapter 4 Memory Management Virtual Memory.
Memory Management Fundamentals Virtual Memory. Outline Introduction Motivation for virtual memory Paging – general concepts –Principle of locality, demand.
CS399 New Beginnings Jonathan Walpole. Virtual Memory (1)
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Virtual Memory 1 1.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Swap Space and Other Memory Management Issues Operating Systems: Internals and Design Principles.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
CS203 – Advanced Computer Architecture Virtual Memory.
The Memory Hierarchy Lecture 31 20/07/2009Lecture 31_CA&O_Engr. Umbreen Sabir.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
MODERN OPERATING SYSTEMS Third Edition ANDREW S
CS 140 Lecture Notes: Virtual Memory
Memory Management Virtual Memory.
ECE232: Hardware Organization and Design
CS161 – Design and Architecture of Computer
Memory Caches & TLB Virtual Memory
Outline Paging Swapping and demand paging Virtual memory.
Virtual Memory © 2004, D. J. Foreman.
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 2018
Virtual Memory Chapter 8.
CSCI206 - Computer Organization & Programming
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Main Memory Background Swapping Contiguous Allocation Paging
CS 140 Lecture Notes: Virtual Memory
Introduction to the Intel x86’s support for “virtual” memory
Translation Lookaside Buffer
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE451 Virtual Memory Paging Autumn 2002
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Paging and Segmentation
CSE 153 Design of Operating Systems Winter 2019
Virtual Memory © 2004, D. J. Foreman.
Review What are the advantages/disadvantages of pages versus segments?
Virtual Memory 1 1.
Presentation transcript:

ICOM Noack Memory management Virtual memory Paging and segmentation Demand paging Memory management hardware

ICOM Noack Virtual memory Reasons No program relocation – just remap memory Security – hardware keeps processes from interfering Efficiency – only needed memory is loaded Addresses Virtual address – what the CPU sees Physical address – to physical memory Page fault interrupt – whenever virtual address doesn’t map into physical address Normal operation First few lookups cause page faults and loading of memory blocks After a short time, repeated accesses in same blocks of memory usually work CPU Address translation Physical memory Virtual address Physical address Page Fault interrupt

ICOM Noack The working set hypothesis Programs live monotonous lives Small loops of code or calling same function – these small blocks of code are used heavily Arrays or structures – program typically works in a few heavily used data areas Stack – activity is at the stack top Common statistics Hit ratio – percent of memory accesses that do not cause page fault interrupts (or cache hit ratio) Amount of memory needed vs block size Hit ratio vs number of blocks allowed and block size Typical tradeoffs Performance - block size – hit ratio – memory required for Various program types Number of processes Amount of physical memory

ICOM Noack Paging and segmentation Ideas are familiar to 8086 programmers Segment Not of fixed size Access attributes – ownership, access rights (RO, RW, kernel/user) Few for any given process Each usually has a purpose Page Fixed size – always a power of 2 – often 4096 bytes Access attributes – ownership, access rights (RO, RW, kernel/user) Status and physical page number for each virtual page number As many as needed CPUSegmentationPaging Physical memory Virtual addressLinear addressPhysical address

ICOM Noack Demand paging Basic idea – don’t load it until you need it Feasible because working set hypothesis is valid Won’t keep working unless some form of page replacement is used to eliminate unused physical pages Normal operation First few lookups cause page faults and loading of memory blocks After a short time, repeated accesses in same blocks of memory usually work Page table formats Direct – virtual  physical Inverse - physical  virtual Multilevel - virtual  page directory  page table  physical

ICOM Noack How paging works Address parts Page number which page Translated by paging hardware or software Offset Length=log 2 (page size) Not translated by paging – page is handled as a unit Translation – direct Virtual address used as index to page table – page table entry says either Physical page number is… Or I am on disk at … Or I am not valid Page numberoffset Address – virtual or physical offset Page number Directory number Address into multilevel page table

ICOM Noack Multilevel paging and lookaside Steps Directory base is in a register Virtual directory number is used to look up page table base Page table is used to look up page table entry This gives physical page number or how to find it on disk Consequences Three memory accesses for each real memory transaction Remedy Transaction lookup buffer in hardware This remembers last few paging lookups This is what hit ratios are about

ICOM Noack Page tables and page table entries Page table entry Physical page number or device/block location on disk Status Valid Modified (also called dirty) Accessed recently Privilege level Page directory entry Base of page table Privilege level Size of page table (if not fixed)

ICOM Noack The page frame table An inverse table for all of physical memory Each page table entry results in a page frame table entry Not changed at context switch (why) Contains accessed and modified bits Used to find pages to swap out or discard Dirty pages are written back Clean ones are discarded Used to allocate clean pages and by pagedaemon

ICOM Noack Memory management hardware

ICOM Noack Memory management in Linux Hardware-independent memory management layer Adapts to 32 and 64-bit address widths Method is three-level page tables Entity64 bit32 bit Page directory10 bits10 bits Page middle10 bits0 bits Page table10 bits10 bits Page size13 bits12 bits Note: not all the 64 bits are used 43 bits already gives a 43 Tbyte space Page middle directory has size 1 for 32-bit architectures This allows same system calls for 32-bit and 64-bit architectures

ICOM Noack Segmentation in Linux Almost doesn’t exist The main segments are all 4 GB, spanning the entire address space Kernel memory is actually in top GB (above 3 GB) User memory is in bottom 3 GB Register assignments are CS – either user or kernel code segment