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

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

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

Transcription

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

2 Memory Management: Early Systems Memory is second only to processes in importance (and in intensity) with which its managed by the OS Tanenbaum. 2

3 Memory Management Ideally programmers want memory that is large fast non volatile Memory management done by OS memory manager Special purpose hardware Memory hierarchy small amount of fast, expensive memory cache some medium-speed, medium price main memory Gigabytes of slow, cheap disk storage Translate these speeds to human scale 3

4 Memory Management Memory Management means Being aware of what parts of the memory are in use and which parts are not Allocating memory to processes when they request it and de-allocating memory when a process releases it Moving data from memory to disc, when the physical capacity becomes full, and vice versa. Stopping programs interfering with memory that doesn t belong to them 4

5 Memory Management: Early Systems Types of memory allocation schemes: Single-user systems Fixed partitions Dynamic partitions Relocatable dynamic partitions 5

6 Single-User Contiguous Scheme Program is loaded in its entirety into memory and allocated as much contiguous space in memory as it needs Jobs processed sequentially in single-user systems Requires minimal work by the Memory Manager Register to store the base address Accumulator to keep track of the program size One ie BIOS Embedded System DOS 6

7 Memory Protection in Single-User Contiguous Scheme To properly implement this scheme a boundary register is needed Special purpose H/W must be designed into CPUs the contents of the register can only be modified by special privileged instruction When a process references memory the system checks if its outside its boundary Inside: then service the request Outside: Error message and terminate program Of course the user program must access the OS from time to time to perform I/O for example Does this through system calls The system detects the call and switches to kernel mode or executive mode 0x123 CPU boundary register 0x123 7

8 Single-User Contiguous Scheme (continued) Disadvantages of Single-User Contiguous Scheme: Doesn t support multiprogramming Mono-programming is unacceptable for modern user Modern users will not suffer the delay of swapping programs in/out to the hard disk Not cost effective Multiprogramming makes more effective use of the CPU... When a single process is doing I/O the CPU is inactive 8

9 The secret is multiprogramming can improve the utilization of the CPU But now the problem is : how do we to organize the available memory so all the programs can reside there? 9

10 Memory Management: Early Systems Types of memory allocation schemes: Single-user systems Fixed partitions Dynamic partitions Relocatable dynamic partitions 10

11 Fixed Partitions Main memory is partitioned; one partition/job Partitions can be different sizes The partition sizes remain static unless and until computer system is shut down, reconfigured, and restarted Must remember where each space is in memory Also requires protection of the job s memory space Requires matching job size with partition size Allows multiprogramming 11

12 Fixed Partitions (continued) To allocate memory spaces to jobs, the operating system s Memory Manager must keep some sort of table. A very simple example is shown below: Table 2.1: A simplified fixed partition memory table with the free partition shaded 12

13 Fixed Partitions (continued) Job1 is allocated first space large enough to accommodate it Job 2 is allocated next available space large enough to accommodate it Job 3? No partition big enough to accommodate it even though 70K of free space is available in Partition 1 where Job 1 occupies only 30K of the 100K available but unfortunately Job 1 owns all of this partition. 13

14 Fixed Partitions (continued) Programmers In the earliest multi-programming systems the programmer translated the job using an absolute assemble or compiler This meant that the process had a pre-defined precise location defined for it in memory The process could only run in that space If that partition was occupied (while others were free) then this resulted in inefficiencies. To overcome this problem programmers created (more complex) relocating compilers, assemblers, and loaders. These programs produced a relocatable program that could run in any available (big enough) partition 14

15 Fixed Partitions (continued) Disadvantages: Requires entire program to be stored contiguously Jobs are allocated space on the basis of first available partition of required size Works well only if all of the jobs are of the same size or if the sizes are known ahead of time Arbitrary partition sizes lead to undesired results Too small a partition size results in large jobs having to wait such that their turnaround time is extended Too large a partition size results in memory waste or internal fragmentation 15

16 Memory Management: Early Systems Types of memory allocation schemes: Single-user systems Fixed partitions Dynamic partitions Relocatable dynamic partitions 16

17 Dynamic Partitions Dynamic Partitions: Jobs are given only as much memory as they request when they are loaded Available memory is kept in contiguous blocks Memory waste is comparatively small Disadvantages: At first its great and it fully utilizes memory when the first jobs are loaded Subsequent allocation leads to memory waste or external fragmentation 17

18 Dynamic Partitions (continued) Figure 2.2: Main memory use during dynamic partition allocation 18

19 Dynamic Partitions (continued) 5 K 10 K 35K of memory available but Job 8 still has to wait! 20K Figure 2.2 (continued): Main memory use during dynamic partition allocation 19

20 Where to put the jobs With Dynamic memory allocation we give jobs just enough room Easy for first job What happens when we have lots of jobs all arriving one after the other and all with different requirements We need some sort of allocation algorithm 20

21 Best-Fit and First-Fit Fit Allocation Free partitions are allocated on the following basis: First-fit memory allocation: First partition fitting the requirements Leads to fast allocation of memory space Best-fit memory allocation: Smallest partition fitting the requirements Results in least wasted space Internal fragmentation reduced but not eliminated 21

22 Best-Fit Versus First-Fit Fit Allocation First-fit memory allocation: Advantage: Faster in making allocation Disadvantage: Leads to memory waste Best-fit memory allocation Advantage: Makes the best use of memory space Disadvantage: Slower in making allocation 22

23 First-Fit Fit Allocation Figure 2.3: An example of a first-fit free scheme 23

24 Best-Fit? Figure 2.4: An example of a best-fit free scheme 24

25 A Note: The Memory Manager In the following slides we assume that the Memory Manager keeps two lists, one for free memory (LHS) and one for busy memory blocks (RHS) Assume the two lists are of a fixed size and the elements in the list can contain values or be empty. For simplicity the lists are often merged in the diagrams that follow 25

26 A new Job requires a 200 size block First-Fit Fit Algorithm Free Memory List The various addresses where we can get free space.... Where can we put the Job? Please note that = 4180 ( so the space (1045) up to 5225 must be filled with jobs) After Job is placed in memory the list of addresses where free space is available changes 26

27 Best-Fit Algorithm Algorithm for Best-Fit: Goal: find the smallest memory block into which the job will fit NB: Entire table must be searched before allocation 27

28 A Job requires 200 spaces Best-Fit Algorithm Where will it be placed? 28

29 More Allocation Schemes Hypothetical allocation schemes:. Next-fit: Starts searching from last allocated block, for the next available block when a new job arrives Worst-fit: Allocates the largest free available block to the new job Opposite of best-fit Good way to explore the theory of memory allocation; might not be the best choice for an actual system 29

30 Another way to do it? Alternative search strategy Search the entire input queue looking for the largest job that fits into the partition Do not waste a large partition on a small job but smaller jobs are discriminated against Have at least one small partition or ensure that small jobs only get skipped a certain number of times 30

31 When Jobs finish How do we reclaim space when jobs finish? 31

32 Deallocation Deallocation: Freeing an allocated memory space For fixed-partition system: Straightforward process. When job completes, Memory Manager resets the status of the job s memory block to free Any code for example, binary values with 0 indicating free and 1 indicating busy may be used 32

33 Deallocation (continued) For dynamic-partition system: Algorithm tries to combine free areas of memory whenever possible. This makes it more complex. The system must prepare for three possible cases: Case 1: When the block to be deallocated is adjacent to another free block Case 2: When the block to be deallocated is between two free blocks Case 3: When the block to be deallocated is isolated from other free blocks 33

34 Case 1: Joining Two Free Blocks Join This has to be de-allocated. It buts-up to the next highest free memory location (although not to the free space below it... there is probably another process in the green area). 34

35 Case 1: Joining Two Free Blocks The free memory list must be changed to reflect starting address of the new free block In the example, 7600 this was the address of the first instruction of the job that just released this block Memory block size for the new free space must be changed to show its new size that is, the combined total of the two free partitions In the example, ( ) 35

36 Case 2: Joining Three Free Blocks Now notice that the memory we will free is butted-up to free memory above and below it. We ll end up with three free spaces. These can be joined together. This has to be de-allocated 36

37 Case 2: Joining Three Free Blocks. Deallocated memory space is between two free memory blocks Change list to reflect the starting address of the new free block In the example, 7560 which was the smallest beginning address Sizes of the three free partitions must be combined In the example, ( ) Because location 7600 in our list has been combined the pointer in that list location must be changed to null to indicate that it no longer points to free memory space, hence null. 37

38 Case 3: Deallocating an Isolated Block Space to be deallocated is isolated from other free areas 1. System learns that the memory block to be released is tight between two other busy areas 2. Null entry in the busy list 3. Must search the free memory list for a null entry 4. And point that list element to the new free area

39 Memory Management: Early Systems Types of memory allocation schemes: Single-user systems Fixed partitions Dynamic partitions Relocatable dynamic partitions 39

40 Problems so far The fixed and dynamic memory management systems described so far share some unacceptable fragmentation characteristics that must be resolved We ll likely end up with lots of slivers of un-used memory 40

41 Relocatable Dynamic Partitions Relocatable Dynamic Partitions: Memory Manager relocates programs to gather together all of the empty blocks Compact the empty blocks to make one block of memory large enough to accommodate some or all of the jobs waiting to get in Sometimes called garbage collection Its not easy 41

42 Relocatable Dynamic Partitions (continued) Compaction: Reclaiming fragmented sections of the memory space Every program in memory must be relocated so they are contiguous So every address so must be relocated Every reference to an address within the program must be updated Data must not be harmed 42

43 Relocatable Dynamic Partitions (continued) Figure 2.5: An assembly language program that performs a simple incremental operation 43

44 Relocatable Dynamic Partitions (continued) The assembly language program (RHS) after it has been processed by the assembler appear on LHS. Notice the memory locations are flagged by apostrophe 44

45 Relocatable Dynamic Partitions (continued) Compaction issues: What goes on behind the scenes when relocation and compaction take place? What keeps track of how far each job has moved from its original storage area? What lists have to be updated? 45

46 Relocatable Dynamic Partitions (continued) What lists have to be updated? Free list must show the partition for the new block of free memory Busy list must show the new locations for all of the jobs already in process that were relocated Each job will have a new address except for those that were already at the lowest memory locations 46

47 Relocatable Dynamic Partitions (continued) Special-purpose registers are used for relocation: Bounds register Stores highest location accessible by each program Relocation register Contains the value that must be added to each address referenced in the program so it will be able to access the correct memory addresses after relocation If the program isn t relocated, the value stored in the program s relocation register is zero 47

48 Relocatable Dynamic Partitions (continued) Figure 2.7: Three snapshots of memory before and after compaction 48

49 Relocatable Dynamic Partitions (continued) Figure 2.8: Contents of relocation register and close-up of Job 4 memory area (a) before relocation and (b) after relocation and compaction 49

50 Relocatable Dynamic Partitions (continued) Compacting and relocating optimizes the use of memory and thus improves throughput Options for when and how often it should be done: When a certain percentage of memory is busy When there are jobs waiting to get in After a prescribed amount of time has elapsed Goal: Optimize processing time and memory use while keeping overhead as low as possible 50

51 Summary Four memory management techniques were used in early systems: single-user systems, fixed partitions, dynamic partitions, and relocatable dynamic partitions Memory waste in dynamic partitions is comparatively small as compared to fixed partitions First-fit is faster in making allocation but leads to memory waste Best-fit makes the best use of memory space but slower in making allocation 51

52 Summary (continued) Compacting and relocating optimizes the use of memory and thus improves throughput All techniques require that the entire program must: Be loaded into memory Be stored contiguously Remain in memory until the job is completed Each technique puts severe restrictions on the size of the jobs: can only be as large as the largest partitions in memory 52

53 Objectives of this chapter were You will be able to describe: The basic functionality of the three memory allocation schemes presented in this chapter: fixed partitions, dynamic partitions, relocatable dynamic partitions Best-fit memory allocation as well as first-fit memory allocation schemes How a memory list keeps track of available memory The importance of deallocation of memory in a dynamic partition system 53

54 Objectives (continued) You should be able to describe: The importance of the bounds register in memory allocation schemes The role of compaction and how it improves memory allocation efficiency 54

Memory Management, Early Systems

Memory Management, Early Systems Memory Management, Early Systems Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions Deallocation Relocatable Dynamic Partitions Conclusion Single User Configurations Fixed Partitions Dynamic

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

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

Section I Section Real Time Systems. Processes. 1.7 Memory Management. (Textbook: A. S. Tanenbaum Modern OS - ch. 3) Memory Management Introduction 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

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

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

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

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

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

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

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

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

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

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

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

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

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 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

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

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. 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

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

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

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

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

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

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

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

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

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

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

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

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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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. Overview

Memory Management. Overview Memory Management 1 Overview Basic memory management Address Spaces Virtual memory Page replacement algorithms Design issues for paging systems Implementation issues Segmentation 2 1 Memory Management

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

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

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

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

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

System Software Prof. Dr. H. Mössenböck

System Software Prof. Dr. H. Mössenböck System Software Prof. Dr. H. Mössenböck 1. Memory Management 2. Garbage Collection 3. Linkers and Loaders 4. Debuggers 5. Text Editors Marks obtained by end-term exam http://ssw.jku.at/misc/ssw/ 1. Memory

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

CHAPTER 9 Exercises 9.1 Answer: 9.2 Ready Running Blocked Answer: 9.3

CHAPTER 9 Exercises 9.1 Answer: 9.2 Ready Running Blocked Answer: 9.3 CHAPTER 9 Virtual memory can be a very interesting subject since it has so many different aspects: page faults, managing the backing store, page replacement, frame allocation, thrashing, page size. The

More information

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

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation Dynamic Storage Allocation CS 44 Operating Systems Fall 5 Presented By Vibha Prasad Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need

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

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No. # 02 Lecture No. # 05 Run-time Environments-Part 3 and Local Optimizations

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

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

Virtual Memory (Ch.10)

Virtual Memory (Ch.10) Virtual Memory (Ch.10)! Background! Demand Paging! Page Faults! Page Replacement! Page Replacement Algorithms! Thrashing! Strategies for Thrashing Prevention Silberschatz / OS Concepts / 6e - Chapter 10

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

Memory Management and Processor Management

Memory Management and Processor Management C H A P T E R 6 Memory Management and Processor Management WHEN YOU FINISH READING THIS CHAPTER YOU SHOULD BE ABLE TO: Distinguish between resident and transient routines. Briefly explain concurrency.

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

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

One of the most difficult aspects of operating system design is memory management.

One of the most difficult aspects of operating system design is memory management. M07_STAL6329_06_SE_C07.QXD 2/21/08 9:30 PM Page 309 PART THREE Memory One of the most difficult aspects of operating system design is memory management. Although the cost of memory has dropped dramatically

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

Operating Systems. Memory Management. Memory management

Operating Systems. Memory Management. Memory management Oerating Systems Memory management Memory Management List of Toics 1. Memory Management 2. Memory In Systems Design 3. Binding Times 4. Introduction to Memory Management 5. Raw Memory Model 6. Single Contiguous

More information

CSE 513 Introduction to Operating Systems. Class 7 - Virtual Memory (2)

CSE 513 Introduction to Operating Systems. Class 7 - Virtual Memory (2) CSE 513 Introduction to Operating Systems Class 7 - Virtual Memory (2) Jonathan Walpole Dept. of Comp. Sci. and Eng. Oregon Health and Science University Key memory management issues Utilization Programmability

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

Memory management. The memory manager. Explicit deallocation. Advanced Compiler Construction Michel Schinz

Memory management. The memory manager. Explicit deallocation. Advanced Compiler Construction Michel Schinz Memory management Memory management Advanced Compiler Construction Michel Schinz 2014 04 10 The memory of a computer is a finite resource. Typical programs use a lot of memory over their lifetime, but

More information

Virtual and Physical Addresses

Virtual and Physical Addresses Virtual and Physical Addresses Physical addresses are provided by the hardware: one physical address space per machine; valid addresses are usually between 0 and some machinespecific maximum; not all addresses

More information

Memory Management CS 447. Prof. R.K. Joshi Dept of CSE IIT Bombay

Memory Management CS 447. Prof. R.K. Joshi Dept of CSE IIT Bombay Memory Management CS 447 Prof. R.K. Joshi Dept of CSE IIT Bombay Some Simple Memory schemes Some Simple Memory schemes Some Simple Memory schemes Overlays: User level memory management (e.g. TurboPascal)

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

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

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

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example The Deadlock Problem Deadlocks A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 tape drives. P 1 and P 2 each

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

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

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

CPU Scheduling. Basic Concepts. Basic Concepts. CPU Scheduler. Histogram of CPU-burst Times CPU. Alternating Sequence of CPU and I/O Bursts

CPU Scheduling. Basic Concepts. Basic Concepts. CPU Scheduler. Histogram of CPU-burst Times CPU. Alternating Sequence of CPU and I/O Bursts Basic Concepts P CPU Scheduling CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Demand Segmentation Operating System Examples 9.2 Background

More information

Last Class: File System Abstraction! Today: File System Implementation!

Last Class: File System Abstraction! Today: File System Implementation! Last Class: File System Abstraction! Lecture 19, page 1 Today: File System Implementation! Disk management Brief review of how disks work. How to organize data on to disks. Lecture 19, page 2 How Disks

More information

Last Class: File System Abstraction. Protection

Last Class: File System Abstraction. Protection Last Class: File System Abstraction Naming Protection Persistence Fast access Lecture 17, page 1 Protection The OS must allow users to control sharing of their files => control access to files Grant or

More information

History of Operating Systems. 1950s. COMPSCI s style. Total Control

History of Operating Systems. 1950s. COMPSCI s style. Total Control History of Operating Systems 1950s Why review the history of OSs? Seeing how OSs developed shows the link between the capabilities of hardware and the design of OSs. It explains why OSs are as they are

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

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

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum Scheduling Yücel Saygın These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum 1 Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods

More information