Memory Management Norman White Stern School of Business.

Slides:



Advertisements
Similar presentations
Chapter 4 Memory Management Basic memory management Swapping
Advertisements

Part IV: Memory Management
Segmentation and Paging Considerations
Memory Design Example. Selecting Memory Chip Selecting SRAM Memory Chip.
Operating System Support Focus on Architecture
Lecture 11: Memory Management
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Multiprocessing Memory Management
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
Memory Management 2010.
Chapter 8 Operating System Support (Continued)
Memory Organization.
Chapter 3.2 : Virtual Memory
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Computer Organization and Architecture
Memory Management Five Requirements for Memory Management to satisfy: –Relocation Users generally don’t know where they will be placed in main memory May.
Virtual Memory I Chapter 8.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Computer Organization and Architecture Operating System Support Chapter 8.
Review of Memory Management, Virtual Memory CS448.
Operating Systems Chapter 8
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Lecture 19: Virtual Memory
Cosc 2150: Computer Organization Chapter 6, Part 2 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.
1 Memory Management Chapter Basic memory management 4.2 Swapping (εναλλαγή) 4.3 Virtual memory (εικονική/ιδεατή μνήμη) 4.4 Page replacement algorithms.
Operating Systems Memory management. Memory Management List of Topics 1. Memory Management 2. Memory In Systems Design 3. Binding Times 4. Introduction.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
IT253: Computer Organization
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
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.
1 Address Translation Memory Allocation –Linked lists –Bit maps Options for managing memory –Base and Bound –Segmentation –Paging Paged page tables Inverted.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
Memory Management Continued Questions answered in this lecture: What is paging? How can segmentation and paging be combined? How can one speed up address.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
Memory Management – Page 1CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Memory Management *** Modified – look for Reading:
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
Memory management The main purpose of a computer system is to execute programs. These programs, together with the data they access, must be in main memory.
Virtual Memory. Cache memory enhances performance by providing faster memory access speed. Virtual memory enhances performance by providing greater memory.
Computer Architecture Chapter (8): Operating System Support
Chapter 2 Memory and process management
Segmentation COMP 755.
CS703 - Advanced Operating Systems
Chapter 9 – Real Memory Organization and Management
William Stallings Computer Organization and Architecture
Day 20 Virtual Memory.
Chapter 8: Main Memory.
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Computer Architecture
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
CS399 New Beginnings Jonathan Walpole.
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
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 9 Memory Management
CS703 - Advanced Operating Systems
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Memory Management Norman White Stern School of Business

Problem How does operating system handle memory Not a huge problem for non- multiprogramming OS like DOS All you need to do is separate OS from Application program Much bigger problem for a multiprogramming system

Address Space Considerations Early computers often had 16 bit or 18 bit address spaces (limited by the pointer to a location in memory) As programs became larger, this was a problem As OS starts to support multiprogramming, memory needs increase Can’t fit all programs into a single address space.

Some solutions to address space limitations “SWAP” programs into memory to run Have more “real” memory than the address space can hold. I.e. 16 bit address implies 2**16 locations (65536) Increase real memory to 256K Use special addressing registers to point to memory to be used by the current program Means the operating system now has to move programs around to compact memory

Simple solution – Fixed Partitions Divide real memory into Fixed Size Chunks (partitions) Run programs in partitions that are large enough for prog to fit. Problems- Much wasted memory Large programs can’t run Very difficult to schedule

Better – relocation and bounds registers Assume MR0 reg points to the “REAL” memory location of location “0” of a an address space and MR1 points to the last location (or the length) OS can now tell hardware to “run in relocation mode” Every address reference now has contents of MR0 added to it Hardware will not allow an address beyond MR1 Memory mgt (OS) responsible for locating programs in memory. PROBLEM – What happens when programs finish?

Compaction As programs finish, memory becomes fragmented OS needs to move things around to free up contiguous chunks of memory. Program size limited by real memory

More flexible – Memory mapping Divide memory into fixed size chunks (pages) Assign a register for each page (memory map register) All instructions references use the mapping registers to figure out where the pages is in real memory Address references to locations viewed as references to a page and a location with the page (in decimal, location 32,357 is viewed as page 32 displacement 357) (1,000 locations per page) Mapping register 32 points to the “real” memory location of page 32.

Memory mapping example As instructions are decoded, each address reference is “mapped”, I.e. the page in the reference is used to indicate which memory map register to use to find where the page is in physical memory. (I.e., 32,567 will be changed to 78,567 if map register 32 contains 78) Advantage- No longer need to move programs around to solve the fragmentation problem, just update mapping registers Problem – registers are expensive, as memory needs grow, memory mapping needs to many registers

Solution – Virtual Memory Memory mapping divided memory into a table Page noReal location … 9921

Segmentation and paging Divide address space into segments and pages Now becomes Segment 3 page 25 displacement 67 Have a set of segment tables and page tables (1 page table for each segment) to describe where the physical memory locations are for pages in an address space A single register (Segment Table Origin Register, STOR) points to the segment table, entries in the segment table point to the page table All address references use the tables to translate addresses.

Segment tables and paging (continued) Seg numberPage table location 0100, ,000 2… 360,000 … 9

Page tables -1 per segment Segment 3 example PagenoLocation 0030, , , ,000

So what happens during address translation Instruction references location Hardware uses STOR to find address of segment table Relative offset in segment table points to page table for segment 3 (60,000) Relative offset 25 points to page location for segment 3, page 25 So, reference is translated to 40067

Ouch! That is really complex Yes, complex and involves lot’s of overhead First, every address reference now generate 2 extra memory references (to segment table and page table) Will run verrrry slowly… Second, lot’s of table maintenance

But look what we can do! Every address space is completely defined by a segment table and page tables Changing an address space is accomplished by pointing STOR to a new segment table. Easy to add on virtual memory!

Virtual Memory Allow programs to run with some of their pages missing. Hardware generates an interrupt if page table entry is missing (add column(s)to page table for missing entry) External page table used to locate page on disk Page paged in, and instruction re-executed

Ok, that’s cool but isn’t it very slow? Need some tricks to make it go fast Add some extra memory logic to help translation (translation look-aside buffer, TLB) TLB is very high speed associative memory that looks up recently referenced segno,pageno combinations and replaces them with their real locations. If the the info is in TLB, segment table and page table not necessary. TLB has a limited number of entries. Only recent references remembered.

So what happens? Instruction references are translated in the processor with minor overhead If TLB is fast and large overhead is minimal (< 1% typically) But OS is much more complex due to interaction between memory management and processor management

Virtual Memory Advantages Can now run programs larger than physical memory (but still limited by address space) Performance is limited by amount of real memory (thrashing if REAL < WORKSET) OS can run in separate address space, better for security File I/O can be combined with virtual memory (connect an address space to a segment and page table). File can be manipulated as if it were in memory Programmers (usually) do not need to know size of real memory.

Conclusion Virtual Memory is now the standard on almost all systems (except cell phones and PDAs)