Memory Management Problem: Records (of various lengths) need to be stored. Model: A big array of space to store them, managed by a memory manager. Like.

Slides:



Advertisements
Similar presentations
Memory Management Chapter FourteenModern Programming Languages, 2nd ed.1.
Advertisements

Chapter 12: File System Implementation
Part IV: Memory Management
Dynamic Memory Management
Chapter 2: Memory Management, Early Systems
Chapter 2: Memory Management, Early Systems
Memory Management, Early Systems
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Memory Management Chapter 7.
KERNEL MEMORY ALLOCATION Unix Internals, Uresh Vahalia Sowmya Ponugoti CMSC 691X.
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to.
Chapter 7 Memory Management
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
File System Implementation
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Dynamic memory allocation and fragmentation Seminar on Network and Operating Systems Group II.
Memory Management Memory Areas and their use Memory Manager Tasks:
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.
Memory Management Chapter 7 B.Ramamurthy. Memory Management Subdividing memory to accommodate multiple processes Memory needs to allocated efficiently.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Memory Management Chapter 5.
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Memory Allocation CS Introduction to Operating Systems.
The memory allocation problem Define the memory allocation problem Memory organization and memory allocation schemes.
Layers of a DBMS Query optimization Execution engine Files and access methods Buffer management Disk space management Query Processor Query execution plan.
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
Dynamic Partition Allocation Allocate memory depending on requirements Partitions adjust depending on memory size Requires relocatable code –Works best.
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
1. Memory Manager 2 Memory Management In an environment that supports dynamic memory allocation, the memory manager must keep a record of the usage of.
March 16 & 21, Csci 2111: Data and File Structures Week 9, Lectures 1 & 2 Indexed Sequential File Access and Prefix B+ Trees.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
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.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
APS105 Lists. Structures Arrays allow a collection of elements –All of the same type How to collect elements of different types? –Structures; in C: struct.
+ Dynamic memory allocation. + Introduction We often face situations in programming where the data is dynamics in nature. Consider a list of customers.
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
Memory Management -Memory allocation -Garbage collection.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Memory Management Overview.
File Systems - Part I CS Introduction to Operating Systems.
CS 241 Discussion Section (12/1/2011). Tradeoffs When do you: – Expand Increase total memory usage – Split Make smaller chunks (avoid internal fragmentation)
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.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
CHAPTER 3-1, 3-2 MEMORY MANAGEMENT. MEMORY HIERARCHY Small amount of expensive, fast, volatile cache Larger amount of still fast, but slower, volatile.
Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID.
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
W4118 Operating Systems Instructor: Junfeng Yang.
Memory Management I: Dynamic Storage Allocation Oct 8, 1998 Topics User-level view Policies Mechanisms class14.ppt Introduction to Computer Systems.
Memory Management One of the most important OS jobs.
Memory Management By: Piyush Agarwal ( ) Akashdeep ( )
Memory Management.
From Monoprogramming to multiprogramming with swapping
Partitioned Memory Allocation
Operating Systems (CS 340 D)
CS Introduction to Operating Systems
Database Implementation Issues
Segmentation Lecture November 2018.
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
So far… Text RO …. printf() RW link printf Linking, loading
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Memory Management (1).
Operating Systems: Internals and Design Principles, 6/E
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Presentation transcript:

Memory Management Problem: Records (of various lengths) need to be stored. Model: A big array of space to store them, managed by a memory manager. Like a coat-check stand, give them your coat, get back a ticket. Later, return the ticket for your coat. We call the ticket a handle.

Memory Manager ADT // Memory Manager abstract class class MemManager { public: // Store a record and return a handle to it virtual MemHandle insert(void* space, int length) =0; // Release the space associated with a record virtual void release(MemHandle h) =0; // Get back a copy of a stored record virtual int get(void* space, MemHandle h) =0; };

Implementation Issues The client doesn’t know what is in the ticket. The memory manager doesn’t know what is in the message. Multiple clients can share a memory manager. The memory manager might interact with a buffer pool: –The client decides what gets stored –The memory manager decides where things get stored –The buffer pool decides when blocks are in main memory

Dynamic Storage Allocation Use a memory manager when: –Access patterns are uncertain –Messages are of varying length Over time, memory contains interspersed free blocks and reserved blocks. –When adding a new message, find a free block large enough –When deleting, merge free blocks

Fragmentation Internal fragmentation: when more space is allocated than the message size. –Might be done to make memory management easier –Example: Sectors and clusters on disk External fragmentation: Free blocks too small to be useful.

Managing the Free Blocks A key issue is how to merge free blocks 1)Use a linked list of free blocks (external to the memory pool) 2)Add tags to the ends of the free and reserved blocks (part of memory pool)

Selecting a Free Block Somehow, need to pick one of the free blocks in which to store the message It must be at least as large as the message (plus whatever info the memory manager needs, such as size and tags) Extra space can be returned as a free block Want to minimize fragmentation, and avoid failing to service requests

Sequential Fit Methods First Fit: Start from beginning, pick first free block that is big enough –Store list in memory-pool order –Circular first fit: Move forward from current position Best Fit: Pick the smallest block big enough –Store by block size, or search list –Protect large blocks for big requests Worst Fit: Pick the biggest block –Store by block size, or search list –Avoid external fragmentation

Failure Policies What do we do if there is no free block that can hold the message? Must resort to a failure policy. Reject the request Grow the memory Compact the memory Garbage collection