Virtual Machine Memory Snapshot Management via Page Table Copying
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing virtual machine memory snapshot solutions are slow due to the need to suspend the virtual machine and write memory data to a disk, affecting their usability in real-world scenarios.
Innovation Solution
A method and apparatus for managing memory snapshots by suspending a virtual machine, copying its two-level page table to create a snapshot page table with read-only identifiers, increasing reference counts of memory pages, and restoring the virtual machine, allowing snapshots to be created and managed without writing to disk, thus improving speed.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If memory data is written to disk to create a snapshot, then the snapshot is persistent and reliable, but the operation becomes very slow
Solution Approach 1:
The patent creates a copy of the virtual machine's page table structure in memory to represent the snapshot state, rather than writing actual memory data to disk. This page table copy points to the same memory pages as the original VM, creating a reference-based snapshot that is both fast to create and reliable for restoration purposes.
Solution Approach 2:
The patent introduces a page table structure as an intermediary layer between the virtual machine memory and the snapshot representation. This page table acts as a mediator that can be quickly copied and modified to create snapshots without directly copying or writing the underlying memory data, thus improving speed while maintaining reliability through the page table's ability to restore the original state.
2Manufacturing precision
If the virtual machine is suspended to create a snapshot, then the snapshot captures the exact state, but the suspension causes service interruption
Solution Approach 1:
The patent performs preliminary actions by setting up the page table structure and establishing the snapshot reference state before the VM needs to be restored. The page table is prepared with the correct state information in advance, so when restoration is needed, the VM can quickly resume without lengthy suspension periods, while still capturing the exact state through the pre-prepared page table.
Solution Approach 2:
Instead of suspending the VM to copy memory contents, the patent copies the page table structure which indirectly represents the memory state. This copying approach captures the exact state information needed while requiring minimal VM suspension time, as the page table is a smaller and faster-to-copy structure compared to full memory contents.
3Manufacturing precision
If all memory pages are copied to create a snapshot, then the snapshot is complete and accurate, but the memory consumption increases significantly
Solution Approach 1:
The patent copies only the page table structure rather than all memory pages to create a snapshot representation. This selective copying approach maintains snapshot completeness by preserving the page table's ability to map and restore memory state, while dramatically reducing memory consumption by avoiding duplication of the actual memory page contents.
Solution Approach 2:
The patent uses a nested structure where the snapshot is represented by a page table that contains references to existing memory pages rather than containing the page data directly. This nested reference structure achieves complete snapshot representation while minimizing memory usage, as the snapshot metadata (page table) is small compared to the actual memory contents it references.
Data Source
AI summary
Provided in the present disclosure are a memory and apparatus for managing a memory snapshot, a device, and a medium. The method includes: when a memory snapshot generation command is acquired, a virtual machine is suspended; a two-level page table of the virtual machine is copied to obtain a first snapshot page table, and a read-only identifier is set for each of page table entries of the two-level page table; and memory pages corresponding to page table entries of the first snapshot page table are acquired by means of the page table entries of the first snapshot page table, a reference count of each of the memory pages is increased, and the virtual machine is restored from a suspended state to a running state.


