Central processor sleep control method, apparatus and electronic device

By determining the relationship between the system and the virtual machine's use of the central processing unit, disabling the system's hibernation function, and configuring the virtual machine's deep and shallow hibernation states, the problem that the existing automatic hibernation mechanism of the central processing unit cannot meet the needs of specific scenarios is solved, and flexible hibernation control and power consumption optimization are achieved.

CN116430978BActive Publication Date: 2026-04-28INSPUR COMM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR COMM TECH CO LTD
Filing Date
2023-02-27
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The existing automatic sleep mechanism of the central processing unit cannot meet the sleep requirements in specific scenarios, especially the user's need for the CPU to immediately enter deep sleep without going through shallow sleep when it is not in use.

Method used

By determining the relationship between the system and virtual machines using the central processing unit (CPU), the hibernation function used by the system is disabled, and the hibernation state of the virtual machine using the CPU is flexibly configured based on the virtual machine hibernation configuration relationship, including deep and shallow hibernation states, to ensure that the system is in working mode and the virtual machine enters a preset hibernation state when needed.

Benefits of technology

It enables flexible configuration of the CPU's sleep state according to user needs without affecting system functionality, meeting sleep requirements in specific scenarios, improving response time and reducing power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116430978B_ABST
    Figure CN116430978B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer, and especially relates to a central processing unit sleep control method, device and electronic equipment. The central processing unit sleep control method comprises the following steps: determining a system using a central processing unit and a virtual machine using the central processing unit to be sleep controlled; closing a sleep function of the system using the central processing unit; configuring a sleep state of the virtual machine using the central processing unit based on a virtual machine sleep configuration relationship; and the virtual machine sleep configuration relationship comprises sleep states corresponding to the virtual machine using the central processing unit. According to the present application, the sleep function of the system using the central processing unit is closed, the sleep state of the virtual machine using the central processing unit is configured according to the virtual machine sleep configuration relationship set by the user, the sleep state of the central processing unit is flexibly configured, and the sleep requirement in a specific scene is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, and electronic device for controlling the hibernation of a central processing unit. Background Technology

[0002] CPU (Central Processing Unit) hibernation, under the premise of hardware support, allows the CPU to enter a low-power hibernation mode when idle, thereby achieving energy saving. Most mainstream CPUs already support low-power hibernation. Currently, the operating system kernel automatically controls the CPU's hibernation state. The hibernation process is as follows: when the CPU is in use, it is in "working mode." When the CPU is idle, it first enters a relatively shallow hibernation mode. As the idle time continues, the CPU then enters a relatively deep hibernation mode. In summary, it automatically hibernates layer by layer from working mode to shallow hibernation to deep hibernation.

[0003] However, the CPU's automatic sleep mechanism cannot meet the specific requirements of certain scenarios. For example, if the user application is not highly real-time, and for energy saving, the user may want the CPU to be in deep sleep when not in use, rather than shallow sleep. In this case, the automatic hibernation mechanism based on the working mode-shallow sleep-deep sleep cannot immediately enter deep sleep, which obviously cannot meet the needs of this scenario. In other words, the existing automatic sleep mechanism of the central processing unit cannot meet the sleep requirements of specific scenarios. Summary of the Invention

[0004] This invention provides a central processing unit (CPU) hibernation control method, apparatus, and electronic device to address the shortcomings of existing CPU automatic hibernation mechanisms, which cannot meet hibernation requirements in specific scenarios.

[0005] This invention provides a method for controlling the hibernation of a central processing unit, comprising:

[0006] Determine which system to be hibernated uses the central processing unit and which virtual machine uses the central processing unit;

[0007] Disable the system's hibernation function using the central processing unit;

[0008] Configure the virtual machine to use the central processing unit's sleep state based on the virtual machine sleep configuration relationship;

[0009] The virtual machine hibernation configuration relationship includes the hibernation state corresponding to the central processing unit used by different virtual machines.

[0010] According to a central processing unit (CPU) hibernation control method provided by the present invention, the virtual machine hibernation configuration relationship includes a first hibernation state and a second hibernation state corresponding to different CPU usage by the virtual machines; configuring the hibernation state of the CPU used by the virtual machines based on the virtual machine hibernation configuration relationship includes:

[0011] Based on the virtual machine hibernation configuration relationship, the first hibernation state of the virtual machine using the central processing unit is enabled, and the second hibernation state of the virtual machine using the central processing unit is disabled;

[0012] The degree of dormancy in the first dormancy state is higher than that in the second dormancy state.

[0013] According to a central processing unit (CPU) hibernation control method provided by the present invention, after configuring the virtual machine to enable the first hibernation state using the CPU based on the virtual machine hibernation configuration relationship and configuring the virtual machine to disable the second hibernation state using the CPU, the method further includes:

[0014] If it is determined that the virtual machine is exclusively using the central processing unit, the hibernation state of the exclusively used central processing unit is configured based on the virtual machine hibernation configuration relationship.

[0015] The virtual machine hibernation configuration relationship also includes the first hibernation state and the second hibernation state corresponding to different exclusive use of the central processing unit at different lifecycles.

[0016] According to a central processing unit (CPU) hibernation control method provided by the present invention, configuring the hibernation state of the CPU exclusively using the virtual machine hibernation configuration relationship includes:

[0017] If it is determined that the CPU is in a power-off state, the first hibernation state of the CPU is configured to be enabled, and the second hibernation state of the CPU is configured to be disabled.

[0018] According to a central processing unit (CPU) hibernation control method provided by the present invention, configuring the hibernation state of the CPU exclusively using the virtual machine hibernation configuration relationship includes:

[0019] If it is determined that the exclusive use of the central processing unit is in an active state, configure the preset sleep state of the exclusive use of the central processing unit to be enabled, and configure the other sleep states of the exclusive use of the central processing unit other than the preset sleep state to be disabled.

[0020] The preset sleep state includes either the first sleep state or the second sleep state.

[0021] According to a method for controlling CPU hibernation provided by the present invention, the method for determining the CPU used by the system to be hibernated and the CPU used by the virtual machine includes:

[0022] The CPU configuration file determines which system and virtual machine use the CPU for hibernation control;

[0023] The central processing unit (CPU) configuration file includes the system usage or virtual machine usage corresponding to different CPUs.

[0024] The present invention also provides a central processing unit hibernation control device, comprising:

[0025] The first determining module is used to determine the CPU used by the system to be hibernated and the CPU used by the virtual machine.

[0026] The first control module is used to disable the system's hibernation function using the central processing unit;

[0027] The second control module configures the virtual machine to use the central processing unit's sleep state based on the virtual machine sleep configuration relationship;

[0028] The virtual machine hibernation configuration relationship includes the hibernation state corresponding to the central processing unit used by different virtual machines.

[0029] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the central processing unit sleep control method as described above.

[0030] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the central processing unit sleep control method as described above.

[0031] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the central processing unit sleep control method as described above.

[0032] The present invention provides a CPU hibernation control method, apparatus, and electronic device. By identifying the CPU used by the system and the CPU used by the virtual machine to be hibernated, the hibernation function of the CPU used by the system is disabled, thereby ensuring that the CPU used by the system is in working mode and that the CPU used by the system runs with priority. By configuring the hibernation state of the CPU used by the virtual machine based on the virtual machine hibernation configuration relationship, the virtual machine uses the CPU to enter a preset hibernation state. Thus, by disabling the hibernation function of the CPU used by the system, the present invention, while ensuring that system functionality is not affected, flexibly configures the hibernation state of the CPU according to the virtual machine hibernation configuration relationship set by the user, thereby meeting the hibernation requirements in specific scenarios. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0034] Figure 1 This is one of the flowcharts illustrating the central processing unit sleep control method provided by the present invention;

[0035] Figure 2 This is the second flowchart of the central processing unit sleep control method provided by the present invention;

[0036] Figure 3 This is the third flowchart of the central processing unit sleep control method provided by the present invention;

[0037] Figure 4 This is the fourth flowchart of the central processing unit sleep control method provided by the present invention;

[0038] Figure 5 This is the fifth flowchart of the central processing unit sleep control method provided by the present invention;

[0039] Figure 6 This is a schematic diagram of the structure of the central processing unit hibernation control device provided by the present invention;

[0040] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0042] So-called CPU hibernation actually means that the CPU runs in a specific power mode because power consumption is lower in this mode. In fact, CPUs have multiple power modes, usually represented by C-States (CPU Power states), collectively referred to as "C states".

[0043] In the C-states architecture, C0, C1...Cn represent different modes, where C0 is the normal operating mode (active), and the others are hibernation states. The difference lies in the depth of the hibernation; the higher the number after C, the deeper the CPU sleeps, and the greater the reduction in CPU power consumption. In fact, the degree of hibernation is determined by the amount of CPU functionality discarded. The more CPU functionality is discarded, the more power is saved, meaning a deeper hibernation. Different hibernation modes are implemented in different ways; some modes cut off the CPU's internal clock, some reduce the CPU voltage, and some may use both methods.

[0044] Hibernation offers energy-saving advantages but also has certain drawbacks. Each time an application attempts to bind itself to the CPU to perform a task, the corresponding CPU must return from its "sleep state" to its "running state," that is, return to C0 mode, i.e., wake up. However, the deeper the CPU sleep mode, the longer it takes for the CPU to return to C0, because it shuts down more processor components. Therefore, different hibernation levels should be selected based on different application scenarios.

[0045] In other words, existing technologies have automatic sleep mechanisms for central processing units (CPUs), which cannot meet the sleep requirements of specific scenarios. Therefore, this invention proposes a CPU sleep control method to address the shortcomings of existing CPU automatic sleep mechanisms in meeting the sleep requirements of specific scenarios.

[0046] Please refer to Figure 1 The central processing unit sleep control method of the present invention includes:

[0047] Step 100: Determine the CPU used by the system to be hibernated and the CPU used by the virtual machine.

[0048] Specifically, provided the physical CPU supports this functionality, users can flexibly control the activation or deactivation of the host CPU's power-saving mode via configuration, on a per-electronic device basis. Deactivating the CPU's power-saving mode indicates that the cloud platform's CPU power-saving control capabilities are not being used. Activating the CPU's power-saving mode indicates that the cloud platform's CPU power-saving control capabilities are being used. The aforementioned cloud platform is an OpenStack-based cloud platform. In this embodiment of the invention, when the electronic device determines that the CPU's power-saving mode is activated, it determines that the system to be hibernated uses the CPU and the virtual machine uses the CPU.

[0049] In one embodiment, determining the CPU used by the system to be hibernated and the CPU used by the virtual machine includes: determining the CPU used by the system to be hibernated and the CPU used by the virtual machine based on a CPU profile.

[0050] The CPU configuration file specifies the system or virtual machine usage for different CPUs. That is, the CPU configuration file defines the system or virtual machine usage for different CPUs through system default settings or user-defined settings. For example, an electronic device may have a CPU with 16 cores. Eight CPU cores are used for system operations, and the remaining eight cores are used for virtual machines. The electronic device reads the CPU configuration file and, based on this file, determines the CPU used by the system and the virtual machine to be hibernated.

[0051] Step 200: Disable the hibernation function of the central processing unit in the system.

[0052] To ensure the efficient operation of the electronic device's system services and prevent the CPU used by the system from hibernating, the electronic device disables the hibernation function of the CPU used by the system when the nova-compute service starts. In other words, the CPU used by the system is in "working mode" with all hibernation states disabled. This ensures that the operation of the electronic device's system services is not affected.

[0053] Step 300: Configure the virtual machine to use the central processing unit's hibernation state based on the virtual machine hibernation configuration relationship.

[0054] The virtual machine hibernation configuration relationship includes different hibernation states corresponding to the central processing unit used by the different virtual machines. Hibernation states include deep hibernation and shallow hibernation. Deep hibernation has a higher degree of hibernation than shallow hibernation.

[0055] For example, the virtual machine hibernation configuration records six virtual machines using the CPU. Three virtual machines using the CPU have deep hibernation enabled and shallow hibernation disabled. Three virtual machines using the CPU have shallow hibernation enabled and deep hibernation disabled. Therefore, in scenarios where only switching between working mode and deep hibernation is required, the virtual machines with deep hibernation enabled and shallow hibernation disabled can operate in working mode when the CPU is active and in deep hibernation when not in use, eliminating the need for shallow hibernation. This allows for seamless switching between working mode and deep hibernation, meeting the requirements of scenarios where only switching between these two states is needed.

[0056] Alternatively, in scenarios where only switching between working mode and shallow hibernation is required, the virtual machine can use the CPU with shallow hibernation enabled and deep hibernation disabled. This allows the CPU to be in working mode when it is working and in shallow hibernation when it is not in use, eliminating the need for deep hibernation. This allows switching between working mode and shallow hibernation to meet the needs of scenarios where only switching between working mode and shallow hibernation is required.

[0057] This invention identifies the CPU used by the system and the CPU used by the virtual machine to be hibernated; it disables the hibernation function of the CPU used by the system, thereby ensuring that the CPU used by the system is in working mode and that it runs with priority. By configuring the hibernation state of the CPU used by the virtual machine based on the virtual machine hibernation configuration relationship, the virtual machine uses the CPU to enter a preset hibernation state. Thus, by disabling the hibernation function of the CPU used by the system, this invention allows for flexible configuration of the CPU's hibernation state according to the virtual machine hibernation configuration relationship set by the user, without affecting system functionality, and meets the hibernation requirements of specific scenarios.

[0058] For other aspects of the embodiments of the present invention, please refer to Figure 2 The virtual machine hibernation configuration relationship includes a first hibernation state and a second hibernation state corresponding to different virtual machines using the central processing unit. Step 300, configuring the hibernation state of the virtual machine using the central processing unit based on the virtual machine hibernation configuration relationship, includes: Step 310, configuring the first hibernation state of the virtual machine using the central processing unit to be enabled based on the virtual machine hibernation configuration relationship, and configuring the second hibernation state of the virtual machine using the central processing unit to be disabled. The hibernation level of the first hibernation state is higher than that of the second hibernation state.

[0059] The first hibernation state represents a deep hibernation state, and the second hibernation state represents a shallow hibernation state. The difference between deep and shallow hibernation states is that the CPU discards more functions in a deep hibernation state than in a shallow hibernation state. The more functions the CPU discards, the more power it saves; in other words, the deeper the hibernation. The methods for implementing different hibernation states also differ. For example, deep hibernation is achieved by cutting off the CPU's internal clock, while shallow hibernation is achieved by reducing the CPU's voltage.

[0060] In this embodiment of the invention, to maximize power saving, the first hibernation state of the virtual machine using the CPU is enabled, and the second hibernation state of the virtual machine using the CPU is disabled. That is, the deep hibernation state of the virtual machine using the CPU is enabled, and the shallow hibernation state of the virtual machine using the CPU is disabled. This allows the virtual machine to be in working mode when using the CPU and in deep hibernation mode when not in use, eliminating the need for a shallow hibernation state (skipping the shallow hibernation state). This allows for switching between working mode and deep hibernation mode, meeting the needs of scenarios requiring only two states to switch between. When the virtual machine is not in use, it immediately enters deep hibernation mode from working mode; when the virtual machine is in use, it immediately enters working mode from deep hibernation mode, enabling the fastest possible execution of tasks and improving response time.

[0061] For other aspects of the embodiments of the present invention, please refer to Figure 3 and Figure 4 After step 310, which configures the virtual machine to enable the first hibernation state using the central processing unit based on the virtual machine hibernation configuration relationship and disables the second hibernation state using the central processing unit, the method further includes:

[0062] Step 320: If it is determined that the virtual machine is exclusively using the central processing unit, configure the hibernation state of the exclusively using central processing unit based on the virtual machine hibernation configuration relationship.

[0063] By traversing all existing virtual machines on the electronic device, it is determined that the virtual machine uses a CPU exclusively. Based on the virtual machine hibernation configuration relationship, the hibernation state of the exclusively used CPU is configured. Here, "exclusively used CPU" means that the virtual machine exclusively uses a specific CPU to perform a special function.

[0064] The virtual machine hibernation configuration relationship also includes the first hibernation state and the second hibernation state corresponding to different exclusive use of the central processing unit at different lifecycles. For example, please refer to... Figure 5 Users can pre-create hibernation states, meaning they can pre-configure hibernation states corresponding to different lifecycles of exclusive CPU usage. Users can set hibernation states including deep hibernation and shallow hibernation. Then, virtual machines with exclusive CPU usage are created, and a list of CPUs allocated to these virtual machines is obtained. Hibernation states for each virtual machine's exclusive CPU usage are then configured for different lifecycles. When a virtual machine's lifecycle changes, the associated hibernation state changes accordingly. For example, hibernation states can be configured for the shutdown and working states of CPU A. When CPU A changes from shutdown to working, its hibernation state changes. This allows for flexible configuration of the virtual machine's exclusive CPU usage hibernation state based on the user's desired hibernation configuration, further meeting hibernation requirements in specific scenarios.

[0065] In other aspects of this invention, step 320, configuring the sleep state of the exclusively used central processing unit based on the virtual machine sleep configuration relationship, includes:

[0066] Step 321: If it is determined that the CPU is in a power-off state, configure the first hibernation state of the CPU to be enabled and the second hibernation state of the CPU to be disabled.

[0067] The first hibernation state represents a deep hibernation state, and the second hibernation state represents a shallow hibernation state. The specific meanings of deep and shallow hibernation states are detailed in the descriptions above and will not be repeated here. When an electronic device determines that it is exclusively using the central processing unit (CPU) in a powered-off state, it configures the first hibernation state for exclusive CPU use to be enabled and the second hibernation state for exclusive CPU use to be disabled.

[0068] To maximize power efficiency, the first hibernation state for exclusive CPU use of the virtual machine is enabled, while the second hibernation state is disabled. Specifically, a deep hibernation state for exclusive CPU use is enabled, while a shallow hibernation state is disabled. This allows the CPU to operate in working mode when not in use and enter deep hibernation when not in use, eliminating the need for a shallow hibernation state (skipping the shallow hibernation state). This seamless switching between working and deep hibernation states meets the needs of scenarios requiring only these two states. When the virtual machine is not in use, the exclusive CPU immediately transitions from working mode to deep hibernation, reducing power consumption and thus saving energy. When the virtual machine is in use, the exclusive CPU immediately transitions from deep hibernation to working mode, enabling faster task execution and improved response time. Therefore, this embodiment of the invention allows for flexible configuration of different hibernation levels for the exclusive CPU use of the virtual machine according to different user scenarios, fulfilling various specific hibernation control requirements for exclusive CPU use.

[0069] In other aspects of this invention, step 320, configuring the sleep state of the exclusive use of the central processing unit based on the virtual machine sleep configuration relationship, includes:

[0070] Step 322: If it is determined that the exclusive use of the CPU is in an active state, configure the preset sleep state of the exclusive use of the CPU to be enabled, and configure other sleep states of the exclusive use of the CPU other than the preset sleep state to be disabled. The preset sleep state includes the first sleep state or the second sleep state.

[0071] The working state can include any of the following: cold migration, hot migration, or restart, where the central processing unit is used exclusively.

[0072] When an electronic device determines that the dedicated CPU is in an active state, it ensures that the dedicated CPU of the active virtual machine is only enabled in the user-specified preset hibernation state, and that other hibernation states are disabled. For example, the preset hibernation state could be a shallow hibernation state. To maintain the efficient operation of the virtual machine service, the dedicated CPU of the active virtual machine is only enabled in the shallow hibernation state, and other hibernation states (i.e., deep hibernation states) are disabled. In this case, the dedicated CPU of the active virtual machine will not enter a deep hibernation state, and can quickly switch from the shallow hibernation state to the active mode, enabling efficient operation of the dedicated CPU. Therefore, this embodiment of the invention can flexibly set different hibernation levels for the dedicated CPU of the virtual machine according to different user scenarios, achieving hibernation control requirements for dedicated CPUs in various specific scenarios.

[0073] The central processing unit (CPU) hibernation control device provided by the present invention is described below. The CPU hibernation control device described below can be referred to in correspondence with the CPU hibernation control method described above.

[0074] Please refer to Figure 6 The present invention also provides a central processing unit sleep control device, comprising:

[0075] The first determining module 601 is used to determine, when it is determined that the power-saving mode of the central processing unit is enabled, whether the system to be hibernated uses the central processing unit or the virtual machine uses the central processing unit.

[0076] The first control module 602 is used to disable the system's hibernation function using the central processing unit;

[0077] The second control module 603 configures the virtual machine to use the central processing unit's hibernation state based on the virtual machine hibernation configuration relationship;

[0078] The virtual machine hibernation configuration relationship includes the hibernation state corresponding to the central processing unit used by different virtual machines.

[0079] The CPU hibernation control device of this invention determines the CPU used by the system and the CPU used by the virtual machine to be hibernated; it disables the hibernation function of the CPU used by the system, thereby ensuring that the CPU used by the system is in working mode and that the CPU used by the system runs with priority. By configuring the hibernation state of the CPU used by the virtual machine based on the virtual machine hibernation configuration relationship, the virtual machine uses the CPU to enter a preset hibernation state. Thus, by disabling the hibernation function of the CPU used by the system, this invention, while ensuring that system functionality is not affected, flexibly configures the hibernation state of the CPU according to the virtual machine hibernation configuration relationship set by the user, thereby meeting the hibernation requirements in specific scenarios.

[0080] In one embodiment, the virtual machine hibernation configuration relationship includes a first hibernation state and a second hibernation state corresponding to different virtual machines using the central processing unit, and the second control module 603 includes:

[0081] The first hibernation state configuration module is used to configure the virtual machine to enable the first hibernation state using the central processing unit based on the virtual machine hibernation configuration relationship, and to configure the virtual machine to disable the second hibernation state using the central processing unit; the hibernation level of the first hibernation state is higher than that of the second hibernation state.

[0082] In one embodiment, the central processing unit sleep control device further includes:

[0083] The second hibernation state configuration module is used to configure the hibernation state of the exclusively used CPU based on the virtual machine hibernation configuration relationship when it is determined that the CPU used by the virtual machine is the exclusive use of the CPU by the virtual machine.

[0084] The virtual machine hibernation configuration relationship also includes the first hibernation state and the second hibernation state corresponding to different exclusive use of the central processing unit at different lifecycles.

[0085] In one embodiment, the second hibernation state configuration module is configured to enable the first hibernation state of the exclusive CPU and disable the second hibernation state of the exclusive CPU when it is determined that the CPU is in a power-off state.

[0086] In one embodiment, the second hibernation state configuration module is used to configure a preset hibernation state of the exclusive-use CPU to be enabled and to configure other hibernation states of the exclusive-use CPU other than the preset hibernation state to be disabled when it is determined that the exclusive-use CPU is in a working state.

[0087] The preset sleep state includes either the first sleep state or the second sleep state.

[0088] In one embodiment, the first determining module is used to determine, based on the CPU configuration file, whether the system to be hibernated uses the CPU and the virtual machine uses the CPU.

[0089] The central processing unit (CPU) configuration file includes the system usage or virtual machine usage corresponding to different CPUs.

[0090] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7 As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute a central processing unit (CPU) hibernation control method. This method includes: determining the CPU used by the system and the CPU used by the virtual machine to be hibernated; disabling the hibernation function of the CPU used by the system; and configuring the hibernation state of the CPU used by the virtual machine based on a virtual machine hibernation configuration relationship, wherein the virtual machine hibernation configuration relationship includes different hibernation states corresponding to different CPUs used by the virtual machines.

[0091] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0092] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the CPU hibernation control method provided by the above methods. The method includes: determining the CPU used by the system to be hibernated and the CPU used by the virtual machine; disabling the hibernation function of the CPU used by the system; configuring the hibernation state of the CPU used by the virtual machine based on the virtual machine hibernation configuration relationship; the virtual machine hibernation configuration relationship includes the hibernation states corresponding to different CPUs used by the virtual machines.

[0093] Furthermore, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, this computer program implements the CPU hibernation control method provided by the methods described above. This method includes: determining the CPU used by the system and the CPU used by the virtual machine to be hibernated; disabling the hibernation function of the CPU used by the system; configuring the hibernation state of the CPU used by the virtual machine based on a virtual machine hibernation configuration relationship; the virtual machine hibernation configuration relationship includes different hibernation states corresponding to different CPUs used by the virtual machines. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0094] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for controlling the hibernation of a central processing unit, characterized in that, include: Determine which system to be hibernated uses the central processing unit and which virtual machine uses the central processing unit; Disable the system's hibernation function using the central processing unit; Configure the virtual machine to use the central processing unit's sleep state based on the virtual machine sleep configuration relationship; The virtual machine hibernation configuration relationship includes the hibernation state corresponding to the central processing unit used by different virtual machines.

2. The central processing unit sleep control method according to claim 1, characterized in that, The virtual machine hibernation configuration relationship includes a first hibernation state and a second hibernation state corresponding to different virtual machines using the central processing unit; configuring the hibernation state of the virtual machine using the central processing unit based on the virtual machine hibernation configuration relationship includes: Based on the virtual machine hibernation configuration relationship, the first hibernation state of the virtual machine using the central processing unit is enabled, and the second hibernation state of the virtual machine using the central processing unit is disabled; The degree of dormancy in the first dormancy state is higher than that in the second dormancy state.

3. The central processing unit sleep control method according to claim 2, characterized in that, After configuring the virtual machine to enable the first hibernation state using the central processing unit based on the virtual machine hibernation configuration relationship, and configuring the virtual machine to disable the second hibernation state using the central processing unit, the method further includes: If it is determined that the virtual machine is exclusively using the central processing unit, the hibernation state of the exclusively used central processing unit is configured based on the virtual machine hibernation configuration relationship. The virtual machine hibernation configuration relationship also includes the first hibernation state and the second hibernation state corresponding to different exclusive use of the central processing unit at different lifecycles.

4. The central processing unit sleep control method according to claim 3, characterized in that, The configuration of the hibernation state for exclusive use of the central processing unit based on the virtual machine hibernation configuration relationship includes: If it is determined that the CPU is in a power-off state, the first hibernation state of the CPU is configured to be enabled, and the second hibernation state of the CPU is configured to be disabled.

5. The central processing unit sleep control method according to claim 3, characterized in that, The configuration of the hibernation state for exclusive use of the central processing unit based on the virtual machine hibernation configuration relationship includes: If it is determined that the exclusive use of the central processing unit is in an active state, configure the preset sleep state of the exclusive use of the central processing unit to be enabled, and configure the other sleep states of the exclusive use of the central processing unit other than the preset sleep state to be disabled. The preset sleep state includes either the first sleep state or the second sleep state.

6. The central processing unit sleep control method according to any one of claims 1 to 5, characterized in that, The system for determining hibernation control uses a central processing unit (CPU) and the virtual machine uses a CPU, including: The CPU configuration file determines whether the system uses a CPU and the virtual machine uses a CPU. The central processing unit (CPU) configuration file includes the system usage or virtual machine usage corresponding to different CPUs.

7. A central processing unit sleep control device, characterized in that, include: The first determining module is used to determine the CPU used by the system to be hibernated and the CPU used by the virtual machine. The first control module is used to disable the system's hibernation function using the central processing unit; The second control module configures the virtual machine to use the central processing unit's sleep state based on the virtual machine sleep configuration relationship; The virtual machine hibernation configuration relationship includes the hibernation state corresponding to the central processing unit used by different virtual machines.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the central processing unit sleep control method as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the central processing unit sleep control method as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the central processing unit sleep control method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Sleep control method, sleep control device and sleep control system for virtual desktop

    CN105100125A

  • Dormancy control method and device for vehicle-mounted computing platform and readable storage medium

    CN112732341A