CN114398147A - Concurrent virtual machine memory space processing method, device, equipment and medium - Google Patents

Concurrent virtual machine memory space processing method, device, equipment and medium Download PDF

Info

Publication number
CN114398147A
CN114398147A CN202111621613.3A CN202111621613A CN114398147A CN 114398147 A CN114398147 A CN 114398147A CN 202111621613 A CN202111621613 A CN 202111621613A CN 114398147 A CN114398147 A CN 114398147A
Authority
CN
China
Prior art keywords
virtual machine
page table
physical memory
target
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111621613.3A
Other languages
Chinese (zh)
Inventor
刘业欣
白波
许秋红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nsfocus Technologies Inc
Nsfocus Technologies Group Co Ltd
Original Assignee
Nsfocus Technologies Inc
Nsfocus Technologies Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nsfocus Technologies Inc, Nsfocus Technologies Group Co Ltd filed Critical Nsfocus Technologies Inc
Priority to CN202111621613.3A priority Critical patent/CN114398147A/en
Publication of CN114398147A publication Critical patent/CN114398147A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention discloses a method, a device, equipment and a medium for processing the memory space of a concurrent virtual machine, wherein when a new first virtual machine is loaded and operated, a target second virtual machine in the same operation environment as the first virtual machine is determined, and the data of a target page table is copied into the page table of a main physical memory of the first virtual machine according to a target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine, so that the data of the first physical page identified by the target page table can be multiplexed, the processing efficiency of the host physical memory space is improved, and the processing is the processing operation of reducing the occupation of the host physical memory space.

Description

Concurrent virtual machine memory space processing method, device, equipment and medium
Technical Field
The present invention relates to the field of virtual machine technologies, and in particular, to a method, an apparatus, a device, and a medium for processing a memory space of a concurrent virtual machine.
Background
In recent years, various types of malicious software are layered endlessly, and in order to detect the malicious software, the prior art adopts a sandbox detection technology, and judges whether the software is the malicious software by running the software in a virtual machine and observing software behaviors. To evade detection, malware usually identifies whether itself is running in a virtual machine by obtaining the size of a memory space. Because the physical memory of the existing real running machine is larger than a preset size, for example, the preset size is 4GB, the malware acquires the size of a physical memory space of a client (guest) of the client system where the malware is located in order to identify whether the malware itself is in the virtual machine, and if the physical memory space of the client is smaller than the preset size, the malware determines that the malware itself is running in the virtual machine.
If a guest physical memory space larger than a preset size is allocated to a virtual machine, a problem occurs that a guest system of the virtual machine loads all non-all-zero data of the guest physical memory space to a host (host) physical memory space, for a 64-bit Windows system, at least 4GB of the host physical memory space must be allocated to one virtual machine, for a real running machine including a dual-to-strong (Xeon) 20-core Central Processing Unit (CPU), the host physical memory space of 128GB can concurrently issue 32 virtual machines at most, and then memory spaces for other purposes are removed, and the concurrent number may be less than 20, but 20 concurrent virtual machines cannot occupy all CPU resources, which may cause waste of CPU resources, so the concurrent number of the virtual machines needs to be increased, the occupied CPU resources are increased, and waste of CPU resources is reduced.
In order to increase the number of concurrency of the virtual machines, the host physical memory space occupied by the concurrent virtual machines needs to be reduced.
In a memory compression method in the prior art, a memory Balloon (Balloon) technology is used to compress host physical memory spaces of multiple concurrent virtual machines, specifically, unused host physical memory spaces are compressed by drivers of the virtual machines, so that overall occupation of the host physical memory spaces is reduced.
In the physical Page Merging method of the concurrent virtual machine in the prior art, a Transparent Page Sharing (TPS) technology and a Kernel name-Page Merging (KSM) technology are used, specifically, physical Page data of a host physical memory space of all concurrently running virtual machines are compared through a virtual machine service program running in a background, and a plurality of physical pages with the Same physical Page data are merged into one physical Page, so that occupation of the host physical memory space of the concurrent virtual machines is reduced.
Because memory compression or memory merging is performed when a plurality of virtual machines operate in the prior art, in order to not affect the execution efficiency of the virtual machines, the time for reducing the occupation consumption of the host physical memory space of the concurrent virtual machine is long in the prior art, and because the time for sandbox detection is short, the same effect of reducing the occupation of the host physical memory space as that in the prior art needs to be achieved on the basis of the time consumed by the prior art in the sandbox detection environment, so when the sandbox detection needs to reduce the processing operation of the occupation of the host physical memory space of the concurrent virtual machine, how to improve the processing efficiency of the host physical memory space is needed to be solved urgently.
Disclosure of Invention
The invention provides a method, a device, equipment and a medium for processing a memory space of a concurrent virtual machine, which are used for solving the problem that the prior art cannot meet the requirement of optimizing memory occupation in a sandbox detection short-time starting process.
The invention provides a concurrent virtual machine memory space processing method, which comprises the following steps:
loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
and copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine.
Further, the copying the data of the target page table to the page table of the main physical memory of the first virtual machine includes:
copying the data of the target page table into a virtual machine management layer (VMM) in a kernel mode, copying the data of the target page table from the VMM and copying the data into a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data of the target page table to a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
calling a user mode interface of a user mode process fork, and copying data of the target page table in page table data of the target second virtual machine process into a page table of the first virtual machine process through the user mode interface of the user mode process fork; or the like, or, alternatively,
calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the user mode process mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is loaded in advance.
Further, after copying the data of the target page table from the VMM and copying the data into the page table of the main physical memory of the first virtual machine, the method further includes:
and adjusting the state of a page table of the main physical memory of the first virtual machine into a non-writable state.
Further, the method further comprises:
if an access violation exit event is detected, acquiring a physical address corresponding to a violation address of the access violation exit event;
judging whether the physical address is the same as the target address of the target physical page or not;
if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the host physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the host physical memory of the first virtual machine into a readable and writable state.
Further, after copying the data of the target page table from the driver layer and copying the data into a page table of a main physical memory of the first virtual machine, the method further includes:
and adjusting the state of the page table of the main physical memory of the first virtual machine into a copy-on-write (COW) state.
Further, after copying, through the user mode interface of the user mode process fork, data of the target page table in the page table data of the target second virtual machine process into the page table of the first virtual machine process, the method further includes:
calling a user mode interface of the user mode process fork, and adjusting the state of a page table of a main physical memory of the first virtual machine into a copy-on-write (COW) state;
and carrying out system initialization operation on the first virtual machine.
Further, after copying the data of the target page table from the memory share through the user mode interface of the user mode process mmap and copying the data of the target page table into the page table of the main physical memory of the first virtual machine, the method further includes:
and calling a user mode interface of the user mode process mmap, and adjusting the state of the page table of the main physical memory of the first virtual machine to be a copy-on-write (COW) state.
Correspondingly, the invention provides a concurrent virtual machine memory space processing device, which comprises:
the determining module is used for loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
and the processing module is used for copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is a physical memory with the largest memory space in a host physical memory space mapped by a guest physical memory space of the virtual machine.
Further, the processing module is specifically configured to copy the data of the target page table to a virtual machine management layer VMM in a kernel mode, copy the data of the target page table from the VMM, and copy the data of the target page table to a page table of a main physical memory of the first virtual machine; or copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data into a page table of a main physical memory of the first virtual machine; or calling a user mode interface of a user mode process fork, and copying data of the target page table in page table data of the target second virtual machine process into a page table of the first virtual machine process through the user mode interface of the user mode process fork; or calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the user mode process mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is pre-loaded.
Further, the processing module is further configured to, after copying the data of the target page table from the VMM and copying the data into the page table of the main physical memory of the first virtual machine, adjust a state of the page table of the main physical memory of the first virtual machine to a non-writable state.
Further, the processing module is further configured to, if an access violation exit event is detected, obtain a physical address corresponding to a violation address of the access violation exit event; judging whether the physical address is the same as the target address of the target physical page or not; if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the host physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the host physical memory of the first virtual machine into a readable and writable state.
Further, the processing module is further configured to, after copying the data of the target page table from the driver layer and copying the data into the page table of the main physical memory of the first virtual machine, adjust a state of the page table of the main physical memory of the first virtual machine to a copy-on-write COW state.
Further, the processing module is further configured to, after copying data of the target page table in the page table data of the target second virtual machine process to the page table of the first virtual machine process through the user mode interface of the user mode process fork, call the user mode interface of the user mode process fork, and adjust the state of the page table of the main physical memory of the first virtual machine to a copy-on-write COW state; and carrying out system initialization operation on the first virtual machine.
Further, the processing module is further configured to copy, through the user mode interface of the user mode process mmap, the data of the target page table from the memory share, and after copying the data of the target page table into the page table of the main physical memory of the first virtual machine, call the user mode interface of the user mode process mmap, and adjust the state of the page table of the main physical memory of the first virtual machine to a copy-on-write COW state.
Accordingly, the present invention provides an electronic device, which includes a processor and a memory, where the memory is used to store program instructions, and the processor is used to implement the steps of any one of the above concurrent virtual machine memory space processing methods when executing a computer program stored in the memory.
Accordingly, the present invention provides a computer readable storage medium storing a computer program, which when executed by a processor implements the steps of any of the above-mentioned concurrent virtual machine memory space processing methods.
The invention provides a method, a device, equipment and a medium for processing the memory space of a concurrent virtual machine, wherein when a new first virtual machine is loaded and operated, a target second virtual machine in the same operation environment as the first virtual machine is determined, and the data of a target page table is copied into the page table of a main physical memory of the first virtual machine according to a target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine, so that the data of the first physical page identified by the target page table can be multiplexed, the processing efficiency of the host physical memory space is improved, and the processing is the processing operation of reducing the occupation of the host physical memory space.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic process diagram of an unstable pixel determining method according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating a method for copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating another example of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating another example of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating another example of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a concurrent virtual machine memory space processing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to improve the processing efficiency of a host physical memory space when sandbox detection requires a processing operation that reduces the occupation of the host physical memory space of a concurrent virtual machine, embodiments of the present invention provide a method, an apparatus, a device, and a medium for processing the host physical memory space of the concurrent virtual machine.
Example 1:
fig. 1 is a schematic process diagram of a method for processing a memory space of a concurrent virtual machine according to an embodiment of the present invention, where the process includes the following steps:
s101: loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine.
The memory space processing method of the concurrent virtual machine provided by the embodiment of the invention is applied to electronic equipment, wherein the electronic equipment can be a tablet computer, a PC, an intelligent terminal and the like, and can also be a server, and the server can be a local server or a cloud server.
When the electronic device performs sandbox detection and processing operation that needs to reduce occupation of host physical memory space of the concurrent virtual machine, in order to improve processing efficiency of the host physical memory space, occupation of the host physical memory space may be reduced when the first virtual machine is loaded and operated. The first virtual machine refers to a new virtual machine which is loaded and run, the new virtual machine is relative to a virtual machine which is loaded and run, and the virtual machine which is loaded and run is referred to as a second virtual machine, wherein the number of the second virtual machines can be one or more.
The electronic device starts to load and run a first virtual machine, in order to reduce the occupation of a host physical memory space, a host physical memory space of a certain loaded second virtual machine can be used, in order to determine a target second virtual machine of the host physical memory space to be used, according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine, a second virtual machine which is the same as the running environment of the first virtual machine is determined, and the second virtual machine is determined as the target second virtual machine of the used host physical memory space.
The operating environment comprises software and hardware, wherein the software refers to an operating system, the hardware comprises a CPU, a memory, a display card, a hard disk and the like, and because the hardware of the virtual machines in the same electronic device is the same, different operating environments of the virtual machines can refer to different operating systems, including Windows, Linux, Unix and the like, and Windows can be subdivided into Windows xp, Windows 7, Windows 10 and the like; or the same operating system but different installed software and patches; it may also be the same operating system, the same software and patches but different snapshot files.
When the second virtual machine is a target second virtual machine having the same execution environment as the first virtual machine, the first virtual machine may use an operating system in a host physical memory space of the target second virtual machine.
S102: and copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine.
According to the determined target second virtual machine, in order to multiplex the data of the first physical page identified by the target page table of the host physical memory of the target second virtual machine, the operating environment of the target second virtual machine is the same as that of the first virtual machine, so that the first virtual machine can use the operating system in the host physical memory space of the target second virtual machine.
Because the host physical memory space of the target second virtual machine is used by the physical page (MMU page) mapped to the guest physical memory space of the target second virtual machine, the memory space of the operating system in the host physical memory space of the target second virtual machine is the main physical memory, and the memory space size of the main physical memory is the largest in the host physical memory space of the target second virtual machine, the first virtual machine can multiplex the data of the first physical page identified by the target page table by copying the data of the target page table of the main physical memory in the embodiment of the present invention.
And copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine. The target Page table records identification information of the physical Page, for example, the identification information may be a Page Frame Number (PFN) of the physical Page. According to a target page table of a main physical memory of a target second virtual machine, a first physical page corresponding to the target page table can be determined, and data of the first physical page identified by the target page table is used according to the target page table.
When a new first virtual machine is loaded and operated, the method of the embodiment of the invention determines a target second virtual machine in the same operation environment as the first virtual machine, and copies the data of a target page table into the page table of a main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in a host physical memory space mapped by a guest physical memory space of the virtual machine, so that the data of a first physical page identified by the target page table can be multiplexed, the processing efficiency of the host physical memory space is improved, and the processing is the processing operation of reducing the occupation of the host physical memory space.
Example 2:
to implement the saving of the target page table to the first guest physical memory space of the first virtual machine, on the basis of the foregoing embodiment, in an embodiment of the present invention, the saving of the target page table to the first guest physical memory space of the first virtual machine includes:
mode 1: and copying the data of the target page table into a virtual Machine management layer (VMM) in a kernel mode, copying the data of the target page table from the VMM and copying the data into a page table of a main physical memory of the first virtual Machine.
In the electronic device, a VMM in a kernel state is included, the VMM is operated in the kernel state of an operating system, and a VMM driver can provide protection mechanisms necessary for virtualization technology.
The electronic equipment copies the data of the target page table into the VMM in the kernel mode, and copies the data of the target page table from the VMM in the kernel mode into the page table of the main physical memory of the first virtual machine. The target page table belongs to a Two-Dimensional page table (Two Dimensional page), also called Secondary Level Address Translation (SLAT).
Fig. 2 is a schematic diagram of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention, as shown in fig. 2, a kernel state and a user state exist in the electronic device, a process of a virtual machine is run in the user state, a VMM is run in the kernel state, a process of a parent virtual machine in fig. 2 is a process of a target second virtual machine, a process of a new virtual machine is a process of the first virtual machine, data of the target page table of the main physical memory in the process of the parent virtual machine is copied into the VMM, and data of the target page table is copied from the VMM and is copied into the page table of the main physical memory of the new virtual machine. The parent virtual machine process is in a suspended state after the snapshot file is loaded and the physical memory space of the host is allocated.
Mode 2: and copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data into a page table of a main physical memory of the first virtual machine.
In the embodiment of the present invention, the data of the target page table may also be copied to a driver layer in the kernel mode, the data of the target page table is copied in the driver layer, and the data of the copied target page table is copied to a page table of a main physical memory of the first virtual machine. The target page table belongs to a process page table, and the process page table is a one-dimensional page table.
Fig. 3 is another schematic diagram of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention, as shown in fig. 3, a kernel mode and a user mode exist in the electronic device, the user mode runs a process of a virtual machine, the kernel mode runs a driver module, a process of a parent virtual machine in the diagram is a process of a target second virtual machine, a process of a new virtual machine is a process of the first virtual machine, data of the target page table of the main physical memory in the process of the parent virtual machine is copied into the driver module, and data of the target page table is copied from the driver module and into a page table of the main physical memory of the new virtual machine.
Mode 3: and calling a user mode interface of a user mode process fork, and copying data of the target page table in the page table data of the target second virtual machine process to the page table of the first virtual machine process through the user mode interface of the user mode process fork.
In the embodiment of the present invention, a user mode interface of the user mode process fork may also be called, and the data of the target page table in the page table data of the target second virtual machine process is copied to the page table of the first virtual machine process through the user mode interface.
The user mode interface is an interface of the target second virtual machine, and the child virtual machine process is invoked through the user mode interface of the fork system to completely copy the memory of the parent virtual machine process, that is, the first virtual machine can completely copy the memory data and the handle of the target second virtual machine through the user mode interface, and the memory data includes data of the target page table.
When the data of the target page table is copied in the third party, no matter the third party is the VMM in the kernel mode or the drive layer in the kernel mode, the cost for copying the data of the target page table is high, the efficiency is low, in order to improve the efficiency for copying the data of the target page table, in the mode 3, the mode of directly copying the data of the target page table is completed by utilizing the function of the Linux kernel, mutual influence among concurrent virtual machines is guaranteed, in the mode 3, the user mode interface of the target second virtual machine is called, and the data of the target page table is directly copied from the page table data of the process of the target second virtual machine.
Fig. 4 is another schematic diagram of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention, as shown in fig. 4, a user mode exists in the electronic device, the user mode runs a process of a virtual machine, a process of a parent virtual machine in the diagram is a process of a target second virtual machine, a process of a new virtual machine is a process of the first virtual machine, and data of the target page table of the parent virtual machine can be copied into the page table of the main physical memory of the new virtual machine through an arrow fork between the process of the parent virtual machine and the process of the new virtual machine.
Mode 4: calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is loaded in advance.
In the embodiment of the present invention, the target second virtual machine loads the snapshot file in advance and allocates a host physical memory space, a memory share is created when the snapshot file corresponding to the first physical page identified by the target page table of the second virtual machine is loaded, the name of the memory share is a name related to the virtual machine operating environment, and after the snapshot file is loaded, the target second virtual machine is in a suspended state.
Therefore, the electronic device may further invoke a user mode interface of the user mode process mmap, directly copy the data of the target page table from the memory share of the target second virtual machine through the user mode interface, and copy the data of the target page table into the page table of the main physical memory of the first virtual machine. The user mode interface is an interface of the first virtual machine.
In the mode 4, a user mode interface of a user mode process mmap of the first virtual machine can be called when the mode of directly copying the data of the target page table is adopted, and in order to ensure that concurrent virtual machines do not influence each other, when the user mode interface of the first virtual machine is called to copy the data of the target page table, the data of the target page table is copied from the memory share of the target second virtual machine.
Fig. 5 is another schematic diagram of copying data of a target page table into a page table of a main physical memory of a first virtual machine according to an embodiment of the present invention, as shown in fig. 5, a user state exists in the electronic device, the user state runs a process of a virtual machine, a process of a parent virtual machine in the diagram is a process of a target second virtual machine, a process of a new virtual machine is a process of the first virtual machine, and data of the target page table in memory sharing of the parent virtual machine can be copied into the page table of the main physical memory of the new virtual machine through an arrow mmap between the process of the parent virtual machine and the process of the new virtual machine.
In the embodiment of the present invention, since a plurality of virtual machines of the same operating environment are concurrently executed in the same system of the electronic device, and all of the virtual machines use the same main physical memory, before the scheme of the embodiment of the present invention is adopted, the virtual machines occupy n × mGB; wherein n is the number of concurrent virtual machines in the same operating environment, and m is the size of a main physical memory occupied by a single virtual machine; after the scheme of the embodiment of the invention is adopted, the virtual machine occupies 2 × mGB, so that the occupation of the host physical memory space of the concurrent virtual machine is reduced.
In the above embodiment, the method 1 is implemented by using a virtualization technology, and the main physical memory of the target second virtual machine is implemented by using the SLAT page table.
A host physical memory space; the mode 2 uses a one-dimensional page table and directly uses a copy-on-write mechanism of the system to realize the use of the main physical memory of the target second virtual machine; the mode 3 is to use the user mode interface and copy-on-write function of the operating system completely to realize the use of the main physical memory of the target second virtual machine; mode 4 uses the main physical memory of the target second virtual machine with a user-mode interface and copy-on-write functionality outside fork.
The mode 1 and the mode 2 need module support, and for the Linux/Unix system, drivers need to be compiled under different kernel versions, which is relatively expensive. Modes 3 and 4 do not need the support of a driving module, and have good universality. However, mode 3 also needs to be reinitialized when running the first virtual machine, and in summary, mode 4 has the least implementation cost and the best versatility.
Example 3:
to implement the normal operation of the first virtual machine, on the basis of the foregoing embodiments, in an embodiment of the present invention, after the copying the data of the target page table from the VMM and copying the data into the page table of the main physical memory of the first virtual machine, the method further includes:
and adjusting the state of a page table of the main physical memory of the first virtual machine into a non-writable state.
In the embodiment of the present invention, after the data of the target page table is copied from the VMM and stored in the page table of the main physical memory of the first virtual machine, in order to prevent the first virtual machine from affecting the target second virtual machine when using the physical page corresponding to the target page table, the state of the page table of the main physical memory of the first virtual machine is further adjusted to be in a non-writable state.
The target page table includes identification information and state information of the target physical page, the state information includes states of readable, writable, executable and the like, and the non-writable state includes two states of readable and executable.
In order to make the first virtual machine operate normally, in the embodiment of the present invention, the method further includes:
if an access violation exit event is detected, acquiring a physical address corresponding to a violation address of the access violation exit event;
judging whether the physical address is the same as the target address of the target physical page or not;
if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the main physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the main physical memory of the first virtual machine into a readable and writable state.
When a first virtual machine runs, an access violation exit event of memory writing may occur, if the access violation exit event is detected, a physical address corresponding to a violation address of the access violation exit event is obtained, whether the physical address is the same as a target address of a target physical page is judged according to the physical address corresponding to the violation address, and if the physical address is the same as the target address, the first virtual machine accesses the physical page identified by the target page table and wants to execute the memory writing operation; and if the physical address is different from the target address, indicating that the first virtual machine access physical page is not the physical page corresponding to the target page table.
When the physical address is determined to be the same as the target address of the target physical page, the VMM applies for a second physical page in the host physical memory space, wherein the size of the memory space of the second physical page is the same as the size of the memory space of the first physical page, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the main physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the main physical memory of the first virtual machine into a readable and writable state.
Example 4:
to implement the normal operation of the first virtual machine, on the basis of the foregoing embodiments, in an embodiment of the present invention, after the copying the data of the target page table from the driver layer and copying the data into the page table of the main physical memory of the first virtual machine, the method further includes:
adjusting a state of a page table of a main physical memory of the first virtual machine to a copy-on-write (COW) state.
In order to implement normal operation of the first virtual machine, in the embodiment of the present invention, after the data of the target page table is copied from the driver layer and copied to the page table of the main physical memory of the first virtual machine by using the method 2 in the above embodiment 2, the state of the page table of the main physical memory of the first virtual machine may be further adjusted to be the COW state.
The COW means that for a physical page of a host physical memory space, the COW can be mapped to a guest physical memory space of multiple virtual machine processes, and the multiple virtual machine processes can read the content of the same physical page at the same time, but when the content of the physical page of a certain process is rewritten, the system automatically creates a new physical page to store the modified data.
Example 5:
in order to implement normal operation of a first virtual machine, on the basis of the foregoing embodiments, in an embodiment of the present invention, after the copying, by the user mode interface of the user mode process fork, data of the target page table in the page table data of the target second virtual machine process into the page table of the first virtual machine process, the method further includes:
calling a user mode interface of the user mode process fork, and adjusting the state of a page table of a main physical memory of the first virtual machine into a copy-on-write (COW) state;
and carrying out system initialization operation on the first virtual machine.
In order to implement normal operation of the first virtual machine, in the embodiment of the present invention, after the data of the target page table is copied and the data of the target page table is copied into the page table of the main physical memory of the first virtual machine in the above-mentioned manner 3 in embodiment 2, the user mode interface of the user mode process fork may be continuously called, so as to adjust the state of the page table of the main physical memory of the first virtual machine to the COW state.
And because when the user mode interface of the user mode process fork is called to copy the data of the target page table, the memory data and the handle of the target second virtual machine can be completely copied, so that the first virtual machine is completely the same as the target second virtual machine and is also completely the same as other external interfaces, and a plurality of virtual machine processes cannot be concurrent at this time, the initialization operation of the newly-launched first virtual machine is also required to be carried out, including controlling the first virtual machine to use a new virtual machine disk image file, carrying out VMM initialization operation again, and reestablishing a socket port communicating with an external program, and the like.
Example 6:
to implement normal operation of the first virtual machine, on the basis of the foregoing embodiments, in an embodiment of the present invention, after the copying, through the user mode interface of the user mode process mmap, the data of the target page table from the memory share, and copying the data of the target page table into the page table of the main physical memory of the first virtual machine, the method further includes:
and calling a user mode interface of the user mode process mmap, and adjusting the state of the page table of the main physical memory of the first virtual machine to be a copy-on-write (COW) state.
In order to implement normal operation of the first virtual machine, in the embodiment of the present invention, after the data of the target page table is copied from the memory sharing and the data of the target page table is copied into the page table of the main physical memory of the first virtual machine in the manner 4 in the above embodiment 2, the user state interface of the user state process mmap may be continuously called, and the state of the page table of the main physical memory of the first virtual machine is adjusted to the COW state.
Example 7:
on the basis of the foregoing embodiments, fig. 6 is a schematic structural diagram of a concurrent virtual machine memory space processing apparatus according to an embodiment of the present invention, where the apparatus includes:
a determining module 601, configured to load and run a first virtual machine, and determine a target second virtual machine that is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
a processing module 602, configured to copy, according to a target page table of a main physical memory of the target second virtual machine, data of the target page table into a page table of the main physical memory of the first virtual machine, where the main physical memory is a physical memory with a largest memory space in a host physical memory space mapped by a guest physical memory space of the virtual machine.
Further, the processing module is specifically configured to copy the data of the target page table to a virtual machine management layer VMM in a kernel mode, copy the data of the target page table from the VMM, and copy the data of the target page table to a page table of a main physical memory of the first virtual machine; or copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data into a page table of a main physical memory of the first virtual machine; calling a user mode interface of a user mode process fork, and copying data of the target page table in page table data of the target second virtual machine process into a page table of the first virtual machine process through the user mode interface of the user mode process fork; or calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the user mode process mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is pre-loaded.
Further, the processing module is further configured to, after copying the data of the target page table from the VMM and copying the data into the page table of the main physical memory of the first virtual machine, adjust a state of the page table of the main physical memory of the first virtual machine to a non-writable state.
Further, the processing module is further configured to, if an access violation exit event is detected, obtain a physical address corresponding to a violation address of the access violation exit event; judging whether the physical address is the same as the target address of the target physical page or not; if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the host physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the host physical memory of the first virtual machine into a readable and writable state.
Further, the processing module is further configured to, after copying the data of the target page table from the driver layer and copying the data into the page table of the main physical memory of the first virtual machine, adjust a state of the page table of the main physical memory of the first virtual machine to a copy-on-write COW state.
Further, the processing module is further configured to, after copying data of the target page table in the page table data of the target second virtual machine process to the page table of the first virtual machine process through the user mode interface of the user mode process fork, call the user mode interface of the user mode process fork, and adjust the state of the page table of the main physical memory of the first virtual machine to a copy-on-write COW state; and carrying out system initialization operation on the first virtual machine.
Further, the processing module is further configured to copy, through the user mode interface of the user mode process mmap, the data of the target page table from the memory share, and after copying the data of the target page table into the page table of the main physical memory of the first virtual machine, call the user mode interface of the user mode process mmap, and adjust the state of the page table of the main physical memory of the first virtual machine to a copy-on-write COW state.
Example 8:
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and on the basis of the foregoing embodiments, an electronic device according to an embodiment of the present invention is further provided, where the electronic device includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704;
the memory 703 has stored therein a computer program which, when executed by the processor 701, causes the processor 701 to perform the steps of:
loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
and copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine.
Further, the processor 701 is specifically configured to, in the copying of the data of the target page table to the page table of the main physical memory of the first virtual machine, include:
copying the data of the target page table into a virtual machine management layer (VMM) in a kernel mode, copying the data of the target page table from the VMM and copying the data into a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data of the target page table to a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
calling a user mode interface of a user mode process fork, and copying data of the target page table in page table data of the target second virtual machine process into a page table of the first virtual machine process through the user mode interface of the user mode process fork; or the like, or, alternatively,
calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the user mode process mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is loaded in advance.
Further, after the processor 701 is further configured to copy the data of the target page table from the VMM and copy the data of the target page table into a page table of a main physical memory of the first virtual machine, the method further includes:
and adjusting the state of a page table of the main physical memory of the first virtual machine into a non-writable state.
Further, the processor 701 is further configured to, if an access violation exit event is detected, obtain a physical address corresponding to a violation address of the access violation exit event;
judging whether the physical address is the same as the target address of the target physical page or not;
if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the host physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the host physical memory of the first virtual machine into a readable and writable state.
Further, after the processor 701 is further configured to copy the data of the target page table from the driver layer and copy the data into a page table of a main physical memory of the first virtual machine, the method further includes:
and adjusting the state of the page table of the main physical memory of the first virtual machine into a copy-on-write (COW) state.
Further, the processor 701 is further configured to, after the copying, through the user mode interface of the user mode process fork, data of the target page table in the page table data of the target second virtual machine process into the page table of the first virtual machine process, the method further includes:
calling a user mode interface of the user mode process fork, and adjusting the state of a page table of a main physical memory of the first virtual machine into a copy-on-write (COW) state;
and carrying out system initialization operation on the first virtual machine.
Further, after the processor 701 is further configured to copy, through the user mode interface of the user mode process mmap, the data of the target page table from the memory share, and copy the data of the target page table into the page table of the main physical memory of the first virtual machine, the method further includes:
and calling a user mode interface of the user mode process mmap, and adjusting the state of the page table of the main physical memory of the first virtual machine to be a copy-on-write (COW) state.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 702 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital instruction processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
Example 9:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, where the computer program is executed by a processor to perform the following steps:
loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
and copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine.
Further, the copying the data of the target page table to the page table of the main physical memory of the first virtual machine includes:
copying the data of the target page table into a virtual machine management layer (VMM) in a kernel mode, copying the data of the target page table from the VMM and copying the data into a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data of the target page table to a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
calling a user mode interface of a user mode process fork, and copying data of the target page table in page table data of the target second virtual machine process into a page table of the first virtual machine process through the user mode interface of the user mode process fork; or the like, or, alternatively,
calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the user mode process mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is loaded in advance.
Further, after copying the data of the target page table from the VMM and copying the data into the page table of the main physical memory of the first virtual machine, the method further includes:
and adjusting the state of a page table of the main physical memory of the first virtual machine into a non-writable state.
Further, the method further comprises:
if an access violation exit event is detected, acquiring a physical address corresponding to a violation address of the access violation exit event;
judging whether the physical address is the same as the target address of the target physical page or not;
if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the host physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the host physical memory of the first virtual machine into a readable and writable state.
Further, after copying the data of the target page table from the driver layer and copying the data into a page table of a main physical memory of the first virtual machine, the method further includes:
and adjusting the state of the page table of the main physical memory of the first virtual machine into a copy-on-write (COW) state.
Further, after copying, through the user mode interface of the user mode process fork, data of the target page table in the page table data of the target second virtual machine process into the page table of the first virtual machine process, the method further includes:
calling a user mode interface of the user mode process fork, and adjusting the state of a page table of a main physical memory of the first virtual machine into a copy-on-write (COW) state;
and carrying out system initialization operation on the first virtual machine.
Further, after copying the data of the target page table from the memory share through the user mode interface of the user mode process mmap and copying the data of the target page table into the page table of the main physical memory of the first virtual machine, the method further includes:
and calling a user mode interface of the user mode process mmap, and adjusting the state of the page table of the main physical memory of the first virtual machine to be a copy-on-write (COW) state.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A concurrent virtual machine memory space processing method is characterized by comprising the following steps:
loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
and copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is the physical memory with the largest memory space in the host physical memory space mapped by the guest physical memory space of the virtual machine.
2. The method of claim 1, wherein copying data of the target page table into a page table of a main physical memory of the first virtual machine comprises:
copying the data of the target page table into a virtual machine management layer (VMM) in a kernel mode, copying the data of the target page table from the VMM and copying the data into a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
copying the data of the target page table to a drive layer of a kernel mode, copying the data of the target page table from the drive layer and copying the data of the target page table to a page table of a main physical memory of the first virtual machine; or the like, or, alternatively,
calling a user mode interface of a user mode process fork, and copying data of the target page table in page table data of the target second virtual machine process into a page table of the first virtual machine process through the user mode interface of the user mode process fork; or the like, or, alternatively,
calling a user mode interface of a user mode process mmap, copying data of the target page table from memory sharing through the user mode interface of the user mode process mmap, and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, wherein the memory sharing is created when a snapshot file of a first physical page identified by the target page table of the second virtual machine is loaded in advance.
3. The method of claim 2, wherein after copying the data of the target page table from the VMM and into a page table of a main physical memory of the first virtual machine, the method further comprises:
and adjusting the state of a page table of the main physical memory of the first virtual machine into a non-writable state.
4. The method of claim 3, further comprising:
if an access violation exit event is detected, acquiring a physical address corresponding to a violation address of the access violation exit event;
judging whether the physical address is the same as the target address of the target physical page or not;
if so, the VMM applies for a second physical page with the same memory space size as the first physical page identified by the target page table in a host physical memory space, copies the data of the first physical page into the second physical page, updates the identification information of the first physical page recorded by the page table of the host physical memory of the first virtual machine into the identification information of the second physical page, and adjusts the state of the page table of the host physical memory of the first virtual machine into a readable and writable state.
5. The method of claim 2, wherein after copying data of the target page table from the driver layer and into a page table of a main physical memory of the first virtual machine, the method further comprises:
and adjusting the state of the page table of the main physical memory of the first virtual machine into a copy-on-write (COW) state.
6. The method of claim 2, wherein after copying, by the user mode interface of the user mode process fork, the data of the target page table in the page table data of the target second virtual machine process into the page table of the first virtual machine process, the method further comprises:
calling a user mode interface of the user mode process fork, and adjusting the state of a page table of a main physical memory of the first virtual machine into a copy-on-write (COW) state;
and carrying out system initialization operation on the first virtual machine.
7. The method of claim 2, wherein after copying the data of the target page table from the memory share through the user mode interface of the user mode process mmap and copying the data of the target page table into a page table of a main physical memory of the first virtual machine, the method further comprises:
and calling a user mode interface of the user mode process mmap, and adjusting the state of the page table of the main physical memory of the first virtual machine to be a copy-on-write (COW) state.
8. A concurrent virtual machine memory space processing apparatus, the apparatus comprising:
the determining module is used for loading and running a first virtual machine, and determining a target second virtual machine which is the same as the running environment of the first virtual machine according to the running environment of the first virtual machine and the running environment of each loaded second virtual machine;
and the processing module is used for copying the data of the target page table into the page table of the main physical memory of the first virtual machine according to the target page table of the main physical memory of the target second virtual machine, wherein the main physical memory is a physical memory with the largest memory space in a host physical memory space mapped by a guest physical memory space of the virtual machine.
9. An electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory has stored therein a computer program which, when executed by the processor, causes the processor to perform the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that it stores a computer program executable by a processor, which program, when run on the processor, causes the processor to carry out the method of any one of claims 1-7.
CN202111621613.3A 2021-12-28 2021-12-28 Concurrent virtual machine memory space processing method, device, equipment and medium Pending CN114398147A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111621613.3A CN114398147A (en) 2021-12-28 2021-12-28 Concurrent virtual machine memory space processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111621613.3A CN114398147A (en) 2021-12-28 2021-12-28 Concurrent virtual machine memory space processing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114398147A true CN114398147A (en) 2022-04-26

Family

ID=81228273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111621613.3A Pending CN114398147A (en) 2021-12-28 2021-12-28 Concurrent virtual machine memory space processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114398147A (en)

Similar Documents

Publication Publication Date Title
KR101574403B1 (en) Combined virtual graphics device
US9933968B2 (en) Method, system, and device for modifying a secure enclave configuration without changing the enclave measurement
US7421533B2 (en) Method to manage memory in a platform with virtual machines
US10185514B2 (en) Virtual machine trigger
US9176765B2 (en) Virtual machine system and a method for sharing a graphics card amongst virtual machines
KR20070100367A (en) Method, apparatus and system for dynamically reassigning memory from one virtual machine to another
US20060253682A1 (en) Managing computer memory in a computing environment with dynamic logical partitioning
CN107807839B (en) Method and device for modifying memory data of virtual machine and electronic equipment
CN107209683B (en) Backup image restore
US7757034B1 (en) Expansion of virtualized physical memory of virtual machine
US20150006795A1 (en) Memory controller for providing a plurality of defined areas of a mass storage medium as independent mass memories to a master operating system core for exclusive provision to virtual machines
CN101091161B (en) An apparatus and method for cooperative guest firmware
CN111090521A (en) Memory allocation method and device, storage medium and electronic equipment
US9575796B2 (en) Virtual device timeout by memory offlining
US20170147376A1 (en) Input ouput memory management unit based zero copy virtual machine to virtual machine communication
CN114398172A (en) Resource allocation method and device, electronic equipment and computer readable storage medium
US9342477B2 (en) Multi-core processor, controlling method thereof and computer system with such processor
US9766918B2 (en) Virtual system device identification using GPU to host bridge mapping
CN112204521A (en) Processor feature ID response for virtualization
CN114398147A (en) Concurrent virtual machine memory space processing method, device, equipment and medium
US20080072009A1 (en) Apparatus and method for handling interrupt disabled section and page pinning apparatus and method
TWI452468B (en) Method for sharing memory of virtual machine and computer system using the same
JP5417303B2 (en) Virtual computer system and installation method thereof
US11734182B2 (en) Latency reduction for kernel same page merging
CN112162830B (en) Quick starting method of virtual machine, storage medium and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination