Dormancy wake-up probing method, apparatus, and computing device cluster

CN122985253APending Publication Date: 2026-10-27HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510536245.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0005]但是,在虚拟化管理器不发送唤醒信息给虚拟机的情况下,虚拟机内的云桌面系统服务不知道虚拟机已经被唤醒,会导致云桌面系统服务上报延迟,最终导致唤醒接入时长加长

Benefits of technology

[0033]应当理解的是,上述第二方面提及的休眠唤醒探测装置可以为第七方面或第八方面提及的芯片,还可以为第三方面提及的计算设备。本申请的第二方面至第八方面的技术方案及对应的可能的实现方式所取得的有益效果,可以参见上述对第一方面及其对应的可能的实现方式的技术效果,此处不再赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985253A_ABST
    Figure CN122985253A_ABST
Patent Text Reader

Abstract

The application discloses a hibernation wake-up detection method and device and a computer cluster, and belongs to the field of cloud computing. The method comprises the following steps: obtaining first information, wherein the first information is used for representing a first time interval, and the first time interval is a time interval between two adjacent working time points of a virtual machine recorded by a timer of the virtual machine; obtaining second information, wherein the second information is used for representing a second time interval, and the second time interval is a time interval between two adjacent working time points of the virtual machine recorded by a system clock of a computer; and determining that the virtual machine has been woken up in the case that a difference between the second information and the first information is greater than a threshold. Since the first information is related to the time recorded by the timer of the virtual machine, and the second information is related to the time recorded by the system clock of the computer, once the virtual machine is woken up from hibernation, the difference between the second information and the first information will instantaneously become large, thereby achieving the purpose of quickly detecting that the virtual machine has been woken up, effectively reducing the reporting delay, and shortening the wake-up access time length.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing, and in particular to a method, apparatus, and computing device cluster for detecting sleep / wake-up. Background Technology

[0002] A cloud desktop is a virtual desktop deployed within a virtual machine on a cloud server. When a cloud desktop goes into hibernation, all files and processes within the cloud desktop are saved in memory, so that when the cloud desktop is awakened, it can return to its state before hibernation. Since cloud desktop service providers do not charge for the central processing unit (CPU) and memory after a cloud desktop goes into hibernation, only for storage, users choose to hibernate or shut down. Because cloud desktop hibernation preserves the state before hibernation, users prefer to use hibernation to save costs.

[0003] Cloud desktops can implement hibernation in two ways: in-band hibernation and out-of-band hibernation. In-band hibernation is achieved through the operating system inside the virtual machine. Out-of-band hibernation, on the other hand, involves the underlying virtualization manager or the physical host controlling the virtual machine's hibernation process without relying on the operating system.

[0004] Accordingly, in-band hibernation corresponds to in-band hibernation-wake-up, and out-of-band hibernation corresponds to out-of-band hibernation-wake-up. Taking out-of-band hibernation-wake-up as an example, the wake-up process is as follows: The virtualization manager unfreezes the virtual machine, restores the hibernation file and loads it into the virtual machine's memory. The virtualization manager can send wake-up information to the virtual machine to wake it up. After the virtual machine wakes up, the cloud desktop system service resumes operation and periodically reports the status of the virtual machine to the management desktop service, which can then determine whether the cloud desktop has been woken up.

[0005] However, if the virtualization manager does not send wake-up information to the virtual machine, the cloud desktop system service inside the virtual machine will not know that the virtual machine has been woken up, which will cause a delay in the cloud desktop system service's reporting and ultimately increase the wake-up access time. Summary of the Invention

[0006] This application provides a method, apparatus, and computing device cluster for detecting sleep / wake-up. It can quickly determine that a virtual machine has been woken up without the virtualization manager sending wake-up information to the virtual machine, thereby effectively shortening the wake-up access time. The technical solution is as follows.

[0007] Firstly, a method for detecting hibernation / wake-up is provided. This method is applied to a virtual desktop service (such as a cloud desktop system service), which is deployed within a virtual machine, which is deployed in a computer. The method includes: acquiring first information, which characterizes a first time interval, recorded by the virtual machine's timer as the time interval between two adjacent working moments of the virtual machine; acquiring second information, which characterizes a second time interval, recorded by the computer's system clock as the time interval between two adjacent working moments of the virtual machine; and determining that the virtual machine has been woken up based on the difference between the second and first information. Since the first information is related to the time recorded by the virtual machine's timer, and the second information is related to the time recorded by the computer's system clock, once the virtual machine wakes up from hibernation (i.e., the virtual machine starts working), the difference between the second and first information will instantly increase. Therefore, once the difference between the second and first information instantly increases, the cloud desktop system service can determine that the virtual machine has been woken up, achieving the goal of quickly detecting that the virtual machine has been woken up, thereby effectively reducing the reporting latency of the cloud desktop system service and shortening the wake-up access time.

[0008] In one possible implementation, the first information is a first time interval, and the second information is a second time interval; or, the first information is counting information related to the first time interval, and the second information is counting information related to the second time interval. The counting information may include billing duration or the number of set tags. For example, the first information is the actual billing duration obtained by summarizing the billing duration of the first time interval, and the second information is the theoretical billing duration obtained by summarizing the billing duration of the second time interval; or, for another example, the first information is the actual number of set tags counted periodically according to the first time interval, and the second information is the theoretical number of set tags counted periodically according to the second time interval.

[0009] In one possible implementation, the first information includes a first time interval, and the second information includes a second time interval. Determining that the virtual machine has been woken up when the difference between the second information and the first information is greater than a threshold includes: determining that the virtual machine has been woken up when the difference between the second time interval and the first time interval is greater than the threshold. Therefore, once the virtual machine is woken up from hibernation, if the difference between the second time interval and the first time interval is greater than the threshold, it can be determined that the virtual machine has been woken up. This allows for timely detection of virtual machine wake-up, achieving the goal of rapid detection of virtual machine wake-up, effectively reducing the latency of cloud desktop system service reporting, and shortening the wake-up access time.

[0010] In one possible implementation, after determining that the virtual machine has been woken up, the method further includes: reporting a notification to the cloud desktop management service, the notification carrying information that the virtual machine has been woken up. The cloud desktop management service is used to manage the access of the cloud desktop system service to the cloud desktop client. By reporting the virtual machine wake-up notification to the cloud desktop management service after determining that the virtual machine has been woken up, the cloud desktop management service can promptly learn that the virtual machine has been woken up, and thus promptly control the access of the cloud desktop system service to the cloud desktop client, shortening the wake-up access time.

[0011] In one possible implementation, after determining that the virtual machine has been woken up, the method further includes: stopping the operation of detecting whether the virtual machine has been woken up, effectively saving the resource occupation of out-of-band hibernation and reducing the resource occupation of out-of-band hibernation wake-up.

[0012] In one possible implementation, after determining that the virtual machine has been woken up, the method further includes: stopping the execution of time synchronization operations, effectively saving the resource occupation of out-of-band hibernation, and reducing the resource occupation of out-of-band hibernation wake-up.

[0013] In one possible implementation, after determining that the virtual machine has been woken up, the method further includes: recording the state or start time of the probe task, the state or start time of the state being used to prompt the probe task to avoid being called repeatedly; the probe task is the task that detects whether the virtual machine has been woken up, and by recording the state or start time of the probe task, preparation is made for the next hibernation.

[0014] In one possible implementation, the method further includes: when the virtual machine receives a notification to enter hibernation but has not yet entered hibernation, performing a cache clearing operation on the virtual machine. By clearing the virtual machine's cache, the burden on the virtual machine is reduced, which can effectively reduce the hibernation time or hibernation wake-up time.

[0015] In one possible implementation, the method further includes: disconnecting the cloud desktop client when the virtual machine receives a notification to enter hibernation but has not yet entered hibernation, which can avoid reconnection operations caused by the cloud desktop client's delayed perception of the cloud desktop status.

[0016] Secondly, a hibernation / wake-up device is provided. The device is applied to a cloud desktop system service, which is deployed within a virtual machine. The virtual machine is deployed in a computer. The device includes: a first time interval, which is the time interval between two adjacent working moments of the virtual machine recorded by the virtual machine's timer; an acquisition module, used to acquire second information, which is used to characterize the second time interval, which is the time interval between two adjacent working moments of the virtual machine recorded by the computer's system clock; and a detection module, used to determine that the virtual machine has been woken up when the difference between the second information and the first information is greater than a threshold.

[0017] In one possible implementation, the first information is a first time interval, and the second information is a second time interval; or, the first information is counting information related to the first time interval, and the second information is counting information related to the second time interval, wherein the counting information may include billing duration or the number of set tags. For example, the first information is the actual billing duration obtained by summarizing the billing duration of the first time interval, and the second information is the theoretical billing duration obtained by summarizing the billing duration of the second time interval; as another example, the first information is the actual number of set tags counted periodically according to the first time interval, and the second information is the theoretical number of set tags counted periodically according to the second time interval.

[0018] In one possible implementation, the first information includes a first time interval, and the second information includes a second time interval; the detection module is used to determine that the virtual machine has been woken up if the difference between the second time interval and the first time interval is greater than a threshold.

[0019] In one possible implementation, the device further includes: a reporting module for reporting a notification to the cloud desktop management service, the notification carrying information that the virtual machine has been woken up, and the cloud desktop management service for managing the access of cloud desktop system services to cloud desktop clients.

[0020] In one possible implementation, the apparatus further includes: a first execution module for stopping the execution of the operation of detecting whether the virtual machine has been woken up.

[0021] In one possible implementation, the apparatus further includes a second execution module for stopping the execution of time synchronization operations.

[0022] In one possible implementation, the apparatus further includes: a recording module for recording the state of the probe task or the start time of the state, the state or the start time of the state being used to prompt the probe task to avoid being called repeatedly; the probe task is a task for detecting whether the virtual machine has been woken up.

[0023] In one possible implementation, the apparatus further includes a third execution module for performing a cache clearing operation on the virtual machine when the virtual machine receives a notification to enter hibernation but has not yet entered hibernation.

[0024] In one possible implementation, the apparatus further includes a fourth execution module for executing a disconnect cloud desktop client if the virtual machine receives a notification to enter hibernation but has not yet entered hibernation.

[0025] Thirdly, a computing device is provided, comprising a processor and a memory, the memory being used to store a computer program for performing the method provided in the first aspect. The processor is configured to execute the computer program stored in the memory to implement the method described in the first aspect.

[0026] Optionally, the computing device may further include a communication bus for establishing a connection between the processor and the memory.

[0027] Fourthly, a computing device cluster is provided, including at least one computing device, each computing device including a processor and memory;

[0028] The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the cluster of computing devices performs the method described in the first aspect above.

[0029] Fifthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the method described in the first aspect.

[0030] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, cause the computer to perform the method described in the first aspect.

[0031] In a seventh aspect, a chip is provided, including a processor for retrieving and executing instructions stored in a memory, causing a computer equipped with the chip to perform the method described in the first aspect above.

[0032] Eighthly, another chip is provided, comprising: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected by an internal connection path, the processor is used to execute code in the memory, and when the code is executed, a computer with the chip installed performs the method in the first aspect described above.

[0033] It should be understood that the sleep / wake-up detection device mentioned in the second aspect above can be the chip mentioned in the seventh or eighth aspect, or the computing device mentioned in the third aspect. The beneficial effects achieved by the technical solutions and corresponding possible implementations of the second to eighth aspects of this application can be found in the above description of the technical effects of the first aspect and its corresponding possible implementations, and will not be repeated here. Attached Figure Description

[0034] Figure 1 This is a schematic diagram of the out-of-band hibernation process for virtual machines provided in related technologies;

[0035] Figure 2 This is a schematic diagram of the out-of-band hibernation and wake-up process of a virtual machine provided in related technologies;

[0036] Figure 3 A schematic flowchart illustrating a sleep / wake-up detection method provided in an embodiment of this application;

[0037] Figure 4 A schematic flowchart illustrating a sleep / wake-up detection method provided in an embodiment of this application;

[0038] Figure 5 This is a schematic diagram of the structure of a sleep / wake-up detection device provided in an embodiment of this application;

[0039] Figure 6 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0040] Figure 7 This is a schematic diagram of the structure of a computing device cluster provided in an embodiment of this application;

[0041] Figure 8 This is a schematic diagram of another computing device cluster provided in an embodiment of this application. Detailed Implementation

[0042] Cloud desktops are virtual desktops deployed within virtual machines on cloud servers. They offer all the advantages of cloud infrastructure, such as elastic scaling and pay-as-you-go pricing. Cloud desktop service packages typically support two billing models: periodic billing and pay-as-you-go. Periodic billing is suitable for scenarios requiring stable, long-term use of cloud desktop resources, offering greater discounts compared to pay-as-you-go. Pay-as-you-go billing is suitable for short-term business needs or scenarios that don't require 24 / 7 operation. When not in use, instance computing resources can be released by shutting down or hibernating, saving costs. Shutting down releases instance computing resources but doesn't retain the user's memory state. However, when the cloud desktop hibernates, all files and processes within the cloud desktop are preserved in memory, allowing it to return to its pre-hibernation state upon waking. Therefore, users of cloud desktops often prefer hibernation to save costs.

[0043] Cloud desktop hibernation can include in-band hibernation and out-of-band hibernation. In-band hibernation is implemented through the operating system inside the virtual machine. Out-of-band hibernation, on the other hand, involves the underlying virtualization manager or the physical host controlling the virtual machine's hibernation process without relying on the operating system. This application will use out-of-band hibernation as an example for detailed explanation.

[0044] Figure 1 This is a schematic diagram illustrating the out-of-band hibernation process of a virtual machine provided in related technologies. For example... Figure 1 As shown, the out-of-band hibernation process for a virtual machine can be as follows: Step ① The hypervisor acts as the host virtualization layer, responsible for managing and allocating physical resources while providing an isolated runtime environment for the guest virtual machine. The host virtualization layer freezes the guest virtual machine. Step ② The host virtualization layer saves the hibernation file from the guest virtual machine's memory to its own storage. Step ③ The host virtualization layer updates the power state. After the guest virtual machine hibernates, it needs to be woken up. Figure 2 This is a schematic diagram illustrating the out-of-band hibernation and wake-up process of a virtual machine provided in related technologies. For example... Figure 2 As shown, the out-of-band hibernation and wake-up process for the Guest virtual machine can be as follows: Step ① The Host virtualization layer unfreezes the Guest virtual machine. Step ② The Host virtualization layer restores the hibernation file and loads it into the Guest virtual machine's memory. Step ③ The Host virtualization layer updates the power state.

[0045] Using out-of-band hibernation in cloud desktops can solve the problems of prolonged and unstable in-band hibernation. However, when a virtual machine waking up from out-of-band hibernation, the host virtualization layer cannot send a signal to the guest virtual machine. Therefore, the cloud desktop system service (Agent) within the virtual machine is unaware that it has been woken up. This causes a delay (typically 60 seconds) in the cloud desktop system service reporting the wake-up information to the managing desktop service, ultimately increasing the access time for the cloud desktop system service to connect to the cloud desktop client. Therefore, this application addresses the problem of how the cloud desktop system service can quickly detect when a virtual machine has been woken up, provided that the host virtualization layer does not send a signal to the guest virtual machine.

[0046] To address the aforementioned technical problems, this application provides a hibernation / wake-up detection method. This method is applied to a virtual desktop service (such as a cloud desktop system service), which is deployed within a virtual machine, and the virtual machine is deployed on a computer. The method may include: acquiring first information, which characterizes a first time interval, recorded by the virtual machine's timer as the time interval between two adjacent working moments of the virtual machine; acquiring second information, which characterizes a second time interval, recorded by the computer's system clock as the time interval between two adjacent working moments of the virtual machine; and determining that the virtual machine has been woken up when the difference between the second information and the first information is greater than a threshold. Since the first information is related to the time recorded by the virtual machine's timer, and the second information is related to the time recorded by the computer's system clock, once the virtual machine wakes up from hibernation (i.e., the virtual machine starts working), the difference between the second information and the first information will instantly increase. Therefore, once the difference between the second information and the first information instantly increases, the cloud desktop system service can determine that the virtual machine has been woken up, achieving the goal of quickly detecting that the virtual machine has been woken up, thereby effectively reducing the reporting delay of the cloud desktop system service and shortening the wake-up access time.

[0047] In some embodiments, the first information is a first time interval, and the second information is a second time interval; or, the first information is counting information related to the first time interval, and the second information is counting information related to the second time interval, wherein the counting information may include billing duration or the number of tags set. For example, the first information is the actual billing duration obtained by summarizing the billing duration of the first time interval, and the second information is the theoretical billing duration obtained by summarizing the billing duration of the second time interval; as another example, the first information is the actual number of tags set according to the first time interval as a periodic timer, and the second information is the theoretical number of tags set according to the second time interval as a periodic timer.

[0048] For example, assuming the threshold is 1, the first information could be the time interval recorded by the virtual machine's timer, i.e., the first time interval; the second information could be the time interval recorded by the computer's system clock, i.e., the second time interval. For example, Figure 3 This is a flowchart illustrating a sleep / wake-up detection method provided in an embodiment of this application. Figure 3 As shown, step ① involves the Cloud Desktop System Service Agent acquiring the first time interval. The Cloud Desktop System Service Agent then acquires the second time interval. Finally, the Cloud Desktop System Service Agent calculates the difference between the second and first time intervals. During virtual machine hibernation, the virtual machine's timer stops, meaning the virtual machine's working time stops, and the computer's system clock also stops recording time. When the virtual machine is awakened from hibernation, it begins working. At this time, the virtual machine's timer continues counting from the working time before wake-up, resulting in a working time interval of 1 second. Since the computer's system clock needs to be synchronized to the latest time, the second time interval is the period from virtual machine hibernation to wake-up. Therefore, the difference between the second and first time intervals is greater than 1 second. When the virtual machine is working normally, the computer's system clock records a time interval of 1 second. At this time, the difference between the second and first time intervals is less than 1 second. Therefore, once the virtual machine is awakened from hibernation, if the difference between the second and first time intervals is greater than 1 second, it can be determined that the virtual machine has been awakened, allowing for timely detection of the virtual machine's awakening. Simultaneously, step ② involves the Cloud Desktop System Service Agent reporting to the management desktop service that the virtual machine has been awakened. Step ③: The managed desktop service promptly instructs the cloud desktop system service to access the cloud desktop client. This effectively reduces the reporting latency of the cloud desktop system service and shortens the wake-up access time.

[0049] The following describes in detail a hibernation / wake-up detection method provided by an embodiment of this application, with reference to examples. This hibernation / wake-up detection method can be applied to a cloud desktop system service, which is deployed within a virtual machine, and the virtual machine is deployed on a computer. The cloud desktop system service typically provides an application program interface (API) or management interface, allowing cloud desktop clients connected to the service to invoke hibernation and wake-up operations. These interfaces may be based on RESTful APIs, RPC (such as gRPC), or other protocols. The cloud desktop client sends hibernation requests or hibernation / wake-up requests to the cloud desktop system service by calling these interfaces. The following description proceeds in stages.

[0050] The first stage is before the virtual machine goes into hibernation.

[0051] After the cloud desktop client sends a hibernation request to the cloud desktop system service, the cloud desktop system service receives the hibernation request. At this time, the virtual machine receives a notification to enter hibernation. If it has not yet entered hibernation, the cloud desktop system service can perform a cache clearing operation on the virtual machine. This should be understood as the cloud desktop system service clearing invalid caches from the virtual machine. Invalid caches can include caches that have lost their validity, browsing history, duplicate caches, etc. By clearing the virtual machine's cache, the burden on the virtual machine is reduced, which can effectively reduce the hibernation time or hibernation wake-up time. Of course, if the cloud desktop system service is connected to a cloud desktop client, the cloud desktop system service can also disconnect the cloud desktop client, which can avoid reconnection operations caused by the cloud desktop client's delayed perception of the cloud desktop status.

[0052] In addition, the cloud desktop system service can also start a time synchronization thread, which performs time synchronization operations. For example, the cloud desktop system service performs time synchronization at a first preset time interval. The first preset time interval can be 0.7 seconds or 1.5 seconds. This is to facilitate subsequent time synchronization during the virtual machine's wake-up process to obtain an accurate system time. Simultaneously, the cloud desktop system service can also start a sleep / wake-up detection thread, which can perform a detection operation to determine whether the virtual machine has been woken up. For example, the cloud desktop system service performs this detection at a second preset time interval. The second preset time interval can be 1 second or 1.2 seconds.

[0053] Afterwards, the virtual machine's operating system receives the hibernation request and begins the hibernation operation. When the virtual machine needs to be woken up, the cloud desktop client calls the aforementioned interface to send a hibernation-wake request to the cloud desktop system service. Upon receiving the hibernation-wake request, the cloud desktop system service verifies the request's validity (such as authentication information, permission checks, etc.) and then locates the corresponding virtual machine. The virtual machine's operating system receives the hibernation-wake request and performs the wake-up operation. At this time, the cloud desktop system service continues to run the time synchronization thread and the hibernation-wake detection thread.

[0054] In the second stage, the virtual machine is awakened from hibernation.

[0055] Figure 4 This is a flowchart illustrating a sleep / wake-up detection method provided in an embodiment of this application. Figure 4 As shown, the cloud desktop system service can execute S401-S403 (some of which are optional).

[0056] S401, The cloud desktop system service obtains first information, which is used to characterize the first time interval. The first time interval is the time interval between two adjacent working moments of the virtual machine recorded by the virtual machine's timer.

[0057] For example, a virtual machine's timer records the virtual machine's working time. For instance, while the virtual machine is working, the timer accumulates the countdown, and when it reaches 50 seconds, the virtual machine goes to sleep. When the virtual machine is woken from sleep, the timer continues accumulating for another 50 seconds until it reaches 51 seconds.

[0058] S402, The cloud desktop system service obtains the second information, which is used to characterize the second time interval, which is the time interval between two adjacent working moments of the virtual machine recorded by the computer's system clock.

[0059] Continuing with the above example, when the virtual machine's timer counts down for 50 seconds, the computer's system clock can record 12:00. When the virtual machine's timer counts down for 51 seconds, the virtual machine has been awakened, and the computer's system clock is refreshed to the latest time. At this time, the computer's system clock can record 12:30. Of course, the embodiments in this application are not limited to the times listed above, but are only used as examples for illustration.

[0060] S403. If the difference between the second information and the first information is greater than the threshold, the cloud desktop system service determines that the virtual machine has been woken up.

[0061] The threshold can be set according to the actual situation, and no specific limit is made here.

[0062] As described above, the first information is a first time interval, and the second information is a second time interval. Alternatively, the first information may be counting information related to the first time interval, and the second information may be counting information related to the second time interval. The counting information may include billing duration or the number of set tags. For example, the first information may be the actual billing duration obtained by summarizing the billing duration of the first time interval, and the second information may be the theoretical billing duration obtained by summarizing the billing duration of the second time interval. As another example, the first information may be the first setting information for a periodic timed task, and the second information may be the second setting information for a periodic timed task. For instance, the first information may be the actual number of set tags counted according to the first time interval as a periodic timed task, and the second information may be the theoretical number of set tags counted according to the second time interval as a periodic timed task. The following describes S403 in detail with reference to the different contents contained in the first and second information.

[0063] For example, the first information includes a first time interval, and the second information includes a second time interval; S403 can be implemented as follows: if the difference between the second time interval and the first time interval is greater than a first threshold, determine that the virtual machine has been woken up. For example, the first threshold is 1. During the virtual machine's hibernation, the virtual machine's working time stops, and the computer's system clock also stops recording time. At this time, the system clock's recording time is 12:00. When the virtual machine is woken up from hibernation at 13:00, the virtual machine starts working. At this time, the virtual machine's timer will continue counting from the working time before wake-up, so the virtual machine's working time interval is 1 second. However, the computer's system clock needs to be synchronized to the latest time, i.e., 13:00. Therefore, the second time interval is the period from the virtual machine's hibernation to its wake-up, which is 60 seconds. Therefore, the difference between the second time interval and the first time interval is greater than 1. When the virtual machine is working normally, the computer's system clock's recording time interval is also 1 second. At this time, the difference between the second time interval and the first time interval is less than 1. It is evident that once the virtual machine is awakened from hibernation, if the difference between the second time interval and the first time interval is greater than 1, it can be determined that the virtual machine has been awakened. This allows for timely detection of the virtual machine being awakened, achieving the goal of rapid detection of virtual machine awakening.

[0064] For example, the first information includes the actual billing duration, and the second information includes the theoretical billing duration. Then, S403 can be implemented as follows: if the difference between the theoretical and actual billing durations is greater than a second threshold, determine that the virtual machine has been woken up. For example, the second threshold is 5. During virtual machine hibernation, the virtual machine does not work. When the virtual machine is woken up from hibernation, it starts working. At this time, the virtual machine's timer continues counting from the working time before wake-up, and the virtual machine's working time interval is 1 second. Therefore, the actual working time of the virtual machine is cumulative. However, the computer's system clock needs to be synchronized to the latest time, and there is a time difference between virtual machine hibernation and virtual machine wake-up. For example, if the virtual machine hibernates at 15:30 and wakes up at 15:36, then the theoretical billing duration includes the 6 minutes of hibernation. Therefore, there is a deviation between the theoretical and actual billing durations. Hence, the difference between the theoretical and actual billing durations is greater than 6. When the virtual machine is working normally, the computer's system clock records a time interval of 1 second. At this time, the difference between the theoretical billing duration and the actual billing duration is 0, which is less than 6. Therefore, once the virtual machine is woken up from hibernation, if the difference between the theoretical billing duration and the actual billing duration is greater than 6, it can be determined that the virtual machine has been woken up. This allows for timely detection of the virtual machine being woken up, achieving the goal of rapid virtual machine wake-up.

[0065] For example, the first information includes actual billing, and the second information includes theoretical billing. Then, S403 can be implemented as follows: if the difference between the theoretical billing and the actual billing duration is greater than a third threshold, determine that the virtual machine has been woken up. For example, the second threshold is 1.5, and the cost per second is 0.01 yuan. During virtual machine hibernation, the virtual machine does not work. When the virtual machine is woken up from hibernation, it starts working, and at this time, the virtual machine's timer continues billing for the working time before wake-up. For example, if the virtual machine's hibernation cost is 5 yuan, the cost accumulates for each second the virtual machine is woken up from hibernation, i.e., 5.01 yuan, 5.02 yuan, and so on. The theoretical billing is calculated based on the virtual machine's startup time. If the virtual machine's hibernation time is 11:01 and the virtual machine wakes up from hibernation at 11:21, then the calculated theoretical billing is 5 + 0.01 * 20 = 7 yuan. The theoretical billing is 2 yuan more than the actual billing. When a virtual machine is working normally, the computer's system clock records a time interval of 1 second. At this time, the difference between the theoretical billing and the actual billing is 0, which is less than 1.5. Therefore, once the virtual machine is woken up from hibernation, the difference between the theoretical billing and the actual billing is greater than 1.5, which indicates that the virtual machine has been woken up. This allows for timely detection of the virtual machine being woken up, achieving the goal of rapid virtual machine wake-up.

[0066] The third stage occurs after the virtual machine is awakened.

[0067] After the cloud desktop system service determines that the virtual machine has been woken up, it can report this to the management desktop service. Upon receiving this report, the management desktop service can instruct the cloud desktop system service to connect to the cloud desktop client. Upon receiving the instruction, the cloud desktop system service connects to the cloud desktop client. By reporting the virtual machine's wake-up status to the management desktop service upon confirmation, the management desktop service can promptly become aware of the wake-up and control the connection of the cloud desktop system service to the cloud desktop client, thus shortening the wake-up connection time.

[0068] To reduce resource consumption, the cloud desktop system service can also stop detecting whether a virtual machine has been woken up. That is, after a virtual machine is woken up, the detection process stops, effectively saving resources used by external hibernation and reducing the resource consumption from waking up from external hibernation. Additionally, the cloud desktop system service can also stop performing time synchronization operations. This means that after a virtual machine is woken up, the time synchronization operation stops, effectively saving resources used by external hibernation and reducing the resource consumption from waking up from external hibernation.

[0069] Additionally, the cloud desktop system service can record the status or start time of the probe task. This status or start time is used to alert the probe task to avoid repeated calls. The probe task is the task that detects whether the virtual machine has been woken up. For example, the cloud desktop system service can use ThreadLocal to store the transaction status of the current hibernation / wake-up probe thread. Before entering a Hibernate transaction, a flag (e.g., a boolean value) is set to indicate that the current hibernation / wake-up probe thread has entered a transaction. This flag is checked before each attempt to enter a Hibernate transaction. If the flag is already set, it means the current thread is already in a transaction, and an exception can be thrown or other handling measures can be taken. Therefore, by recording the status or start time of the probe task to achieve the purpose of setting a time flag, preparation can be made for the next hibernation.

[0070] This application also provides a sleep / wake-up detection device. This sleep / wake-up detection device can be implemented as part or all of an electronic device by software, hardware, or a combination of both. See also... Figure 5 This device is used in virtual desktop services (such as cloud desktop system services), which are deployed within virtual machines. The virtual machines are deployed in computers. The hibernation / wake-up detection device 500 includes:

[0071] The acquisition module 501 is used to acquire first information, which is used to characterize a first time interval, and the first time interval is the time interval between two adjacent working moments of the virtual machine recorded by the virtual machine's timer.

[0072] The acquisition module 501 is used to acquire second information, which is used to characterize a second time interval, which is the time interval between two adjacent working moments of the virtual machine recorded by the computer's system clock.

[0073] The detection module 502 is used to determine that the virtual machine has been woken up when the difference between the second information and the first information is greater than a threshold.

[0074] In this application, since the first information is related to the time recorded by the virtual machine's timer and the second information is related to the time recorded by the computer's system clock, once the virtual machine wakes up from hibernation, that is, the virtual machine starts working, the difference between the second information and the first information will instantly increase. Then, the cloud desktop system service can determine that the virtual machine has been woken up, thus achieving the purpose of the cloud desktop system service to quickly detect that the virtual machine has been woken up, thereby effectively reducing the reporting delay of the cloud desktop system service and shortening the wake-up access time.

[0075] In one possible implementation, the first information is a first time interval, and the second information is a second time interval; or, the first information is counting information related to the first time interval, and the second information is counting information related to the second time interval. For example, the first information is the actual billing duration obtained by summarizing the billing duration of the first time interval, and the second information is the theoretical billing duration obtained by summarizing the billing duration of the second time interval; or, for another example, the first information is the actual number of tags set according to the first time interval as periodic time statistics, and the second information is the theoretical number of tags set according to the second time interval as periodic time statistics.

[0076] In one possible implementation, the first information includes a first time interval, and the second information includes a second time interval; the detection module 502 is used to determine that the virtual machine has been woken up if the difference between the second time interval and the first time interval is greater than a threshold.

[0077] In one possible implementation, the device 500 further includes a reporting module 508, used to report a notification to the cloud desktop management service, the notification carrying information that the virtual machine has been woken up, and the cloud desktop management service is used to manage the access of cloud desktop system services to cloud desktop clients.

[0078] In one possible implementation, the device 500 further includes a first execution module 503, used to stop the operation of detecting whether the virtual machine has been woken up.

[0079] In one possible implementation, the device 500 further includes a second execution module 504 for stopping the execution of time synchronization operations.

[0080] In one possible implementation, the device 500 further includes: a recording module 505, used to record the state of the probe task or the start time of the state, the state or the start time of the state being used to prompt the probe task to avoid being called repeatedly; the probe task is a task to detect whether the virtual machine has been woken up.

[0081] In one possible implementation, the hibernation / wake-up detection device 500 further includes a third execution module 506, which is used to perform a cache clearing operation on the virtual machine when the virtual machine receives a notification to enter hibernation but has not entered hibernation.

[0082] In one possible implementation, the hibernation / wake-up detection device 500 further includes a fourth execution module 507, used to disconnect the cloud desktop client when the virtual machine receives a notification to enter hibernation but has not entered hibernation.

[0083] Both the acquisition module 501 and the detection module 502 can be implemented in software or in hardware. For example, the implementation of the acquisition module 501 will be described below. Similarly, the implementation of the detection module 502 can refer to the implementation of the acquisition module 501.

[0084] As an example of a software functional unit, module 501 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, module 501 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0085] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0086] As an example of a hardware functional unit, module 501 may include at least one computing device, such as a server. Alternatively, module A may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.

[0087] The multiple computing devices included in the acquisition module 501 can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the acquisition module 501 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the acquisition module 501 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0088] It should be noted that, in other embodiments, the acquisition module 501 can be used to execute any step in the sleep-wake detection method, and the output module 502 can be used to execute any step in the sleep-wake detection method. The steps implemented by the acquisition module 501 and the detection module 502 can be specified as needed. By implementing different steps in the sleep-wake detection method through the acquisition module 501 and the detection module 502, all functions of the sleep-wake detection device can be realized.

[0089] It should be noted that the hibernation / wake-up detection device provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the hibernation / wake-up detection device and the hibernation / wake-up detection method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0090] This application also provides a computing device 600. For example... Figure 6 As shown, the computing device 600 includes a bus 602, a processor 604, a memory 606, and a communication interface 608. The processor 604, the memory 606, and the communication interface 608 communicate with each other via the bus 602. The computing device 600 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 600.

[0091] Bus 602 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 6The bus 602 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 602 may include a path for transmitting information between various components of the computing device 600 (e.g., memory 606, processor 604, communication interface 608).

[0092] Processor 604 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0093] Memory 606 may include volatile memory, such as random access memory (RAM). Processor 604 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0094] The memory 606 stores executable program code, and the processor 604 executes the executable program code to implement the functions of the aforementioned acquisition module or detection module, thereby realizing the sleep-wake detection method. That is, the memory 606 stores instructions for executing the sleep-wake detection method.

[0095] The communication interface 608 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 600 and other devices or communication networks.

[0096] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0097] like Figure 7 As shown, the computing device cluster includes at least one computing device 600. The memory 606 of one or more computing devices 600 in the computing device cluster may store the same instructions for executing a sleep-wake detection method.

[0098] In some possible implementations, the memory 606 of one or more computing devices 600 in the computing device cluster may also store partial instructions for executing the sleep-wake detection method. In other words, a combination of one or more computing devices 600 can jointly execute the instructions for executing the sleep-wake detection method.

[0099] It should be noted that the memory 606 in different computing devices 600 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the resource modification device. That is, the instructions stored in the memory 606 of different computing devices 600 can implement the functions of one or more modules among the acquisition module, modification module, or grouping module.

[0100] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 8 One possible implementation is shown. For example... Figure 8 As shown, two computing devices 600A and 600B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, computing devices 600A and 600B include a bus 602, a processor 604, a memory 606, and a communication interface 606. The memory 606 in computing device 600A stores instructions for performing the functions of the acquisition module. Simultaneously, the memory 606 in computing device 600B stores instructions for performing the functions of the probe module.

[0101] Figure 8 The connection method between the computing device clusters shown can be considered as follows: taking into account that the sleep-wake detection method provided in this application needs to be changed based on the grouped resource group, the functions implemented by the grouping module and the change module are to be executed by the computing device 600B.

[0102] It should be understood that Figure 8 The functions of computing device 600A shown can also be performed by multiple computing devices. Similarly, the functions of computing device 600B can also be performed by multiple computing devices.

[0103] This application embodiment also provides a communication device, which includes a transceiver, a memory, and a processor. The transceiver, the memory, and the processor communicate with each other via an internal connection path. The memory stores instructions, and the processor executes the instructions stored in the memory to control the transceiver to receive and transmit signals. When the processor executes the instructions stored in the memory, it causes the processor to perform... Figure 4 The sleep / wake detection method shown.

[0104] It should be understood that the aforementioned processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting the Advanced Reduced Instruction Set Computing (RISC) machine (ARM) architecture.

[0105] Furthermore, in an alternative embodiment, the memory described above may include read-only memory and random access memory, and provide instructions and data to the processor. The memory may also include non-volatile random access memory. For example, the memory may also store device type information.

[0106] The memory can be volatile or non-volatile, or may include both. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which serves as an external cache. Many forms of RAM are available by way of example, but not limitation. Examples include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0107] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions capable of running on a computing device or stored on any usable medium. When the computer program product runs on at least one computing device, it causes the at least one computing device to perform a sleep-wake detection method.

[0108] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform a sleep-wake detection method.

[0109] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital versatile disc (DVD)), or a semiconductor medium (e.g., solid state disk (SSD)). It is worth noting that the computer-readable storage medium mentioned in the embodiments of this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.

[0110] It should be understood that "multiple" as mentioned herein refers to two or more. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, to facilitate a clear description of the technical solutions of the embodiments of this application, the terms "first," "second," etc., are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and the terms "first," "second," etc., do not necessarily imply that they are different.

[0111] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in the embodiments of this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A method for detecting sleep / wake-up, characterized in that, The method is applied to a cloud desktop system service, wherein the cloud desktop system service is deployed within a virtual machine, and the virtual machine is deployed in a computer. The method includes: Obtain first information, which is used to characterize a first time interval, which is the time interval between two adjacent working moments of the virtual machine as recorded by the timer of the virtual machine; Obtain second information, which is used to characterize a second time interval, which is the time interval between two adjacent working moments of the virtual machine recorded by the system clock of the computer; If the difference between the second information and the first information is greater than a threshold, it is determined that the virtual machine has been woken up.

2. The method as described in claim 1, characterized in that, The first information is the first time interval, and the second information is the second time interval; Alternatively, the first information may be count information related to the first time interval, and the second information may be count information related to the second time interval.

3. The method as described in claim 1 or 2, characterized in that, After determining that the virtual machine has been woken up, the method further includes: A notification is reported to the cloud desktop management service, the notification carrying information that the virtual machine has been woken up. The cloud desktop management service is used to manage the access of the cloud desktop system service to the cloud desktop client.

4. The method according to any one of claims 1-3, characterized in that, After determining that the virtual machine has been woken up, the method further includes: Stop performing the operation to detect whether the virtual machine has been woken up.

5. The method according to any one of claims 1-4, characterized in that, After determining that the virtual machine has been woken up, the method further includes: Stop the time synchronization operation.

6. The method according to any one of claims 1-5, characterized in that, After determining that the virtual machine has been woken up, the method further includes: Record the status of the probe task or the start time of the status, which is used to prompt the probe task to avoid being called repeatedly; the probe task is the task of detecting whether the virtual machine has been woken up.

7. The method according to any one of claims 1-6, characterized in that, The method further includes: If the virtual machine receives a notification to enter hibernation but does not actually enter hibernation, perform a cache clearing operation on the virtual machine.

8. The method according to any one of claims 1-7, characterized in that, The method further includes: If the virtual machine receives a notification to enter hibernation but does not actually enter hibernation, disconnect the cloud desktop client.

9. A sleep / wake-up device, characterized in that, The device is applied to a cloud desktop system service, the cloud desktop system service is deployed within a virtual machine, the virtual machine is deployed in a computer, and the device includes: The acquisition module is used to acquire first information, which is used to characterize a first time interval, and the first time interval is the time interval between two adjacent working moments of the virtual machine recorded by the timer of the virtual machine. The acquisition module is used to acquire second information, which is used to characterize a second time interval, and the second time interval is the time interval between two adjacent working moments of the virtual machine recorded by the system clock of the computer. The detection module is used to determine that the virtual machine has been woken up if the difference between the second information and the first information is greater than a threshold.

10. The apparatus as claimed in claim 9, characterized in that, The first information is the first time interval, and the second information is the second time interval; Alternatively, the first information may be count information related to the first time interval, and the second information may be count information related to the second time interval.

11. The apparatus as claimed in claim 9 or 10, characterized in that, The device further includes: The reporting module is used to report a notification to the cloud desktop management service. The notification carries information that the virtual machine has been woken up. The cloud desktop management service is used to manage the access of the cloud desktop system service to the cloud desktop client.

12. The apparatus as claimed in any one of claims 9-11, characterized in that, The device further includes: The first execution module is used to stop the operation of detecting whether the virtual machine has been woken up.

13. The apparatus according to any one of claims 9-12, characterized in that, The device further includes: The second execution module is used to stop the execution of time synchronization operations.

14. The apparatus according to any one of claims 9-13, characterized in that, The device further includes: A recording module is used to record the status of the probe task or the start time of the status, and the status or the start time of the status is used to prompt the probe task to avoid being called repeatedly; the probe task is a task to detect whether the virtual machine has been woken up.

15. The apparatus according to any one of claims 9-14, characterized in that, The device further includes: The third execution module is used to perform a cache clearing operation on the virtual machine when the virtual machine receives a notification to enter hibernation but does not enter hibernation.

16. The apparatus according to any one of claims 9-15, characterized in that, The device further includes: The fourth execution module is used to disconnect the cloud desktop client when the virtual machine receives a notification to enter hibernation but does not enter hibernation.

17. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method of any one of claims 1-8.

18. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a cluster of computing devices, perform the method of any one of claims 1-8.

19. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster performs the method of any one of claims 1-8.