Storage Management - Chap 10 MANAGING A STORAGE HIERARCHY on-chip --> main memory --> 750ps - 8ns 10 - 90 ns. 128kb - 16mb 2gb -1 tb. RATIO 1 10 hard disk.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Virtual Memory Chapter 18 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S. Dandamudi.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
Memory Management Design & Implementation Segmentation Chapter 4.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
CS 104 Introduction to Computer Science and Graphics Problems
Virtual Memory. Names, Virtual Addresses & Physical Addresses Source Program Absolute Module Name Space P i ’s Virtual Address Space P i ’s Virtual Address.
Memory Management.
Memory Management 2010.
Memory Management (continued) CS-3013 C-term Memory Management CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
Lecture 33: Chapter 5 Today’s topic –Cache Replacement Algorithms –Multi-level Caches –Virtual Memories 1.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Operating Systems Chapter 8
Memory Management 3 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
1 Memory Management Chapter Basic memory management 4.2 Swapping (εναλλαγή) 4.3 Virtual memory (εικονική/ιδεατή μνήμη) 4.4 Page replacement algorithms.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Page 110/20/2015 CSE 30341: Operating Systems Principles So far…  Page  Fixed size pages solve page allocation problem (and external fragmentation) 
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
1 Address Translation Memory Allocation –Linked lists –Bit maps Options for managing memory –Base and Bound –Segmentation –Paging Paged page tables Inverted.
CE Operating Systems Lecture 14 Memory management.
Chapter 4 Memory Management Virtual Memory.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Review (1/2) °Caches are NOT mandatory: Processor performs arithmetic Memory stores data Caches simply make data transfers go faster °Each level of memory.
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
CS 241 Section Week #9 (11/05/09). Topics MP6 Overview Memory Management Virtual Memory Page Tables.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Memory Management CS Spring Overview Partitioning, Segmentation, and Paging External versus Internal Fragmentation Logical to Physical Address.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo 1 Memory management & paging.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Memory.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Memory Management Chapter 5 Advanced Operating System.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Instructor: Junfeng Yang
Module 9: Virtual Memory
Chapter 8: Main Memory.
Segmentation Lecture November 2018.
ECE 445 – Computer Organization
5: Virtual Memory Background Demand Paging
Main Memory Background Swapping Contiguous Allocation Paging
Practical Session 8, Memory Management 2
CSE451 Virtual Memory Paging Autumn 2002
Computer Architecture
Lecture 35 Syed Mansoor Sarwar
Paging and Segmentation
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Module 9: Virtual Memory
COMP755 Advanced Operating Systems
Practical Session 9, Memory Management continues
Chapter 8 & 9 Main Memory and Virtual Memory
CSE 542: Operating Systems
Page Main Memory.
Presentation transcript:

Storage Management - Chap 10 MANAGING A STORAGE HIERARCHY on-chip --> main memory --> 750ps - 8ns ns. 128kb - 16mb 2gb -1 tb. RATIO 1 10 hard disk --> cartridge tape system ms. seconds 1gb - 1 tb. infinite RATIO:100,000 10,000,000

Storage Management Algorithms  Fetch -- what object’s storage to bring into memory -- SWAP IN  Placement -- what empty slot to use to satisfy a storage request  Replacement -- what used slot(s) to free to satisfy a storage request -- SWAP OUT

New and Malloc 1. Round the requested size; e.g. to an aligned memory address or minimum block size. Results in internal fragmentation. 2. Search the free space data structure 3. Split the block(s) found, if required Free 1. Coalesce multiple free blocks into one

Fixed-Size Requests 1. Linked list or bit map data structure Varying-Size Requests 1. Bit map data structure  Results in small unusable fragments, external fragmentation  May require de-fragmentation routine 2. Overhead of the data structure is referred to as table fragmentation

Bit Map Example allocate(3) returns allocate(5) returns free(11, 2)

Program Model  Multiple Segments, consisting of at least Code, Data, Stack, Heap

Requirements  It should be possible to control access to an segment. For example, writing over a procedure should be illegal.  It should be possible to validate access to an segment. The arguments to a procedure should always be of the correct type and it should not be possible for a procedure to access segments outside its sphere of influence (principle of least privilege).  The size of a segment can vary dynamically and be arbitrarily large.  Each segment can be shared in a controlled manner among any number of processes.  A segment can dynamically link to other segments by referring to their symbolic names at execution time.

Hardware Placement Options

Hardware Placement Support NONE Static Relocation Onion Skin Algorithm Operating System 0 Program One 100,000 Top of Program Two

Hardware Placement Support One Relocation Register (base/limit) Dynamic Relocation Operating System 0 Program One 100,000 All of Program Two 250,000 PHYSICAL ADDRESSES LOGICAL ADDRESSES Base=0 Limit=99,999 Base=100,000 Limit=249,999 Base=250,000 Limit=299,999

Hardware Placement Support Two Relocation Registers (base/limit) One for Code, One for Data/Stack Operating System 0 DATA STACK V ^ CODE 100,000 All of Program Two 250,000 PHYSICAL ADDRESSES LOGICAL ADDRESSES Limit=249,999 Base=150,000 Limit=149,999 Base=100,000

Hardware Placement Support Multiple Relocation Registers SEGMENT TABLE LOGICAL ADDRESS OFFSETSEGMENT NO. SEGMENT TABLE PHYSICAL ADDRESS OFFSETSEGMENT BASE ADDR.

Hardware Placement Support Multiple Segments

Segments Vary in Size  SO  We still have the external fragmentation problem  BUT  We meet all the requirements for managing our Program Model

Paging to Solve Placement  Make all requests the same size

Paging Solves Placement Only but not Program Model

Replacement What is a process’ page fault rate? t - the access time to main store T - the access time to a page on disk f - the fraction of a program kept in main store. p(f) - the average number of page faults per store reference as a function of f (0<=p(f)<=1).

Replacement What is a process’ page fault rate?  FAULT INTERARRIVAL TIME >= PAGE TRANSFER TIME FROM DISK t/p(f) >= T t/(1-f) >= T assume random f >= 1 - t/T  t = 50ns T = 5ms  t/T = 1/100,000

Conclusion  A program with a random page reference pattern is BAD!!  Luckily, for loops, arrays, recursion, stack access all increase Program Locality

Replacement Algorithms  SCOPE –Global : take pages from anybody –Local : only take pages from process that caused the page-not-in-memory fault  ALLOCATION –Fixed : physical memory per process is limited –Variable : physical memory per process can grow or shrink during execution

Replacement Algorithms page reference trace TIME Refs 5 PAGES, 15 TIME PERIODS

Replacement Algorithms least-recently used

CANNOT IMPLEMENT IN PRACTICE The little matter of a stack of thousands of page #s LRU Approximation Add bits to each page table entry DIRTY - set on a write ACCESSED - set on a read/write

LRU Approximation Clock Algorithm  At certain clock ticks, –Step a sweep pointer through every page table for a certain number of entries e.g. 100  IF THE PAGE TABLE POINTS TO PHYSICAL MEMORY –DIRTY ACCESSED ACTION – F F Take that page away – F T Turn ACCESSED off – T T Turn ACCESSED off – T F Write page to disk (clean) then turn DIRTY off