Multiprocessing Memory Management

Slides:



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

Part IV: Memory Management
Chapter 2: Memory Management, Early Systems
Memory Management, Early Systems
Allocating Memory.
Memory Management Norman White Stern School of Business.
Chapter 7 Memory Management
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Memory Design Example. Selecting Memory Chip Selecting SRAM Memory Chip.
Operating System Support Focus on Architecture
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
CS 104 Introduction to Computer Science and Graphics Problems
Memory Management 2010.
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.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
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.
Overview: Memory Memory Organization: General Issues (Hardware) –Objectives in Memory Design –Memory Types –Memory Hierarchies Memory Management (Software.
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
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.
CS 346 – Chapter 8 Main memory –Addressing –Swapping –Allocation and fragmentation –Paging –Segmentation Commitment –Please finish chapter 8.
Review of Memory Management, Virtual Memory CS448.
Swapping and Contiguous Memory Allocation. Multistep Processing of a User Program User programs go through several steps before being run. Program components.
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.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
1 Memory Management Chapter Basic memory management 4.2 Swapping (εναλλαγή) 4.3 Virtual memory (εικονική/ιδεατή μνήμη) 4.4 Page replacement algorithms.
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.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Computer Systems Week 14: Memory Management Amanda Oddie.
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo 1 Memory management & paging.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
NETW3005 Memory Management. Reading For this lecture, you should have read Chapter 8 (Sections 1-6). NETW3005 (Operating Systems) Lecture 07 – Memory.
Memory Management Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only storage.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Memory.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
Memory Management Damian Gordon.
Memory.
Chapter 2 Memory and process management
Chapter 8: Main Memory.
Chapter 9 – Real Memory Organization and Management
William Stallings Computer Organization and Architecture
CSI 400/500 Operating Systems Spring 2009
Main Memory Management
Operating System Concepts
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Multistep Processing of a User Program
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
So far… Text RO …. printf() RW link printf Linking, loading
Main Memory Background Swapping Contiguous Allocation Paging
Contents Memory types & memory hierarchy Virtual memory (VM)
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Multiprocessing Memory Management Partitioning Relocation Fragmentation Virtual Memory Swapping

Partitioning Every process including OS needs its own part of memory Memory partitioning: One partition per process static (fixed) vs. dynamic partitioning static disadvantage: waste, large programs can’t run Relocation: After assigning a partition to a process you have to adjust all addresses in the program Security: Every process has only access to its own memory Bounds register

Fixed Partition Example

Swapping Example: multiprocessing environment and a round robin scheduling 2 big processes to execute that need partition 3 either only allow one of them in the ready queue or whenever you start the next process you have to liberate partition 3 to make room for the next one “Swapping”: moving of memory content from and to disk as processes switch Can be very expensive

Dynamic Partitioning No fixed size partition Before a process starts running it allocates as much memory as it needs You waste less memory, instead of waiting for partition 3, the second big process can have a combination of 1 and 2. Same problem with swapping as before if the total size of all processes is bigger than total memory Additional Problem: Fragmentation

Round Robin and Swapping

Fragmentation Free A Finishes D starts Free B Finishes E starts Process A Process B Process C Free A Finishes D starts B Finishes E starts C Finishes F starts What about G? Free Process F Free Process E Free G Process D

Fragmentation continued Happens in all forms of memory that you can alter (RAM, disk …) Hard drive solution: instead of looking for a block that is big enough you start saving and if you run into some used part you leave a link to the next B C D B A_1 C A_2 D A_rest

Fragmentation Problem of piecewise storage: slow access More general solution: Rearrange memory content from time to time B C D B C D

Virtual Memory Motivation More flexibility with memory partitioning Independence of Physical memory size and address space physical memory (RAM) can be smaller than the total memory requirement of a process address space is limited (bus size and ISA) than physical memory Address is not a real physical address but has to be translated

VM Example: Less physical memory than needed RAM: 32K with address size is 15 bit Job needs 64 K (“virtual” address size is 16 bit) You could store half in RAM and second half on hard drive You need data from 0010000000000100 Determine: Is this location in RAM or on hard drive? If RAM: find corresponding physical address and read If hard drive: Load other half into RAM (done by OS), find corresponding physical address and read

VM: Technical Solution Instead of taking half’s you make smaller slices called pages Page table keeps track which page is in physical memory and where OS loads and stores pages from disk into physical memory (RAM) if a page miss happens Address translation in Memory Management Unit (MMU) each virtual address gets translated into a physical one

Memory access

Page Table Task: Virtual address is: 0010000000000100 How do you find correct entry in page table? How do you find the correct corresponding address?

Simple Address translation Some address size computation: Virtual address size: 16 Physical address size: 15 Table size: 16 entries address size for table = 4 Page size: 4K How many bit do you need to find something within the page: 12 Number of pages in RAM: 8 You need 3 bit to find page

Example Virtual Address: 0010000000000100 Split address: first 4 bit: 0010 = address in page table last 12 bit: 000000000100 = page offset Look up physical page address in page table at address 0010 (entry 2): 110 Recombine physical page address and page offset to physical address: 110000000000100

More Examples Convert the following virtual addresses given the page table: 01101111 11000100 10010010 Questions: How big is physical memory? How big is a page? How many pages are in physical memory? 00 0 01 1 00 1 10 1 11 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

Solutions 16 entries in page table = 4 bit of virtual address to locate page will be replaces by 2 bit (content of page table) Physical address has 6 bit, size= 26 virtual address was 8 bit of which 4 were for page table: 4 bit remaining for page offset Page size = 16 4 pages in physical memory 01101111=111111 11000100=000100 10010010=100010

Page replacement strategy If process requests an address that is not in physical memory the present bit in page table is 0 OS interrupt: read page that contains that address into physical memory and save one old page to disk Very similar to cache Objective: Keep pages that are likely to be used again Minimize computational overhead Strategies: Least recently used Oldest

What has to be done in case of page replacement? Write old page from physical memory to disk Load new page into physical memory Update page table: Set present bit of old page to 0 Insert physical page address in table at position given by first 4 bits of virtual address

Example of Table Update 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00 0 01 1 00 1 10 1 11 1 00 0 01 0 00 1 10 1 11 1 You request address: 00110111 This results a page miss Assume page 13 (01) is the least used 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

Virtual Memory Summary 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 Can now run programs larger than physical memory Programmers (usually) do not need to know size of real memory.