Linux Vs. Windows NT Memory Management Hitesh Kumar

Slides:



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

The Linux Kernel: Memory Management
Memory Management in Linux (Chap. 8 in Understanding the Linux Kernel)
Kernel memory allocation
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
Memory Management Design & Implementation Segmentation Chapter 4.
UQC152H3 Advanced OS Memory Management under Linux.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Chapter 8.3: Memory Management
Memory Management (II)
CE6105 Linux 作業系統 Linux Operating System 許 富 皓. Chapter 2 Memory Addressing.
1 Pertemuan 16 Isu-Isu pada Sistem Paging dan Segmentasi Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
Chapter 3.2 : Virtual Memory
Computer Organization Cs 147 Prof. Lee Azita Keshmiri.
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved The Operating System Machine.
CS2422 Assembly Language & System Programming September 22, 2005.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
1 Memory Management in Representative Operating Systems.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice, FL ©2008,
Virtual Memory Chantha Thoeun. Overview  Purpose:  Use the hard disk as an extension of RAM.  Increase the available address space of a process. 
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
Memory Management in Windows and Linux &. Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory.
Address Translation Mechanism of 80386
Cosc 3P92 Week 9 & 10 Lecture slides
CSNB334 Advanced Operating Systems 5. Memory Management
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.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
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.
Paging Example What is the data corresponding to the logical address below:
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Memory Management CS Spring Overview Partitioning, Segmentation, and Paging External versus Internal Fragmentation Logical to Physical Address.
ICOM Noack Memory management Virtual memory Paging and segmentation Demand paging Memory management hardware.
操作系统原理 OPERATING SYSTEM Chapter 3 Memory Management 内存管理.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
Microprocessor and Assembly Language Addressing Models
W4118 Operating Systems Instructor: Junfeng Yang.
CS203 – Advanced Computer Architecture Virtual Memory.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Example: The Intel 32 and 64-bit Architectures Dominant industry chips.
W4118 Operating Systems Instructor: Junfeng Yang.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
CSNB334 Advanced Operating Systems 5. Memory Management
COMBINED PAGING AND SEGMENTATION
Address Translation Mechanism of 80386
Day 21 Virtual Memory.
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Day 22 Virtual Memory.
CSCI206 - Computer Organization & Programming
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Paging Lecture November 2018.
Computer Architecture
The Operating System Machine Level
Memory management, part 3: outline
Lecture 36 Syed Mansoor Sarwar
Virtual Memory Hardware
Main Memory Session - 16.
CSE 451: Operating Systems Winter 2004 Module 10.5 Segmentation
Lecture 37 Syed Mansoor Sarwar
CSE451 Virtual Memory Paging Autumn 2002
CSE 451 Autumn 2003 November 13 Section.
CS703 - Advanced Operating Systems
Assembly Language for Intel-Based Computers, 5th Edition
COMP755 Advanced Operating Systems
Chapter 8: Main Memory CSS503 Systems Programming
Presentation transcript:

Linux Vs. Windows NT Memory Management Hitesh Kumar

Introduction Linux and Windows NT use Virtual Memory with paging. The memory management is platform independent. These platforms provide the support for paging with varying levels of page tables. The platform chosen for explanation is Intel Pentium/x86.

Linux Memory Management Linux uses two separate memory management schemes like SVR4 and Solaris. These Two Schemes are: a. Virtual memory management for user process. b. Kernel memory management for the use of Kernel. The complete 4GB memory(linear address space of Pentium /x86) is divided into two parts. The first 0-3GB(0 x BFFF FFFF) is used for user process. The next 3GB to 4GB part is used for the kernel.

4GB Kernel space 3GB User Space Linux Address Space

Address Generation In x86 x86 provides the support for both Segmentation and Paging. Maximum Segment Size is 4GB; the complete linear address space of the processor. Smaller size segments are created by specifying limit field. Logical Address 1. Logical address must be provided to locate a byte, which is the combination of segment selector and offset.

Continue 2. Segment Selector selects the segment descriptor, a data structure which contains the base address of the segment. Linear Address 1.The offset is added into the base address to create the linear address of the byte. Physical Address 1. If paging is not enabled then linear address is directly used to access the byte in the physical memory. 2. If paging is enabled then linear address is broken into 3 parts: Page Directory(10), Page Table(10), Offset(12). 3. The page size is 4KB.

Segmentation and Paging In x86 Logical Address Selecter offset Linear Address Space Linear Address segment Lin Addr Global Desc. Table Dir Table offset Physical Address Space Segment Descriptor Page Phy Addr. Page Dir Page Table Entry Entry Segmentation and Paging In x86

How Linux Uses This? Uses Flat Memory Model. All the segments in the user space are of 3GB. The segment in kernel space are of 1GB and start from 3GB. Each process contains its own page directory and maps the full 4GB space. The kernel mode is entered by switching the segments from user space to kernel space.

Continue Linux uses three level page table structure: 1. PAGE GLOBAL DIRECTORY. 2. PAGE MIDDLE DIRECTORY. 3. PAGE TABLE. The software handling middle level does nothing on x86. Page Replacement Algorithm Linux uses second chance clock algorithm for page replacement, means uses one bit.

Physical Memory Management Linux uses zone allocator to allocate the physical pages of memory. Memory is divided into zones for different purposes like DMA. Memory from each zone is allocated in 2n –paged size blocks , by using Buddy system .

Kernel Memory Management Kernel does frequent memory allocation for small sized objects. Only zone allocator is inefficient for this. The idea of “Object Caching” is used, because most of the time is wasted in initialization and destruction of objects. Slab allocator is used for dividing the 2n - paged blocks into small buffers.

Slab Layout Kmem slab Kmem bufctl Kmem bufctl Kmem bufctl buf buf buf unused Slab Layout

Windows NT Memory Management Like Linux, it divides the memory into two parts. 2GB is allocated for user space and 2GB is used for kernel space. The address generation scheme is same as of Linux.

Windows NT Address Space 4GB Kernel space 2GB User Space Windows NT Address Space

Page Frame States Page-Frame States 1. Valid 2. Modified. 3. Standby 4. Free 5. Zeroed 6. Bad.

Page Frame Database Page Table Page frame database Valid Modified PTE Free Standby PTE PTE Page Frame Database