Memory Addressing in Linux  Logical Address machine language instruction location  Linear address (virtual address) a single 32 but unsigned integer.

Slides:



Advertisements
Similar presentations
Memory Management Unit
Advertisements

The Linux Kernel: Memory Management
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.
Virtual Memory Chapter 18 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S. Dandamudi.
Intel MP.
Configuring the Operating System Configure Performance Options Processor scheduling and memory usage Virtual memory Memory for network performance Configure.
OS Memory Addressing.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
Linux 作業系統 Linux Operating System Dr. Fu-Hau Hsu.
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.
X86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT
Memory Management (II)
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
CE6105 Linux 作業系統 Linux Operating System 許 富 皓. Chapter 2 Memory Addressing.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
Chapter 3.2 : Virtual Memory
Linux Operating System
Virtual Memory  Early computers had a small and fixed amount to memory. All programs had to be able to fit in this memory. Overlays were used when the.
1 CE6105 Linux 作業系統 Linux Operating System 許 富 皓.
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
UNIT 2 Memory Management Unit and Segment Description and Paging
1 Linux Operating System 許 富 皓. 2 Chapter 2 Memory Addressing.
ITEC 325 Lecture 29 Memory(6). Review P2 assigned Exam 2 next Friday Demand paging –Page faults –TLB intro.
CS 346 – Chapter 8 Main memory –Addressing –Swapping –Allocation and fragmentation –Paging –Segmentation Commitment –Please finish chapter 8.
Address Translation Mechanism of 80386
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.
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: Memory-Management Strategies. 8.2 Chapter 8: Memory Management Strategies n Background n Swapping n Contiguous Memory Allocation n Paging n.
1 Linux Operating System 許 富 皓. 2 Memory Addressing -- with the assistance of 江瑞敏 and 許齊顯.
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.
Memory Addressing in Linux (Chap. 2, Understanding the Linux Kernel) J. H. Wang Oct. 20, 2008.
Computer Architecture 2011 – VM x86 1 Computer Architecture Virtual Memory (VM) – x86 By Dan Tsafrir, 30/5/2011 Presentation based on slides by Lihu Rappoport.
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.
80386DX.
Memory Addressing in Linux (Chap. 2 in Understanding the Linux Kernel) J. H. Wang Oct. 15, 2009.
1 i386 Memory Management Professor Ching-Chi Hsu 1998 年 4 月.
Introduction to Virtual Memory and Memory Management
Linux Operating System
操作系统原理 OPERATING SYSTEM Chapter 3 Memory Management 内存管理.
Different Microprocessors Tamanna Haque Nipa Lecturer Dept. of Computer Science Stamford University Bangladesh.
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.
OS Memory Addressing. Architecture CPU – Processing units – Caches – Interrupt controllers – MMU Memory Interconnect North bridge South bridge PCI, etc.
Microprocessor system architectures – IA32 paging Jakub Yaghob.
W4118 Operating Systems Instructor: Junfeng Yang.
COMP 3500 Introduction to Operating Systems Paging: Translation Look-aside Buffers (TLB) Dr. Xiao Qin Auburn University
Basic Paging (1) logical address space of a process can be made noncontiguous; process is allocated physical memory whenever the latter is available. Divide.
COSC6385 Advanced Computer Architecture Lecture 7. Virtual Memory
Chapter 2: The Linux System Part 4
CSNB334 Advanced Operating Systems 5. Memory Management
COMBINED PAGING AND SEGMENTATION
Address Translation Mechanism of 80386
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
x86 segmentation, page tables, and interrupts
CSE 153 Design of Operating Systems Winter 2018
Linux Operating System Kernel
Introduction to the Intel x86’s support for “virtual” memory
Linux 운영체제 및 응용 Lecture Note 2 Memory Addressing 오상규 정보통신대학원.
Introduction to the Pentium’s support for “virtual” memory
CS703 - Advanced Operating Systems
Linux 운영체제 및 응용 Lecture Note 2 Memory Addressing 오상규 정보통신대학원.
CSE 153 Design of Operating Systems Winter 2019
Chapter 8: Main Memory CSS503 Systems Programming
CS444/544 Operating Systems II Virtual Memory
Presentation transcript:

Memory Addressing in Linux  Logical Address machine language instruction location  Linear address (virtual address) a single 32 but unsigned integer  Physical address address in memory chip

Logical address translation Logical address Segmentation Unit Paging Unit Linear AddressPhysical Address

Segmentation in Linux  Linux uses segmentation only when required by the 80x86 architecture  All processes use the same logical addresses  All segments descriptors are stored in the Global Descriptor Table  Segments used by Linux Kernel code segment  DPL = 0 (Kernel Mode)  Type = 0xa(read and execute) Kernel data segment  DPL = 0  Type = 2 (read and write) User code segment  DPL = 3 (User Mode)  Type = 0xa User data segment  DPL = 3  Type = 2 Task State Segment (TSS) Default Local Descriptor Table (LDT) Advanced Power Management (APM)  4 segments

Paging in Linux  In 80x86 processors, paging is enabled by setting the PG flag of a control register named cr0. When PG = 0, linear addresses are interpreted as physical addresses When PG = 1, physical addresses are computed from the page table  The 32 bits of a linear address are divided into three fields: Directory  most significant 10 bits Table  intermediate 10 bits Offset  The least significant 12 bits

Paging in Linux (80x86) DirectoryTableOffset cr3 Page + Page Table Page Directory

Extended Paging (Pentium) DirectoryOffset cr3 Page + Page Directory + 4 MB Enabled by setting the PSE flag of the cr4 register

Three-Level Paging  Used in 64-bit architectures  HP Alpha Page frames are 8kb offset field is 13 bits Only the least significant 43 bits of an address are used Three-levels of page tables  3 10-bit page tables

Physical Address Extension (PAE) Paging Mechanism  Kernel cannot directly address more than 1 GB of RAM  Starting with the address pins = 64 GB  Pentium Pro Physical Address Extension (PAE) Set PAE flag in the cr4 control register

Change to Paging Mechanism to support PAE  64 GB split into 2^24 distinct page frames  page tables expanded from 20 to 24 bits  new level of page table called page directory pointer table (PDPT)  cr3 control register contains a 27-bit Page Directory Pointer Table base address  When mapping 4KB pages (ps flag cleared) cr3 -> PDPT bits 31-30: one of 4 entries in PDPT bits 29-21: one of 512 entries in Page Directory bits 20-12: one of 512 entries in Page Table bits 11-0: Offset  When mapping 2MB pages (ps flag set) cr3 -> PDPT bits 31-30: one of 4 entries in PDPT bits 29-21: one of 512 entries in Page Directory bits 20-0: Offset

Hardware Cache  Use the CD flag of the cr0 processor register to enable cache  Each page can have a different cache policy  Page Directory and each page table entry includes two flags PCD (page cache disable) PWT (page write-through)  Each 80x86 processor has its own local TLB – located in cache

Loading Linux  Linux kernel is installed in RAM starting from 0x (2 nd megabyte)  typical configurations give a kernel size < 2MB  BIOS uses first meg

Process Page Tables  linear addresses from 0x to 0xbfffffff either user or kernel mode  linear addresses from 0xc to 0xffffffff can only be addressed in kernel mode  PAGE_OFFSET = 0xc

Kernel Page Tables  The kernel maintains a set of Page Tables for its own use rooted at the Master Kernel Page Global Directory  After system initialization This set of page tables never used directly The highest entries are the reference model for the corresponding entries of the PGD of every regular process in the system

Provisional kernel page tables  initialized statically during kernel compilation  during initialization need to be able to first 8megs are accessed directly  But were using paging So an identity mapping is performed

Fix-Mapped Linear Addresses  The 4 th gigabyte is reserved for a direct mapping of physical memory  a fixed mapped linear address is a constant linear address like 0xfffffdf0 whose corresponding physical address can be set up in an arbitrary way  Linear address X maps to physical-Address X- PAGE_OFFSET

Noncontiguous Memory Area Management  It is preferable to map memory areas into sets of contiguous page frames  However, if requests for memory areas are infrequent, it makes sense to use an allocation schema based on noncontiguous page frames accessed through contiguous linear addresses  Linux uses noncontiguous memory areas in several ways Ex: to allocate data structures for active swap areas

Linear addresses interval Physical memory mapping vmalloc area vmalloc area Persistent kernel mappings Fix-mapped linear addresses PAGE_OFFSET high_memory 4 GB PKMAP_BASE VMALLOC_END 8 MB4KB VMALLOC_START high_memory = linear address that corresponds to the end of directly mapped physical memory