1 / 7

Linux Memory Management

Linux Memory Management. High-Level versus Low-Level. Assigning memory to tasks. Each Linux process has a ‘process descriptor’ with a pointer inside it named ‘mm’: struct task_struct { pid_t pid; char comm[16]; struct mm_struct *mm;

Télécharger la présentation

Linux Memory Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux Memory Management High-Level versus Low-Level

  2. Assigning memory to tasks • Each Linux process has a ‘process descriptor’ with a pointer inside it named ‘mm’: struct task_struct { pid_t pid; char comm[16]; struct mm_struct *mm; /* plus many additional fields */ };

  3. struct mm_struct • Describes the task’s ‘memory map’ • Where’s the code, the data, the stack? • Where are the ‘shared libraries’? • What are attributes of each memory area? • How many distinct memory areas? • Where is the task’s ‘page directory’?

  4. Virtual Memory Areas • Inside ‘mm_struct’ is a pointer to a list • Name of this pointer is ‘mmap’ struct mm_struct { struct vm_area_struct *mmap; /* plus many other fields */ };

  5. Linked List of VMAs • Each ‘vm_area_struct’ points to another struct vm_area_struct { unsigned long vm_start; unsigned long vm_end; unsigned long vm_flags; struct vm_area_struct *vm_next; /* plus some other fields */ };

  6. Structure relationships The ‘process descriptor’ for a task task_struct Task’s mm structure mm_struct *mm *mmap VMA VMA VMA VMA VMA Linked list of ‘vm_area_struct’ structures

  7. Demo ‘vma.c’ module • Creates a pseudo-file: /proc/vma • Lets user see the list of VMAs for a task • Also shows the ‘pgd’ field in ‘mm_struct’ EXERCISE • Compare our demo to ‘/proc/self/maps’

More Related