Tutorial 6 Memory Management

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Chapter 6: Memory Management
11 Memory Management The External View of the Memory Manager Hardware Application Program Application Program File MgrDevice MgrMemory Mgr Process Mgr.
Memory Management. Memory Manager Requirements –Minimize executable memory access time –Maximize executable memory size –Executable memory must be cost-effective.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 11.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter Memory Management.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.
Chapter 9 – Real Memory Organization and Management
Memory Management Chapter 4. Memory hierarchy Programmers want a lot of fast, non- volatile memory But, here is what we have:
Chapter 3.1 : Memory Management
CS 104 Introduction to Computer Science and Graphics Problems
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Memory Management Chapter 5.
MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.
Computer Organization and Architecture
Lecture 9: SHELL PROGRAMMING (continued) Creating shell scripts!
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
1 Chapter 3.1 : Memory Management Storage hierarchy Storage hierarchy Important memory terms Important memory terms Earlier memory allocation schemes Earlier.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
Tutorial 7 Memory Management presented by: Antonio Maiorano Paul Di Marco.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 8: Memory Management Strategies.
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.
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Ch. 4 Memory Mangement Parkinson’s law: “Programs expand to fill the memory available to hold them.”
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
Chapter 4 Storage Management (Memory Management).
Chapter 4 Memory Management.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
Page 1 2P13 Week 5. Page 2 Page 3 Page 4 Page 5.
6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.
Subject: Operating System.
Chapter 4 Memory Management Virtual Memory.
Computer Systems Week 14: Memory Management Amanda Oddie.
Memory Management Operating Systems CS550. Memory Manager Memory manager - manages allocation and de-allocation of main memory Plays significant impact.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Swap Space and Other Memory Management Issues Operating Systems: Internals and Design Principles.
- means "replacement of a block of stored instructions or data with another.“ - a method that allows programs to be larger than the computer's main memory.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 11.
COMP 3500 Introduction to Operating Systems Memory Management: Part 1 Dr. Xiao Qin Auburn University Slides.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
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.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
MEMORY MANAGEMENT. memory management  In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. 
Memory Management.
Chapter 8: Main Memory.
CSI 400/500 Operating Systems Spring 2009
Main Memory Management
Unit 6: Real Memory organization management
So far… Text RO …. printf() RW link printf Linking, loading
Main Memory Background Swapping Contiguous Allocation Paging
Lecture 32 Syed Mansoor Sarwar
Chapter 8: Memory management
Lecture 3: Main Memory.
Operating System Chapter 7. Memory Management
COMP755 Advanced Operating Systems
Page Main Memory.
Presentation transcript:

Tutorial 6 Memory Management Comp346 Winter 2015 Tutorial 6 Memory Management 1 Memory Management

Types of Memory Primary Memory (RAM) Holds data and programs used by a process that is executing. Only type of memory that a CPU deals with. Secondary Memory (i.e., hard disk) Non-volatile memory used to store data when a process is not executing. Memory Management

The Memory Manager (MM) Purpose: to manage the use of primary and secondary memory. Responsible for: Allocating primary memory to processes. Moving processes between primary and secondary memory. Optimizing memory usage. Memory Management

Within a Process Memory Management

Process Memory There are two types of memory that can be used within a process: Stack: used for local variables and for passing parameters to function calls. Heap: used for dynamic memory allocation. Memory Management

Process Memory Layout Allocates more memory than needed at first. Text Segment Allocates more memory than needed at first. Heap grows towards stack for dynamic memory allocation. Stack grows towards heap when automatic variables are created. Data Segment (global and static variables) Heap Storage Stack Segment Environment Variables, etc. Memory Management

Between Processes Memory Management

Memory Allocation When a process is ready to run, it requests memory from the MM. Different strategies can be used to allocate memory: Fixed-partition strategies Variable-partition strategies Memory Management

Fixed-Partition Strategies Memory is divided into fixed-size regions. Size of each region usually is not equal. MM will allocate a region to a process that best fits it. Unused memory within an allocated partition is called internal fragmentation. Memory Management

An Example Operating Partition 1 System Process 1 Partition 2 Internal Fragmentation Process 2 Partition 3 Process 3 Partition 4 Internal Fragmentation Partition 5 Partition 6 Partition 7 Memory Management

Problems … Not suitable for systems in which process memory requirements is not known ahead of time; i.e., timesharing systems. Sometimes, user is idle; other times, memory requirements change! Memory Management

Variable-Partition Strategies MM allocates regions equal to the memory requirements of a process at any given time. As processes die, holes develop in the memory, MM inserts new processes into holes using a best fit strategy. Memory Management

More… Results in External Fragmentation After a while, only small processes will be able to run due to too much external fragmentation. MM must compact the memory to make more space available for larger processes. Memory Management

An Example Operating System Operating System Operating System Process 5 Process 5 Process 1 Process 4 Process 4 Process 2 Process 3 Process 3 Process 3 Initially P2 completes P4 starts P1 completes P5 starts After compacting Memory Management

Memory Management Strategies

MM Strategies Since most OSs offer multiprogramming, we study multiple-partition MM strategies. We want to maximize the number of (active) processes that can be “in memory” at the same time. Makes use of “secondary storage”.

Swapping Comes from the basis that when a process is blocked, it does not need to be in memory. Thus, it is possible to save a process’ entire address space to disk. Implemented on Windows. Blocked = waiting for I/O, semaphore, blocked on resource and anything else you can think of…

Virtual Memory Comes from the basis that all of a process’ address space is not needed at once. Thus, chop up the address space into smaller parts and only load the parts that are needed. These parts need not be contiguous in memory!

Virtual Memory Usage Virtual memory is used in most modern operating systems: Windows NT/XP/ X uses one or more “page files” to swap pages. Linux uses a hard disk partition (“swap partition”) to swap to.

Virtual Memory More details about Virtual Memory will be in the next tutorial. Memory Management