Memory Management in Windows and Linux &. Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory.

Slides:



Advertisements
Similar presentations
Basic Memory Management Monoprogramming Protection Swapping Overlaying OS space User space.
Advertisements

Virtual Memory Management G. Anuradha Ref:- Galvin.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
16.317: Microprocessor System Design I
4/14/2017 Discussed Earlier segmentation - the process address space is divided into logical pieces called segments. The following are the example of types.
CS 153 Design of Operating Systems Spring 2015
Memory Management Design & Implementation Segmentation Chapter 4.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Memory Management (II)
Linux Vs. Windows NT Memory Management Hitesh Kumar
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
CE6105 Linux 作業系統 Linux Operating System 許 富 皓. Chapter 2 Memory Addressing.
Memory Management.
Memory Management 2010.
Chapter 11 – Virtual Memory Management Outline 11.1 Introduction 11.2Locality 11.3Demand Paging 11.4Anticipatory Paging 11.5Page Replacement 11.6Page Replacement.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
Memory Management April 28, 2000 Instructor: Gary Kimura.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
By Matthew Smith, John Allred, Chris Fulton. Requirements Relocation Protection Sharing Logical Organization Physical Organization.
CS 346 – Chapter 8 Main memory –Addressing –Swapping –Allocation and fragmentation –Paging –Segmentation Commitment –Please finish chapter 8.
CSNB334 Advanced Operating Systems 5. Memory Management
Computer Architecture Lecture 28 Fasih ur Rehman.
Operating Systems Unit 8: – Virtual Memory management Operating Systems.
Lecture 19: Virtual Memory
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
Operating Systems ECE344 Ding Yuan Paging Lecture 8: Paging.
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.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
1 Linux Operating System 許 富 皓. 2 Memory Addressing.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
Chapter 4 Memory Management Virtual Memory.
Virtual Memory 1 1.
Lecture 11 Page 1 CS 111 Online Working Sets Give each running process an allocation of page frames matched to its needs How do we know what its needs.
ICOM Noack Memory management Virtual memory Paging and segmentation Demand paging Memory management hardware.
Demand Paging Reference Reference on UNIX memory management
Windows XP Memory Management Aaron Lanoy and Jason Farnsworth.
Lecture 14 PA2. Lab 2: Demand Paging Implement the following syscalls xmmap, xmunmap, vcreate, vgetmem/vfreemem, srpolicy Deadline: November , 10:00.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
COS 318: Operating Systems Virtual Memory Design Issues.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
Virtual Memory Chapter 8.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Non Contiguous Memory Allocation
Memory Caches & TLB Virtual Memory
Virtual Memory User memory model so far:
CS703 - Advanced Operating Systems
143A: Principles of Operating Systems Lecture 6: Address translation (Paging) Anton Burtsev October, 2017.
Address Translation Mechanism of 80386
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 8: Main Memory.
Lecture 28: Virtual Memory-Address Translation
CSCI206 - Computer Organization & Programming
Page Replacement.
Virtual Memory فصل هشتم.
CSE 451: Operating Systems Autumn 2005 Memory Management
Translation Buffers (TLB’s)
Virtual Memory Overcoming main memory size limitation
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451 Autumn 2003 November 13 Section.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Paging and Segmentation
Lecture 9: Caching and Demand-Paged Virtual Memory
CSE 542: Operating Systems
Presentation transcript:

Memory Management in Windows and Linux &

Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory Lazy allocation –Avoid allocating memory until necessary Prefetching –Move pages from disk to main memory before they are needed Pagefile –Stores pages that do not fit in main memory –Windows XP supports up to 16 pagefiles

Memory Organization 32-bit virtual address space –Windows 64-Bit Edition has 64-bit address space. –4GB virtual address space per process User space vs. System space –Process can access only user space –VMM stores page tables and other data in system space –2GB user space, 2GB system space 4KB pages

Memory Organization Two-level hierarchical memory map –Page directory table Page directory entries (PDEs) point to page table One page directory table per process Location in page directory register –Page table Page table entries (PTEs) point to page frames –Page frame Contains page of data TLB (translation lookaside buffer) accelerates address translation

. Virtual address translation

Memory Allocation

Page frame states

Page Replacement Process

Linux Memory Management Memory manager supports 32- and 64-bit addresses Also supports NUMA (nonuniform memory access architectures) To allow Linux to scale from desktops and workstations, to servers and supercomputers

Page Table Organization

Memory Organization Linux uses paging exclusively –Often implemented using a single page size –On 32-bit systems, kernel can address 4GB of data On 64-bit systems, the kernel supports up to 2 petabytes of data –Three levels of page tables Page global directory Page middle directory Page tables –On systems that support only two levels of page tables, page middle directory contains exactly one entry Virtual address space organized into virtual memory areas to group information with same permissions (similar to segments)

Linux on the IA-32 architecture Kernel attempts to reduce overhead due to TLB flushing on context switch Divides each 4GB address space into a 3GB region for process data and instructions and a 1GB address space for kernel data and instructions Most of the kernel’s address space is directly mapped to main memory so that it can access information belonging to any process

Kernel virtual address space mapping

Memory Organization Memory zones –DMA memory: first 16MB of main memory Kernel attempts to make memory available in this region for legacy hardware –Normal memory: between 16MB and 896MB on the IA-32 architecture Stores user data and most kernel data –High memory: > 896MB on the IA-32 architecture Contains memory that the kernel does not permanently map to its address space Bounce buffer –Allocates low memory temporarily for I/O –Data is “bounced” to high memory after I/O completes

Physical memory zones on the IA- 32

Page Replacement Page replacement is performed independently for each page zone –Algorithm is a variant of the clock page-replacement algorithm Two linked lists per zone –Active list contains pages that have been referenced recently –Inactive list contains pages that have been used less recently Page enters system at the head of the inactive list, referenced bit set If the page is active or inactive and its referenced bit is off, the bit is turned on –Ensures that recently referenced pages are not selected for replacement If page is inactive and is being referenced for the second time (referenced bit is on), page is moved to head of the active list, referenced bit is cleared –Allows the kernel to distinguish between referenced pages that have been accessed once and those that have been accessed more than once recently –The latter are placed in the active list so they are not selected for replacement

Page-replacement system overview

Swapping kswapd (the kernel swap daemon) –Periodically frees page frames by flushing dirty pages to disk –Swaps pages from the tail of the inactive list First determines if the page has a valid entry in the swap cache –Enables clean pages to be freed immediately Cannot free a page frame if –Page is shared kswapd must unmap multiple references to the page Reverse mapping improves efficiency –Page is dirty kswapd must flush it to disk Performed asynchronously by pdflush –Page is locked (e.g., currently under I/O) kswapd must wait until page is unlocked