Overview. Operating Systems I. Simple Memory Management. Simple Memory Management. Multiprocessing w/fixed Partitions.

Similar documents
Chapter 9 Memory Management

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

Module 8: Memory Management

Part Three - Memory Management. Chapter 8: Memory-Management Strategies

Module 9: Memory Management. Background. Binding of Instructions and Data to Memory

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

8.1 Background. Part Four - Memory Management. Chapter 8: Memory-Management Management Strategies. Chapter 8: Memory Management

Module 8: Memory Management

Chapter 8: Main Memory

Chapter 9: Memory Management. Background

Chapter 8: Main Memory

CS307: Operating Systems

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2

Chapter 8: Memory Management Strategies

Memory Management. Memory Management

I.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY

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

Chapter 8: Memory Management

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts

Logical versus Physical Address Space

CS307 Operating Systems Main Memory

Memory Management. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Memory Management Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University

CS370 Operating Systems

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

CS 3733 Operating Systems:

Principles of Operating Systems

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Chapter 8 Main Memory

Chapter 8: Memory-Management Strategies

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

Chapter 8: Memory- Management Strategies

Chapter 9 Memory Management

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

Chapter 8: Memory Management

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

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

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

Chapter 8 Memory Management

Chapter 8: Main Memory

The Memory Management Unit. Operating Systems. Autumn CS4023

Chapter 8: Memory Management. Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging

Chapter 8: Memory- Manage g me m nt n S tra r t a e t gie i s

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation

Lecture 8 Memory Management Strategies (chapter 8)

Chapter 8: Main Memory

Background. Contiguous Memory Allocation

Goals of Memory Management

Memory Management. Contents: Memory Management. How to generate code? Background

CS399 New Beginnings. Jonathan Walpole

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium

Main Memory. CISC3595, Spring 2015 X. Zhang Fordham University

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Memory Management. Dr. Yingwu Zhu

SHANDONG UNIVERSITY 1

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

CS420: Operating Systems

Preview. Memory Management

Multilevel Paging. Multilevel Paging Translation. Paging Hardware With TLB 11/13/2014. CS341: Operating System

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

Memory Management. Dr. Yingwu Zhu

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1

12: Memory Management

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure.

Memory Management. Memory Management

Memory management: outline

Memory management: outline

Main Memory (Part I)

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Main Memory Yi Shi Fall 2017 Xi an Jiaotong University

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Memory Management (1) Memory Management

Memory Management william stallings, maurizio pizzonia - sistemi operativi

Memory Management. Memory

Main Memory (Part II)

Memory Management. CSE 2431: Introduction to Operating Systems Reading: , [OSC]

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program!

Memory Management. Memory Management Requirements

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

UNIT-III VIRTUAL MEMORY

CS370 Operating Systems

Introduction to Operating Systems

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University

6.823 Computer System Architecture. Problem Set #3 Spring 2002

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Operating Systems, Fall

Operating Systems, Fall

Memory and multiprogramming

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012.

Paging & Segmentation

Unit-03 Deadlock and Memory Management Unit-03/Lecture-01

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

Basic Memory Management

Requirements, Partitioning, paging, and segmentation

Transcription:

Overview Operating Systems I Management Provie Services processes files Manage Devices processor memory isk Simple Management One process in memory, using it all each program nees I/O rivers until 96 I/O rivers Simple Management Small, protecte, rivers D Mono-programming -- No multiprocessing ROM Device Drivers ROM User Prog User Prog User Prog User Prog Multiprocessing w/fixe Partitions Partion Partion Partion Partion (a) 9k 5k k k Unequal queues Simple! Partion Partion Partion Partion (b) Waste large partition Skip small jobs Aress Bining Compile Time maybe absolute bining (.com) Link Time ynamic vs. static libraries Loa Time relocatable coe Run Time relocatable memory segments overlays paging Source Object Loa Moule Binary Compile Link Loa Run

vs Aresses Compile-Time + Loa Time aresses same Run time aresses ifferent Relocatable Coe Allow logical aresses Protect other processes Aress 6 Relocation Register + MMU User goes from to max Aress 6 goes from R+ to R+max Limit Reg < error no yes Reloc Reg + aress Aresses must be contiguous! Object Moule Information require to loa into memory Heaer Information Machine Coe Initialize Data Symbol Table Relocation Information (see sample) Loaing an Object Resolve references of object moule On Disk Heaer Executable Coe Initialize Data In Executable Coe Initialize Data Uninitialize Data Variable-Size Partitions Iea: want to remove waste memory that is not neee in each partition Definition: Hole - a block of available memory scattere throughout memory New process allocate memory from hole large enough to fit it process 5 8 one Variable-Size Partitions process 5 keeps track of: allocate partitions process 5 process 9 process 9 9 arrv arrv 5 one free partitions (holes) queues! process

Variable-Size Partitions Variable-Size Partitions Given a list of free holes: k k k 5k 5k k k k 5k How o you satisfy a request of sizes? k, k, k 5k Requests: k, k, k First-fit: allocate first hole that is big enough Best-fit: allocate smallest hole that is big enough Worst-fit: allocate largest hole (say, k) Variable-Size Partitions First-fit: might not search the entire list Best-fit: must search the entire list Worst-fit: must search the entire list First-fit an Best-ft better than Worst-fit in terms of spee an storage utilization Request? What if a request for aitional memory? process malloc(k)? Internal Fragmentation Have some empty space for each processes Allocate to A A stack A ata A program Room for growth Internal Fragmentation - allocate memory may be slightly larger than requeste memory an not being use. External Fragmentation External Fragmentation - total memory space exists to satisfy request but it is not contiguous 5k Process 9? process 5k k

Analysis of External Fragmentation Assume: system at equilibrium process in mile if N processes, / time process, / hole ==> / N holes! Fifty-percent Rule Funamental: ajacent holes combine ajacent processes not combine 5k Compaction Shuffle memory contents to place all free memory together in one large block Only if relocation ynamic! Same I/O DMA problem Process 9 process 5k 9k 5k k (a) process (b) process Review What is a relocation register? What is external fragmentation? How to fix? Given fixe partitions. List three ways to hanle a job that requests too much memory. Cost of Compaction Compaction of vs. Swap (Disk) process process 5k process process 9k 5k k Disk much slower! Solution? Want to minimize external fragmentation Large Blocks But internal fagmentation! Traeoff Sacrifice some internal fragmentation for reuce external fragmentation Paging Paging aress space of a process can be noncontiguous; process is allocate memory wherever latter is available Divie memory into fixe-size blocks size is a power of, between 5 an 89 bytes calle Frames Divie logical memory into bocks of same size calle Pages

Paging Aress generate by ivie into: Page number (p) - inex to page table page table contains base aress of each page in memory (frame) Page offset () - offset into page/frame p f page table f memory Page size bytes Page Paging Example size bytes (8 pages) Page Page Page 5 6 Page Page Page Page Page Page Page Page Paging Example Offset Page Frame aress space m page size n page offset m-n Paging Harware page number p m-n page offset note: not losing any bytes! n phsical memory m bytes Paging Example Consier: memory = 8 bytes aress space = 8 frames How many bits in an aress? How many bits for page number? How many bits for page offset? Can a logical aress space have only pages? How big woul the page table be? Page Page Process B Page Page Process A Example page number p page offset m-n= n= 5 6 b= Page A Page B Page A Page B 5

Avantages Paging Traeoffs no external fragmentation (no compaction) relocation (now pages, before were processes) Disavantages internal fragmentation consier: 8 byte pages,,66 byte proc 5 pages + 86 bytes = 96 bytes avg: / page per process small pages! overhea page table / process (context switch + space) lookup (especially if page to isk) Implementation of Page table kept in registers Fast! Only goo when number of frames is small Expensive! Registers Disk Implementation of Page table kept in main memory Base Register (PTBR) Page Page Length PTBR Two memory accesses per ata/inst access. Solution? Associative Registers Page Page logical aress p Associative Registers page frame number number miss associative registers hit f page table f aress -% mem time memory Associative Register Performance Hit Ratio - percentage of times that a page number is foun in associative registers Effective access time = hit ratio x hit time + miss ratio x miss time hit time = reg time + mem time miss time = reg time + mem time * Example: 8% hit ratio, reg time = nanosec, mem time = nanosec.8 * +. * = nanosecons Protection Protection bits with each frame Store in page table Expan to more perms Page Page Page v v v i Protection Bit Page Page Page 6

Large Aress Spaces Typical logical aress spaces: Gbytes => aress bits (-byte aress) Typical page size: Kbytes = bits Page table may have: / = = million entries Each entry bytes => MB per process! Do not want that all in Solution? Page the page table Multilevel paging page number p p Page Multilevel Paging page offset Outer Page Table Multilevel Paging Translation Multilevel Paging Performance page number p p page offset p outer page table p inner page table esire page memory access if miss Effective access time? 9% hit rate.8 * +. * = 6 nanosecons Inverte Page table maps to aresses pi p search pi p i i View Paging lost users view of memory Nee logical memory units that grow an contract ex: stack, share library subroutine main stack Still nee page per process --> backing store accesses longer! (search + swap) Solution? Segmentation! symbol table

Segmentation Segmentation aress: <segment, offset> Segment table - maps two-imensional user efine aress into one-imensional aress base - starting location limit - length of segment Harware support Segment Table Base Register Segment Table Length Register logical aress s limit base < error no yes + aress main stack memory Management Outline Basic Fixe Partitions Variable Partitions Paging Basic Enhance Specific WinNT Linux Virtual Management in WinNT bit aressess ( = GB aress space) Upper GB share by all processes (kernel moe) Lower GB privater per process Page size is KB (, so offset is bits) Multilevel paging ( levels) bits for outer page table (page irectory) bits for inner page table bits for offset Management in WinNT Each page-table entry has bits only neee for aress translation bits left-over Characteristics Access: rea only, rea-write States: vali, zeroe, free Inverte page table points to page table entries list of free frames Management in Linux Page size: Alpha AXP ha 8 Kbyte page Intel x86 has Kbyte page Multilevel paging ( levels) Even though harware support on x86! 8

Management in Linux Buy-heap Buy-blocks are combine to larger block Linke list of free blocks at each size If not small enough, broken own 6 KB 8 KB 8 KB 8 KB KB KB 9