Hot replacement method for process where application program on computing device is located
By implementing the hot replacement method of application processes on computing devices, the business interruption problem caused by process upgrades in complex software architecture is solved, and unsensed business continuity and user experience improvement are achieved.
Patent Information
- Application Number
- CN202410024134.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-07-03
- Filing Date
- 2024-01-08
- Publication Date
- 2025-01-03
AI Technical Summary
In an environment with a complex software architecture, resident processes or services need to be stopped during upgrade or repair, resulting in business interruption and affecting user experience.
By implementing the hot replacement method of application processes on the computing device, the process is dormant and saves state data using save points, the upgraded process is started and the status data of the original process is loaded through the unified entrance to ensure business continuity.
It realizes that there is no need to interrupt business services during application upgrade, improves user experience, and ensures that the upgraded process can continue to execute the original business.
Smart Images

Figure CN119248331A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method for hot replacing a process where an application program on a computing device resides. Background Art
[0002] With the continuous development of operating systems and cloud computing technologies, software architecture is becoming more and more complex.
[0003] Usually, there are some resident services or processes. These processes or services can be application processes or services, or small programs or microservices, etc. They need to keep running and continuously provide business services to customers. When these resident processes need to be repaired or upgraded, they need to stop the business service first, upgrade the application, and restart it after the upgrade is completed before the service can be restored. This process will cause the business service to be interrupted for a period of time, affecting the user experience. Summary of the invention
[0004] The present application provides a method for hot replacement of the process where an application is located on a computing device. The method of the present application can be used to implement hot replacement of the process where the application is located. During the application upgrade process, there is no need to interrupt the business, thereby improving the user experience.
[0005] In a first aspect, the present application provides a method for hot replacing a process where an application program is located on a computing device, comprising:
[0006] The computing device puts the first process into hibernation at a save point, so that the first process enters a hibernation state at the save point, where the first process is a process before the application program is upgraded;
[0007] Saving state data of the first process at a save point;
[0008] Start the second process, where the second process is the process after the application is upgraded;
[0009] The second process loads the state data of the first process at the save point through a unified entry and executes the task. The unified entry is used to constrain the second process to load the state data at the save point in the absence of state data.
[0010] The present application provides a method for hot replacement of the process where an application is located, which puts the process of the application before the upgrade to sleep at a save point, and saves the state data of the process of the application before the upgrade. Then, the upgraded application is started, and the process of the upgraded application is used to load the state data of the process of the application before the upgrade to continue to execute the task. During the application upgrade process, the process hot replacement method of the present application is adopted, and the entire upgrade process of the application does not need to interrupt business services, and the upgrade process is imperceptible to users, thereby improving the user experience. In addition, in the present application, the setting of a unified entry and save point ensures that the second process is clean and stateless when loading the state data of the process before the upgrade, thereby ensuring that the process of the upgraded application can continue to execute the original business and continue to provide services to users after loading the state data of the process before the upgrade.
[0011] Based on the first aspect, in a possible implementation, the first process corresponds to multiple threads.
[0012] The computing device puts the first process into hibernation at a save point, so that the first process enters a dormant state at the save point, the first process being a process before the application program is upgraded, and saves state data of the first process at the save point, including:
[0013] The computing device puts the multiple threads corresponding to the first process into hibernation at the save point, so that the multiple threads corresponding to the first process enter a hibernation state at the save point;
[0014] State data of a plurality of threads corresponding to the first process at a save point is saved.
[0015] It can be understood that the process of the application corresponds to multiple threads. When the first process is put to sleep, the multiple threads corresponding to the first process need to be put to sleep and the state data corresponding to the multiple threads need to be saved.
[0016] Based on the first aspect, in a possible implementation, before the computing device puts the first process into hibernation at a save point, the method further includes:
[0017] The computing device receives a sleep instruction of the first process; and / or,
[0018] An instruction to start a second process is received, and / or an instruction to use the second process to load the state data of the first process at the save point through a unified entry and execute a task is received.
[0019] It can be understood that in a possible implementation, before executing the hot replacement method of the process where the application is located, the computing device can receive instructions sent from the outside, and the computing device executes the method of the present application according to the external instructions.
[0020] Based on the first aspect, in a possible implementation manner, the method is implemented in a sandbox or a dynamic link library or a compiler.
[0021] In a second aspect, the present application provides a hot replacement device for a process where an application program is located on a computing device, the device comprising:
[0022] A dormancy module, used to put the first process into dormancy at a save point, so that the first process enters a dormant state at the save point, the first process being a process before the application is upgraded;
[0023] The hibernation module is further used to save the state data of the first process at the save point;
[0024] A startup module, used to start a second process, where the second process is a process after the application is upgraded;
[0025] The task execution module is used to load the state data of the first process at the save point into the second process through the unified entry and execute the task. The unified entry is used to constrain the second process to load the state data at the save point in the absence of state data.
[0026] Based on the second aspect, in a possible implementation, the first process corresponds to multiple threads.
[0027] The hibernation module is used to:
[0028] Putting multiple threads corresponding to the first process to sleep at the save point, so that the multiple threads corresponding to the first process enter a sleep state at the save point;
[0029] State data of a plurality of threads corresponding to the first process at a save point is saved.
[0030] Based on the second aspect, in a possible implementation, the device further includes a communication module, and the communication module is used to:
[0031] receiving a sleep instruction of the first process; and / or,
[0032] An instruction to start a second process is received, and / or an instruction to use the second process to load the state data of the first process at the save point through a unified entry and execute a task is received.
[0033] Based on the second aspect, in a possible implementation, the device is a sandbox or a dynamic link library or a compiler.
[0034] The functional modules of the second aspect are used to implement the method described in the first aspect and any possible implementation manner of the first aspect.
[0035] In a third aspect, the present application provides a computing device, comprising a memory and a processor, the memory being used to store instructions, and the processor of the computing device being used to execute the instructions stored in the memory to implement the method described in the first aspect and any possible implementation manner of the first aspect.
[0036] In a fourth aspect, the present application provides a computer storage medium comprising program instructions, which, when executed on a computing device, enables the computing device to execute the method described in the first aspect and any possible implementation of the first aspect.
[0037] In a fifth aspect, the present application provides a computer program product, including program instructions, and when the computer program product is executed by a computing device, the computing device is used to execute the method described in the aforementioned first aspect and any possible implementation of the first aspect. The computer program product can be a software installation package, and when it is necessary to use the method provided by the aforementioned first aspect and any possible design of the first aspect, the computer program product can be downloaded and executed on a device to implement the method described in the first aspect and any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of a system architecture provided for this application;
[0039] Figure 2 A flowchart of a method for hot-replacing a process of an application program on a computing device provided by the present application;
[0040] Figure 3 A schematic diagram of a structure for hot replacement of a process where an application program is located on a computing device provided by the present application;
[0041] Figure 4 A schematic diagram of a first process entering a dormant state provided by the present application;
[0042] Figure 5 A schematic diagram of starting a second process provided by the present application;
[0043] Figure 6 A schematic diagram of a system structure provided for this application;
[0044] Figure 7 A schematic diagram of the structure of a computing device provided in this application. DETAILED DESCRIPTION
[0045] The present application provides a method for hot replacement of a process where an application program is located on a computing device. Before introducing the method described in the present application, the technical terms involved in the method embodiments of the present application are first introduced.
[0046] Hot process replacement refers to a technology that dynamically replaces a process while it is running. The replaced process can still continue to perform the work tasks of the process before the replacement, and the replaced process does not need to be reinitialized or reconfigured. The hot process replacement process is imperceptible to the business and users.
[0047] Process hibernation means stopping the process and saving the process status data in memory or on disk.
[0048] Introduce the system architecture provided by this application. Figure 1 , Figure 1 A schematic diagram of a system architecture provided in the present application, the system architecture includes a hot replacement device 100 and a computing device 200 .
[0049] The computing device 200 may be, for example, an electronic device such as a terminal device, a desktop computer, a physical server, etc. An application is installed on the computing device 200, and the application may provide some resident services for the user, and the application may exist in the form of a mini-program or a micro-service.
[0050] The hot replacement device 100 is used to provide a process hot replacement service for an application on a computing device 200. When an application on a computing device 200 needs to be upgraded, such as a version upgrade / version update or a problem repair, but the application is required to execute the user's business and the business of the application is not desired to be suspended, the hot replacement device 100 can be used to hot replace the process of the running application that provides business services to the user.
[0051] In the present application, the hot replacement device 100 may be an installation package or a compressed package. When it is necessary to hot replace the process of the application program on the computing device 200, the installation package or compressed package of the hot replacement device 100 may be downloaded and installed on the computing device 200. By running the installation package or compressed package of the hot replacement device 100, the hot replacement process of the application program on the computing device 200 may be hot replaced. Optionally, the installation package of the hot replacement device 100 may be located in the cloud. The computing device 200 implements the method described in the present application by downloading or calling the installation package of the hot replacement device 100 in the cloud.
[0052] Optionally, the hot replacement device 100 may also be a smart network card, which is inserted or deployed on the computing device 200 and the program instructions in the smart network card are run to hot replace the process where the application program on the computing device 200 is located.
[0053] Optionally, the hot replacement device 100 may also be a chip, which is inserted or deployed on the computing device 200 and runs program instructions in the chip to hot replace the process of the application on the computing device 200. The hot replacement device 100 may also exist in other forms, which are not limited in this application.
[0054] When the application version is upgraded, the installation package of the new version of the application is installed on the disk of the computing device 200, and the hot replacement device 100 is installed on the computing device 200. When the program instructions in the hot replacement device 100 are running on the computing device 200, the hot replacement device 100 interacts with the computing device 200, thereby realizing hot replacement of the process where the application on the computing device 200 is located.
[0055] It should be noted that, because the application is upgraded while the application is running, the process where the original version of the application is located (i.e., the first process hereinafter) is still running in the memory of the computing device 200. After the new version of the application installation package is installed on the disk, while the process where the original version of the application is located (the first process hereinafter) is running (while executing the business), the process is hot-replaced with the process of the new version of the application, and the business is continued to be executed using the process of the new version of the application. If only the new version of the application installation package is installed without hot-replacing the process where the original version of the application is located, the process cannot continue to execute the business based on the new version of the application, and the task fails. How to hot-replace the process of the application is described in the method embodiment below, and please refer to the specific description of the method embodiment below.
[0056] based on Figure 1 The system described above, the present application provides a method for hot replacement of the process where the application program is located on a computing device. After the hot replacement device is installed on the computing device, the computing device executes the method of the present application. Figure 2 , Figure 2 A flowchart of a method for hot replacing a process where an application is located on a computing device provided in the present application is provided. The method is described from the perspective of the computing device and includes but is not limited to the description below.
[0057] S101. A computing device puts a first process into hibernation at a save point, causing the first process to enter a dormant state at the save point, and saves state data of the first process at the save point, wherein the first process is a process before an application program is upgraded.
[0058] The first process is the process before the application is upgraded. It can be understood that during the running of the application, although the installation package of the new version of the application has been installed on the disk of the computing device, the process of the original version of the application is still running in the memory. The first process is the process of the original version of the application, that is, the process before the application is upgraded.
[0059] The first process corresponds to multiple threads, and the state data of the first process at the save point is saved. Specifically, the state data of the multiple threads corresponding to the first process at the save point is saved. The state data includes which tasks each thread has completed, which tasks have not been completed, and which step the task being executed has reached. Generally, each thread has multiple tasks to execute, and the node position of the save point is usually set to the node position where the thread has completed one task but has not started to execute another task. In this way, the amount of state data is relatively small, the state data is simpler, and it is also convenient to record the state data. Of course, the node position of the save point can also be set to the process of the thread executing a task, but the state data is more complicated.
[0060] The first process enters a dormant state at a save point, and saves the state data of the first process at the save point. Specifically, multiple threads corresponding to the first process enter a dormant state at the save point at the same time, and save the state data of multiple threads corresponding to the first process at the save point. For example, if the save point is set to a node position where a thread has completed a task but another task has not yet started, then among the multiple threads corresponding to the first process, if some threads have completed a task but another task has not yet started, and if some threads are in the process of executing a task, the thread that has completed a task will wait for the thread that is executing a task until all threads have completed a task, then multiple threads enter a dormant state at the same time, and save the state data of each thread in the multiple threads. In specific implementation, when the first process is in the process of executing a task, after receiving a dormant instruction, the first process itself determines whether it needs to enter a dormant state at an appropriate time.
[0061] The state data may be stored in the memory of the computing device or on a disk of the computing device. Alternatively, a fixed memory space may be requested on the computing device to store the state data.
[0062] Putting the first process to sleep can be achieved through the checkpoint / restore in userspace (CRIU) technology. Among them, CRIU is a software tool running on the Linux operating system, which aims to provide the ability to perform checkpoint and restore operations on Linux processes from user space. Checkpointing is the process of saving the current state of a running application, including its memory, open file descriptors, and other related information. The application can be restored from this checkpoint later. Other technologies can also be used to put the first process to sleep, which is not limited in this application.
[0063] Optionally, before the computing device puts the first process into hibernation, the computing device receives a hibernation instruction sent by the hot replacement device, that is, after the hot replacement device is deployed on the computing device, the program code in the hot replacement device is run, so that the hot replacement device sends a hibernation instruction to the computing device, and the hibernation instruction is used to instruct the first process to enter a hibernation state at a save point and save the state data of the first process at the save point. Accordingly, the computing device responds to the hibernation instruction. The save point is pre-set, and the save point refers to a node position, which refers to the node position where the first process enters a hibernation state. Specifically, the hibernation instruction is used to instruct multiple threads corresponding to the first process to enter a hibernation state at a save point, and save the state data of multiple threads corresponding to the first process at the save point.
[0064] See also Figure 3 , Figure 3 A schematic diagram of a structure for hot replacement of a process where an application is located on a computing device provided by the present application. An external device sends a sleep instruction to the computing device, wherein the external device may be a hot replacement device in the present application, and the sleep instruction is used to instruct a first process to enter a sleep state through a save point, and the first process refers to a process before the application is upgraded; after receiving the sleep instruction, the first process on the computing device enters a sleep state through a save point, and saves the state data of the first process at the save point.
[0065] S102: The computing device starts a second process, where the second process is a process after the application version is upgraded.
[0066] After the first process on the computing device enters the dormant state, the computing device starts a second process, where the second process is a process after the application is upgraded, that is, the computing device starts a new version of the application.
[0067] Optionally, before starting the second process, the computing device receives an instruction to start the second process sent by the hot replacement device. The hot replacement device includes a program instruction to start the second process. After sending the sleep instruction to the computing device, the hot replacement device inputs the instruction to start the second process to the computing device, and accordingly, the computing device executes the instruction to start the second process.
[0068] S103: The second process loads the state data of the first process at the save point through the unified entry and executes the task.
[0069] The second process on the computing device loads the state data of the first process at the save point through the unified entry and continues to execute the task. The unified entry is used to constrain the second process to load the state data at the save point in the absence of state data, wherein the second process in the absence of state data means that the second process does not contain unexecuted tasks, that is, the second process currently has no tasks to execute. The unified entry can also be understood as a node location in essence. The setting of the unified entry ensures that the second process is in a clean state when loading the state data at the save point, so that it can continue to execute tasks according to the state data of the first process at the save point and provide business services to users.
[0070] For example, the task performed by the first process before hibernation is to calculate the sum of natural numbers between 1 and 100, and the node position of the set save point is to calculate the sum of natural numbers between 1 and 50. After receiving the hibernation instruction, the first process enters the hibernation state at the save point and saves the state data of the first process, which includes the value of the sum of natural numbers between 1 and 50 and the unfinished calculation task. After the second process is started, the second process may have its own tasks. The unified entry ensures that the second process can load the state data of the first process at the save point only after completing its own tasks, thereby ensuring that the second process is restored to the original business of the first process.
[0071] exist Figure 3 In the schematic diagram shown, after the first process enters the sleep state, the computing device starts the second process, uses the second process to load the saved state data of the first process at the unified entrance, and continues to execute tasks based on the state data to provide business services to users.
[0072] Optionally, the hot replacement device includes program instructions for causing the second process to load the state data of the first process at the save point through a unified entry and continue to execute the task. The hot replacement device sends the program instructions to the computing device, and accordingly, the computing device receives and executes the instructions.
[0073] Before step S101, the hot replacement device is deployed on the computing device, and before the new version of the application installation package is installed, the first process is started through the unified entry. Here, the unified entry is also used to constrain the first process to load the state data at the save point in the absence of state data. The difference from step S103 is that the save point here does not contain any state data, that is, in the initial state, there is no state data. Starting the first process through the unified entry only ensures the clean state of the first process. The hot replacement device includes program instructions for starting the first process through the unified entry.
[0074] For example, see Figure 4 As shown in the structural diagram, the first process is started through a unified entry, and after loading the status data at the save point (the status data at the save point is empty at this time), the first process enters the main function to execute the task, wherein the first process corresponds to multiple threads, for example, the first process corresponds to thread 1, thread 2...thread N.
[0075] During the process of executing a task by the first process, if the first process receives a sleep instruction, the first process responds to the sleep instruction, and multiple threads corresponding to the first process enter a sleep state at a save point, and saves the state data of the first process at the save point.
[0076] After the first process enters the dormant state, the second process is started. The second process is the process where the new version of the application is located. Figure 5 As shown, the second process loads the state data at the save point through the unified entry, and then executes the task.
[0077] The method described in the present application can be implemented by a sandbox or a dynamic link library or a compiler. For example, when the method described in the present application is implemented by a dynamic link library, a unified entry interface function is provided in the dynamic link library, and the first process can be started by the unified entry interface function, that is, the main function of the first process is passed in as a parameter of the unified entry interface function, and the first process is loaded with the state data of the save point through the unified entry (the state data is empty at this time) and then enters the main function. The dynamic link library can also provide a sleep function for the first process to enter a sleep state at a save point, and the first process enters a sleep state at the save point through the sleep function.
[0078] The process hot replacement method provided in the present application can also be applied to the field of hot replacement of operating systems.
[0079] It can be seen that the present application provides a hot replacement method for the process where the application is located, which puts the process of the application before the upgrade to sleep at the save point, and saves the state data of the process of the application before the upgrade. Then, the upgraded application is started, and the process of the upgraded application is used to load the state data of the process of the application before the upgrade, and the task is continued. During the application upgrade process, the process hot replacement method of the present application is adopted, and the entire upgrade process of the application does not need to interrupt business services. The process hot replacement process is extremely short (because the process hot replacement process is extremely short, it basically has no impact on the business), and the upgrade process is imperceptible to the user, thereby improving the user experience.
[0080] In addition, the setting of unified entry and save point in this application ensures that the second process is clean and stateless when loading the state data of the process before the upgrade, thereby ensuring that the process of the upgraded application can continue to execute the original business and continue to provide services to users after loading the state data of the process before the upgrade.
[0081] The method embodiments provided in the present application are introduced above. The following is an introduction to the device embodiments corresponding to the above method embodiments.
[0082] See also Figure 6 , Figure 6 The system architecture diagram of a process hot replacement provided by the present application includes a hot replacement device 600 for a process where an application program on a computing device resides. Optionally, the system also includes Figure 1 Hot replacement device 100 in system architecture. The following focuses on the hot replacement device 600 of the process where the application program on the computing device is located.
[0083] The hot replacement device 600 of the process where the application program is located on the computing device includes:
[0084] A hibernation module 610, configured to hibernate the first process at a save point, so that the first process enters a hibernation state at the save point, where the first process is a process before the application is upgraded;
[0085] The sleep module 610 is further used to save the state data of the first process at the save point;
[0086] A starting module 620 is used to start a second process, where the second process is a process after the application is upgraded;
[0087] The task execution module 630 is used to load the state data of the first process at the save point through the unified entry and execute the task. The unified entry is used to constrain the second process to load the state data at the save point in the absence of state data.
[0088] In a possible implementation, the first process corresponds to multiple threads, and the sleep module 610 is used to: put the multiple threads corresponding to the first process to sleep at a save point, so that the multiple threads corresponding to the first process enter a sleep state at the save point; and save the state data of the multiple threads corresponding to the first process at the save point.
[0089] In a possible implementation, the device 600 also includes a communication module 640, which is used to: receive a sleep instruction of the first process; and / or, receive an instruction to start the second process, and / or, receive an instruction to use the second process to load the state data of the first process at the save point through a unified entry and execute a task.
[0090] In a possible implementation, the device 600 is a sandbox or a dynamic link library or a compiler.
[0091] Among them, the sleep module 610, the startup module 620, the task execution module 630 and the communication module 640 can all be implemented by software, or can be implemented by hardware. Exemplarily, the sleep module 610 is taken as an example to introduce the implementation of the sleep module 610. Similarly, the implementation of the startup module 620, the task execution module 630 and the communication module 640 can refer to the implementation of the sleep module 610.
[0092] The apparatus 600 can be deployed on a computing device. As an example of a software functional unit, the sleep module 610 may include code running on a computing device. Among them, the computing device may be a computing device in a cloud service, and the computing device may be, for example, a bare metal server, a terminal device, etc. Further, the computing device may be one or more. For example, the sleep module 610 may include code running on multiple computing devices. It should be noted that the multiple computing devices used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple computing devices used to run the code may be distributed in the same availability zone (AZ) or in different AZs, and each AZ includes a data center or multiple data centers with similar geographical locations. Among them, generally a region may include multiple availability zones AZ.
[0093] Similarly, multiple computing devices used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set in each VPC to achieve interconnection between VPCs through the communication gateway.
[0094] As an example of a hardware functional unit, the sleep module 610 may include at least one computing device. Alternatively, the sleep module 610 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0095] The multiple computing devices included in the sleep module 610 can be distributed in the same region or in different regions. The multiple computing devices included in the sleep module 610 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the sleep module 610 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0096] It should be noted that, in other embodiments, the sleep module 610 can be used to execute any step in a method for hot replacement of a process containing an application on a computing device, and the startup module 620, the task execution module 630 and the communication module 640 can all be used to execute any step in a method for hot replacement of a process containing an application on a computing device. The steps that the sleep module 610, the startup module 620, the task execution module 630 and the communication module 640 are responsible for implementing can be specified as needed. The sleep module 610, the startup module 620, the task execution module 630 and the communication module 640 respectively implement different steps in a method for hot replacement of a process containing an application on a computing device to realize all the functions of the device 600.
[0097] See also Figure 7 , Figure 7 is a schematic diagram of a computing device provided in the present application. The computing device 700 may be a computing device in a method embodiment or may be Figure 6The apparatus 600 in the embodiment. Further, the computing device 700 includes a processor 701, a storage unit 702, a storage medium 703 and a communication interface 704, wherein the processor 701, the storage unit 702, the storage medium 703 and the communication interface 704 communicate via a bus 705, and also communicate via other means such as wireless transmission.
[0098] The processor 701 is composed of a plurality of general-purpose processors, such as a CPU. The hardware chip is an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The PLD is a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC) or any combination thereof. The processor 701 executes various types of digital storage instructions, such as software or firmware programs stored in the storage unit 702, which enables the computing device 700 to provide a wide variety of services.
[0099] In a specific implementation, as an embodiment, the processor 701 includes one or more CPUs, such as Figure 7 CPU0 and CPU1 are shown in the figure.
[0100] In a specific implementation, as an embodiment, the computing device 700 also includes multiple processors, such as Figure 7 1 and 10. Each of these processors may be a single-CPU or a multi-CPU. A processor herein refers to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0101] The storage unit 702 is used to store program code, and is controlled by the processor 701 to execute the steps in the above method embodiment. The program code includes one or more software units. The above one or more software units are Figure 6The sleep module 610, the start module 620, the task execution module 630 and the communication module 640 in the embodiment, wherein the sleep module 610 is used to put the first process to sleep at the save point, so that the first process enters the sleep state at the save point, and the sleep module 610 is also used to save the state data of the first process at the save point, etc., which can be specifically used to implement Figure 2 In step S101 of the embodiment, the startup module 620 is used to start the second process, specifically to execute Figure 2 In step S102 of the method embodiment, the task execution module 630 is used to load the state data of the first process at the save point through the unified entry of the second process and continue to execute the task, which can be specifically used to implement Figure 2 In step S103 of the method embodiment, the communication module 640 is used to implement communication between the computing device and the hot replacement device 100 , such as receiving a sleep instruction sent by the hot replacement device 100 .
[0102] The storage unit 702 includes a read-only memory and a random access memory, and provides instructions and data to the processor 701. The storage unit 702 also includes a non-volatile random access memory. The storage unit 702 is a volatile memory or a non-volatile memory, or includes both volatile and non-volatile memories. Among them, the non-volatile memory is a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory is a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are used, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM). It can also be a hard disk, a universal serial bus (USB), a flash memory, a secure digital memory card (SD card), a memory stick, etc. The hard disk is a hard disk drive (HDD), a solid state disk (SSD), a mechanical hard disk (HDD), etc., and this application does not make specific limitations.
[0103] The storage medium 703 is a carrier for storing data, such as a hard disk, a USB flash drive (universal serialbus), a flash memory, a secure digital memory card (SD card), a memory stick, etc. The hard disk can be a hard disk drive (HDD), a solid state disk (SSD), a mechanical hard disk (HDD), etc., and this application does not make specific limitations.
[0104] The communication interface 704 is a wired interface (such as an Ethernet interface), an internal interface (such as a high-speed serial computer expansion bus (Peripheral Component Interconnect Express, PCIe) bus interface), a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or a wireless local area network interface) for communicating with other servers or units.
[0105] The bus 705 is a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 705 is divided into an address bus, a data bus, a control bus, etc.
[0106] The bus 705 includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are labeled as bus 705 in the figure.
[0107] Need to explain, Figure 7 This is only one possible implementation of the present application. In practical applications, the computing device 700 may also include more or fewer components, which is not limited here. Figure 1-Figure 6 The relevant explanations in the embodiments will not be repeated here.
[0108] The present application also provides a computing device cluster, which includes at least one computing device 700. The storage unit 702 in one or more computing devices 700 in the computing device cluster may store the same or different instructions for executing the method embodiment.
[0109] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device is caused to perform all or part of the steps in the aforementioned method embodiment.
[0110] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a high-density digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state hard disk), etc. The computer-readable storage medium includes instructions that instruct the computing device to perform all or part of the steps in the aforementioned method embodiment.
[0111] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for hot replacement of a process where an application program is located on a computing device, characterized in that: The method comprises: The computing device puts the first process into hibernation at a save point, so that the first process enters a hibernation state at the save point, wherein the first process is a process before the application is upgraded; Saving state data of the first process at the save point; Starting a second process, where the second process is a process after the application is upgraded; The second process is loaded with the state data of the first process at the save point through a unified entry and executes a task, wherein the unified entry is used to constrain the second process to load the state data at the save point in the absence of state data.
2. The method according to claim 1, characterized in that The first process corresponds to multiple threads, The computing device puts a first process into hibernation at a save point, so that the first process enters a hibernation state at the save point, wherein the first process is a process before the application is upgraded, and saves state data of the first process at the save point, including: The computing device causes the plurality of threads corresponding to the first process to sleep at a save point, so that the plurality of threads corresponding to the first process enter a sleep state at the save point; The state data of the plurality of threads corresponding to the first process at the save point is saved.
3. The method according to claim 1 or 2, characterized in that: Before the computing device hibernates the first process at the save point, the method further includes: The computing device receives a sleep instruction of the first process; and / or, An instruction to start the second process is received, and / or an instruction to use the second process to load the state data of the first process at the save point through a unified entry and execute a task is received.
4. The method according to any one of claims 1 to 3, characterized in that: The method is implemented in a sandbox or a dynamic link library or a compiler.
5. A hot replacement device for a process where an application program is located on a computing device, characterized in that: The device comprises: A hibernation module, used for hibernating a first process at a save point, so that the first process enters a hibernation state at the save point, wherein the first process is a process before the application is upgraded; The hibernation module is further used to save the state data of the first process at the save point; A startup module, used to start a second process, where the second process is a process after the application is upgraded; The task execution module is used to load the state data of the first process at the save point into the second process through a unified entry and execute the task. The unified entry is used to constrain the second process to load the state data at the save point without state data.
6. The device according to claim 5, characterized in that The first process corresponds to multiple threads, The sleep module is used for: Putting multiple threads corresponding to the first process to sleep at a save point, so that the multiple threads corresponding to the first process enter a sleep state at the save point; The state data of the plurality of threads corresponding to the first process at the save point is saved.
7. The device according to claim 5 or 6, characterized in that The device further comprises a communication module, wherein the communication module is configured to: receiving a sleep instruction of the first process; and / or, An instruction to start the second process is received, and / or an instruction to use the second process to load the state data of the first process at the save point through a unified entry and execute a task is received.
8. The device according to any one of claims 5 to 7, characterized in that The device is a sandbox or a dynamic link library or a compiler.
9. A computing device, characterized in that The computing device comprises a memory and a processor, the memory is used to store instructions, and the processor of the computing device is used to execute the instructions stored in the memory to implement the method according to any one of claims 1 to 4.
10. A computer storage medium, characterized in that: The method comprises program instructions, which, when executed on a computing device, cause the computing device to execute the method according to any one of claims 1 to 4.
