CS5460: Operating Systems

Size: px
Start display at page:

Download "CS5460: Operating Systems"

Transcription

1 CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8)

2 Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics

3 Example Virtual Address Space Typical address space has 4 parts : binary image of program Data: static variables (globals) : explicitly allocated data (malloc) : implicitly allocated data Kernel mapped into all processes MMU hardware: Remaps virtual addresses to physical Supports read-only, supervisor-only Detects accesses to unmapped regions How can we load two processes into memory at same time? Assume each has similar layout 0xFFFFFFFF SP HP Kernel User PC 0x User stack segment User heap User data segment User code segment Kernel heap Kernel data segment Kernel code segment 0x

4 Mapping Addresses How can process (virtual) addresses be mapped to physical addresses? Compile time: Compiler generates physical addresses directly» Advantages: No MMU hardware, no runtime translation overhead» Disadvantages: Inflexible, hard to multiprogram, inefficient use of DRAM Load time: OS loader fixes addresses when it loads program» Advantages: Can support static multiprogramming» Disadvantages: MMU hardware, inflexible, hard to share data, Dynamic: Compiler generates address, but OS/HW reinterpret» Advantages: Very flexible, can use memory efficiently» Disadvantages: MMU hardware req d, runtime translation overhead For real OSes, processes only use virtual addresses Small-sized embedded systems use physical addresses

5 Uniprogramming (e.g., DOS) One process at a time User code compiled to sit in fixed range (e.g., [0,640 KB]) No hardware virtualization of addresses OS in separate addresses E.g., above 640KB Goals: Safety: None (good and bad) Efficiency: Poor (I/O and compute not overlapped, response time) 0xFFFFFFFF 0xA0000 SP HP PC 0x Reserved for DOS kernel (Dynamically allocated) Uninitialized data (BSS segment) Static data (Data segment) (Text segment)

6 Multiprogramming: Static Relocation OS loader relocates programs OS stored in reserved high region Compiler maps process starting at 0 When process started, OS loader:» Allocates contiguous physical memory» Uses relocation info in binary to fix up addresses to relocated region TSRs in DOS based on this technique Problems: Finding/creating contiguous holes Dealing with processes that grow/shrink Goals: Safety: None! à process can destroy other processes Efficiency: Poor à only one segment per process; slow load times; no sharing 0xFFFFFFFF SP 1 HP 1 PC 1 SP 0 HP 0 PC 0 0x Reserved for OS kernel Data Data

7 Idea: Dynamic Relocation Programs all laid out the same Relocate addresses when used Requires hardware support Two views of memory: Virtual: Process s view Physical: Machine s view Many variants Base and bounds Segmentation Paging Segmented paging Virtual Addresses 0xFFFFFFFF SP 0 HP 0 PC 0 0x xFFFFFFFF SP 1 HP 1 PC 1 Data OS kernel Data OS kernel Physical Addresses Data Data OS kernel 0x

8 Base and Bounds Each process mapped to contiguous physical region Two hardware registers Base: Starting physical address Bounds: Size in bytes On each reference: Check against bounds Add base to get physical address Evaluation: Good points: Bad points: OS handled specially Example: Cray-1 Virtual address P 1 VAs P 0 VAs Virtual Physical address 0x x7ffff 0x x7ffff 0x00000 Trap >? + OS kernel Data Data Bounds register Base register Physical 0xFFFFFFFF Bounds 1 Base 1 Bounds 0 Base 0 0x

9 Base and Bounds Each process has private address space No relocation done at load time Operating system handled specially Runs with relocation turned off (i.e., ignores Base and Bounds) Only OS can modify Base and Bounds registers Good points: Very simple hardware Bad points: Only one contiguous segment per process à inhibits sharing External fragmentation à need to find or make holes Hard to grow segments

10 Segmentation Idea: Create N separate segments Each segment has separate base and bounds register Segment number is fixed portion of virtual address Seg# Offset >? Error! (Trap) Base Base Base Bounds Bounds Bounds + Physical address Base Base Bounds Bounds

11 Segmentation Example Virtual address space is 2000 bytes in size 4 segments up to 500 bytes each Starting at 0, 500, 1000, 1500 What if processor accesses VA 0 VA 1040 VA 1900 VA 920 VA 1898 What if we allocate: 100-byte segment 200-byte segment Base Bounds Segment Table Virtual Address Physical Address 2000 Seg3 Seg2 Seg3 Seg Seg1 Seg2 Seg0 Seg1 0

12 Good features: Segmentation Discussion More flexible than base and bounds à enables sharing (How?) Reduces severity of fragmentation (How?) Small hardware table (e.g., 8 segments) à can fit all in processor Problems: Still have fragmentation à How? What kind? Hard to grow segments à Why? Non-contiguous virtual address space à Real problem? Possible solutions: Fragmentation: Copy and compact Growing segments: Copy and compact Paging

13 Paging Problem w/ segmentation à variable-sized segments Solution à Paging! Insist that all chunks be the same size (typically 512-8K bytes) Call them pages rather than segments Allocation is done in terms of full page-aligned pages à no bounds MMU maps virtual page numbers to physical page numbers Virtual Page# Offset Wired concatenate Physical Page# Physical Page# Other Other Physical Page# Offset Physical address Physical Page# Physical Page# Other Other What other info?

14 How does this help? Paging Discussion No external fragmentation! No forced holes in virtual address space Easy translation à everything aligned on power-of-2 addresses Easy for OS to manage/allocate free memory pool What problems are introduced? What if you do not need entire page? Internal fragmentation Page table may be large» Where should we put it? How can we do fast translation if not stored in processor? How big should you make your pages?» Large: Smaller table, demand paging more efficient» Small: Less fragmentation, finer grained sharing, larger page table

15 Paging Examples Page Table Assume 1000-byte pages What if processor accesses: VA 0 VA 1040 VA 2900 VA 920 VA PPN Valid R/O Super 3 Y N Y 8 N N N 5 Y Y N 7 Y N N 1 N Y Y Virtual Address Physical Address VP1 VP3 VP4 VP3 VP2 VP1 VP0 VP2 VP0 VP4 Free List

16 x86 Paging x86 typically uses 4 KB pages Virtual addresses are 32 bits How big is the offset field of a virtual address? How big is the virtual page number field? How many pages are in a virtual address space? How big is a flat page table? Assume PTE (page table entry) is 32 bits

17 Key Idea From Today Address space virtualization Programs see virtual addresses Kernel can see both virtual and physical addresses Virtual and physical address spaces need not be the same size You must understand this to understand modern operating systems Kernel + HW supports the virtual to physical mapping Has to be fast There are different ways to do it Modern OSes use paging

14 Sharing Main Memory Segmentation and Paging

14 Sharing Main Memory Segmentation and Paging 56 14 Sharing Main Memory Segmentation and Paging Readings for this topic: Siberschatz/Galvin Chapter 8 Simple uniprogramming with a single segment per process: Highest memory holds OS. Process is allocated

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Main Memory Main Memory Address Binding Dynamic Loading Dynamic Linking Paging Primary Interest: Study the sequence of memory addresses generated by a process (a running program)

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2016 Lecture 9: Memory Management Geoffrey M. Voelker Memory Management Next few lectures are going to cover memory management Goals of memory management To

More information

Virtual Memory. Copyright : University of Illinois CS 241 Staff 1

Virtual Memory. Copyright : University of Illinois CS 241 Staff 1 Virtual Memory Copyright : University of Illinois CS 241 Staff 1 Address Space Abstraction Program address space All memory data i.e., program code, stack, data segment Hardware interface (physical reality)

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

Virtual and Physical Addresses

Virtual and Physical Addresses Memory Management 1 Virtual and Physical Addresses Physical addresses are provided directly by the machine. one physical address space per machine addresses typically range from to some maximum, though

More information

Memory Management. Mechanisms: Physical and virtual addressing Paging and segmentation Page table management. Policies: Page replacement algorithms

Memory Management. Mechanisms: Physical and virtual addressing Paging and segmentation Page table management. Policies: Page replacement algorithms Memory Management Goals: Provide a convenient programming model Efficiently allocate a scarce resource Protect programs from each other Protect the OS from programs Mechanisms: Physical and virtual addressing

More information

Last Class: Paging. Today: Segmentation

Last Class: Paging. Today: Segmentation Last Class: Paging Process generates virtual addresses from 0 to Max. OS divides the process onto pages; manages a page table for every process; and manages the pages in memory Hardware maps from virtual

More information

COS 318: Operating Systems. Virtual Memory and Address Translation

COS 318: Operating Systems. Virtual Memory and Address Translation COS 318: Operating Systems Virtual Memory and Address Translation Today s Topics Midterm Results Virtual Memory Virtualization Protection Address Translation Base and bound Segmentation Paging Translation

More information

Virtual Memory. Today. Next time. Motivations for VM Address translation Accelerating translation with TLBs. Dynamic memory allocation and memory bugs

Virtual Memory. Today. Next time. Motivations for VM Address translation Accelerating translation with TLBs. Dynamic memory allocation and memory bugs Virtual Memory Today Motivations for VM Address translation Accelerating translation with TLBs Next time Dynamic memory allocation and memory bugs Fabián E. Bustamante, Spring 21 A system with physical

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

W4118 Operating Systems. Instructor: Junfeng Yang

W4118 Operating Systems. Instructor: Junfeng Yang W4118 Operating Systems Instructor: Junfeng Yang Outline Dynamic memory allocation Stack Heap Heap allocation strategies Intro to memory management 1 Dynamic memory allocation Static (compile time) allocation

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

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

Why Virtual Memory? Address Translation. Goals of Translation. Translation Overview

Why Virtual Memory? Address Translation. Goals of Translation. Translation Overview Why Virtual Memory? Address Translation Tore Larsen Material developed by: Kai Li, Princeton University Use secondary storage Extend expensive DRAM with reasonable performance Provide Protection Programs

More information

COS 318: Operating Systems. Virtual Memory and Its Address Translations

COS 318: Operating Systems. Virtual Memory and Its Address Translations COS 318: Operating Systems Virtual Memory and Its Address Translations Today s Topics! Virtual Memory " Virtualization " Protection! Address Translation " Base and bound " Segmentation " Paging " Translation

More information

MEMORY MANAGEMENT PART I RONG ZHENG

MEMORY MANAGEMENT PART I RONG ZHENG MEMORY MANAGEMENT PART I RONG ZHENG MULTIPROGRAMMING Physical Reality: Processes/Threads share the same hardware Need to multiplex CPU (CPU Scheduling) Need to multiplex use of Memory (Today) Why worry

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

Last Class: Memory Management. Today: Paging

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

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

Address binding Multiprogramming and CPU utilization Contiguous memory management Noncontiguous memory management

Address binding Multiprogramming and CPU utilization Contiguous memory management Noncontiguous memory management Lecture Overview Memory management Address binding Multiprogramming and CPU utilization Contiguous memory management Noncontiguous memory management Paging Operating Systems - May 31, 2001 Memory Ideally

More information

Topics. Lecture 13: Virtual Memory Management. Memory Management Requirements. Virtual address space

Topics. Lecture 13: Virtual Memory Management. Memory Management Requirements. Virtual address space Lecture 13: Virtual Memory Management CSC 469H1F Fall 2006 Angela Demke Brown Topics Review virtual memory basics Large (64-bit) virtual address spaces Multiple Page Sizes Placement policy and cache effects

More information

Memory Management william stallings, maurizio pizzonia - sistemi operativi

Memory Management william stallings, maurizio pizzonia - sistemi operativi Memory Management 1 summary goals and requirements techniques that do not involve virtual memory 2 memory management tracking used and free memory primitives allocation of a certain amount of memory de-allocation

More information

Memory Management (Main Memory) Mehdi Kargahi School of ECE University of Tehran Spring 2008

Memory Management (Main Memory) Mehdi Kargahi School of ECE University of Tehran Spring 2008 Memory Management (Main Memory) Mehdi Kargahi School of ECE University of Tehran Spring 2008 Hardware Address Protection Hardware Address Protection Base and Limit Registers Address Binding Binding: a

More information

Last Class: Memory Management. Today: Relocation & Paging. Dynamic Relocation. Relocation. Uniprogramming Static Relocation Dynamic Relocation

Last Class: Memory Management. Today: Relocation & Paging. Dynamic Relocation. Relocation. Uniprogramming Static Relocation Dynamic Relocation Last Class: Memory Management Today: Relocation & Paging Uniprogramming Static Relocation Dynamic Relocation Processes typically do not use their entire space in memory all the time. Paging 1. divides

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

memory management Vaibhav Bajpai memory management Vaibhav Bajpai OS 2014 motivation virtualize resources: multiplex CPU multiplex memory (CPU scheduling) (memory management) why manage memory? controlled overlap processes should NOT

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

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

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

Memory Management. Questions? What is an address space? What abstractions should it provide? How does he OS protect processes from one another?

Memory Management. Questions? What is an address space? What abstractions should it provide? How does he OS protect processes from one another? Memory Management Questions? What is an address space? What abstractions should it provide? How does he OS protect processes from one another? Remember what a process is? address space + 1 or more threads

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

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

Virtual Memory. CSCI 2021: Machine Architecture and Organization

Virtual Memory. CSCI 2021: Machine Architecture and Organization Virtual Memory CSCI 2021: Machine Architecture and Organization Antonia Zhai Department Computer Science and Engineering University of Minnesota http://www.cs.umn.edu/~zhai With Slides from Bryant and

More information

Implementing Processes. Review: Threads vs.. Processes

Implementing Processes. Review: Threads vs.. Processes Implementing Processes Review: Threads vs.. Processes 1. The process is a kernel abstraction for an independent executing program. includes at least one thread of control also includes a private address

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

Chapter 8: Main Memory CS370 Operating Systems

Chapter 8: Main Memory CS370 Operating Systems Chapter 8: Main Memory CS370 Operating Systems Objectives: Detailed description of various ways of organizing memory hardware Memory-management techniques, including paging and segmentation Detailed description

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

Chapter 8: Memory Management Strategies. Operating System Concepts 8 th Edition,

Chapter 8: Memory Management Strategies. Operating System Concepts 8 th Edition, Chapter 8: Memory Management Strategies, Silberschatz, Galvin and Gagne 2009 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table

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 M1: Virtual Memory Overview ********************************* Review -- 1 min

Lecture M1: Virtual Memory Overview ********************************* Review -- 1 min Lecture M1: Virtual Memory Overview ********************************* Review -- 1 min Dual mode operation n Implementation basics: supervisor mode, handler address, save/restore state n Three ways to invoke

More information

Lecture 19: Virtual Memory

Lecture 19: Virtual Memory Lecture 19: Virtual Memory Virtual Memory concept, Virtualphysical translation, page table, TLB, Alpha 21264 memory hierarchy Adapted from UC Berkeley CS252 S01 1 Virtual Memory Virtual memory (VM) allows

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

Previous Lecture: Deadlocks. Chapter 9: Memory Management

Previous Lecture: Deadlocks. Chapter 9: Memory Management Previous Lecture: Deadlocks A problem/situation with concurrency for both SW (e.g., Java threads) and HW (e.g., interconnection network in a multiprocessor based system) systems. Different ways to deal

More information

EE108B Lecture 14 Virtual Memory. Christos Kozyrakis Stanford University

EE108B Lecture 14 Virtual Memory. Christos Kozyrakis Stanford University EE108B Lecture 14 Virtual Memory Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee108b 1 Announcements Reminders Lab3 and PA2 (part a) are due on today 2 Review: Hardware Support for

More information

CS3600 SYSTEMS AND NETWORKS

CS3600 SYSTEMS AND NETWORKS CS3600 SYSTEMS AND NETWORKS NORTHEASTERN UNIVERSITY Lecture 12: Memory Management Prof. Alan Mislove (amislove@ccs.neu.edu) Background Program must be brought (from disk) into memory and placed within

More information

Paging Advantages. CS 537 Lecture 8 Paging

Paging Advantages. CS 537 Lecture 8 Paging Paging Advantages CS 57 Lecture 8 Paging Michael Swift Easy to allocate physical memory physical memory is allocated from free list of frames to allocate a frame, just remove it from its free list external

More information

Virtual Memory. CS 351: Systems Programming Michael Saelee

Virtual Memory. CS 351: Systems Programming Michael Saelee Virtual Memory CS 351: Systems Programming Michael Saelee registers cache (SRAM) main memory (DRAM) local hard disk drive (HDD/SSD) remote storage (networked drive / cloud) previously: SRAM

More information

Chapter: Chapter 8. Multiple Choice

Chapter: Chapter 8. Multiple Choice Chapter: Chapter 8 Multiple Choice 1. Absolute code can be generated for. A) compile-time binding B) load-time binding C) execution-time binding D) interrupt binding Feedback: 8.1.2 2. is the method of

More information

Unit 1 - Memory Management -partitioning, paging, segmentation, virtual memory

Unit 1 - Memory Management -partitioning, paging, segmentation, virtual memory Unit 1 - Memory Management -partitioning, paging, segmentation, virtual memory Logical vs. Physical Address Space The concept of a logical address space that is bound to a separate physical address space

More information

Chapter 8: Main Memory. Operating System Concepts 9 th Edition

Chapter 8: Main Memory. Operating System Concepts 9 th Edition Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information

Address spaces and memory management

Address spaces and memory management Address spaces and memory management Review of processes Process = one or more threads in an address space Thread = stream of executing instructions Address space = memory space used by threads Address

More information

UMBC. and data. P1 Code. OS code. P1 Data DRAM. P1 stack. 1 (Feb. 3, 2002) Data bus P1 s state. Control

UMBC. and data. P1 Code. OS code. P1 Data DRAM. P1 stack. 1 (Feb. 3, 2002) Data bus P1 s state. Control Processes and Tasks What comprises the state of a running program (a process or task)? Microprocessor Address bus Control DRAM OS code and data EAX EBX ECX EDX special caches code/data cache EBP ESP EDI

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

Lecture 17: Virtual Memory: Concepts

Lecture 17: Virtual Memory: Concepts CSCI-UA.2-3 Computer Systems Organization Lecture 7: Virtual Memory: Concepts Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark Barrett

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

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/19/2010. CSC 256/456 Fall

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/19/2010. CSC 256/456 Fall Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 24

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 24 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2015 Lecture 24 LAST TIME! Extended virtual memory concept to be a cache of memory stored on disk DRAM becomes L4 cache of data stored on L5 disk! Extend

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013! Chapter 8: Memory Management Background" Swapping " Contiguous Memory Allocation" Segmentation" Paging" Structure of the Page Table" Example:

More information

Virtual Memory and Address Translation

Virtual Memory and Address Translation Virtual Memory and Address Translation Review: the Program and the Process VAS Process text segment is initialized directly from program text section. sections Process data segment(s) are initialized from

More information

Previous Lecture: Deadlocks. Chapter 9: Memory Management. Logical vs. Physical Address Space. Background. Binding of Instructions and Data to Memory

Previous Lecture: Deadlocks. Chapter 9: Memory Management. Logical vs. Physical Address Space. Background. Binding of Instructions and Data to Memory Previous Lecture: Deadlocks Binding of Instructions and Data to Memory A problem/situation with concurrency for both SW (e.g., Java threads) and HW (e.g., interconnection network in a multiprocessor based

More information

EE445M/EE380L.6, Lecture 12 4/27/2015. EE445M/EE360L.6 Embedded and Real-Time Systems/ Real-Time Operating Systems. Lecture 12

EE445M/EE380L.6, Lecture 12 4/27/2015. EE445M/EE360L.6 Embedded and Real-Time Systems/ Real-Time Operating Systems. Lecture 12 , 4/27/2015 EE445M/EE360L.6 Embedded and Real-Time Systems/ Real-Time Operating Systems : Memory Management, Heap, Protection, Virtual Memory, Paging Reference: T. Anderson, M. Dahlin, Operating Systems:

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

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

V Computer Systems Organization II (Honors) (Introductory Operating Systems)

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

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 3 Memory Management: Virtual Memory

Chapter 3 Memory Management: Virtual Memory Chapter 3 Memory Management: Virtual Memory Understanding Operating Systems, Fourth Edition Objectives You will be able to describe: The basic functionality of the memory allocation methods covered in

More information

VIRTUAL MEMORY. Prof. Cristina Silvano Politecnico di Milano

VIRTUAL MEMORY. Prof. Cristina Silvano Politecnico di Milano VIRTUAL MEMORY Prof. Cristina Silvano Politecnico di Milano Overview What s Virtual Memory? 2 3 Memory Management Unit (MMU) Translation Look Aside Buffer (TLB) Virtual Memory The virtual memory is a mechanism

More information

Virtual Memory and Paging. Copyright : University of Illinois CS 241 Staff 1

Virtual Memory and Paging. Copyright : University of Illinois CS 241 Staff 1 Virtual Memory and Paging Copyright : University of Illinois CS 24 Staff Application Perspective ( OS (Reserved for Stack Lots of separate processes Heap Uninitialized vars ( segment (BSS Initialized vars

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

HW 3 due 11/10. Lecture 11: Paging. CSE 120: Principles of Operating Systems Alex C. Snoeren

HW 3 due 11/10. Lecture 11: Paging. CSE 120: Principles of Operating Systems Alex C. Snoeren HW 3 due 11/10 Lecture 11: Paging CSE 120: Principles of Operating Systems Alex C. Snoeren Lecture Overview Today we ll cover more paging mechanisms: Optimizations Managing page tables (space) Efficient

More information

Arvind Krishnamurthy Spring Memory Management. To support multiprogramming, we need Protection. How to implement an address space?

Arvind Krishnamurthy Spring Memory Management. To support multiprogramming, we need Protection. How to implement an address space? Memory Management Arvind Krishnamurthy Spring 2004 Memory Management To support multiprogramming, we need Protection How to implement an address space? Physical memory No protection Limited size Sharing

More information

Jinwoo Kim

Jinwoo Kim 1 Operating Systems: Lecture 10 Main Memory Jinwoo Kim jwkim@jjay.cuny.edu Chapter 8: Main Memory 2 Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example:

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

ECE 4750 Computer Architecture. T16: Address Translation and Protection

ECE 4750 Computer Architecture. T16: Address Translation and Protection ECE 4750 Computer Architecture Topic 16: Translation and Protection Christopher Batten School of Electrical and Computer Engineering Cornell University! http://www.csl.cornell.edu/courses/ece4750! ECE

More information

Chapter 9 ~ 10: Memory Management

Chapter 9 ~ 10: Memory Management Department of Electr rical Eng ineering, Chapter 9 ~ 10: Memory Management 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Feng-Chia Unive ersity Outline Background (address translation) Segmentation

More information

Announcements. CMSC 412 Spring Basic Relocation Hardware. Logical vs. Physical Addresses. Contiguous Allocation. Contiguous Allocation.

Announcements. CMSC 412 Spring Basic Relocation Hardware. Logical vs. Physical Addresses. Contiguous Allocation. Contiguous Allocation. Announcements CMSC 412 Spring 2007 Reading: Chapter 8 (except 8.1.2-8.1.5) Chapter 9 (next time) Memory Management: Paging and Segmentation Logical vs. Physical Addresses Basic Relocation Hardware The

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

Memory Management. Motivation. Carsten Griwodz University of Oslo. (includes slides from A. Tanenbaum and M. van Steen)

Memory Management. Motivation. Carsten Griwodz University of Oslo. (includes slides from A. Tanenbaum and M. van Steen) Memory Management Carsten Griwodz University of Oslo (includes slides from A. Tanenbaum and M. van Steen) Motivation! In project assignments so far! Program code is linked to kernel! Physical addresses

More information

Chapter 8: Main Memory. Chapter 8: Memory Management

Chapter 8: Main Memory. Chapter 8: Memory Management Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 8.2 Silberschatz, Galvin

More information

CSC 539: Operating Systems Structure and Design. Spring 2005

CSC 539: Operating Systems Structure and Design. Spring 2005 CSC 539: Operating Systems Structure and Design Spring 25 Memory management swapping contiguous allocation paging segmentation segmentation with paging 1 Memory management memory management and CPU scheduling

More information

Paging and Segmentation

Paging and Segmentation Recap of the Last Class Paging and Segmentation Running a user program compile? link? load? execute Address binding compile-time, load-time, execution-time CS 256/456 Dept. of Computer Science, University

More information

W4118: segmentation and paging. Instructor: Junfeng Yang

W4118: segmentation and paging. Instructor: Junfeng Yang W4118: segmentation and paging Instructor: Junfeng Yang Outline Memory management goals Segmentation Paging TLB 1 Uni- v.s. multi-programming Simple uniprogramming with a single segment per process Uniprogramming

More information

CS 571 Fall OS Memory Management"

CS 571 Fall OS Memory Management CS 571 Fall 2010 OS Memory Management" 9.1! OS Memory Management" Logical and Physical Address Spaces" Contiguous Allocation" Paging" Segmentation" Virtual Memory Techniques (Next Lecture)" Cache concepts

More information

Multi-Process Systems: Memory (1) The Basic Memory Hierarchy. Contemporary Memory Hierarchy & Dynamic Loading. (Executable) Secondary Primary

Multi-Process Systems: Memory (1) The Basic Memory Hierarchy. Contemporary Memory Hierarchy & Dynamic Loading. (Executable) Secondary Primary Multi- Systems: (1) What we will learn A detailed description of various ways of organizing memory Discuss various memory-management techniques, including paging and segmentation To provide a description

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

Operating Systems & Memory Systems: Address Translation

Operating Systems & Memory Systems: Address Translation Operating Systems & Memory Systems: Address Translation Computer Science 220 ECE 252 Professor Alvin R. Lebeck Fall 2006 Outline Finish Main Memory Address Translation basics 64-bit Address Space Managing

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 8.2 Silberschatz, Galvin

More information

Virtual Memory. Contiguous Allocation. Contiguous Allocation. Dynamic Storage-Allocation Problem. Fragmentation. Logical vs. Physical Address Space

Virtual Memory. Contiguous Allocation. Contiguous Allocation. Dynamic Storage-Allocation Problem. Fragmentation. Logical vs. Physical Address Space Logical vs. Physical Address Space Virtual Memory CSCI Operating Systems Design Department of Computer Science The concept of a logical address space that is bound to a separate physical address space

More information

Chapter 8: Memory Management

Chapter 8: Memory Management Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium Objectives To provide a detailed description of

More information

Virtual Memory. Lecture 13 CDA

Virtual Memory. Lecture 13 CDA Virtual Memory Lecture 13 CDA 3103 07-02-2014 Review Cache design choices: Size of cache: speed v. capacity Block size (i.e., cache aspect ratio) Write Policy (Write through v. write back) Associativity

More information

Chapter 6, The Operating System Machine Level

Chapter 6, The Operating System Machine Level Chapter 6, The Operating System Machine Level 6.1 Virtual Memory 6.2 Virtual I/O Instructions 6.3 Virtual Instructions For Parallel Processing 6.4 Example Operating Systems 6.5 Summary 1 of 30 ECE 3570

More information

Computer Architecture. Memory Hierarchy: Virtual Memory

Computer Architecture. Memory Hierarchy: Virtual Memory Computer Architecture Memory Hierarchy: Virtual Memory Virtual Memory: Definitions Key idea: simulate a larger physical memory than is actually available General approach: Break address space up into pages

More information

Operating Systems Orientation. Copyright : University of Illinois CS 241 Staff 1

Operating Systems Orientation. Copyright : University of Illinois CS 241 Staff 1 Operating Systems Orientation Copyright : University of Illinois CS 241 Staff 1 Objectives Explain the main purpose of operating systems Explain the POSIX standard (UNIX specification) Explain fundamental

More information

Virtual vs Physical Addresses

Virtual vs Physical Addresses Virtual vs Physical Addresses Physical addresses refer to hardware addresses of physical memory. Virtual addresses refer to the virtual store viewed by the process. virtual addresses might be the same

More information

CS 110 Computer Architecture Lecture 23:

CS 110 Computer Architecture Lecture 23: CS 110 Computer Architecture Lecture 23: Virtual Memory Instructor: Sören Schwertfeger http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides based

More information