After introducing memory virtualization technology, there are three types of addresses in the memory system.
Machine Address (MA): The real hardware machine address, visible on the address bus as address signals.
Guest Physical Address (GPA): The pseudo-physical address seen by the virtual machine after abstraction by the VMM.
Virtual Address (VA): The linear address space provided by the Guest OS for its applications.

The mapping relationship from virtual address to guest physical address is denoted as g.
The mapping relationship from guest physical address to machine address is denoted as f.
The operating system’s Memory Management Unit (MMU) can only complete one mapping from virtual address to physical address, but the obtained physical address is only the guest physical address and not the machine physical address. Therefore, the VMM needs to participate to obtain the machine address that can be used on the bus for efficient conversion from virtual address to machine address. The commonly used method is for the VMM to generate a composite mapping f·g based on mappings f and g and write it directly into the MMU. There are two specific implementation methods:
MMU Paravirtualization
This method is mainly used by Xen.
The main principle is: when the Guest OS creates a new page table, the VMM allocates pages from its maintained free memory and registers them. Subsequently, any write operations by the Guest OS to that page table will trap into the VMM for verification and conversion; the VMM checks each entry in the page table to ensure they only map to machine pages belonging to that virtual machine and do not include writable mappings to page table pages. Then, the VMM will replace the guest physical addresses in the page table entries with the corresponding machine addresses according to its maintained mapping f, and finally load the modified page table into the MMU, allowing the MMU to directly complete the conversion from virtual address to machine address based on the modified page table. The essence of this method is to write the mapping relationship f·g directly into the Guest OS’s page table, replacing the original mapping g.
Shadow Page Table
Full virtualization uses shadow page table technology to achieve memory virtualization. Unlike MMU paravirtualization, the VMM maintains a shadow page table for each page table of the Guest OS and writes the mapping relationship f·g into the shadow page table, while the content of the Guest OS’s page table remains unchanged. Then, the VMM writes the shadow page table into the MMU.

The maintenance of the shadow page table incurs significant time and space overhead. The time overhead mainly arises because the Guest OS does not actively notify the VMM when constructing the page table; the VMM must wait until a page fault occurs in the Guest OS to analyze the cause of the fault and then complete the shadow page table. The space overhead mainly comes from the fact that the VMM needs to support multiple virtual machines running simultaneously, and each Guest OS typically creates a set of page tables for each process running on it. Therefore, the space overhead of the shadow page table will increase rapidly with the number of processes.
Shadow Page Table Cache
To balance time and space overhead, the shadow page table cache technology is generally adopted now, where the VMM maintains a portion of the recently used shadow page tables in memory. A new shadow page table is only constructed when it cannot be found in the cache. Most current virtualization technologies have adopted shadow page table cache technology.
Virtualization Technology of Virtual Machine File System

Institute of Computing Technology, Chinese Academy of Sciences Training Center
To learn more about high-quality courses
Please visit the official website: www.tcict.cn
Or call the consultation hotline: 010-82661221

Long press the image above, scan the QR code to follow the official WeChat!