Course: Operating Systems Instructor: M Umair. M Umair

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

CS420: Operating Systems

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

12: Memory Management

Chapters 9 & 10: Memory Management and Virtual Memory

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

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

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

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

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

MODERN OPERATING SYSTEMS. Chapter 3 Memory Management

Chapter 8: Main Memory

CS370 Operating Systems

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

Preview. Memory Management

Chapter 8: Main Memory

CS399 New Beginnings. Jonathan Walpole

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

Chapter 8: Memory- Management Strategies

Chapter 8: Memory Management Strategies

Chapter 8: Memory Management

Basic Memory Management

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Memory Management (1) Memory Management

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

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

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

CSE 4/521 Introduction to Operating Systems. Lecture 12 Main Memory I (Background, Swapping) Summer 2018

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

Chapter 8: Main Memory

CS370 Operating Systems

Module 9: Virtual Memory

CS370 Operating Systems

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

CS370 Operating Systems

Chapter 8 Memory Management

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

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

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

Module 8: Memory Management

Chapter 9: Virtual Memory

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

Logical versus Physical Address Space

CS450/550 Operating Systems

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

Frequently asked questions from the previous class survey

Chapter 4 Memory Management

Chapter 9: Virtual-Memory

Memory Management 9th Week

Operating Systems Lecture 6: Memory Management II

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is.

Background. Contiguous Memory Allocation

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France

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

Memory Management. Memory Management

Chapter 3 - Memory Management

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

Chapter 8 Main Memory

Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSC Operating Systems Spring 2007

CSC Operating Systems Spring Lecture - XIV Virtual Memory - II. Tevfik Ko!ar. Louisiana State University. March 27 th, 2008.

Operating Systems. User OS. Kernel & Device Drivers. Interface Programs. Memory Management

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Chapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition

Memory management OS

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

CS307: Operating Systems

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University

Chapter 8: Main Memory

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

Chapter 4 Memory Management. Memory Management

Memory Management. Dr. Yingwu Zhu

Chapter 8: Memory-Management Strategies

Hardware Address Binding Memory Allocation References. Physical Memory. Daniel Bosk 1

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition

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

Lecture 17. Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

Chapter 9: Virtual Memory

MEMORY MANAGEMENT. Term Paper. Operating Systems CS-384

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University

Unit II: Memory Management

Operating System Concepts

Chapter 9: Memory Management. Background

현재이이미지를표시할수없습니다. Chapter 9: Virtual Memory

3. Memory Management

Module 9: Virtual Memory

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

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

Goals of Memory Management

CSE 4/521 Introduction to Operating Systems. Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.

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

Basic Page Replacement

Week 2: Tiina Niklander

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

CS510 Operating System Foundations. Jonathan Walpole

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

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

Transcription:

Course: Operating Systems Instructor: M Umair

Memory Management

Introduction { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin }

Address Binding Addresses in the source program are generally symbolic (such as count). A compiler will typically bind these symbolic addresses to relocatable addresses. 14 bytes from the beginning of this module. The linkage editor or loader will in turn bind the re-locatable addresses to absolute addresses. For example 74014. { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin }

Address Binding Compile time If you know at compile time where the process will reside in memory, then absolute code can be generated. Load time If it is not known at compile time where the process will reside in memory, then the compiler must generate relocatable code. Final binding is delayed until load time. { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin }

Address Binding Execution time If the process can be moved during its execution from one memory segment to another, then binding must be delayed until run time. Special hardware must be available for this scheme to work. { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin }

Multiprogramming with Fixed Partitions Divide memory up into n (possibly unequal) partitions. This partitioning can be done manually when the system has started up.

Multiprogramming with Fixed Partitions

CPU Utilization

Swapping Sometimes there is not enough main memory to hold all the currently active processes. Excess processes must be kept on disk and brought in to run dynamically. Swapping, consists of bringing in each process, running it for a while, then putting it back on the disk. Virtual memory, allows programs to run even when they are only partially in main memory.

Swapping

Swapping Swapping creates multiple holes in memory It is possible to combine them all into one big one by moving all the processes downward as far as possible. This technique is known as memory compaction. Example On a 256-MB machine that can copy 4 bytes in 40 nsec, it takes about 2.7 sec to compact all of memory.

Swapping Growing Segments Dynamically Allocation of Memory! 1. Grow into hole OR 2. Move process to a hole in memory large enough to hold it OR 3. Wait / Kill

Memory Management with Bitmaps

Virtual Memory Combined size of the program, data, and stack may exceed the amount of physical memory available for it. The operating system keeps those parts of the program currently in use in main memory, and the rest on the disk. Example A 16-MB program can run on a 4-MB machine by carefully choosing which 4 MB to keep in memory at each instant, with pieces of the program being swapped between disk and memory as needed.

Virtual Memory - Paging MMU maps the virtual address onto the physical address. MMU is not required if there is no virtual memory

Virtual Memory - Paging virtual address space is divided up into units called pages corresponding units in the physical memory are called page frames

Virtual Memory - Paging Address Translation Example 00000 8192 8192 24576 20500 12308

Virtual Memory Page Fault Page Fault Example MOV REG, 32768????? CPU generates trap for OS Page Fault OS picks/removes little used page Brings in requested page Change the map Restart trap instruction

Virtual Memory Page Fault Handling

Virtual Memory Page Table { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin }

Virtual Memory Page Table Translation Example 0 0000 0000 0000 0000 At 0000 the information is 2 i.e 0010 0010 0000 0000 0000 -> 8192

Virtual Memory Page Replacement Algorithms Optimal Page Replacement Algorithm If one page will not be used for 8 million instructions and another page will not be used for 6 million instructions, removing the former pushes the page fault. Problem with this algorithm is that it is unrealizable. The operating system has no way of knowing when each of the pages will be referenced next.

Virtual Memory Page Replacement Algorithms Not Recently Used Page Replacement Algorithm Removes a page at random from the lowest numbered nonempty class. Use of R/M bit and clock interrupt. Remove a modified page that has not been referenced in at least one dock tick (typically 20 msec). Classification 3. referenced, modified 2. referenced, not modified 1. not referenced, modified 0. not referenced, not modified

Virtual Memory Page Replacement Algorithms First-In, First-Out (FIFO) Page Replacement Algorithm The operating system maintains a list of all pages currently in memory. The page at the head of the list is the oldest one and the page at the tail is the most recent arrival. On a page fault, the page at the head is removed and the new page added to the tail of the list.

Virtual Memory Page Replacement Algorithms Second Chance Page Replacement Algorithm Replace only if page is old and unused otherwise put on to the end of list.