What is the difference between objects VMA (Virtual Memory Area: struct vm_area_struct
, with which operates the kernel Linux) and PTE (Page Table Entry, with which operates MMU), and why we require VMA and not enough PTE?
The virtual memory address space of each process is divided into virtual memory areas (VMAs) where all the memory in one VMA is contiguous and shares certain properties such as permissions. For example, a process might have one VMA for its code, one VMA for each type of data, one VMA for each distinct memory mapping (if any), etc.
Each VMA consists of a number of pages, where a page is the unit for moving between main physical memory and backing store.
Each page has an entry in the Page Table, to indicate whether the page is currently in physical memory (in which case it points to the physical memory address of the page) or currently “paged out” on the system’s backing storage (in which case it points to the backing storage address of the page copy).
So each VMA has multiple PTEs.
The function of the VMA is to define a contiguous area of virtual memory (contiguous virtual addresses, not contiguous physical addresses) with the correct permissions.
The function of the Page Table is to manage paging between main physical memory and backing store, and to be the communication point between the system/hardware (the MMU) and the OS software.