SlideShare a Scribd company logo
1 of 16
Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
Hardware/Firmware/Software ,[object Object],[object Object],[object Object]
The Linux/x86 scheme ,[object Object],[object Object]
Source-code organization High-level ‘mm’ code is processor-independent (It’s in the ‘/usr/src/linux/mm’ subdirectory) Low-level ‘mm’ code is processor-specific (It’s in the ‘/usr/src/linux/arch/’ subdirectories) i386/mm ppc/mm mips/mm alpha/mm . . .
Our machines have 1GB of RAM Main Memory (1 GB) Intel Pentium CPU 0x00000000 0x3FFFFFFF system bus NIC VGA FIFO (4 KB) VRAM (32 MB) some devices have RAM, too
Booting up ,[object Object],[object Object],[object Object]
Kernel memory-mapping Virtual Memory 0x00000000 0xFFFFFFFF 4-GB Physical memory 0x00000000 0x3FFFFFFF 1-GB 896-MB 896-MB 0xC0000000 display memory device memory mappings
Application memory-mapping kernel space user space text data stack text data stack physical memory virtual memory mappings 3-GB
‘ mm_struct’ ,[object Object],[object Object],[object Object]
How Linux tracks mappings task_struct mm mm_struct pgd start, end, etc vm_area_struct start, end, etc vm_area_struct start, end, etc vm_area_struct start, end, etc vm_area_struct vma mapping-tables mapping-tables mapping-tables
What does ‘malloc()’ do? ,[object Object],[object Object],[object Object],[object Object],[object Object]
‘ mm.c’ and ‘vma.c’ ,[object Object],[object Object],[object Object],[object Object]
When a program ‘forks()’ ,[object Object],[object Object],[object Object],[object Object]
Similar memory-mappings user space kernel space user space text data stack parent-process kernel space text data stack child-process text data data stack stack physical memory virtual memory virtual memory
Another demo ,[object Object]
In-class exercise ,[object Object],[object Object],[object Object]

More Related Content

What's hot

The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structure
Teja Bheemanapally
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
tittuajay
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
Ni Zo-Ma
 
Os structure
Os structureOs structure
Os structure
Mohd Arif
 

What's hot (20)

Introduction to Linux Kernel
Introduction to Linux KernelIntroduction to Linux Kernel
Introduction to Linux Kernel
 
Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and Properties
 
The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structure
 
Unit II - 1 - Operating System Process
Unit II - 1 - Operating System ProcessUnit II - 1 - Operating System Process
Unit II - 1 - Operating System Process
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)
 
Virtual Machines - Virtual Box
Virtual Machines  - Virtual BoxVirtual Machines  - Virtual Box
Virtual Machines - Virtual Box
 
Virtual Machine Concept
Virtual Machine ConceptVirtual Machine Concept
Virtual Machine Concept
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
Linux memory-management-kamal
Linux memory-management-kamalLinux memory-management-kamal
Linux memory-management-kamal
 
Linux operating system ppt
Linux operating system pptLinux operating system ppt
Linux operating system ppt
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Os structure
Os structureOs structure
Os structure
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
 
Kernels and its types
Kernels and its typesKernels and its types
Kernels and its types
 

Viewers also liked

Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
Pegah Taheri
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
Lex Yu
 

Viewers also liked (20)

Memory management in Linux
Memory management in LinuxMemory management in Linux
Memory management in Linux
 
Linux Memory
Linux MemoryLinux Memory
Linux Memory
 
Os Linux
Os LinuxOs Linux
Os Linux
 
Day 1-1-intro-sw-vuls
Day 1-1-intro-sw-vulsDay 1-1-intro-sw-vuls
Day 1-1-intro-sw-vuls
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded DevicesQi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
 
4.6 create and change hard and symbolic links v2
4.6 create and change hard and symbolic links v24.6 create and change hard and symbolic links v2
4.6 create and change hard and symbolic links v2
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
 
VM and IO Topics in Linux
VM and IO Topics in LinuxVM and IO Topics in Linux
VM and IO Topics in Linux
 
An Operating System for Multicore and Clouds: Mechanisms and Implementation
An Operating System for Multicore and Clouds: Mechanisms and ImplementationAn Operating System for Multicore and Clouds: Mechanisms and Implementation
An Operating System for Multicore and Clouds: Mechanisms and Implementation
 
Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Management
 
Input output in linux
Input output in linuxInput output in linux
Input output in linux
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
 
Basic Linux kernel
Basic Linux kernelBasic Linux kernel
Basic Linux kernel
 
Linux Kernel Booting Process (2) - For NLKB
Linux Kernel Booting Process (2) - For NLKBLinux Kernel Booting Process (2) - For NLKB
Linux Kernel Booting Process (2) - For NLKB
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406
 
PCD - Process control daemon - Presentation
PCD - Process control daemon - PresentationPCD - Process control daemon - Presentation
PCD - Process control daemon - Presentation
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformatics
 
Android Memory , Where is all My RAM
Android Memory , Where is all My RAM Android Memory , Where is all My RAM
Android Memory , Where is all My RAM
 
Controlling Memory Footprint at All Layers: Linux Kernel, Applications, Libra...
Controlling Memory Footprint at All Layers: Linux Kernel, Applications, Libra...Controlling Memory Footprint at All Layers: Linux Kernel, Applications, Libra...
Controlling Memory Footprint at All Layers: Linux Kernel, Applications, Libra...
 

Similar to Memory management in linux

Linux internal
Linux internalLinux internal
Linux internal
mcganesh
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Itk rawa t____operatingsystems2
Itk rawa t____operatingsystems2Itk rawa t____operatingsystems2
Itk rawa t____operatingsystems2
KapiL RawaT
 
Operatingsystems
Operatingsystems Operatingsystems
Operatingsystems
kuldeepy60
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
mona_hakmy
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
tech2click
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)
Vivian Vhaves
 

Similar to Memory management in linux (20)

Linux memorymanagement
Linux memorymanagementLinux memorymanagement
Linux memorymanagement
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
Studies
StudiesStudies
Studies
 
Linux internal
Linux internalLinux internal
Linux internal
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Visual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & VirtualisationVisual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & Virtualisation
 
Itk rawa t____operatingsystems2
Itk rawa t____operatingsystems2Itk rawa t____operatingsystems2
Itk rawa t____operatingsystems2
 
Linux Operating System
Linux Operating SystemLinux Operating System
Linux Operating System
 
Operatingsystems
Operatingsystems Operatingsystems
Operatingsystems
 
Operating systems
Operating systemsOperating systems
Operating systems
 
Unix Operating System
Unix Operating SystemUnix Operating System
Unix Operating System
 
UNIX INTERNALS UNIT-I
UNIX INTERNALS UNIT-IUNIX INTERNALS UNIT-I
UNIX INTERNALS UNIT-I
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Bc0056 unix operating system
Bc0056   unix operating systemBc0056   unix operating system
Bc0056 unix operating system
 
Ubuntu OS Presentation
Ubuntu OS PresentationUbuntu OS Presentation
Ubuntu OS Presentation
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)
 
Operating System Concepts Presentation
Operating System Concepts PresentationOperating System Concepts Presentation
Operating System Concepts Presentation
 
LINUX Device Drivers
LINUX Device DriversLINUX Device Drivers
LINUX Device Drivers
 
ubantu ppt.pptx
ubantu ppt.pptxubantu ppt.pptx
ubantu ppt.pptx
 

More from Dr. C.V. Suresh Babu

More from Dr. C.V. Suresh Babu (20)

Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
 
Association rules
Association rulesAssociation rules
Association rules
 
Clustering
ClusteringClustering
Clustering
 
Classification
ClassificationClassification
Classification
 
Blue property assumptions.
Blue property assumptions.Blue property assumptions.
Blue property assumptions.
 
Introduction to regression
Introduction to regressionIntroduction to regression
Introduction to regression
 
DART
DARTDART
DART
 
Mycin
MycinMycin
Mycin
 
Expert systems
Expert systemsExpert systems
Expert systems
 
Dempster shafer theory
Dempster shafer theoryDempster shafer theory
Dempster shafer theory
 
Bayes network
Bayes networkBayes network
Bayes network
 
Bayes' theorem
Bayes' theoremBayes' theorem
Bayes' theorem
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agents
 
Rule based system
Rule based systemRule based system
Rule based system
 
Formal Logic in AI
Formal Logic in AIFormal Logic in AI
Formal Logic in AI
 
Production based system
Production based systemProduction based system
Production based system
 
Game playing in AI
Game playing in AIGame playing in AI
Game playing in AI
 
Diagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AIDiagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AI
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 

Memory management in linux

  • 1. Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
  • 2.
  • 3.
  • 4. Source-code organization High-level ‘mm’ code is processor-independent (It’s in the ‘/usr/src/linux/mm’ subdirectory) Low-level ‘mm’ code is processor-specific (It’s in the ‘/usr/src/linux/arch/’ subdirectories) i386/mm ppc/mm mips/mm alpha/mm . . .
  • 5. Our machines have 1GB of RAM Main Memory (1 GB) Intel Pentium CPU 0x00000000 0x3FFFFFFF system bus NIC VGA FIFO (4 KB) VRAM (32 MB) some devices have RAM, too
  • 6.
  • 7. Kernel memory-mapping Virtual Memory 0x00000000 0xFFFFFFFF 4-GB Physical memory 0x00000000 0x3FFFFFFF 1-GB 896-MB 896-MB 0xC0000000 display memory device memory mappings
  • 8. Application memory-mapping kernel space user space text data stack text data stack physical memory virtual memory mappings 3-GB
  • 9.
  • 10. How Linux tracks mappings task_struct mm mm_struct pgd start, end, etc vm_area_struct start, end, etc vm_area_struct start, end, etc vm_area_struct start, end, etc vm_area_struct vma mapping-tables mapping-tables mapping-tables
  • 11.
  • 12.
  • 13.
  • 14. Similar memory-mappings user space kernel space user space text data stack parent-process kernel space text data stack child-process text data data stack stack physical memory virtual memory virtual memory
  • 15.
  • 16.