Linux Memory Issues Introduction. Some Architecture History 8080 (late-1970s) 16-bit address (64-KB) 8086 (early-1980s) 20-bit address (1-MB) 80286 (mid-’80s)

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Memory Management Unit
Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
Paging Hardware With TLB
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.
Main Memory Operating System Concepts chapter 8 CS 355
OS Memory Addressing.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
IA32 Paging Scheme Introduction to the Intel x86’s support for “virtual” memory.
Linux Memory Issues An introduction to some low-level and some high-level memory management concepts.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
UQC152H3 Advanced OS Memory Management under Linux.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
Chapter 8.3: Memory Management
Memory Management (II)
Linux Vs. Windows NT Memory Management Hitesh Kumar
CE6105 Linux 作業系統 Linux Operating System 許 富 皓. Chapter 2 Memory Addressing.
Memory Management.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Memory-Management Strategies.
Scientific Visualization Using imagery to aid humans in understanding a complicated phenomenon.
Managing physical memory
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 8: Memory Management Dr. Mohamed Hefeeda.
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved The Operating System Machine.
A device-driver for Video Memory Introduction to basic principles of the PC’s graphics display.
Chapter 7: Main Memory CS 170, Fall Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Introduction to the Intel x86’s support for “virtual” memory
CS2422 Assembly Language & System Programming September 22, 2005.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
EECE476: Computer Architecture Lecture 27: Virtual Memory, TLBs, and Caches Chapter 7 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
The ‘zero-copy’ initiative A look at the ‘zero-copy’ concept and an x86 Linux implementation for the case of outgoing packets.
Segmentation CS 537 – Introduction to Operating Systems.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
1 CSC 539: Operating Systems Structure and Design Spring 2005 Memory management  swapping  contiguous allocation  paging  segmentation  segmentation.
Memory Management in Windows and Linux &. Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory.
CS 346 – Chapter 8 Main memory –Addressing –Swapping –Allocation and fragmentation –Paging –Segmentation Commitment –Please finish chapter 8.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Memory Addressing in Linux  Logical Address machine language instruction location  Linear address (virtual address) a single 32 but unsigned integer.
Linux Virtual Memory for Intel Processor
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.
Chapter 8: Memory-Management Strategies. 8.2 Chapter 8: Memory Management Strategies n Background n Swapping n Contiguous Memory Allocation n Paging n.
CS 6560 Operating System Design Lecture 8: Memory Management.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Memory Addressing / Kernel Modules.
1 Linux Operating System 許 富 皓. 2 Memory Addressing.
Paging Example What is the data corresponding to the logical address below:
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
2003 Dominic Swayne1 Microsoft Disk Operating System and PC DOS CS-550-1: Operating Systems Fall 2003 Dominic Swayne.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
80386DX.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Hardware.
The Microprocessor and Its Architecture A Course in Microprocessor Electrical Engineering Department University of Indonesia.
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.
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
OS Memory Addressing. Architecture CPU – Processing units – Caches – Interrupt controllers – MMU Memory Interconnect North bridge South bridge PCI, etc.
W4118 Operating Systems Instructor: Junfeng Yang.
COMP 3500 Introduction to Operating Systems Paging: Translation Look-aside Buffers (TLB) Dr. Xiao Qin Auburn University
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
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.
Address Translation Mechanism of 80386
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Operating Modes UQ: State and explain the operating modes of X86 family of processors. Show the mode transition diagram highlighting important features.(10.
Introduction to the Intel x86’s support for “virtual” memory
Introduction to the Pentium’s support for “virtual” memory
CSE 451: Operating Systems Winter 2004 Module 10.5 Segmentation
COMP755 Advanced Operating Systems
Presentation transcript:

Linux Memory Issues Introduction

Some Architecture History 8080 (late-1970s) 16-bit address (64-KB) 8086 (early-1980s) 20-bit address (1-MB) (mid-’80s) 24-bit address (16-MB) (late-’80s) 32-bit address (4-GB) (late-’90s) 36-bit address (64-GB)

‘Backward Compatibility’ Most buyers resist ‘early obsolescence’ New processors need to run old programs Early design-decisions leave their legacy 8086 could run recompiled 8080 programs 80x86 can still run most 8086 applications Win95/98 could run most MS-DOS apps But a few areas of incompatibility existed

Linux must accommodate legacy Legacy elements: hardware and firmware CPU: reset-address and interrupt vectors ROM-BIOS: data area and boot location Display Controllers: VRAM & video BIOS Support chipsets: 15MB ‘Memory Window’ SMP: Local and I/O APIC

Other CPU Architectures Besides IA-32, Linux runs on other CPUs (e.g., PowerPC, MC68000, IBM360, Sparc) So must accommodate their differences –Memory-Mapped I/O –64-bit address-buses –Non-Uniform Memory Access (NUMA)

Nodes, Zones, and Pages Nodes: to accommodate NUMA systems 80x86 doesn’t support NUMA So on 80x86 Linux uses just one ‘node’ Zones: to accommodate distinct regions Three zones on 80x86: –ZONE_DMA (memory below 16-MB) –ZONE_NORMAL (from 16-MB to 896-MB) –ZONE_HIGHMEM (memory above 896-MB)

Zones divided into Pages 80x86 supports 4-KB page-frames Linux uses an array of ‘page descriptors’ Array of page descriptors: ‘mem_map’ physical memory is ‘mapped’ by CPU

How 80x86 Addresses RAM Two-stages:‘segmentation’ plus ‘paging’ First: logical address  linear address Then: linear address  physical address

Logical to Linear selector GDTR segment-registeroperand-offset virtual address-space memory segment global descriptor table base-address and segment-limit descriptor

Segment Descriptor Format Limit[ ] Base[ ] Base[ ]Base[ ] Limit [ ] 310

Linear to Physical physical address-space offsettable-index linear address CR3 dir-index page frame page directory page table

Page-Size Extensions can map either 4KB or 4MB pages With 4MB pages: middle table is omitted Entire 4GB address-space is subdivided into MB-pages

Linear to Physical physical address-space offset linear address CR3 dir-index page frame page directory 4-MB page-frames

PageTable Entry Format Frame Address 0 31 Frame attributes 1112 Some Frame Attributes: P : (present=1, not-present=0) R/W : (writable=1, readonly=0) U/S : (user=1, supervisor=0) D : (dirty=1, clean=0) A : (accessed=1, not-accessed=0) S : (size 4MB = 1, size 4KB = 0)

Visualizing Memory Virtual address-space (4-GB) –subdivided into 4MB pages (1024 pels) –Text characters: 16 rows by 64 columns Physical address-space (1-GB) –subdivided into 4KB pages (262,144 pels) –Graphics pixels: 512 rows by 512 columns

Two Visualizations ‘pgdir.c’ ‘zones.c’

Virtual Memory Visualization Shows which addresses are ‘mapped’ Display granularity is 4MB Data is gotten from task’s page-directory Page-Directory location is in register CR3 Legend: ‘-’ = frame not mapped ‘3’ = r/w by supervisor ‘7’ = r/w by user

Physical Memory Visualization Shows relative sizes of the three ‘zones’ Display granularity is 4KB Data is based on ‘num_physpages’ And on the ‘Zone-Boundary’ constants light-green:ZONE_DMA dark-green:ZONE_NORMAL dark-brown:ZONE_HIGHMEM

Where are process descriptors? White pages show ‘process descriptors’ Data is taken from the kernel’s tasklist Searching tasklist noticibly slows drawing

Visualization Critique ‘Double-drawing’ is an annoyance No title to say what we’re seeing No legend to explain the color usage No indication of granularity or orientation Display is tightly tied to hardware setup

Future Questions Where are the ‘page descriptors’? How much memory used by ‘mem_map’? Where are user-space memory-regions? Where are the device-driver modules? How much memory is really allocated? Has the ‘free’ memory gotten fragmented?

More future questions Where are the ‘accessed’ pages? Where are the ‘dirty’ pages? How big is the video frame-buffer? And where is it mapped? How big are device-memory regions? And where are they mapped?