Basic Memory Management

Similar documents
Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

OPERATING SYSTEM - MEMORY MANAGEMENT

OPERATING SYSTEMS MEMORY MANAGEMENT

COS 318: Operating Systems. Virtual Memory and Address Translation

Virtual vs Physical Addresses

Chapter 7 Memory Management

W4118: segmentation and paging. Instructor: Junfeng Yang

Chapter 7 Memory Management

Operating Systems, 6 th ed. Test Bank Chapter 7

Disk Space Management Methods

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

CS5460: Operating Systems

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont.

Two Parts. Filesystem Interface. Filesystem design. Interface the user sees. Implementing the interface

Chapter 11: File System Implementation. Chapter 11: File System Implementation. Objectives. File-System Structure

Chapter 11: File System Implementation. Operating System Concepts with Java 8 th Edition

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Memory Management 1. Memory Management. Multitasking without memory management is like having a party in a closet.

Introduction. General Course Information. Perspectives of the Computer. General Course Information (cont.) Operating Systems 1/12/2005

Introduction. General Course Information. Perspectives of the Computer. General Course Information (cont.)

Board Notes on Virtual Memory

Chapter 11: File System Implementation. Operating System Concepts 8 th Edition

Chapter 12. Paging an Virtual Memory Systems

CHAPTER 17: File Management

File-System Implementation

Virtual Machines. COMP 3361: Operating Systems I Winter

Outline: Operating Systems

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

Treating Memory Management and Filesystems as One Topic

OPERATING SYSTEM - VIRTUAL MEMORY

IOMMU: A Detailed view

Virtual Memory. Virtual Memory. Paging. CSE 380 Computer Operating Systems. Paging (1)

Lecture 17: Virtual Memory II. Goals of virtual memory

The Linux Virtual Filesystem

Far-western University Central Office, Mahendranagar Operating System

CPU Scheduling. CSC 256/456 - Operating Systems Fall TA: Mohammad Hedayati

Operating System Structures

We r e going to play Final (exam) Jeopardy! "Answers:" "Questions:" - 1 -

WHITE PAPER Optimizing Virtual Platform Disk Performance

Memory management. Chapter 4: Memory Management. Memory hierarchy. In an ideal world. Basic memory management. Fixed partitions: multiple programs

Devices and Device Controllers

Topics in Computer System Performance and Reliability: Storage Systems!

CTE214 Operating Systems Syllabus

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Virtualization in Linux KVM + QEMU

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems

Full and Para Virtualization

Computer Science 4302 Operating Systems. Student Learning Outcomes

FAT32 vs. NTFS Jason Capriotti CS384, Section 1 Winter Dr. Barnicki January 28, 2000

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

ProTrack: A Simple Provenance-tracking Filesystem

Operating Systems 4 th Class

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Memory Management CS 217. Two programs can t control all of memory simultaneously

361 Computer Architecture Lecture 14: Cache Memory

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

Segmentation Segmentation: Generalized Base/Bounds

Virtual Machines. Virtualization

How To Write A Page Table

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

Using process address space on the GPU

Memories Are Made of This

Chapter 1 13 Essay Question Review

Virtualization in the ARMv7 Architecture Lecture for the Embedded Systems Course CSD, University of Crete (May 20, 2014)

Addendum Intel Architecture Software Developer s Manual

Why study Operating Systems? CS 372. Why study. Why study. Introduction to Operating Systems

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Chapter 1 8 Essay Question Review

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File

CS161: Operating Systems

Memory Management under Linux: Issues in Linux VM development

Operating System Tutorial

Peter J. Denning, Naval Postgraduate School, Monterey, California

High-Performance Processing of Large Data Sets via Memory Mapping A Case Study in R and C++

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Configuring CoreNet Platform Cache (CPC) as SRAM For Use by Linux Applications

@ )nventor; Radin Qeorge 26 Franklin Piermont New York 10968{US)

MS SQL Performance (Tuning) Best Practices:

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

The Xen of Virtualization

Lecture 25 Symbian OS

OSes. Arvind Seshadri Mark Luk Ning Qu Adrian Perrig SOSP2007. CyLab of CMU. SecVisor: A Tiny Hypervisor to Provide

Oracle9i Release 2 Database Architecture on Windows. An Oracle Technical White Paper April 2003

KVM & Memory Management Updates

Linux flash file systems JFFS2 vs UBIFS

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Virtual Machines Fact Sheet

Operating Systems. Virtual Memory

EZManage V4.0 Release Notes. Document revision 1.08 ( )

How To Understand And Understand An Operating System In C Programming

Transcription:

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Program must be brought into memory and placed within a process for it to be run. Mono-ming running a single user at a time Need for multi-ming utilizing multiple instances of resources (multiple CPUs) overlapping I/O with CPU Memory management task #1: Allocate memory space among user s (keep track of which parts of memory are currently being used and by whom). 2/13/2007 CSC 256/456 - Spring 2007 1 2/13/2007 CSC 256/456 - Spring 2007 2 Running a user Address Binding User s go through several steps before being run. static dynamic source compiler object linker loadable in-memory execution Binding of instructions and data to physical memory addresses can happen at different stages. Compile&link time: If memory location known a priori, absolute code can be generated; Must recompile code if starting location changes. Load time: Must generate relocatable code if memory location is not known at compile time. Execution time: Binding delayed until run time. Compare them on flexibility & protection & overhead static dynamic source compiler object linker loadable in-memory execution 2/13/2007 CSC 256/456 - Spring 2007 3 2/13/2007 CSC 256/456 - Spring 2007 4

Logical vs. Physical Address Space Two different addresses for execution-time addressing binding: Logical address those in the loaded user ; often generated at compile time; will be translated at execution time; also referred to as virtual address. Physical address address seen by the physical memory unit. Memory management task #2: address translation and protection. Contiguous Allocation Contiguous allocation allocate contiguous memory space for each user MMU: address translation and protection Assume that logical address always starts from 0; Relocation register contains starting physical address; Limit register contains range of logical addresses each logical address must be less than the limit register. Address translation from logical addresses and physical addresses pure software translation is too slow (why?) (mostly) done in hardware Memory-mapping unit (MMU): hardware device that maps virtual to physical address; enforces memory protection policies. 2/13/2007 CSC 256/456 - Spring 2007 5 2/13/2007 CSC 256/456 - Spring 2007 6 Contiguous Allocation (Cont.) Memory space allocation Available memory blocks of various size are scattered throughout memory. When a process arrives, it is allocated memory from a free block large enough to accommodate it. Operating system maintains information about: a) allocated partitions b) free partitions (hole) process 8 process 9 process 9 process 10 Space Allocation Strategies How to satisfy a request of size n from a list of free memory blocks (holes). First-fit: Allocate the first hole that is big enough. Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size. Produces the smallest leftover hole. Worst-fit: Allocate the largest hole; max-heap (the data structure) can help here. Compare them on speed & space utilization. 2/13/2007 CSC 256/456 - Spring 2007 7 2/13/2007 CSC 256/456 - Spring 2007 8

Fragmentation External Fragmentation total memory space exists to satisfy a request, but it is not contiguous. Internal Fragmentation allocated memory may be slightly larger than requested memory; this size difference is memory internal to a minimal allocation unit, but not being used. Reduce external fragmentation by compaction Shuffle memory contents to place all free memory together in one large block. Issues: overhead problems with s currently doing I/O Paging (non-contiguous allocation) Physical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter is available. Divide physical memory into fixed-sized blocks called frames (typically 4KB). Divide logical memory into blocks of same size called pages. To run a of size n pages, need to find n free frames and load. Internal fragmentation. 2/13/2007 CSC 256/456 - Spring 2007 9 2/13/2007 CSC 256/456 - Spring 2007 10 Track Free Space Keep track of free space: free block/page chain bitmaps 2GB physical memory, 4KB basic allocation unit size of the bitmap? Discussions on the space overhead the performance of releasing/requesting free memory Paging: Address Translation Scheme A logical address is divided into: Page number (p) used as an index into a page table which contains base address of each page in physical memory. Page offset (d) the offset address with each page/frame. The same for both logical address and physical address. 2/13/2007 CSC 256/456 - Spring 2007 11 2/13/2007 CSC 256/456 - Spring 2007 12

Load A User Program: An Example Implementation of Page Table Before loading After loading Page table is (usually) kept in main memory why not in registers? kernel or user space? Hardware MMU: Page-table base register points to the page table. Page-table length register indicates size of the page table. In this scheme every data/instruction access requires two memory accesses. One for the page table and one for the data/instruction. Solution: A special fast-lookup hardware cache called translation look-aside buffers (TLBs) 2/13/2007 CSC 256/456 - Spring 2007 13 2/13/2007 CSC 256/456 - Spring 2007 14 Paging MMU With TLB Effective Access Time Assume TLB Lookup = 1 ns Memory cycle time is 100 ns Hit ratio (α) percentage of times that a page number is found in the TLB. Effective memory Access Time (EAT) EAT = 101 α + 201 (1 α) 2/13/2007 CSC 256/456 - Spring 2007 15 2/13/2007 CSC 256/456 - Spring 2007 16

Disclaimer Parts of the lecture slides contain original work of Abraham Silberschatz, Peter B. Galvin, Greg Gagne, Andrew S. Tanenbaum, and Gary Nutt. The slides are intended for the sole purpose of instruction of operating systems at the University of Rochester. All copyrighted materials belong to their original owner(s). 2/13/2007 CSC 256/456 - Spring 2007 17