Operating system hot-backup method and apparatus based on virtual machine, and device and medium

By setting up mutually backed-up operating systems in virtual machines and quickly switching the frozen backup operating system to the running state, the problems of high cost and time-consuming abnormal recovery of the virtual machine Guest operating system are solved, and efficient hot backup recovery is achieved.

WO2025195433A1PCT designated stage Publication Date: 2025-09-25BEIJING HORIZON INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/083593
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-20
Filing Date
2025-03-19
Publication Date
2025-09-25

AI Technical Summary

Technical Problem

In the existing technology, when the guest operating system of a virtual machine is abnormal, the recovery process requires redundant hardware or a full system restart, resulting in high costs and long time.

Method used

By setting up two operating systems that back up each other in the virtual machine, one is in running state and the other is in frozen state, when an abnormality is detected in the running operating system, the frozen backup operating system is quickly switched to the running state to achieve hot backup.

Benefits of technology

Improves the abnormal recovery efficiency of the operating system, shortens the recovery time, and reduces hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025083593_25092025_PF_FP_ABST
    Figure CN2025083593_25092025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present disclosure are an operating system hot-backup method and apparatus based on a virtual machine, and a device and a medium. The method comprises: in response to detecting that a first operating system, which is currently run by a virtual machine, is abnormal, stopping the running of the first operating system; controlling a second operating system, which corresponds to the virtual machine and serves as a backup, to switch from a first frozen state to a running state, wherein the first frozen state is a state in which the second operating system executes a freezing instruction to freeze; and taking the second operating system as a currently running operating system for running an application. The embodiments of the present disclosure are conducive to improving the efficiency of an operating system being restored from an anomaly, and shortening consumed time, and are also conducive to reducing hardware costs.
Need to check novelty before this filing date? Find Prior Art

Description

Virtual machine-based operating system hot backup method, device, equipment, and medium

[0001] This disclosure claims priority to a Chinese patent application filed with the State Intellectual Property Office on March 20, 2024, with application number CN202410324267.X and invention name “Method, device, equipment and medium for hot backup of operating system based on virtual machine”, the entire contents of which are incorporated by reference into this disclosure. Technical Field

[0002] The present disclosure relates to computer technology, and in particular to a method, apparatus, device and medium for hot backup of an operating system based on a virtual machine. Background Art

[0003] To fully utilize a computer's hardware resources, virtualization technology can simulate multiple virtual hosts (VMs) on a single computer, enabling the concurrent running of multiple operating systems. Rapid recovery from guest operating system (OS) failures is a critical security issue. Summary of the Invention

[0004] The embodiments of the present disclosure provide a virtual machine-based operating system hot backup method, apparatus, device, and medium, which can improve the abnormal recovery efficiency of the operating system, shorten the time consumption, and reduce the cost.

[0005] One aspect of an embodiment of the present disclosure provides a virtual machine-based operating system hot backup method, comprising: in response to detecting an abnormality in a first operating system currently running on the virtual machine, stopping the operation of the first operating system; controlling a second operating system corresponding to the virtual machine as a backup to switch from a first frozen state to a running state; the first frozen state is a state in which the second operating system executes a freeze instruction to freeze the second operating system; and using the second operating system as the currently running operating system for running applications.

[0006] Another aspect of the embodiments of the present disclosure provides an operating system hot backup device based on a virtual machine, including: a first processing module, used to stop running the first operating system in response to detecting an abnormality in the first operating system currently running on the virtual machine; a second processing module, used to control the second operating system corresponding to the virtual machine as a backup to switch from a first frozen state to a running state; the first frozen state is a state in which the second operating system executes a freeze instruction to freeze; and a third processing module, used to use the second operating system as the currently running operating system for running applications.

[0007] In another aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the virtual machine-based operating system hot backup method described in any of the above embodiments of the present disclosure.

[0008] Another aspect of the embodiments of the present disclosure provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the virtual machine-based operating system hot backup method described in any of the above embodiments of the present disclosure.

[0009] In another aspect of the embodiments of the present disclosure, a computer program product is provided. When instructions in the computer program product are executed by a processor, the virtual machine-based operating system hot backup method provided in any of the above embodiments of the present disclosure is executed.

[0010] Based on the virtual machine-based operating system hot backup method, apparatus, equipment and medium provided by the above-mentioned embodiments of the present disclosure, when an abnormality is detected in the first operating system currently running on the virtual machine, the first operating system can be stopped; the second operating system corresponding to the virtual machine as a backup is controlled to switch from a first frozen state to a running state; and the second operating system is used as the currently running operating system to run the application. The method of the embodiment of the present disclosure sets two operating systems that back up each other for the virtual machine. When one operating system is in a running state, the other operating system is in a frozen state. As a backup operating system, when an abnormality is detected in the operating system in the running state, the backup operating system can be quickly switched from a frozen state to a running state, so that the application can be quickly put into operation, thereby realizing hot backup of the operating system using a hardware resource corresponding to the virtual machine. On the one hand, it helps to improve the efficiency of abnormal recovery of the operating system and shorten the time consumption, and on the other hand, it helps to reduce hardware costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] FIG1 is an exemplary application scenario of the virtual machine-based operating system hot backup method provided by the present disclosure;

[0012] FIG2 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by an exemplary embodiment of the present disclosure;

[0013] FIG3 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0014] FIG4 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0015] FIG5 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0016] FIG6 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0017] FIG7 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0018] FIG8 is a flow chart of a method for hot backup of an operating system based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0019] FIG9 is a schematic diagram of memory snapshot information provided by an exemplary embodiment of the present disclosure;

[0020] FIG10 is a schematic diagram of a computer virtualization architecture provided by an exemplary embodiment of the present disclosure;

[0021] FIG11 is a schematic diagram of an operating system hot backup architecture based on a virtual machine provided by an exemplary embodiment of the present disclosure;

[0022] FIG12 is a schematic diagram of an initialization process of an operating system provided by an exemplary embodiment of the present disclosure;

[0023] FIG13 is a schematic diagram of a switching process when an operating system is abnormal according to an exemplary embodiment of the present disclosure;

[0024] FIG14 is a schematic diagram of memory address allocation provided by an exemplary embodiment of the present disclosure;

[0025] FIG15 is a schematic diagram of a two-level mapping principle of an operating system accessing memory provided by an exemplary embodiment of the present disclosure;

[0026] FIG16 is a schematic diagram of an operating system freeze / recovery process according to an exemplary embodiment of the present disclosure;

[0027] FIG17 is a schematic structural diagram of an operating system hot backup device based on a virtual machine provided by an exemplary embodiment of the present disclosure;

[0028] FIG18 is a schematic structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0029] FIG19 is a schematic structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0030] FIG20 is a structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0031] FIG21 is a structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure;

[0032] FIG22 is a structural diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0033] To explain the present disclosure, example embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. It should be understood that the present disclosure is not limited to the example embodiments.

[0034] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0035] Overview of the Disclosure

[0036] In the process of realizing the present disclosure, the inventors discovered that in order to fully utilize the hardware resources of a computer, virtualization technology can simulate multiple virtual hosts (i.e., virtual machines, or VMs for short) on a single computer, so as to achieve the purpose of running multiple operating systems in parallel on a single computer. Rapid recovery of a virtual machine's Guest (client operating system) when an abnormality occurs is a key issue concerning security. If dual-machine backup is used to achieve abnormal recovery of the operating system, two identical hardware devices need to be run in parallel, i.e., redundant hardware devices are required, which is costly. If the entire hardware and software system is restarted to achieve abnormal recovery of the operating system, multiple startup stages are required, which takes too long.

[0037] Exemplary Overview

[0038] FIG1 is an exemplary application scenario of the operating system hot backup method based on a virtual machine provided by the present disclosure. As shown in FIG1 , one or more virtual machines may be included on a computer device, each virtual machine may independently run an operating system (OS), and multiple virtual machines may run multiple operating systems in parallel. APP represents a user-mode application (which may be referred to as an application) under an operating system. Utilizing the operating system hot backup method based on a virtual machine disclosed in the present disclosure, for any virtual machine, the virtual machine can be managed by the virtualization management program (VMM) corresponding to the virtual machine to implement hot backup of the operating system. Specifically, when an abnormality is detected in the first operating system currently running on the virtual machine, the first operating system can be stopped; the second operating system corresponding to the virtual machine as a backup can be controlled to switch from a first frozen state to a running state; the first frozen state can be a state in which the second operating system executes a freeze instruction to freeze; and then the second operating system can be used as the currently running operating system to run the application. The method disclosed in the present disclosure sets up two operating systems that back up each other based on virtual machines. When one operating system is in a running state, the other operating system is in a frozen state. As a backup operating system, the backup operating system in a frozen state can wait to switch to a running state at any time. When an abnormality is detected in the running operating system, the backup operating system can be quickly switched from the frozen state to the running state, so that the application can be put into operation quickly. In this way, a hot backup of the operating system can be achieved by using the hardware resources corresponding to the virtual machine. On the one hand, it helps to improve the efficiency of abnormal recovery of the operating system and shorten the time. On the other hand, it helps to reduce hardware costs.

[0039] Exemplary Methods

[0040] FIG2 is a flow chart of a virtual machine-based operating system hot backup method provided by an exemplary embodiment of the present disclosure. The method provided in this embodiment can be applied to electronic devices, such as vehicle-mounted computing platforms, system-on-chips, mobile phones, tablets, and other terminal devices. As shown in FIG2 , the method of this embodiment of the present disclosure may include the following steps:

[0041] Step 201: In response to detecting an abnormality in a first operating system currently running on a virtual machine, stop running the first operating system.

[0042] In some optional embodiments, the first operating system can be the master operating system and the second operating system can be the replica operating system. When the virtual machine is started, the first operating system can be the default running operating system and the second operating system can be the backup operating system.

[0043] In some optional embodiments, the first operating system may also be a slave operating system, and the second operating system may be a master operating system.

[0044] In some optional embodiments, the first operating system abnormality may include a virtual machine (or guest) actively triggering a restart or shutdown of the first operating system through a command (the first operating system is considered abnormal), the system's internal panic mechanism determining the first operating system abnormality when the application encounters an error that cannot be handled, the virtual watchdog timeout of the system operation, the virtualization management program encountering an unhandled guest abnormality, and so on. These abnormalities can trigger the state switching of the operating system of the embodiment of the present disclosure. For the abnormality of the first operating system currently running on the virtual machine, any feasible detection method can be used for detection. For example, for the abnormality of actively triggering the restart of the first operating system through a command, it can be determined whether the first operating system abnormality is detected by detecting the restart command or the shutdown command. For the virtual watchdog timeout, it can be determined whether the first operating system abnormality is detected by detecting the timeout state of the virtual watchdog.

[0045] In some optional embodiments of the present disclosure, when an abnormality is detected in the first operating system, the first operating system may be stopped. For example, the first operating system may be stopped by shutting down processing resources corresponding to the first operating system. The processing resources may include, for example, processor resources (e.g., vCPUs), interrupt resources (IRQs), etc. Interrupt resources may refer to resources used by external hardware to send interrupt signals to the operating system.

[0046] In an optional example, step 201 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the first processing module executed by the processor.

[0047] Step 202: Control the second operating system corresponding to the virtual machine and serving as a backup to switch from a first frozen state to a running state.

[0048] The first freezing state is a state in which the second operating system executes a freezing instruction to freeze the second operating system.

[0049] In some optional embodiments, for any virtual machine, two operating system virtual machine structure instances (referred to as structures for short) can be configured, namely a first operating system and a second operating system. When the first operating system is the currently running operating system, the second operating system serves as the backup operating system corresponding to the virtual machine, and the second operating system is in a frozen state (referred to as a first frozen state). The freeze instruction can be preset at a preset position in the system program (image file or image data) of the second operating system. When the second operating system runs to a certain stage, which can be, for example, the completion of the initialization of the second operating system, the freeze instruction can be executed. Executing the freeze instruction causes the second operating system to enter a frozen state. In the frozen state, the processing resources corresponding to the second operating system, except for the processing resources for starting the second operating system, are turned off, such as noboot vCPUs (non-boot virtual processors), interrupt resources (irqs), etc., and the user-mode application under the second operating system is in a waiting state. When the second operating system switches from the first frozen state to the running state, the application can be quickly put into operation.

[0050] In some optional embodiments, after the second operating system switches from the first frozen state to the running state, it can continue to run from the state in which it was running when the freeze instruction was executed, thereby achieving rapid recovery of the operating system abnormality.

[0051] In some optional embodiments, at the same time, either the first operating system or the second operating system can be the currently running operating system of the virtual machine, which is in a running state, while the other operating system, serving as a backup operating system, is in a frozen state. If the currently running operating system experiences an abnormality, the backup operating system corresponding to the virtual machine is switched to the currently running operating system. For example, the second operating system can be the currently running operating system of the virtual machine. In response to detecting an abnormality in the second operating system, the second operating system is stopped, and the first operating system, serving as the backup operating system, corresponding to the virtual machine, is controlled to switch from the second frozen state to the running state.

[0052] In an optional example, step 202 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a second processing module executed by the processor.

[0053] Step 203: Use the second operating system as the currently running operating system to run the application program.

[0054] After the second operating system is switched from the first frozen state to the running state, the second operating system can be used as the operating system currently running on the virtual machine. The application is a user-mode application corresponding to the second operating system, and the user-mode application corresponding to the second operating system can be quickly put into operation from the waiting state.

[0055] In some optional embodiments of the present disclosure, switching between the first operating system and the second operating system can be achieved through the virtualization management program (VMM) corresponding to the virtual machine. Specifically, after the first operating system fails, the VMM can capture the corresponding exception event and trigger a restore action on the backup second operating system, restoring the second operating system to an initialized and runnable state, achieving rapid recovery from the exception and allowing the application to be quickly put into operation.

[0056] In an optional example, step 203 may be executed by the processor calling a corresponding instruction stored in the memory, or may be executed by a third processing module executed by the processor.

[0057] The virtual machine-based operating system hot backup method provided in this embodiment can stop running the first operating system when detecting an abnormality in the first operating system currently running on the virtual machine; control the second operating system corresponding to the virtual machine as a backup to switch from a first frozen state to a running state; and use the second operating system as the currently running operating system to run the application. The method of the disclosed embodiment sets up two operating systems that back up each other based on a virtual machine. When one operating system is in a running state, the other operating system is in a frozen state. As a backup operating system, when an abnormality is detected in the operating system in the running state, the backup operating system can be quickly switched from a frozen state to a running state, so that the application can be quickly put into operation, thereby using a hardware resource corresponding to the virtual machine to achieve hot backup of the operating system. On the one hand, it helps to improve the efficiency of abnormal recovery of the operating system and shorten the time consumption; on the other hand, it helps to reduce hardware costs.

[0058] In some optional embodiments, stopping the first operating system in step 201 may include: stopping processes and / or threads corresponding to the first operating system, and disabling interrupt resources corresponding to the first operating system.

[0059] The process corresponding to the first operating system is an execution process of the system program of the first operating system. A thread is a single sequential control process in program execution, the smallest unit of program execution flow, and the basic unit of processor scheduling and dispatching. A process can have one or more threads, and the program memory space is shared between the threads. The operation of the first operating system is stopped by stopping the process and / or thread. Turning off the interrupt resource corresponding to the first operating system can be expressed as prohibiting external hardware from sending interrupt signals to the first operating system, and / or prohibiting the first operating system from responding to interrupt signals sent by external hardware.

[0060] This embodiment stops the operation of the first operating system by stopping the processes and / or threads corresponding to the first operating system and closing the interrupt resources corresponding to the first operating system, thereby releasing resources. This can provide sufficient resources for the operation of the second operating system, thereby improving resource utilization and achieving hot backup of the operating system with fewer resources.

[0061] FIG3 is a flow chart of an operating system hot backup method based on a virtual machine provided by another exemplary embodiment of the present disclosure.

[0062] In some optional embodiments, as shown in FIG3 , after stopping the first operating system, the method of the embodiment of the present disclosure may further include:

[0063] Step 301: Reset the first operating system to a second frozen state to serve as a backup operating system for the second operating system.

[0064] The second freezing state is similar to the first freezing state described above and will not be described in detail here.

[0065] In some optional embodiments, resetting the first operating system to a second frozen state can be achieved by resetting the memory state and structure state corresponding to the first operating system to the state corresponding to the time of freezing. The memory state may include the state of the memory used by the first operating system at the time of freezing, the memory state may include the private memory state corresponding to the first operating system, and if the first operating system also uses shared memory, the memory state may also include the shared memory state. The structure information is used to describe the resource information corresponding to the first operating system. The resource information may include memory resource information, virtual processor (vCPU) information, interrupt request resource (IRQ, also known as interrupt resource) information, input / output (I / O) virtualization program (virtio) information, DTB (Device Tree Blob) information, etc. The DTB is a binary file stored in the virtual machine that describes the hardware resources and configuration information of the virtual machine and is used to manage hardware resources for the operating system. The operating system can use the DTB to identify and configure the virtual machine's driver. The virtual processor is the CPU within the virtual machine. The IRQ represents the action of executing a hardware interrupt request and is used to stop the working state of the relevant hardware. Virtio is a set of I / O device virtualization programs. It abstracts a group of I / O devices in the paravirtualization management program (Hypervisor) and is used to provide a communication framework and programming interface between upper-layer applications and each hypervisor virtualization device.

[0066] In an optional example, step 301 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a fourth processing module executed by the processor.

[0067] This embodiment resets the first operating system to the second frozen state to serve as a backup operating system for the second operating system. When an abnormality occurs in the second operating system, the first operating system can be quickly switched from the second frozen state to the running state, thereby realizing a cyclic hot backup of the operating system.

[0068] FIG4 is a flow chart of an operating system hot backup method based on a virtual machine provided by yet another exemplary embodiment of the present disclosure.

[0069] In some optional embodiments of the present disclosure, the second frozen state may include a first private memory state and a first structure state corresponding to the first operating system.

[0070] Resetting the first operating system to the second frozen state in step 301 may include:

[0071] Step 3011: Reset the first private memory state corresponding to the first operating system based on the stored first memory snapshot information corresponding to the first operating system in the frozen state.

[0072] The first memory snapshot information may include first private memory snapshot information of a private memory corresponding to the first operating system in a frozen state.

[0073] In some optional embodiments, the first memory snapshot information may be stored when the first operating system enters a frozen state. The first memory snapshot information may be stored in a preset storage area. For example, a snapshot memory corresponding to the first operating system may be set to store the first memory snapshot information.

[0074] In some optional embodiments, the first memory snapshot information may further include first shared memory snapshot information of a shared memory corresponding to the first operating system in a frozen state.

[0075] In some optional embodiments, the first memory snapshot information may specifically include address information and data information of the memory used by the first operating system when it is frozen. The data information represents data stored in the memory at the corresponding address.

[0076] In some optional embodiments, the private memory corresponding to the first operating system can be reset to the first private memory state based on the first memory snapshot information. For example, the data can be copied to the memory of the corresponding address based on the address information and data information in the first memory snapshot information to achieve the reset of the private memory corresponding to the first operating system.

[0077] In an optional example, step 3011 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the first processing unit executed by the processor.

[0078] Step 3012: Reset the first structure state of the first operating system based on the stored first structure information corresponding to the first operating system in the frozen state.

[0079] The first structure information may include resource information corresponding to the first operating system in a frozen state.

[0080] In some optional embodiments, the resource information corresponding to the first operating system in the frozen state may include memory resource (memory) information, virtual processor (vCPU) information, interrupt request resource (irq) information, virtio information, dtb information, etc. of the first operating system in the frozen state.

[0081] In some optional embodiments, a virtualization manager (VMM) may create two virtual machine structure instances (referred to as structures for short), wherein one virtual machine structure instance is used to run a first operating system and the other virtual machine structure instance is used to run a second operating system, and resource information corresponding to the first operating system and the second operating system is maintained in real time through the virtual machine structure instance.

[0082] In some optional embodiments, the first structure information may include a virtual machine structure instance and context information. The context information may include, for example, a vCPU thread context and other related information, so that the first operating system can be accurately reset to the second frozen state.

[0083] In an optional example, step 3012 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a second processing unit executed by the processor.

[0084] This embodiment can quickly and accurately reset the first operating system to the second frozen state through the stored first memory snapshot information and first structure information corresponding to the first operating system in the frozen state, and can quickly resolve abnormal problems of the first operating system, so as to facilitate serving as a backup operating system for the second operating system.

[0085] FIG5 is a flow chart of an operating system hot backup method based on a virtual machine provided by another exemplary embodiment of the present disclosure.

[0086] In some optional embodiments, switching the second operating system corresponding to the control virtual machine as a backup from the first frozen state to the running state in step 202 may include:

[0087] Step 2021: Reset the second shared memory state corresponding to the second operating system in the frozen state based on the stored second memory snapshot information corresponding to the second operating system in the frozen state.

[0088] The second memory snapshot information may include second shared memory snapshot information of the shared memory corresponding to the second operating system in a frozen state.

[0089] In some optional embodiments, the second shared memory snapshot information may be snapshot information of the shared memory used by the second operating system in the frozen state. The second shared memory snapshot information may specifically include address information and data information of the shared memory used by the second operating system when frozen. During a reset, the data therein may be copied to the shared memory at the corresponding storage address based on the second public key memory snapshot information, thereby resetting the shared memory corresponding to the second operating system to the shared memory state corresponding to the frozen state.

[0090] In an optional example, step 2021 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a third processing unit executed by the processor.

[0091] Step 2022: Switch the second operating system to a running state based on the second private memory state, the second structure state, and the second shared memory state corresponding to the second operating system in the frozen state.

[0092] The second private memory state and the second structure state may be completed when the second operating system enters a frozen state. For example, after the second operating system executes a freeze instruction during the initialization phase, the private memory state and structure state of the second operating system are frozen in the second private memory state and the second structure state. For another example, during the process of the second operating system abnormally switching to the first operating system, the second operating system may be reset to the first frozen state, thereby resetting the private memory and structure corresponding to the second operating system to the second private memory state and the second structure state. The specific reset method can refer to the reset method of the first private memory state and the first structure state described above, and will not be repeated here.

[0093] In an optional example, step 2022 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a fourth processing unit executed by the processor.

[0094] In this embodiment, when the second operating system needs to be switched from the first frozen state to the running state, that is, when an abnormal operating system switching is required, the shared memory corresponding to the second operating system can be reset to the second shared memory state, and the second private memory state and the second structure state have been initialized or reset in advance. Therefore, the operating system switching speed can be further improved, so that the operating system abnormality can be recovered more quickly.

[0095] In some optional embodiments, switching the second operating system to the running state based on the second private memory state, the second structure state, and the second shared memory state corresponding to the second operating system in the frozen state may include:

[0096] Based on the second private memory state, the second structure state and the second shared memory state, the processing resources of the second operating system are updated from a disabled state to an enabled state, the processes and / or threads of the second operating system are switched from a frozen state to a running state, and the hardware resources corresponding to the second operating system are reset to an idle state, so that the second operating system is switched from the first frozen state to the running state.

[0097] Among them, the processing resources of the second operating system may include noboot vCPU resources, interrupt resources, etc. The non-enabled state of the processing resources indicates that the processing resources are unavailable. When the processing resources of the second operating system are updated to enabled resources, it indicates that the processing resources are available. The frozen state of the processes and / or threads of the second operating system may refer to the state in which the processes and / or threads of the second operating system are frozen when the second operating system enters the frozen state. The hardware resources corresponding to the second operating system may include the hardware IP (Intellectual Property) required for the operation of the second operating system. The hardware IP (also called hardware module) may refer to the design of a circuit module with independent functions.

[0098] In some optional embodiments, when switching the operating system, it can be determined whether each hardware module needs to be reset, and the hardware modules that need to be reset can be reset to an idle state so that the switched operating system (such as the second operating system) can use the corresponding hardware modules normally and implement the corresponding services.

[0099] In some optional embodiments, whether the hardware module needs to be reset can be determined by:

[0100] 1. For fully virtualized IPs, such as the CPU and Generic Interrupt Controller (GIC), the microkernel can provide specific operation interfaces for the operation of such IPs. When the VMM controls the operating system switching, it must call them in a preset manner. Otherwise, the operating system operation is prone to abnormalities.

[0101] 2. Software implements semi-virtualized IP, such as storage-related EMMC (Embedded Multi Media Card). Access operations for this type of IP are implemented on the host side. Operating system switching does not affect the status of the IP, so reset is not required.

[0102] 3. IPs that are directly passed through the virtual machine, that is, IPs that are not virtualized, such as I2C (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), ISP (Image Signal Processing), etc., may have been configured and used by the running operating system before the operating system is switched. After switching the operating system, if such IPs are not reset, the normal operation of the IPs may be affected. Therefore, after switching the operating system, you can check the status of such IPs, such as checking the value of the status register or other registers, to determine whether they need to be reset and initialized.

[0103] This embodiment switches the second operating system from the first frozen state to the running state by updating the processing resources of the second operating system from the disabled state to the enabled state, switching the processes and / or threads of the second operating system from the frozen state to the running state, and resetting the hardware resources corresponding to the second operating system to the idle state. This allows the second operating system to continue running from the initialized state, thereby improving switching efficiency. Moreover, by resetting the hardware resources to the idle state, it can be ensured that the second operating system after switching can correctly use each hardware module.

[0104] FIG6 is a flow chart of an operating system hot backup method based on a virtual machine provided by yet another exemplary embodiment of the present disclosure.

[0105] In some optional embodiments, as shown in FIG6 , before stopping the first operating system in response to detecting an abnormality in the first operating system currently running on the virtual machine in step 201, the method of the embodiment of the present disclosure may further include:

[0106] Step 401: Initialize the second operating system to a first frozen state.

[0107] In some optional embodiments, the second operating system can be initialized to the first frozen state through an initialization process of the second operating system. For example, the second operating system can be started, and a freeze instruction is set at a preset location in the system program of the second operating system. During the startup process, if the second operating system executes the preset freeze instruction, the second operating system enters the first frozen state.

[0108] In an optional example, step 401 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by an initialization module executed by the processor.

[0109] This embodiment initializes the second operating system to the first frozen state so that the second operating system can serve as a backup operating system. When the first operating system is abnormal, the second operating system can be quickly switched from the first frozen state to the running state for running applications.

[0110] In some optional embodiments, before stopping the operation of the first operating system in response to detecting an abnormality in the first operating system currently running on the virtual machine in step 201, it may also include: when an abnormality occurs in the second operating system as the currently running operating system, resetting the second operating system to the first frozen state.

[0111] Here, resetting the second operating system to the first frozen state is similar to resetting the first operating system to the second frozen state, and will not be described in detail here.

[0112] In this embodiment, when an exception occurs in the second operating system as the currently running operating system, the second operating system can be reset to the first frozen state while switching to the first operating system, serving as a backup operating system for the first operating system, thereby implementing a cyclic hot backup of the operating system.

[0113] In some optional embodiments, as shown in FIG6 , before stopping the first operating system in response to detecting an abnormality in the first operating system currently running on the virtual machine in step 201, the method of the embodiment of the present disclosure may further include:

[0114] Step 501: Initialize the first operating system to a second frozen state.

[0115] The initialization of the first operating system to the second frozen state is similar to the initialization of the second operating system to the first frozen state, and will not be described in detail here.

[0116] In an optional example, step 501 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by an initialization module executed by the processor.

[0117] After initializing the second operating system to the first frozen state in step 401, the method may further include:

[0118] Step 502: Switch the first operating system from the second frozen state to the running state, and use it as the currently running operating system for running the application program.

[0119] After the initialization of the first operating system and the second operating system is completed, the first operating system can be switched from the second frozen state to the running state and used as the currently running operating system to run the application program.

[0120] In some optional embodiments, after completing the initialization of the first operating system and the second operating system, the second operating system may be switched from the first frozen state to the running state as the currently running operating system for running application programs, without specific limitation.

[0121] In an optional example, step 502 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a fifth processing module executed by the processor.

[0122] This embodiment initializes both the first operating system and the second operating system to a frozen state, and then uses the first operating system as the currently running operating system, switching from the frozen state to the running state, thereby preparing for the hot backup of the operating system. When the currently running operating system is abnormal, the backup operating system can be quickly switched from the frozen state to the initialized running state to continue running, thereby improving the efficiency of operating system abnormality recovery.

[0123] FIG7 is a flow chart of an operating system hot backup method based on a virtual machine provided by another exemplary embodiment of the present disclosure.

[0124] In some optional embodiments, as shown in FIG7 , initializing the first operating system to the second frozen state in step 501 may include:

[0125] Step 5011: Start the first operating system based on the image data of the first operating system.

[0126] The image data of the first operating system may include a system program of the first operating system. Based on the image data of the first operating system, the system program may be loaded into a private memory corresponding to the first operating system, and the system program may be run to start the first operating system.

[0127] In an optional example, step 5011 may be executed by the processor calling a corresponding instruction stored in a memory, or may be executed by a first startup unit executed by the processor.

[0128] Step 5012: In response to the first operating system executing the freeze instruction, the first operating system switches to a second frozen state and generates first shared memory snapshot information of the first operating system in the frozen state.

[0129] If the first operating system executes the freeze instruction, indicating that the first operating system has been initialized to a preset state and can enter the frozen state, the first operating system switches to the second frozen state. Furthermore, shared memory snapshot information can be generated based on the address information and data information of the shared memory used by the first operating system as the first shared memory snapshot information of the first operating system in the frozen state.

[0130] In an optional example, step 5012 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the first freezing unit executed by the processor.

[0131] Step 5013: Store the first shared memory snapshot information and the first structure information corresponding to the first operating system in the frozen state.

[0132] The first structure information can be found in the above content and will not be elaborated here.

[0133] In some optional embodiments, the first shared memory snapshot information may be stored in a snapshot memory corresponding to the first operating system. The first structure information may be stored in a memory corresponding to the VMM.

[0134] In an optional example, step 5013 may be executed by the processor calling a corresponding instruction stored in the memory, or may be executed by a fifth processing unit executed by the processor.

[0135] This embodiment generates first shared memory snapshot information of the first operating system in a frozen state, stores the first shared memory snapshot information and the first structure information, facilitates the subsequent resetting of the shared memory and virtual machine structure instance of the first operating system, and provides effective data support for operating system switching.

[0136] In some optional embodiments, as shown in FIG7 , initializing the second operating system to the first frozen state in step 401 may include:

[0137] Step 4011: Start the second operating system based on the mirror data of the second operating system.

[0138] In an optional example, step 4011 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the second starting unit executed by the processor.

[0139] Step 4012: In response to the second operating system executing the freeze instruction, the second operating system switches to the first frozen state and generates second shared memory snapshot information of the second operating system in the frozen state.

[0140] In an optional example, step 4012 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by a second freezing unit executed by the processor.

[0141] Step 4013: Store the second shared memory snapshot information and the second structure information corresponding to the second operating system in the frozen state.

[0142] The second structure information includes resource information corresponding to the second operating system in a frozen state.

[0143] The specific operations of the above steps 4011 to 4013 are similar to the initialization process of the above-mentioned first operating system and are not described in detail here.

[0144] In an optional example, step 4013 may be executed by the processor calling a corresponding instruction stored in the memory, or may be executed by a sixth processing unit executed by the processor.

[0145] This embodiment generates second shared memory snapshot information of the second operating system in a frozen state, stores the second shared memory snapshot information and the second structure information, facilitates the subsequent resetting of the shared memory and structure of the second operating system, and provides effective data support for operating system switching.

[0146] FIG8 is a flow chart of an operating system hot backup method based on a virtual machine provided by yet another exemplary embodiment of the present disclosure.

[0147] In some optional embodiments, as shown in FIG8 , the process of initializing the second operating system to the first frozen state in step 401 may further include:

[0148] Step 5014: Generate first private memory snapshot information of the first operating system in a frozen state.

[0149] In some optional embodiments, the first private memory snapshot information may be generated based on the address information and data information of the private memory used by the first operating system in the frozen state.

[0150] In some optional embodiments, the first private memory snapshot information may be asynchronously generated during the process of initializing the second operating system to the first frozen state, which helps to improve initialization efficiency.

[0151] In an optional example, step 5014 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the first generating unit executed by the processor.

[0152] Step 5015: Store the first private memory snapshot information.

[0153] The first shared memory snapshot information and the first private memory snapshot information constitute the first memory snapshot information corresponding to the first operating system. The first private memory snapshot information can be stored in the snapshot memory corresponding to the first operating system.

[0154] In an optional example, step 5015 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the fifth processing unit executed by the processor.

[0155] This embodiment generates and stores first private memory snapshot information of the first operating system in a frozen state during the process of initializing the second operating system to a first frozen state, thereby helping to implement asynchronous processing, improve initialization efficiency, and facilitate subsequent resetting of the private memory of the first operating system, providing effective data support for operating system switching.

[0156] The process of switching the first operating system from the second frozen state to the running state in step 502 may further include:

[0157] Step 4014: Generate second private memory snapshot information of the second operating system in a frozen state.

[0158] The second private memory snapshot information may be generated according to the address information and data information of the private memory used by the second operating system in the frozen state.

[0159] In an optional example, step 4014 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the second generating unit executed by the processor.

[0160] Step 4015: Store the second private memory snapshot information.

[0161] The second shared memory snapshot information and the second private memory snapshot information constitute the second memory snapshot information corresponding to the second operating system. The second private memory snapshot information can be stored in the snapshot memory corresponding to the second operating system.

[0162] In an optional example, step 4015 may be executed by the processor calling corresponding instructions stored in the memory, or may be executed by the sixth processing unit executed by the processor.

[0163] This embodiment generates and stores second private memory snapshot information of the second operating system in the frozen state during the process of switching the first operating system from the second frozen state to the running state. This helps to achieve asynchronous processing, improve the startup efficiency of the operating system, and facilitate the subsequent resetting of the private memory corresponding to the second operating system, providing effective data support for the switching of the operating systems.

[0164] In some optional embodiments, generating the first shared memory snapshot information of the first operating system in the frozen state in step 5012 may include:

[0165] Based on the physical address and length of the first shared memory used when the first operating system executes the freeze instruction, at least one segment of shared sub-memory is determined according to a preset segment length threshold; for any segment of shared sub-memory, snapshot address information of the shared sub-memory is generated based on the physical address and length of the shared sub-memory; based on the snapshot address information of the shared sub-memory and the shared memory data of the shared sub-memory, shared memory snapshot information of the shared sub-memory is generated; and based on the shared memory snapshot information of each shared sub-memory, first shared memory snapshot information is determined.

[0166] The preset segment length threshold can be set to any length value, such as 1MB, 2MB, 3MB, etc. There are no specific limitations. The snapshot address information of any shared sub-memory may include address-related information such as the physical address and length of the shared sub-memory. The shared memory data of the shared sub-memory is the data stored in the shared sub-memory.

[0167] In some optional embodiments, the first shared memory snapshot information may be obtained by arranging the shared memory snapshot information of each shared sub-memory in a certain order.

[0168] In some optional embodiments, FIG9 is a schematic diagram of memory snapshot information provided by an exemplary embodiment of the present disclosure. As shown in FIG9 , taking the preset segment length threshold as 2MB as an example, the first shared memory snapshot information may include multiple snapshot information, each snapshot information corresponds to a shared sub-memory, each snapshot information includes a header and data, and the struct header represents the information structure of the header. Each header may include the real physical address (addr) field, length (len) field and magic field of the corresponding shared sub-memory. The magic field is filled with a preset value when storing the snapshot information. The preset value is used to verify the snapshot information when reading the snapshot information to determine whether the snapshot information has been modified. For example, if the magic field is a preset value when reading the snapshot information, it can be determined that the snapshot information is valid (or normal). If the magic field is not a preset value, it can be determined that the snapshot information is abnormal. By verifying the snapshot information through the magic field, the validity and reliability of the snapshot information can be effectively improved. When resetting the shared memory of the first operating system, the data can be copied to the memory of the corresponding address according to the header information, so as to quickly find the original address.

[0169] In some optional embodiments, generating the second shared memory snapshot information of the second operating system in a frozen state in step 4012 may include: determining at least one segment of shared sub-memory according to a preset segment length threshold based on the physical address and length of the second shared memory used when the second operating system executes the freeze instruction; for any segment of shared sub-memory, generating snapshot address information of the shared sub-memory based on the physical address and length of the shared sub-memory; generating shared memory snapshot information of the shared sub-memory based on the snapshot address information of the shared sub-memory and the shared memory data of the shared sub-memory; and determining the second shared memory snapshot information based on the shared memory snapshot information of each shared sub-memory.

[0170] The generation principle of the second shared memory snapshot information is similar to that of the first shared memory snapshot information, and is not described in detail here.

[0171] In some optional embodiments, generating the first private memory snapshot information of the first operating system in a frozen state in step 5014 may include: determining at least one segment of private sub-memory according to a preset segment length threshold based on the physical address and length of the first private memory used when the first operating system executes the freeze instruction; for any segment of private sub-memory, generating snapshot address information of the private sub-memory based on the physical address and length of the private sub-memory; generating private memory snapshot information of the private sub-memory based on the snapshot address information of the private sub-memory and private memory data of the private sub-memory; and determining the first private memory snapshot information based on the private memory snapshot information of each private sub-memory.

[0172] The generation principle of the first private memory snapshot information is similar to that of the first shared memory snapshot information, and is not described in detail here.

[0173] In some optional embodiments, generating the second private memory snapshot information of the second operating system in a frozen state in step 4014 may include: determining at least one segment of private sub-memory according to a preset segment length threshold based on the physical address and length of the second private memory used when the second operating system executes the freeze instruction; for any segment of private sub-memory, generating snapshot address information of the private sub-memory based on the physical address and length of the private sub-memory; generating private memory snapshot information of the private sub-memory based on the snapshot address information of the private sub-memory and private memory data of the private sub-memory; and determining the second private memory snapshot information based on the private memory snapshot information of each private sub-memory.

[0174] The generation principle of the second private memory snapshot information is similar to that of the first shared memory snapshot information, and is not described in detail here.

[0175] This embodiment uses the physical address and length of the memory (which can be either shared or private memory) used when any operating system executes a freeze instruction, identifies each sub-segment of memory according to a preset segment length threshold, generates memory snapshot information for each sub-segment, and then determines complete memory snapshot information based on the memory snapshot information of each sub-segment. Because each sub-segment of memory can record the actual physical address and length corresponding to that sub-segment through snapshot address information, the original address can be quickly found based on the snapshot address information, which helps further improve memory reset efficiency.

[0176] In some optional embodiments, the switching of the first operating system to the second frozen state in step 5012 may include: freezing the processes and / or threads corresponding to the first operating system; updating the first processing resources corresponding to the first operating system from an enabled state to a disabled state, the first processing resources including other processor resources and interrupt resources except the processor resources used to start the first operating system.

[0177] Among them, freezing the processes and / or threads corresponding to the first operating system may refer to keeping the processes and / or threads corresponding to the first operating system in the current state and no longer changing, so that they can continue to run from the current state when switched to the running state again. Updating the first processing resource from the enabled state to the disabled state may refer to releasing (or stopping) other processor resources (i.e., noboot CPUs) that are not used to start the first operating system, and retaining the processor resources used to start the first operating system to ensure that the running state of the first operating system can be quickly restored when the operating system is switched, and the interrupt resources are turned off. For example, the processor resources corresponding to the first operating system include CPU0 to CPU7, wherein CPU0 is the processor resource used to start the first operating system. In the case where the first operating system enters the frozen state, CPU1 to CPU7 can be stopped, and CPU0 can be retained, so that when the first operating system is switched from the second frozen state to the running state again, it can quickly switch to the running state before the initialization and continue to run.

[0178] In some optional embodiments, the switching of the second operating system to the first frozen state in step 4012 may include: freezing the processes and / or threads corresponding to the second operating system; updating the second processing resources corresponding to the second operating system from an enabled state to a disabled state, the second processing resources including other processor resources and interrupt resources except the processor resources used to start the second operating system.

[0179] The specific operation of switching the second operating system to the first frozen state is similar to that of switching the first operating system to the second frozen state, and will not be described in detail here.

[0180] For any operating system, this embodiment freezes the processes and / or threads corresponding to the operating system during the initialization process, shuts down the processing resources of the operating system, and puts the operating system into a frozen state. When the operating system needs to switch to a running state, it can be quickly reset from the frozen state to the running state after initialization, thereby effectively improving the switching efficiency between operating systems.

[0181] In some optional embodiments, FIG10 is a schematic diagram of a virtualization architecture of a computer provided by an exemplary embodiment of the present disclosure. As shown in FIG10 , the computer may include a virtualization management program (VMM) component, a client operating system (Guest) component (i.e., a virtual machine VM), a native service (Native service) component, a native driver (Native driver) component, and an operating system kernel (kernel) component. The guest includes user-mode software (APP) and kernel-mode software (OS). EL (Exception Level) represents the exception level, typically including EL1, EL2, and EL3. The APP runs at EL0, the OS runs at EL1, the hypervisor represents the virtual machine management program, runs at EL2, and the VMM runs at EL0. Each guest corresponds to a VMM, and each VMM runs independently. The resources between the components are isolated from each other and do not interfere with each other. The guest and the VMM interact with each other. The VMM can manage all resources throughout the entire life cycle of the VM, including memory, DTB, vCPU, IRQ, virtio, and other resources.

[0182] FIG11 is a schematic diagram of a virtual machine-based operating system hot backup architecture provided by an exemplary embodiment of the present disclosure. As shown in FIG11 , for any guest (or guest) in FIG10 , two virtual machine structure instances, namely struct vm vm[0] and struct vm vm[1], can be created within the VMM component. struct vm vm[0] can be applied to a master, which can be, for example, a first operating system, and struct vm vm[1] can be applied to a replica, which can be, for example, a backup second operating system. When the VMM component is started, the master and replica can be started separately, and a memory snapshot can be created through a guest freeze / restore process. The memory snapshot can include at least one of the first shared memory snapshot information, the first private memory snapshot information, the second shared memory snapshot information, and the second private memory snapshot information. The memory snapshot is stored in a corresponding storage area. For example, when the freeze instruction is first executed, the memory snapshot information can be generated and stored in the corresponding storage area. At the same time, the corresponding structvm (i.e., virtual machine structure instance) key status and context (struct vm key status & context) can be stored. For example, the key status and context of the virtual machine structure instance are the first and second structure information described above. When one guest (e.g., the master) is running, the VMM's background thread (helper thread) can load the memory snapshot information of the backup guest (e.g., the replica) to the corresponding memory address and reload the struct vm instance corresponding to the backup guest. In this way, if an exception occurs in the running guest, the backup guest can be quickly switched from a frozen state to a running state to continue running. In Figure 11, snapshot memory is the memory used to store memory snapshot information, and private memory is the private memory of the master or replica. The left side of Figure 11 shows the master and its corresponding snapshot memory and private memory, while the right side of Figure 11 shows the replica and its corresponding private memory and snapshot memory. The master and replica cannot access each other's private memory and snapshot memory. The dashed arrow corresponding to each guest points to the memory range available during the guest's operation. For example, the master's available memory range includes the memory range from the start address of the private memory on the left to the end address of the shared memory. The memory range that replica can use includes the starting address of shared memory to the end address of private memory on the right.The VMM can access the snapshot memory, private memory, and shared memory. The VMM can copy data in the snapshot memory to the private memory and shared memory of the corresponding operating system to facilitate resetting the operating system to a running state.

[0183] In some optional embodiments, FIG12 is a schematic diagram of an operating system initialization process provided by an exemplary embodiment of the present disclosure. As shown in FIG12 , the VMM may include a main thread and a helper thread. The guest master represents the first operating system, the vm guest master represents the first operating system corresponding to the virtual machine, the guest replica represents the second operating system, and the vm guest replica represents the second operating system corresponding to the virtual machine. The initialization process is as follows:

[0184] 1. VMM initialization. For example, the VMM can be initialized using the initialization command vmm_init, where "init" in the initialization command vmm_init stands for initialization and "vmm" stands for the VMM to be initialized. The VMM initialization can be implemented by executing the VMM initialization program in the main thread.

[0185] 2. The VMM initializes the VM guest master. For example, the VM guest master initialization can be triggered by the command vm_init(master). This initialization operation may include requesting a guest master virtual machine structure instance and setting configuration options.

[0186] 3. The VMM triggers the guest master to run. For example, you can use the vcpu_start(master) command to trigger the guest master to run. In the vcpu_start(master) command, vcpu represents the virtual processor corresponding to the guest master, and start means start. The guest master is run using the virtual processor corresponding to the guest master. For example, this can start the thread corresponding to the guest master.

[0187] 4. The guest master executes a freeze instruction, which may be, for example, freeze(master), and sends a freeze command to the VMM.

[0188] 5. The VMM captures the freeze command of the guest master and suspends the guest master, for example, by stopping the guest master thread and stopping the master, and then saves the shared memory snapshot information (i.e., the first shared memory snapshot information mentioned above) and the key state and context corresponding to the virtual machine structure instance. For example, the relevant information can be stored by using the command save struct vm (master), where save in the command save struct vm (master) means save, and struct vm means the virtual machine structure instance.

[0189] 6. The VMM initializes the VM guest replica. For example, the VM guest replica can be initialized by running the command vm_init(replica).

[0190] 7. The VMM triggers the guest replica to run. For example, you can use the vcpu_start(replica) command to trigger the guest replica to run. This allows the guest replica to run using the vcpu corresponding to the guest replica.

[0191] 8. The VMM triggers an asynchronous save of the guest master's private memory snapshot information, for example, by using the command save snapshot(master) to trigger the asynchronous save operation, i.e., storing the first private memory snapshot information. Specifically, the first private memory snapshot information can be generated by a background thread (helper thread) and stored in the snapshot memory.

[0192] 9. The guest replica executes the freeze instruction, which can be expressed as freeze(replica), and sends a freeze command to the VMM.

[0193] 10. The VMM captures the freeze command of the guest replica, suspends the guest replica, and then saves the shared memory snapshot information corresponding to the guest replica and the key state and context of the virtual machine structure instance.

[0194] 11. The VMM restores the key state and context of the virtual machine structure instance corresponding to the guest master, as well as the shared memory, that is, resets the first structure state and the first shared memory state corresponding to the first operating system.

[0195] 12. The VMM triggers the guest master to continue running by using the vcpu_start(master) command. The guest master executes the restore process to restore processor resources, interrupt resources, etc., and performs memory hotplug, so that the guest master switches from the frozen state to the running state to continue running.

[0196] 13. The VMM triggers an asynchronous save of the guest replica's private memory snapshot (i.e., the second private memory snapshot) to the corresponding snapshot memory. For example, the VMM can use the save snapshot (replica) command to save the guest replica's private memory snapshot. This means that a background thread generates and stores the second private memory snapshot.

[0197] Figure 13 is a schematic diagram of a switching process when an operating system exception occurs, provided by an exemplary embodiment of the present disclosure. As shown in Figure 13, after the guest master and guest replica are initialized and the guest master is running, if a guest master operating system exception (guest error) is detected, a guest switch between operating systems (guest switch) can be performed. The switching process is as follows:

[0198] 1. The VMM detects a guest master exception (guest error).

[0199] 2. The VMM stops the guest master related threads. For example, the VMM can stop the virtual processor vcpu corresponding to the guest master through the command vcpu_stop(master) to stop the guest master related threads.

[0200] 3. The VMM disables interrupts. For example, you can use the disable irqs command to update the interrupt resource from an enabled state to a disabled state, thereby disabling interrupts.

[0201] 4. The VMM copies the data in the guest replica's snapshot memory to the guest replica's shared memory, triggering the guest replica to resume operation. The guest replica then executes the restore process, which can include restoring processor resources and interrupt resources using the restore (hw_reset) command and hot-plugging memory using the memory hotplug command. The guest replica then switches to the running state and continues to operate. If the current switch process is the first switch after initialization, the guest replica's private memory and virtual machine structure instance are frozen during the initialization process and therefore remain unchanged. If the current switch process is not the first switch after initialization, the guest replica's private memory and virtual machine structure instance are reset when the guest replica is reset to the frozen state. Therefore, during the operating system switch, only the shared memory data needs to be copied.

[0202] 5. The VMM triggers asynchronous recovery of the guest master. For example, the restore(master) command can be used to trigger asynchronous recovery of the guest master.

[0203] 6. The VMM asynchronous thread (i.e., the helper thread) resets the guest master's private memory to the first private memory state in the frozen state.

[0204] 7. The VMM asynchronous thread resets the virtual machine structure instance corresponding to the guest master to the first structure state in the frozen state, thereby resetting the guest master to the frozen state (i.e., the second frozen state) and continuing to serve as the backup operating system of the guest replica.

[0205] If the guest replica is abnormal, you can follow a similar process to switch to the guest master, thereby achieving mutual backup between the guest master and the guest replica.

[0206] Figure 14 is a schematic diagram of memory address allocation provided by an exemplary embodiment of the present disclosure. As shown in Figure 14, the entire memory address can be divided into the following parts: shared memory (public), the first snapshot memory (master snapshot) and first private memory (master private) corresponding to the guest master, the second snapshot memory (replica snapshot) and second private memory (replica private) corresponding to the guest replica, and the memory occupied by the microkernel and components (Kernel & Component). The shared memory can be shared by the guest master and guest replica because they do not run in parallel and therefore do not interfere with each other. The first private memory and the second private memory are each occupied independently by the guest master and guest replica, without interfering with each other. Furthermore, by dividing the shared memory into shared and private memory, the background image loading function can be reused. The image can include the operating system image data and the aforementioned memory snapshot information, facilitating the various asynchronous processes mentioned above during initialization and switching, thereby improving the efficiency of switching between operating systems. For example, in the case of the guest replica, the private memory reset is pre-copied in the background, while the shared memory is copied during the operating system switch. The arrows from low to high indicate the access rights corresponding to each memory segment, from low to high.

[0207] In some optional embodiments, FIG15 is a schematic diagram illustrating the two-level mapping principle for operating system memory access, provided by an exemplary embodiment of the present disclosure. As shown in FIG15 , the two-level mapping may include a mapping from the virtual address space (Virtual Address Space) to the intermediate physical address space (Intermediate Physical Address Space), and a mapping from the intermediate physical address space to the real physical address space (Physical Address Space). The mapping from the virtual address space to the intermediate physical address space is called the first-level mapping, or stage1; the mapping from the intermediate physical address space to the real physical address space is called the second-level mapping, or stage2. The stage1 table represents the mapping page table for the first-level mapping, and the stage2 table represents the mapping page table for the second-level mapping. From the time a guest boots up to the time it executes the freeze instruction, it may not access all pre-allocated memory. Therefore, when taking a memory snapshot, it is sufficient to only detect the physical memory actually occupied by the guest at the time of freezing. To achieve this, the page table for the second-level mapping (stage2) may not be mapped before the guest boots up. Instead, the corresponding address may be mapped only when a page fault occurs when the guest accesses memory. This helps accurately calculate the actual physical memory usage. The gray address space in the stage2 table represents occupied space.

[0208] In some optional embodiments, Figure 16 is a schematic diagram of the operating system freeze / restore process provided by an exemplary embodiment of the present disclosure. As shown in Figure 16, a freeze instruction echo freeze can be added to the initialization program to trigger the freeze process. The freeze process includes freezing the operating system's processes and threads (freeze process&thread), updating noboot CPUs from an enabled state to a disabled state (disable noboot CPUs), updating interrupt resources from an enabled state to a disabled state (disable irqs), and suspending the operating system (suspend enter). If the operating system needs to switch from a frozen state to a running state, a recovery (restore) process is entered. The recovery process may include the end of the operating system suspension (suspend exit), updating interrupt resources from a disabled state to an enabled state (enable irqs), updating noboot CPUs from a disabled state to an enabled state, restoring processes and threads (restore process&thread), and hardware module reset processing flow (do_dev_recovery_ops and reset&reconfig). After the recovery process is completed, the operating system returns to the running state corresponding to the freeze instruction and continues running (continue run).

[0209] The hot backup method for an operating system based on a virtual machine of the disclosed embodiment can achieve the goal of quickly reloading the backup operating system when an operating system exception occurs by creating memory snapshot information (or memory snapshot image) of the operating system and the freezing / restoring characteristics of the operating system, combined with the abnormality detection and image loading process of the virtualization management program, so as to quickly reload the backup operating system when an operating system exception occurs, quickly switch the backup operating system to the running state, and achieve the goal of quickly rerunning the application program, thereby achieving the goal of quickly restoring the system from the abnormal state to the normal operating state at a low resource cost. In addition, for an abnormal operating system (such as the first operating system), the private memory and virtual machine structure instance of the first operating system can be asynchronously reset to the frozen state in advance after the operating system is switched, which does not affect the operation of the second operating system after the switch, and can also allow the private memory and virtual machine structure instance of the abnormal first operating system to be reset to the initialized state in advance as a backup of the second operating system. This can further speed up the switching process and improve the switching speed between operating systems at the next switch.

[0210] The above-mentioned embodiments of the present disclosure may be implemented individually or in any combination without conflict. The specific configuration may be based on actual needs and is not limited by the embodiments of the present disclosure.

[0211] Any virtual machine-based operating system hot backup method provided in the embodiments of the present disclosure can be executed by any appropriate device with data processing capabilities, including but not limited to terminal devices and servers. Alternatively, any virtual machine-based operating system hot backup method provided in the embodiments of the present disclosure can be executed by a processor, such as by invoking corresponding instructions stored in a memory to execute any virtual machine-based operating system hot backup method mentioned in the embodiments of the present disclosure. This will not be further described below.

[0212] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk, etc. Various media that can store program codes.

[0213] Exemplary devices

[0214] FIG17 is a schematic diagram of a virtual machine-based operating system hot backup device according to an exemplary embodiment of the present disclosure. The device of this embodiment can be used to implement the corresponding method embodiment of the present disclosure. The device shown in FIG17 may include: a first processing module 61, a second processing module 62, and a third processing module 63.

[0215] The first processing module 61 may be configured to stop running the first operating system in response to detecting an abnormality in the first operating system currently running on the virtual machine.

[0216] The second processing module 62 may be used to control the second operating system corresponding to the virtual machine and serving as a backup to switch from a first frozen state to a running state; the first frozen state is a state in which the second operating system executes a running freeze instruction to freeze.

[0217] The third processing module 63 may be configured to use the second operating system as the currently running operating system to run the application program.

[0218] In some optional embodiments, the first processing module 61 may be specifically configured to: stop the process and / or thread corresponding to the first operating system, and disable the interrupt resource corresponding to the first operating system.

[0219] FIG18 is a schematic structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure.

[0220] In some optional embodiments, as shown in FIG18 , the apparatus of the embodiment of the present disclosure may further include:

[0221] The fourth processing module 71 may be configured to reset the first operating system to a second frozen state, so as to serve as a backup operating system for the second operating system.

[0222] FIG19 is a structural diagram of an operating system hot backup device based on a virtual machine provided by yet another exemplary embodiment of the present disclosure.

[0223] In some optional embodiments of the present disclosure, the second frozen state may include a first private memory state and a first structure state corresponding to the first operating system.

[0224] As shown in FIG. 19 , the fourth processing module 71 may include: a first processing unit 711 and a second processing unit 712 .

[0225] The first processing unit 711 may be configured to reset a first private memory state corresponding to the first operating system based on stored first memory snapshot information corresponding to the first operating system in a frozen state.

[0226] The first memory snapshot information includes first private memory snapshot information of a private memory corresponding to the first operating system in a frozen state.

[0227] The second processing unit 712 may be configured to reset the first structure state of the first operating system based on the stored first structure information corresponding to the first operating system in the frozen state.

[0228] The first structure information includes resource information corresponding to the first operating system in a frozen state.

[0229] FIG20 is a schematic structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure.

[0230] In some optional embodiments, the second processing module 62 may include: a third processing unit 621 and a fourth processing unit 622 .

[0231] The third processing unit 621 may be configured to reset the second shared memory state corresponding to the second operating system in the frozen state based on the stored second memory snapshot information corresponding to the second operating system in the frozen state.

[0232] The second memory snapshot information includes second shared memory snapshot information of the shared memory corresponding to the second operating system in a frozen state.

[0233] The fourth processing unit 622 may be configured to switch the second operating system to a running state based on the second private memory state, the second structure state, and the second shared memory state corresponding to the second operating system in the frozen state.

[0234] In some optional embodiments, the fourth processing unit 622 can be specifically used to: based on the second private memory state, the second structure state and the second shared memory state, update the processing resources of the second operating system from a non-enabled state to an enabled state, switch the processes and / or threads of the second operating system from a frozen state to a running state, and reset the hardware resources corresponding to the second operating system to an idle state, so that the second operating system switches from the first frozen state to a running state.

[0235] In some optional embodiments, as shown in FIG18 , the apparatus of the embodiment of the present disclosure may further include:

[0236] The initialization module 81 may be configured to initialize the second operating system to a first frozen state.

[0237] In some optional embodiments, as shown in FIG18 , the apparatus of the embodiment of the present disclosure may further include: a reset module 82 , which may be used to reset the second operating system to the first frozen state when an abnormality occurs in the second operating system as the currently running operating system.

[0238] In some optional embodiments, the initialization module 81 may also be configured to initialize the first operating system to a second frozen state.

[0239] The apparatus of the embodiment of the present disclosure may further include:

[0240] The fifth processing module 83 may be configured to switch the first operating system from the second frozen state to the running state, so as to serve as the currently running operating system for running application programs.

[0241] FIG21 is a schematic structural diagram of an operating system hot backup device based on a virtual machine provided by another exemplary embodiment of the present disclosure.

[0242] In some optional embodiments, as shown in FIG. 21 , the initialization module 81 may include: a first starting unit 811 , a first freezing unit 812 , and a fifth processing unit 813 .

[0243] The first booting unit 811 may be configured to boot the first operating system based on the mirror data of the first operating system.

[0244] The first freezing unit 812 may be configured to, in response to the first operating system executing a freeze instruction, switch the first operating system to a second frozen state and generate first shared memory snapshot information of the first operating system in the frozen state.

[0245] The fifth processing unit 813 may be configured to store the first shared memory snapshot information and the first structure information corresponding to the first operating system in the frozen state.

[0246] In some optional embodiments, as shown in FIG. 21 , the initialization module 81 may include: a second starting unit 81 a , a second freezing unit 81 b , and a sixth processing unit 81 c .

[0247] The second startup unit 81a can be used to start the second operating system based on the mirror data of the second operating system.

[0248] The second freezing unit 81b may be configured to, in response to the second operating system executing the freeze instruction, switch the second operating system to the first frozen state and generate second shared memory snapshot information of the second operating system in the frozen state.

[0249] The sixth processing unit 81c may be configured to store the second shared memory snapshot information and the second structure information corresponding to the second operating system in the frozen state.

[0250] The second structure information includes resource information corresponding to the second operating system in a frozen state.

[0251] In some optional embodiments, as shown in FIG. 21 , the initialization module 81 may further include: a first generating unit 814 , which may be configured to generate first private memory snapshot information of the first operating system in a frozen state.

[0252] The fifth processing unit 813 may also be configured to store the first private memory snapshot information.

[0253] The first shared memory snapshot information and the first private memory snapshot information constitute the first memory snapshot information corresponding to the first operating system.

[0254] In some optional embodiments, as shown in FIG21 , the initialization module may further include:

[0255] The second generating unit 81d may be configured to generate second private memory snapshot information of the second operating system in a frozen state.

[0256] The sixth processing unit 81c may also be configured to store the second private memory snapshot information.

[0257] The second shared memory snapshot information and the second private memory snapshot information constitute the second memory snapshot information corresponding to the second operating system.

[0258] In some optional embodiments, the first freezing unit 812 can be specifically used to: determine at least one segment of shared sub-memory according to a preset segment length threshold based on the physical address and length of the first shared memory used when the first operating system executes the freeze instruction; for any segment of shared sub-memory, generate snapshot address information of the shared sub-memory based on the physical address and length of the shared sub-memory; generate shared memory snapshot information of the shared sub-memory based on the snapshot address information of the shared sub-memory and the shared memory data of the shared sub-memory; and determine the first shared memory snapshot information based on the shared memory snapshot information of each shared sub-memory.

[0259] In some optional embodiments, the second freezing unit 81b can be specifically used to: determine at least one segment of shared sub-memory according to a preset segment length threshold based on the physical address and length of the second shared memory used when the second operating system executes the freeze instruction; for any segment of shared sub-memory, generate snapshot address information of the shared sub-memory based on the physical address and length of the shared sub-memory; generate shared memory snapshot information of the shared sub-memory based on the snapshot address information of the shared sub-memory and the shared memory data of the shared sub-memory; and determine the second shared memory snapshot information based on the shared memory snapshot information of each shared sub-memory.

[0260] In some optional embodiments, the first generating unit 814 may be specifically configured to:

[0261] Based on the physical address and length of the first private memory used when the first operating system executes the freeze instruction, at least one segment of private sub-memory is determined according to a preset segment length threshold; for any segment of private sub-memory, snapshot address information of the private sub-memory is generated based on the physical address and length of the private sub-memory; private memory snapshot information of the private sub-memory is generated based on the snapshot address information of the private sub-memory and the private memory data of the private sub-memory; and first private memory snapshot information is determined based on the private memory snapshot information of each private sub-memory.

[0262] In some optional embodiments, the second generating unit 81d may be specifically configured to:

[0263] Based on the physical address and length of the second private memory used when the second operating system executes the freeze instruction, at least one segment of private sub-memory is determined according to a preset segment length threshold; for any segment of private sub-memory, snapshot address information of the private sub-memory is generated based on the physical address and length of the private sub-memory; private memory snapshot information of the private sub-memory is generated based on the snapshot address information of the private sub-memory and the private memory data of the private sub-memory; and second private memory snapshot information is determined based on the private memory snapshot information of each private sub-memory.

[0264] In some optional embodiments, the first freezing unit 812 may be specifically configured to:

[0265] Freeze the process and / or thread corresponding to the first operating system; update the first processing resource corresponding to the first operating system from an enabled state to a disabled state, the first processing resource including other processor resources and interrupt resources except the processor resource used to start the first operating system.

[0266] In some optional embodiments, the second freezing unit 81b may be specifically configured to:

[0267] Freeze the process and / or thread corresponding to the second operating system; update the second processing resource corresponding to the second operating system from an enabled state to a disabled state, the second processing resource including other processor resources and interrupt resources except the processor resource used to start the second operating system.

[0268] The beneficial technical effects corresponding to the exemplary embodiment of this device can be found in the corresponding beneficial technical effects of the above exemplary method part, which will not be repeated here.

[0269] Exemplary electronic devices

[0270] FIG22 is a structural diagram of an electronic device provided by an embodiment of the present disclosure, which includes at least one processor 11 and a memory 12 .

[0271] The processor 11 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.

[0272] The memory 12 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), a hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may execute the one or more computer program instructions to implement the methods and / or other desired functions of the various embodiments of the present disclosure described above.

[0273] In one example, the electronic device 10 may further include an input device 13 and an output device 14 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0274] The input device 13 may also include, for example, a keyboard, a mouse, etc.

[0275] The output device 14 can output various information to the outside, and may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0276] Of course, for simplicity, FIG22 only shows some of the components of the electronic device 10 related to the present disclosure, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 10 may further include any other appropriate components depending on the specific application.

[0277] Exemplary computer program products and computer-readable storage media

[0278] In addition to the above methods and devices, embodiments of the present disclosure may also provide a computer program product, including computer program instructions, which, when executed by a processor, enable the processor to perform the steps in the methods of various embodiments of the present disclosure described in the above "Exemplary Method" section.

[0279] The computer program product may be written in any combination of one or more programming languages ​​to implement the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, and conventional procedural programming languages ​​such as C or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a stand-alone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0280] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor executes the steps in the method of various embodiments of the present disclosure described in the above “Exemplary Method” section.

[0281] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium is, for example, but not limited to, a system, device or component comprising electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0282] The basic principles of the present disclosure have been described above in conjunction with specific embodiments. However, the advantages, strengths, and effects mentioned in this disclosure are merely illustrative and not restrictive, and should not be considered as essential to each embodiment of the present disclosure. Furthermore, the specific details disclosed above are provided for illustrative purposes and to facilitate understanding, rather than as limitations. These details do not limit the present disclosure to necessarily being implemented using these specific details.

[0283] Those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include these modifications and variations.

Claims

1. A method for hot backup of an operating system based on a virtual machine, comprising: In response to detecting an abnormality in a first operating system currently running on the virtual machine, stopping the running of the first operating system; Controlling the second operating system corresponding to the virtual machine as a backup to switch from a first frozen state to a running state; the first frozen state is a state in which the second operating system executes a freeze instruction to freeze; The second operating system is used as the currently running operating system to run the application program.

2. The method according to claim 1, wherein After stopping the first operating system, the method further includes: The first operating system is reset to a second frozen state to use the first operating system as a backup operating system for the second operating system.

3. The method according to claim 2, wherein: The second frozen state includes a first private memory state and a first structure state corresponding to the first operating system; The resetting the first operating system to the second frozen state includes: resetting the first private memory state corresponding to the first operating system based on the stored first memory snapshot information corresponding to the first operating system in the frozen state; the first memory snapshot information includes first private memory snapshot information of the private memory corresponding to the first operating system in the frozen state; Based on the stored first structural information corresponding to the first operating system in the frozen state, the first structural state of the first operating system is reset; the first structural information includes resource information corresponding to the first operating system in the frozen state.

4. The method according to claim 1, wherein The controlling the second operating system corresponding to the virtual machine and serving as a backup to switch from a first frozen state to a running state includes: resetting a second shared memory state corresponding to the second operating system in the frozen state based on the stored second memory snapshot information corresponding to the second operating system in the frozen state, wherein the second memory snapshot information includes second shared memory snapshot information of the shared memory corresponding to the second operating system in the frozen state; The second operating system is switched to a running state based on a second private memory state, a second structure state, and a second shared memory state corresponding to the second operating system in the frozen state.

5. The method according to claim 4, wherein The step of switching the second operating system to a running state based on a second private memory state, a second structure state, and a second shared memory state corresponding to the second operating system in a frozen state includes: Based on the second private memory state, the second structure state and the second shared memory state, the processing resources of the second operating system are updated from a disabled state to an enabled state, the processes and / or threads of the second operating system are switched from a frozen state to a running state, and the hardware resources corresponding to the second operating system are reset to an idle state, so that the second operating system switches from the first frozen state to a running state.

6. The method according to claim 1, wherein The stopping of the first operating system includes: Stop the process and / or thread corresponding to the first operating system, and disable the interrupt resource corresponding to the first operating system.

7. The method according to any one of claims 1 to 6, wherein: Before stopping the first operating system currently running on the virtual machine in response to detecting an abnormality in the first operating system, the method further includes: Initializing the second operating system to the first frozen state; or, When an exception occurs in the second operating system as the currently running operating system, the second operating system is reset to the first frozen state.

8. The method according to claim 7, wherein: Before stopping the first operating system currently running on the virtual machine in response to detecting an abnormality in the first operating system, the method further includes: Initializing the first operating system to a second frozen state; After initializing the second operating system to the first frozen state, the method further includes: The first operating system is switched from the second frozen state to a running state as the currently running operating system for running application programs.

9. The method according to claim 8, wherein Initializing the first operating system to a second frozen state includes: starting the first operating system based on the image data of the first operating system; In response to the first operating system executing the freeze instruction, the first operating system switches to a second frozen state and generates first shared memory snapshot information of the first operating system in the frozen state; storing the first shared memory snapshot information and first structure information corresponding to the first operating system in a frozen state; Initializing the second operating system to the first frozen state includes: starting the second operating system based on the image data of the second operating system; In response to the second operating system executing the freeze instruction, the second operating system switches to the first frozen state and generates second shared memory snapshot information of the second operating system in the frozen state; The second shared memory snapshot information and second structure information corresponding to the second operating system in a frozen state are stored; the second structure information includes resource information corresponding to the second operating system in a frozen state.

10. The method according to claim 9, wherein: The process of initializing the second operating system to the first frozen state further includes: generating first private memory snapshot information of the first operating system in a frozen state; Storing the first private memory snapshot information; The first shared memory snapshot information and the first private memory snapshot information constitute first memory snapshot information corresponding to the first operating system; The process of switching the first operating system from the second frozen state to the running state further includes: generating second private memory snapshot information of the second operating system in a frozen state; Storing the second private memory snapshot information; The second shared memory snapshot information and the second private memory snapshot information constitute second memory snapshot information corresponding to the second operating system.

11. The method according to claim 10, wherein: The generating of first shared memory snapshot information of the first operating system in a frozen state includes: Determining at least one shared sub-memory segment according to a preset segment length threshold based on a physical address and length of the first shared memory used when the first operating system executes the freeze instruction; For any section of the shared sub-memory, generating snapshot address information of the shared sub-memory based on the physical address and length of the shared sub-memory; Generate shared memory snapshot information of the shared sub-memory based on the snapshot address information of the shared sub-memory and the shared memory data of the shared sub-memory; determining the first shared memory snapshot information based on the shared memory snapshot information of each shared sub-memory; The generating of second shared memory snapshot information of the second operating system in a frozen state includes: determining, based on the physical address and length of the second shared memory used when the second operating system executes the freeze instruction, at least one shared sub-memory according to the preset segment length threshold; For any section of the shared sub-memory, generating snapshot address information of the shared sub-memory based on the physical address and length of the shared sub-memory; Generate shared memory snapshot information of the shared sub-memory based on the snapshot address information of the shared sub-memory and the shared memory data of the shared sub-memory; determining the second shared memory snapshot information based on the shared memory snapshot information of each shared sub-memory; The generating of first private memory snapshot information of the first operating system in a frozen state includes: Determining at least one private sub-memory segment according to the preset segment length threshold based on the physical address and length of the first private memory used when the first operating system executes the freeze instruction; For any segment of the private sub-memory, generating snapshot address information of the private sub-memory based on the physical address and length of the private sub-memory; Generate private memory snapshot information of the private sub-memory based on the snapshot address information of the private sub-memory and the private memory data of the private sub-memory; Determining the first private memory snapshot information based on the private memory snapshot information of each of the private sub-memories; The generating of second private memory snapshot information of the second operating system in a frozen state includes: Determining at least one private sub-memory segment according to the preset segment length threshold based on the physical address and length of the second private memory used when the second operating system executes the freeze instruction; For any segment of the private sub-memory, generating snapshot address information of the private sub-memory based on the physical address and length of the private sub-memory; Generate private memory snapshot information of the private sub-memory based on the snapshot address information of the private sub-memory and the private memory data of the private sub-memory; The second private memory snapshot information is determined based on the private memory snapshot information of each of the private sub-memories.

12. The method according to claim 9, wherein The first operating system switches to the second frozen state, comprising: Freezing the process and / or thread corresponding to the first operating system; updating a first processing resource corresponding to the first operating system from an enabled state to a disabled state, the first processing resource including other processor resources and interrupt resources except for a processor resource used to start the first operating system; Switching the second operating system to the first frozen state includes: Freezing the process and / or thread corresponding to the second operating system; The second processing resources corresponding to the second operating system are updated from an enabled state to a disabled state, where the second processing resources include other processor resources and interrupt resources except the processor resources used to start the second operating system.

13. A virtual machine-based operating system hot backup device, comprising: A first processing module is configured to, in response to detecting an abnormality in a first operating system currently running on the virtual machine, stop running the first operating system; a second processing module, configured to control a second operating system corresponding to the virtual machine and serving as a backup to switch from a first frozen state to a running state; the first frozen state being a state in which the second operating system executes a running freeze instruction to freeze the second operating system; The third processing module is configured to use the second operating system as the currently running operating system to run the application program.

14. A computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 12.

15. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Operating system hot backup method and device and file system reconstruction method

    CN103729262A

  • Multi-operating system switching operation method, computing device and storage medium

    CN114691226A

  • Memory snapshot generation method and device, computer equipment and storage medium

    CN116700904A

  • Operating system hot backup method, device and equipment based on virtual machine and medium

    CN118193128A

  • Virtual system and method for securing external network connectivity

    US11113086B1