Section I Section Real Time Systems. Processes. 1.7 Memory Management. (Textbook: A. S. Tanenbaum Modern OS - ch. 3) Memory Management Introduction

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Section I Section Real Time Systems. Processes. 1.7 Memory Management. (Textbook: A. S. Tanenbaum Modern OS - ch. 3) Memory Management Introduction"

Transcription

1 EE206: Software Engineering IV 1.7 Memory Management page 1 of 28 Section I Section Real Time Systems. Processes 1.7 Memory Management (Textbook: A. S. Tanenbaum Modern OS - ch. 3) Memory Management Introduction Memory Overview Memory operations allow the process to store and consequently retrieve information. Process Store Retrieve Memory Memory Manager Memory Manager = Part of an operating system (OS) that manages memory Keeps track of which parts of memory are in use

2 EE206: Software Engineering IV 1.7 Memory Management page 2 of 28 Allocates/reallocates/de-allocates memory to/from processes when needed Swapping between main memory and disk when not enough memory to hold all the processes Need for Memory Manager Programs (and consequently processes) expand to fill all the memory available to them There may be not enough memory resources for other programs (processes) There is a need for an authority to control memory management: Memory manager Main Memory Management Classes Due to lack of sufficient memory to hold all processes in the memory at once some processes are moved back/forth between main memory and disk during execution (more complex; use swapping/paging). Due to lack of memory launching processes is not permitted at some point (simpler).

3 EE206: Software Engineering IV 1.7 Memory Management page 3 of 28 Memory Management Schemes Without Swapping or Paging Mono-programming - No Memory Management One process is in memory at a time Running application has complete control over all of the memory in the machine No separate OS present There is no protection involved, since the application process can write to any memory location Every process must contain device drivers for each I/O device it uses No longer commonly used Memory N-1 Application 0

4 EE206: Software Engineering IV 1.7 Memory Management page 4 of 28 Mono-programming Resident Monitor Usual technique in simple microcomputers OS can be resident in RAM or ROM In the memory there is only a Monitor (or OS) and the User program (or application) The Monitor is generally placed at the top or the bottom of the memory Memory Monitor (OS) User Program Fence Memory Device Drivers in ROM User Program OS in RAM General approach e.g. PC with MS-DOS There is a program in ROM called BIOS (Basic Input Output System) that allows basic I/O

5 EE206: Software Engineering IV 1.7 Memory Management page 5 of 28 Problem: How could be OS protected from corruption? E.g. an application may write into OS region of memory Solution: Hardware can provide a fence (a memory location) to compare all (user) memory accesses against If the value of the user s memory access address is on the OS side of the fence, the hardware generates a trap, preventing access to that memory location This is similar to what happens when a segmentation fault occurs under Windows OS This can slow down the execution speed, as each memory reference must be checked => problem for OS operations that MUST be fast

6 EE206: Software Engineering IV 1.7 Memory Management page 6 of 28 Consequence: Two modes of execution: User mode (application running), a fence comparison is made with every memory access Supervisor mode (OS running), no comparison is done, as the operating system must have access to the entire memory space Further Problem: Fence had to be built into the hardware in order to achieve speed efficiency Fence value was originally constant If OS did not fit: some memory was wasted or part of the O/S was unprotected Solution: Fence value is placed in a register and can be updated to accommodate the size of the OS

7 EE206: Software Engineering IV 1.7 Memory Management page 7 of 28 Multiprogramming: Large memory can improve CPU utilisation! Approximate CPU Utilisation = 1 - p n p = fraction of time a process spends in I/O wait state n = number of processes waiting for I/O (i.e. CPU idle) E.g. Let s assume that: There is 80% average I/O wait there is 1M memory, OS occupies 200k, and each user program occupies 200k. This allows 4 user programs in memory at once: (1M 200K) / 200K = 4 The CPU utilisation (ignoring OS system overhead) is: = = 0.59; approx. 60% Adding another 1 M of memory, we have: = = 0.87; approx. 87% CPU utilization Adding a third M of memory, we have: = = 0.96; approx. 96% CPU utilization

8 EE206: Software Engineering IV 1.7 Memory Management page 8 of 28 Multiprogramming - Fixed Number of Tasks (MFT) Idea: Main memory is divided into a set of n fixed partitions Partition 3 Partition 2 Partition 1 OS Each process can use one of these partitions only A process cannot cross partition boundaries A partition cannot be shared between processes When a process job is done, another appropriately sized) process/job will take its place

9 EE206: Software Engineering IV 1.7 Memory Management page 9 of 28 There could be: Separate input queues for each partition (each partition can be accessed separately) Single input queue Using separate queues Principle: Large jobs would queue for large partitions, whereas small jobs for small partitions Problem: Queues for large partitions may be empty, while queues for smaller partitions may be full Using a single queue Principle: As a partition becomes free, job closest to front of the queue could be loaded into the empty partition and run Problem: This could waste large partitions on small jobs

10 EE206: Software Engineering IV 1.7 Memory Management page 10 of 28 Principle: A different strategy would be to search in the queue for the largest job that fits the empty partition Problem: This discriminates against small jobs Usually the best service is given to small jobs, not the worst Solutions: Have one small partition to run small jobs or Allow a job to be skipped maximum k times Memory Fragmentation Internal Fragmentation: Memory space within a partition is wasted because often smaller jobs are run in larger partitions e.g. Assume that a 200k job is running in a 500 k partition => 300 k memory space is wasted

11 EE206: Software Engineering IV 1.7 Memory Management page 11 of 28 External fragmentation: Enough total space in empty partitions exists to run a process, but this space cannot be used as no single partition can hold the entire process Partitions are wasted due to the way they are divided up These fixed partitions in MFT systems are generally set up (e.g. every day) and not changed thereafter Key Issues: Job-Partition Allocation Very difficult A good selection for a job mix might be a bad selection for another job mix Partition Size Selection Very difficult Involves choosing the partition sizes to match the greatest number of jobs Both internal and external fragmentation should be avoided

12 EE206: Software Engineering IV 1.7 Memory Management page 12 of 28 Idea: Swapping Employed when it is not enough physical memory available to hold simultaneously data from more processes The memory content related to one process is written to a backing store (disk), and memory content related to another process is read in Swapping time is long (it consists of one large write and one large read, the speed of which depends mainly on the disk s performance) Background Swapping: Refers to disk transfers during process execution It does not have to wait for slow disk-memory copy, but the disk must be a DMA device This makes for a much faster switch and better overall execution speed Swapping could be based on fixed partitions, but too much memory is wasted by programs that are smaller than their partitions A different approach is needed

13 EE206: Software Engineering IV 1.7 Memory Management page 13 of 28 Multiprogramming with Variable Partitions Location, size and number of processes in memory may vary dynamically in time Memory Allocation changes as processes come into memory and leave it C C C C C B B B B E A A A D D D OS OS OS OS OS OS OS Originally all the memory is free and is kept in one block OS keeps track of which memory is in use, and which is not in use

14 EE206: Software Engineering IV 1.7 Memory Management page 14 of 28 When a job arrives, the OS searches for a free memory block to put the job into If a big enough block is found, it is allocated to the job. The remainder of that block (if any) is marked as a new, smaller, free block When a job ends, its memory is returned to the system. If the returned memory is next to a free block, the two are joined into one contiguous block Fragmentation Internal Fragmentation: Hardly any internal fragmentation External fragmentation: A significant issue Performance Issues Generally, free blocks are kept in a sort of list. When memory allocation takes place for a job, the list must be searched for a memory chunk that is big enough Improves memory utilisation, but complicates allocation and de-allocation of memory

15 EE206: Software Engineering IV 1.7 Memory Management page 15 of 28 General Dynamic Storage Allocation Problem (GDSAP) Goals: Efficiency of memory allocation/de-allocation and Minimisation of fragmentation. A. Memory Compaction Idea: Technique that combines all empty regions ( holes ) into one large one by moving all processes as far as possible to the end of memory Notes: Not usually done as requires a lot of CPU time. However CPU speeds are increasing much faster than RAM speeds This eliminates the external fragmentation Swapping and compaction can be used together. When the jobs are swapped back in, they can be placed together to leave the largest hole possible

16 EE206: Software Engineering IV 1.7 Memory Management page 16 of 28 Observation 1: In some programming languages, memory allocated to processes can grow (e.g. by dynamically allocating memory in C using malloc() ) If there are holes on either side of the memory allocated to a process, it can grow into them If there are not adjacent holes : - The growing process can be moved to a hole large enough or - One or more processes can be swapped out to make a large enough hole for this process Extra memory can be added during swapping and/or moving if the process is expected to grow Observation 2: Sometimes requests are made for amounts of memory just inferior to the available free space (e.g bytes block and there is a bytes block free) The request can be satisfied, but the overhead to keep track of the wasted spaces is more than if all blocks would be allocated. This principle produces very small internal fragmentation

17 EE206: Software Engineering IV 1.7 Memory Management page 17 of 28 B. Keeping Track of OS Memory Usage: 1. Memory Management with Bit Maps Memory is divided into allocation units (words, KB) The size is a key design issue Corresponding to each allocation unit is a bit in a Bit Map having a value of 0 if free and 1 if occupied E.g.: - Memory with 4 Processes and two holes: A B C D - Corresponding Bit-map Notes: Searching the bit-map for a run of a given length is a slow operation - Not generally used

18 EE206: Software Engineering IV 1.7 Memory Management page 18 of Memory Management with Linked Lists Maintain a linked list of allocated/free memory segments E.g.: - Memory with 4 Processes and two holes: A B C D - Corresponding Linked list (sorted by address): p 0 5 h 5 3 p 8 6 p 14 4 h 18 2 p Legend: h - hole, p - process C. Allocating Memory to a Process: Several algorithms can be used to allocate memory Assumes Memory Manager knows how much memory to allocate

19 EE206: Software Engineering IV 1.7 Memory Management page 19 of 28 First-Fit: Scan list until it finds a hole big enough The hole is broken into two pieces (one for process, one for unused memory) except in the very unlikely case of an exact fit It is a fast algorithm as it searches as little as possible Next-Fit: Minor variation of the above algorithm. Same as First-Fit, except it keeps track of where and when it finds a suitable hole Next time is starts searching from where it has left of Achieves slightly worst performance than first-fit Best-Fit: Searches the list and finds the smallest free hole that is needed This method tries to reduce fragmentation by minimising left over space Slower than first-fit as searches entire list every time Results in more wasted memory than First-Fit as it tends to fill up memory with tiny useless holes

20 EE206: Software Engineering IV 1.7 Memory Management page 20 of 28 Worst-Fit: Takes the largest available hole This method tries to reduce fragmentation by leaving the most usable leftover piece Not as good as First-Fit, Next-Fit or Best-Fit Quick-fit: Keeps separate lists for some of the more common sizes requested Finding an appropriate hole is extremely fast Disadvantage: For all schemes Mostly due to the usual sorting by hole size When process terminates or is swapped out, finding neighbours to see if merge is possible is expensive in terms of CPU time

21 EE206: Software Engineering IV 1.7 Memory Management page 21 of Memory Management with the Buddy System Takes advantage of fact that computers use the binary system in addressing to speed up the merging of adjacent holes Memory Manager keeps a list of free blocks of size 1, 2, 4, 8, bytes up to the size of memory i.e. 1M memory requires 21 lists Initially all memory is free, and 1M list contains a single entry containing a single 1 hole Holes listed only for sizes that are powers of 2 E.g. Memory M Holes Initially 1 Request 70 A Request 35 A B Request 80 A B 64 C Return A 128 B 64 C Request B D C Return B D C Return D 256 C Return C

22 EE206: Software Engineering IV 1.7 Memory Management page 22 of 28 Details: 70K process swapped into an empty 1M memory: 128K requested as smallest power-of-2 block No 128K block available so 1M block split into two 512K blocks (called buddies) Repeat splitting until get 128K block Next 35K swapped in. Round up to power of 2 (64K) No 64K block so split 128K block If we free 128K block (i.e. Process A) goes on free list for 128K blocks Check to see if merging possible. Advantages: Sort blocks by size, but not necessarily at addresses that are multiple of block size Very fast Disadvantages: Inefficient in the use of memory (i.e. internal fragmentation)

23 EE206: Software Engineering IV 1.7 Memory Management page 23 of 28 Idea: Virtual Memory Addresses a different problem: programs too big to fit into the memory The Old Way: Split programs into overlays. As an overlay finishes it calls another one The overlays are kept on disk and are swapped in/out of memory by OS The program has to be split by the programmer The New Way: Virtual memory turned the whole job over to computer OS keeps the parts of any program currently in use in main memory, the rest on the disk Works very well with multiprogramming Most Virtual memory systems use a technique called paging

24 EE206: Software Engineering IV 1.7 Memory Management page 24 of 28 Idea: Paging Allows any available section of memory to be used even if it is not large enough to hold an entire object It makes use of program-generated addresses that are called virtual addresses A virtual address is not placed directly on the memory bus, being first mapped to physical address by the Memory Management Unit (MMU)

25 EE206: Software Engineering IV 1.7 Memory Management page 25 of 28 Principles: Virtual address space is divided into units called pages Corresponding units in physical memory are called page frames or frames Mapping pages into frames requires hardware support The size of the pages is determined by the hardware. The pages and the frames always have the same size 512B to 8K are common sizes. All pages but the last page are of the same size Transfers between memory and disks are in units of a page E.g.: For 4K-large pages, 64K of Virtual address space and 32K of physical memory we have 16 pages and 8 frames

26 EE206: Software Engineering IV 1.7 Memory Management page 26 of 28 Each Virtual address consists of two parts: - A page number (pageno) pageno = offset from top of module/pagesize - A displacement within the page (offset) offset = offset from top of module%pagesize / = div operator % = modulo operator Each process has associated a data structure called page table. Entries in this page table contain the base (starting) address of each page in physical memory. This table is in fact a map showing where each part of the process is loaded in the physical memory The pageno of the Virtual address is used as an index into the process page table In order to get a physical address from a Virtual address: - The page number is used to index the page table. This derives the base address of the frame (the address at which the page is loaded in memory) - The displacement is added to the frame base address to derive the physical address

27 EE206: Software Engineering IV 1.7 Memory Management page 27 of 28 The page (and frame) size is generally a power of two. In this way, div and modulo operators are implemented by simple bit operations This allows the derivation of page number and offset within the page to be computed very efficient in hardware When a job is to be loaded, the number of frames required for the job is computed If enough frames are available, the job is loaded into the free frames, and the page table of this process is updated accordingly Notes: There is no external fragmentation as any free frame can be allocated There is some internal fragmentation. E.g. Assume that frame size (i.e. page size) = 4K. If the job is 17K, 5 frames are needed, one being only partially full. In this way 3K are wasted in the frame that holds the last page of the object

28 EE206: Software Engineering IV 1.7 Memory Management page 28 of 28

Chapter 2 Memory Management: Early Systems. Understanding Operating Systems, Fourth Edition

Chapter 2 Memory Management: Early Systems. Understanding Operating Systems, Fourth Edition Chapter 2 Memory Management: Early Systems Understanding Operating Systems, Fourth Edition Memory Management: Early Systems Memory is second only to processes in importance (and in intensity) with which

More information

Learning Outcomes. Memory Management

Learning Outcomes. Memory Management Learning Outcomes Memory Management Appreciate the need for memory management in operating systems, understand the limits of fixed memory allocation schemes. Understand fragmentation in dynamic memory

More information

Memory Management. Today. Next Time. ! Basic memory management! Swapping! Kernel memory allocation. ! Virtual memory

Memory Management. Today. Next Time. ! Basic memory management! Swapping! Kernel memory allocation. ! Virtual memory Memory Management Today! Basic memory management! Swapping! Kernel memory allocation Next Time! Virtual memory Memory management! Ideal memory for a programmer Large Fast Non volatile Cheap! Nothing like

More information

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 602

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 602 Memory Management Reading: Silberschatz chapter 9 Reading: Stallings chapter 7 1 Outline Background Issues in Memory Management Logical Vs Physical address, MMU Dynamic Loading Memory Partitioning Placement

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Chapter 7 1 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to consume available processor

More information

An Introduction to Memory Management: appendix. Copyright : University of Illinois CS 241 Staff 1

An Introduction to Memory Management: appendix. Copyright : University of Illinois CS 241 Staff 1 An Introduction to Memory Management: appendix Copyright : University of Illinois CS 241 Staff 1 Memory partitioning Nowadays memory management is based on a sophisticated technique known as (paged) virtual

More information

CSE 380 Computer Operating Systems. Instructor: Insup Lee. University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.

CSE 380 Computer Operating Systems. Instructor: Insup Lee. University of Pennsylvania, Fall 2002 Lecture Note: Memory Management. CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management 1 Memory Management q The memory management portion of the Operating System

More information

PROJECT REPORT MEMORY MANAGEMENT DATE :

PROJECT REPORT MEMORY MANAGEMENT DATE : PROJECT REPORT MEMORY MANAGEMENT DATE : GROUP MEMBERS: MEMORY MANAGEMENT PURPOSE: To simulate memory management of a simple system in order to better comprehend the complex memory management system of

More information

Main Memory. Memory. Address binding. Memory spaces. All processes need main memory.

Main Memory. Memory. Address binding. Memory spaces. All processes need main memory. Memory If we define memory as a place where data is stored there are many levels of memory: Processor registers Primary (or main) memory RAM Secondary memory slower and more permanent disks Tertiary memory

More information

Memory Management Basics

Memory Management Basics Memory Management Basics 1 Basic Memory Management Concepts Address spaces Physical address space The address space supported by the hardware Starting at address, going to address MAX sys Logical/virtual

More information

Announcement. HW#3 will be posted today. Exercise # 4 will be posted on Piazza today.

Announcement. HW#3 will be posted today. Exercise # 4 will be posted on Piazza today. Announcement HW#3 will be posted today. Exercise # 4 will be posted on Piazza today. Operating Systems: Internals and Design Principles Chapter 7 Memory Management Seventh Edition William Stallings Modified

More information

3. Memory Management

3. Memory Management Principles of Operating Systems CS 446/646 3. Memory Management René Doursat Department of Computer Science & Engineering University of Nevada, Reno Spring 2006 Principles of Operating Systems CS 446/646

More information

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

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering Memory management basics (1) Requirements (1) Operating Systems Part of E1.9 - Principles of Computers and Software Engineering Lecture 7: Memory Management I Memory management intends to satisfy the following

More information

Memory Management. Main memory Virtual memory

Memory Management. Main memory Virtual memory Memory Management Main memory Virtual memory Main memory Background (1) Processes need to share memory Instruction execution cycle leads to a stream of memory addresses Basic hardware CPU can only access

More information

4 Main Memory Management

4 Main Memory Management 4 Main Memory Management 4.1 Introduction A large part of the OS s responsibility is organising main memory for processes. GOAL pack as many processes into memory as possible so that the processor will

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles Chapter 7 Memory Management Eighth Edition William Stallings Frame Page Segment A fixed-length block of main memory. A fixed-length block of data that

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 7 Memory Management Dave Bremer Otago Polytechnic, N.Z. 2009, Prentice Hall Roadmap Basic requirements of Memory Management

More information

Memory Management. In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes

Memory Management. In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes Memory Management Is the task carried out by the OS and hardware to accommodate multiple processes in main memory If only a few processes can be kept in main memory, then much of the time all processes

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 7 Memory Management Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Memory Management Subdividing

More information

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

Memory Management. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum Memory Management Yücel Saygın These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum 1 Memory Management Ideally programmers want memory that is large fast non volatile

More information

LOGICAL AND PHYSICAL ORGANIZATION MEMORY MANAGEMENT TECHNIQUES (CONT D)

LOGICAL AND PHYSICAL ORGANIZATION MEMORY MANAGEMENT TECHNIQUES (CONT D) MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

More information

Computer Systems Engineering Department, QUEST, Nawabshah OPERATING SYSTEMS

Computer Systems Engineering Department, QUEST, Nawabshah OPERATING SYSTEMS OPERATING SYSTEMS Memory Management Introduction Fixed Partitioning Variable Partitioning Memory Hole/Allocation management Problems Introduction Techniques to manage Main memory efficiently Provides multitasking

More information

Memory Management (Ch.9)

Memory Management (Ch.9) Memory Management (Ch.9)! Background! Address Binding - Linking and Loading! Swapping! Memory Protection! Contiguous Memory Allocation! Paging! Segmentation! Combined Paging and Segmentation Silberschatz

More information

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems. Memory Management. Lecture 9 Michael O Boyle Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Chapter 8: Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation

More information

Chapter 9: Memory Management

Chapter 9: Memory Management Chapter 9: Memory Management Background Logical versus Physical Address Space Overlays versus Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts 9.1 Background

More information

Lectures 21 : Memory Management (ii) Thu 19 Nov 2009

Lectures 21 : Memory Management (ii) Thu 19 Nov 2009 CS211: Programming and Operating Systems Lectures 21 : Memory Management (ii) Thu 19 Nov 2009 CS211 Lectures 21 : Memory Management (ii) 1/23 This afternoon... 1 Recall... Memory management 2 Contiguous

More information

CH 7. MAIN MEMORY. Base and Limit Registers. Memory-Management Unit (MMU) Chapter 7: Memory Management. Background. Logical vs. Physical Address Space

CH 7. MAIN MEMORY. Base and Limit Registers. Memory-Management Unit (MMU) Chapter 7: Memory Management. Background. Logical vs. Physical Address Space Chapter 7: Memory Management CH 7. MAIN MEMORY Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation adapted from textbook slides Background Base and Limit Registers

More information

Goals of Memory Management

Goals of Memory Management Memory Management Goals of Memory Management Allocate available memory efficiently to multiple processes Main functions Allocate memory to processes when needed Keep track of what memory is used and what

More information

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

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging Memory Management Outline Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging 1 Background Memory is a large array of bytes memory and registers are only storage CPU can

More information

Agenda. Memory Management. Binding of Instructions and Data to Memory. Background. CSCI 444/544 Operating Systems Fall 2008

Agenda. Memory Management. Binding of Instructions and Data to Memory. Background. CSCI 444/544 Operating Systems Fall 2008 Agenda Background Memory Management CSCI 444/544 Operating Systems Fall 2008 Address space Static vs Dynamic allocation Contiguous vs non-contiguous allocation Background Program must be brought into memory

More information

What is the Base register and what is the Limit register?

What is the Base register and what is the Limit register? What is the Base register and what is the Limit register? Base register: Specifies the smallest legal physical memory address. Limit register: Specifies the size of the range. A pair of base and limit

More information

Start of Lecture: March 10, Chapter 8: Main Memory

Start of Lecture: March 10, Chapter 8: Main Memory Start of Lecture: March 10, 2014 1 Reminders Assignment 2 is done! Assignment 3 has been released, due last day of classes Exercise 4 is due on March 18 Paul Lu started talking about memory management

More information

Virtual Memory & Memory Management

Virtual Memory & Memory Management CS 571 Operating Systems Virtual Memory & Memory Management Angelos Stavrou, George Mason University Memory Management 2 Logical and Physical Address Spaces Contiguous Allocation Paging Segmentation Virtual

More information

OS - Memory Management

OS - Memory Management OS - Memory Management Memory management is the functionality of an operating system which handles or manages primary memory. Memory management keeps track of each and every memory location either it is

More information

8.1 Background. Base and Limit Registers. Chapter 8: Memory-Management Management Strategies. Objectives

8.1 Background. Base and Limit Registers. Chapter 8: Memory-Management Management Strategies. Objectives Chapter 8: Memory-Management Management Strategies Objectives To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including

More information

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

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen Folie a: Name & Data Processing 2 3: Memory Management Dipl.-Ing. Bogdan Marin Fakultät für Ingenieurwissenschaften Abteilung Elektro-und Informationstechnik -Technische Informatik- Objectives Memory Management

More information

Operating Systems, 6 th ed. Test Bank Chapter 7

Operating Systems, 6 th ed. Test Bank Chapter 7 True / False Questions: Chapter 7 Memory Management 1. T / F In a multiprogramming system, main memory is divided into multiple sections: one for the operating system (resident monitor, kernel) and one

More information

Operating Systems Concepts

Operating Systems Concepts Operating Systems Concepts MODULE 7: MEMORY MANAGEMENT Andrzej Bednarski, Ph.D. student Department of Computer and Information Science Linköping University, Sweden E-mail: andbe@ida.liu.se URL: http://www.ida.liu.se/~andbe

More information

8 Memory Management. 8.1 Requirements. 8 Memory Management Protection Relocation INTRODUCTION TO MEMORY MANAGEMENT OPERATING SYSTEMS

8 Memory Management. 8.1 Requirements. 8 Memory Management Protection Relocation INTRODUCTION TO MEMORY MANAGEMENT OPERATING SYSTEMS OPERATING SYSTEMS INTRODUCTION TO MEMORY MANAGEMENT 1 8 Memory Management In a multiprogramming system, in order to share the processor, a number of processes must be kept in. Memory management is achieved

More information

Chapter 8: Memory Management

Chapter 8: Memory Management Chapter 8: Memory Management Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 8.2 Memory Management Examine basic (not virtual) memory

More information

COSC243 Part 2: Operating Systems

COSC243 Part 2: Operating Systems COSC243 Part 2: Operating Systems Lecture 20: Main Memory Management Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 20 1 / 29 O/S/ course overview Introduction

More information

OPERATING SYSTEM - MEMORY MANAGEMENT

OPERATING SYSTEM - MEMORY MANAGEMENT OPERATING SYSTEM - MEMORY MANAGEMENT http://www.tutorialspoint.com/operating_system/os_memory_management.htm Copyright tutorialspoint.com Memory management is the functionality of an operating system which

More information

Memory Management. Prof. P.C.P. Bhatt. P.C.P Bhat OS/M4/V1/2004 1

Memory Management. Prof. P.C.P. Bhatt. P.C.P Bhat OS/M4/V1/2004 1 Memory Management Prof. P.C.P. Bhatt P.C.P Bhat OS/M4/V1/2004 1 What is a Von-Neumann Architecture? Von Neumann computing requires a program to reside in main memory to run. Motivation The main motivation

More information

Topics. Caches and Virtual Memory. Cache Operations. Cache Operations. Write Policies on Cache Hit. Read and Write Policies.

Topics. Caches and Virtual Memory. Cache Operations. Cache Operations. Write Policies on Cache Hit. Read and Write Policies. Topics Caches and Virtual Memory CS 333 Fall 2006 Cache Operations Placement strategy Replacement strategy Read and write policy Virtual Memory Why? General overview Lots of terminology Cache Operations

More information

Chapter 9: Memory Management. Background

Chapter 9: Memory Management. Background Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 9.1 Background Program must be brought into memory and placed within a process for it

More information

Today. Memory management. Memory Management. Computer Hardware Review

Today. Memory management. Memory Management. Computer Hardware Review Memory management Knut Omang Ifi/Paradial 1 Oct, 2009 (with slides from V. Goebel, C. Griwodz (Ifi/UiO), P. Halvorsen (Ifi/UiO), K. Li (Princeton), A. Tanenbaum (VU Amsterdam), and M. van Steen (VU Amsterdam))

More information

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College April 7, 2015

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College April 7, 2015 CS 31: Intro to Systems Virtual Memory Kevin Webb Swarthmore College April 7, 2015 Reading Quiz Memory Abstraction goal: make every process think it has the same memory layout. MUCH simpler for compiler

More information

Goals of memory management. Today s desktop and server systems. Tools of memory management. A trip down Memory Lane

Goals of memory management. Today s desktop and server systems. Tools of memory management. A trip down Memory Lane Goals of memory management CSE 451: Operating Systems Spring 212 Module 11 Memory Management Allocate memory resources among competing processes, maximizing memory utilization and system throughput Provide

More information

Contiguous Allocation. Contiguous Allocation. Free List. Dynamic Storage-Allocation Problem. Fragmentation

Contiguous Allocation. Contiguous Allocation. Free List. Dynamic Storage-Allocation Problem. Fragmentation Contiguous Allocation Main memory usually into two partitions: Resident operating system, usually held in low memory with interrupt vector. User processes then held in high memory. Memory Management --

More information

Memory Management Duties. Overview of Presentation. (User View: code segments) User View: address space

Memory Management Duties. Overview of Presentation. (User View: code segments) User View: address space Overview of Presentation responsibilities of a memory manager user view of memory management memory management strategies, algorithms fixed partitions, variable partitions algorithms, fragmentation, coalescing

More information

Background. Memory Management. Base and Limit Registers. Binding of Instructions and Data to Memory. Logical vs. Physical Address Space

Background. Memory Management. Base and Limit Registers. Binding of Instructions and Data to Memory. Logical vs. Physical Address Space Background 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 CPU can access directly Register access

More information

Chapter 8: Memory Management!

Chapter 8: Memory Management! The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still

More information

Module 4: Memory Management

Module 4: Memory Management Module 4: Memory Management The von Neumann principle for the design and operation of computers requires that a program has to be primary memory resident to execute. Also, a user requires to revisit his

More information

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) (Review) Memory Management

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) (Review) Memory Management Outline V22.0202-001 Computer Systems Organization II (Honors) (Introductory Operating Systems) Lecture 14 Memory Management March 28, 2005 Announcements Lab 4 due next Monday (April 4 th ) demos on 4

More information

Introduction to Paging

Introduction to Paging Introduction to Paging Readings Silberschatz: 8.2, 8.4 Outline Introduction to Paging Concepts Introduction Previous memory schemes were characterized by Need for compaction External fragmentation Paging

More information

CSC501 Operating Systems Principles. Memory Management

CSC501 Operating Systems Principles. Memory Management CSC501 Operating Systems Principles Memory Management 1 Previous Lectures q Linker & Loader q Today Q Memory Management 2 Layer user filesystem inter-machine net. memory mgr (high) device mgr + drivers

More information

Lecture 4: Memory Management

Lecture 4: Memory Management Lecture 4: Memory Management Background Program must be brought into memory and placed within a process for it to be run Input queue collection of processes on the disk that are waiting to be brought into

More information

Operating Systems Memory Management

Operating Systems Memory Management Operating Systems Memory Management ECE 344 ECE 344 Operating Systems 1 Memory Management Contiguous Memory Allocation Paged Memory Management Virtual Memory ECE 344 Operating Systems 2 Binding of Instructions

More information

ICS Principles of Operating Systems

ICS Principles of Operating Systems ICS 143 - Principles of Operating Systems Operating Systems - Review of content from midterm to final Prof. Ardalan Amiri Sani Prof. Nalini Venkatasubramanian ardalan@uci.edu nalini@ics.uci.edu Deadlocks

More information

CHAPTER 8 Exercises 8.1 Answer: 8.2 Answer: 8.3 Answer:

CHAPTER 8 Exercises 8.1 Answer: 8.2 Answer: 8.3 Answer: CHAPTER 8 Although many systems are demand paged (discussed in Chapter 12), there are still many that are not, and in many cases the simpler memory-management strategies may be better, especially for small

More information

Memory Management. Operating Systems. Monoprogramming without Swapping or Paging. Multiprogramming

Memory Management. Operating Systems. Monoprogramming without Swapping or Paging. Multiprogramming Operating Systems User OS Kernel & Device Drivers Interface Programs Management Management is an important resource that needs to be managed by the OS manager is the component of the OS responsible for

More information

Basic Memory Management

Basic Memory Management 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

More information

Dynamic Memory Management in Hardware

Dynamic Memory Management in Hardware Dynamic Memory Management in Hardware A master thesis presented to the Mälardalens University in fulfilment of the thesis requirement for the degree of Master of Science in Electrical Engineering Västerås,

More information

Lecture 10: Memory Management

Lecture 10: Memory Management Lecture 10: Memory Management CSE 120: Principles of Operating Systems guest starring Amin Vahdat Project 2 Due 11/14 Memory Management Next few lectures are going to cover memory management Goals of memory

More information

Objectives and Functions

Objectives and Functions Objectives and Functions William Stallings Computer Organization and Architecture 6 th Edition Week 10 Operating System Support Convenience Making the computer easier to use Efficiency Allowing better

More information

7. Memory Management

7. Memory Management Lecture Notes for CS347: Operating Systems Mythili Vutukuru, Department of Computer Science and Engineering, IIT Bombay 7. Memory Management 7.1 Basics of Memory Management What does main memory (RAM)

More information

Memory Management and Paging. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han

Memory Management and Paging. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han Announcements PA #2 due Friday March 18 11:55 pm - note extension of a day Read chapters 11 and 12 From last time...

More information

CS5460: Operating Systems

CS5460: Operating Systems CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8) Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics

More information

Last Class: Demand Paged Virtual Memory!

Last Class: Demand Paged Virtual Memory! Last Class: Demand Paged Virtual Memory! Benefits of demand paging: Virtual address space can be larger than physical address space. Processes can run without being fully loaded into memory. Processes

More information

406 memory pool memory allocation handle memory deallocation dynamic storage allocation

406 memory pool memory allocation handle memory deallocation dynamic storage allocation 406 Chap. 12 Lists and Arrays Revisited 12.4 Memory Management Most of the data structure implementations described in this book store and access objects all of the same size, such as integers stored in

More information

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIRST, SECOND, THIRD SEMESTER FINAL EXAMINATION, 2014/2015 SESSION ITC2053/TIS2233 OPERATING SYSTEM DSEWE-F-2-/14, DSEW-E-F-1/14,

More information

Operating Systems Concepts: Chapter 8: Memory Management

Operating Systems Concepts: Chapter 8: Memory Management Operating Systems Concepts: Chapter 8: Memory Management Olav Beckmann Huxley 449 http://www.doc.ic.ac.uk/~ob3 Acknowledgements: There are lots. See end of Chapter 1. Home Page for the course: http://www.doc.ic.ac.uk/~ob3/teaching/operatingsystemsconcepts/

More information

CHAPTER 6 Memory. CMPS375 Class Notes (Chap06) Page 1 / 17 by Kuo-pao Yang

CHAPTER 6 Memory. CMPS375 Class Notes (Chap06) Page 1 / 17 by Kuo-pao Yang CHAPTER 6 Memory 6.1 Memory 313 6.2 Types of Memory 313 6.3 The Memory Hierarchy 315 6.3.1 Locality of Reference 318 6.4 Cache Memory 319 6.4.1 Cache Mapping Schemes 321 6.4.2 Replacement Policies 333

More information

William Stallings Computer Organization and Architecture

William Stallings Computer Organization and Architecture William Stallings Computer Organization and Architecture Chapter 8 Operating System Support Rev. 3.2 (2009-10) by Enrico Nardelli 8-1 Objectives and Functions Convenience Making the computer easier to

More information

Embedded RTOS Memory Management

Embedded RTOS Memory Management CS512 Embedded RTOS Embedded RTOS Memory Management C.-Z. Yang http://syslab.cse.yzu.edu.tw/~czyang Background Program must be brought into memory and placed within a process for it to be run. Binding

More information

Last Class: Memory Management. Recap: Paging

Last Class: Memory Management. Recap: Paging Last Class: Memory Management Static & Dynamic Relocation Fragmentation Paging Lecture 12, page 1 Recap: Paging Processes typically do not use their entire space in memory all the time. Paging 1. divides

More information

Operating Systems Lecture #3: Modern Paradigms of Memory Management

Operating Systems Lecture #3: Modern Paradigms of Memory Management Lecture #3: Modern Paradigms of Memory Management Written by based on the lecture series of Dr. Dayou Li and the book Understanding 4th ed. by I.M.Flynn and A.McIver McHoes (2006) Department of Computer

More information

Up until now we assumed that an entire program/process needed to be in memory to execute

Up until now we assumed that an entire program/process needed to be in memory to execute Lecture Overview Virtual memory Demand paging Page faults Page replacement Frame allocation Thrashing Operating Systems - June 7, 00 Virtual Memory Up until now we assumed that an entire program/process

More information

Virtual Memory. Reading: Silberschatz chapter 10 Reading: Stallings. chapter 8 EEL 358

Virtual Memory. Reading: Silberschatz chapter 10 Reading: Stallings. chapter 8 EEL 358 Virtual Memory Reading: Silberschatz chapter 10 Reading: Stallings chapter 8 1 Outline Introduction Advantages Thrashing Principal of Locality VM based on Paging/Segmentation Combined Paging and Segmentation

More information

Memory Management. memory hierarchy

Memory Management. memory hierarchy Memory Management Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory cache some medium-speed, medium price main memory gigabytes of

More information

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18 PROCESS VIRTUAL MEMORY CS124 Operating Systems Winter 2013-2014, Lecture 18 2 Programs and Memory Programs perform many interactions with memory Accessing variables stored at specific memory locations

More information

Chapter 3 Memory Management: Virtual Memory

Chapter 3 Memory Management: Virtual Memory Understanding Operating Systems, Fifth Edition 3-1 Chapter 3 Memory Management: Virtual Memory At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics

More information

Lesson 6: Memory Management & Virtualization

Lesson 6: Memory Management & Virtualization Lesson 6: Memory Management & Virtualization Contents Dynamic allocation, Memory fragmentation Paging Address translation with paging Paging hardware Page table structures Segmentation Virtual memory background

More information

Memory Management. Memory Areas and their use. Memory Manager Tasks: Free List Implementations. acquire release

Memory Management. Memory Areas and their use. Memory Manager Tasks: Free List Implementations. acquire release Memory Management Memory Areas and their use Memory Manager Tasks: acquire release Free List Implementations Singly Linked List Doubly Linked List Buddy Systems Memory Management Memory areas: In languages

More information

Virtual Memory. COMP375 Computer Architecture and Organization

Virtual Memory. COMP375 Computer Architecture and Organization Virtual Memory COMP375 Computer Architecture and Organization You never know when you're making a memory. Rickie Lee Jones Design Project The project is due 1:00pm (start of class) on Monday, October 19,

More information

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note: Chapter 7 OBJECTIVES Operating Systems Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the concept of virtual memory. Understand the

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Logical vs. physical address space Fragmentation Paging Segmentation Reading: Silberschatz, Ch. 8 Memory Management Observations: Process needs at least CPU and memory to run. CPU context

More information

Chapter 9: Virtual-Memory Management

Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocation Kernel Memory Other

More information

Chapter 3 Memory Management

Chapter 3 Memory Management Chapter 3 Memory Management Basic memory management Swapping Virtual memory Page replacement algorithms Design issues for paging systems Segmentation Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,

More information

Basic Page Replacement

Basic Page Replacement Basic Page Replacement 1. Find the location of the desired page on disk. Find a free frame: - If there is a free frame, use it - If there is no free frame, use a page replacement algorithm to select a

More information

Chapter 9: Virtual-Memory Management

Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocation Kernel Memory Other

More information

Address spaces and address binding compile-time load-time run-time Memory management: mapping virtual address to physical addresses

Address spaces and address binding compile-time load-time run-time Memory management: mapping virtual address to physical addresses Outline Address spaces and address binding compile-time load-time run-time Memory management: mapping virtual address to physical addresses Paging contiguous allocation and fragmentation paging hardware

More information

Windows Server Performance Monitoring

Windows Server Performance Monitoring Spot server problems before they are noticed The system s really slow today! How often have you heard that? Finding the solution isn t so easy. The obvious questions to ask are why is it running slowly

More information

OPERATING SYSTEM - VIRTUAL MEMORY

OPERATING SYSTEM - VIRTUAL MEMORY OPERATING SYSTEM - VIRTUAL MEMORY http://www.tutorialspoint.com/operating_system/os_virtual_memory.htm Copyright tutorialspoint.com A computer can address more memory than the amount physically installed

More information

Paging: Design Issues

Paging: Design Issues Paging: Design Issues 1! 2! Readings Silbershatz et al: 9.5-9.6 3! Outline Frame Allocation Case Studies 4! Thrashing A process causing page faults every few instructions is said to be thrashing If a process

More information

arm DBMS File Organization, Indexes 1. Basics of Hard Disks

arm DBMS File Organization, Indexes 1. Basics of Hard Disks DBMS File Organization, Indexes 1. Basics of Hard Disks All data in a DB is stored on hard disks (HD). In fact, all files and the way they are organised (e.g. the familiar tree of folders and sub-folders

More information

Operating Systems Lecture #2b: Early Paradigms of Memory Management II

Operating Systems Lecture #2b: Early Paradigms of Memory Management II Lecture #2b: Early Paradigms of Memory Management II Written by based on the lecture series of Dr. Dayou Li and the book Understanding 4th ed. by I.M.Flynn and A.McIver McHoes (2006) Department of Computer

More information

Ecient Programming in C

Ecient Programming in C Ecient Programming in C Memory Allocation Comparison and implementation of basic malloc algorithms Marcel Ellermann(6315155) DKRZ - Deutsches Klima Rechenzentrum Contents Ecient Programming in C........................................

More information

SUBJECT CODE /NAME : CS6401 OPERATING SYSTEMS YEAR/SEM: II/04 QUESTION BANK

SUBJECT CODE /NAME : CS6401 OPERATING SYSTEMS YEAR/SEM: II/04 QUESTION BANK SUBJECT CODE /NAME : CS6401 OPERATING SYSTEMS YEAR/SEM: II/04 QUESTION BANK Unit-I OPERATING SYSTEMS OVERVIEW 1. Differentiate between tightly coupled systems and loosely coupled systems. 2. Define OS

More information

Lecture 17: Paging Mechanisms

Lecture 17: Paging Mechanisms Operating Systems (A) (Honor Track) Lecture 17: Paging Mechanisms Tao Wang School of Electronics Engineering and Computer Science http://ceca.pku.edu.cn/wangtao Fall 2013 Acknowledgements: Prof. Xiangqun

More information