Process upgrading method and device, electronic equipment and storage medium
By coordinating the handling of hot patch upgrade events between the main thread and the child thread, the problem of insufficient real-time hot patch repair in the existing technology is solved, and a faster and less impactful patch repair process is achieved.
Patent Information
- Application Number
- CN202311444128.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2025-05-02
AI Technical Summary
In the prior art, when the business process undergoes hot patch repair, the real-time performance is insufficient, resulting in long business pauses and affecting the user experience.
Receive hot patch upgrade messages through the main thread and insert hot patch upgrade events into each child thread to ensure that the hot patch upgrade events are the highest priority. The child thread responds to the hot patch upgrade event based on the execution information of the current event and returns the response information to the main thread. The main thread determines whether to perform hot patch upgrades based on the response information.
Improves the real-time performance of hot patch repair for business processes, reduces the business impact during hot patch repair, and avoids long-term pauses caused by stopping the entire process for patch repair.
Smart Images

Figure CN119917150A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a process upgrade method, device, electronic device and storage medium. Background Art
[0002] Hot patching is a fast and low-cost way to repair defects in device software versions. Compared with directly upgrading the software version, the main advantage of hot patching is that it will not interrupt the current business of the device, that is, without restarting the device, the defects of the current software version of the device can be repaired. Hot patching technology is usually a function-level replacement, that is, if a software vulnerability occurs in function A, then function B with the vulnerability modified is used to replace function A, so that the program runs, instead of function A, but function B. The usual practice is to modify the entry instruction of function A to jump to function B. On the Linux operating system, various business software usually runs on the operating system in the form of processes. For a running process, when there is a vulnerability, the vulnerability of the business process is repaired by hot patching it. In this way, the business process does not need to restart the process, and the device system does not need to be restarted to repair the vulnerability.
[0003] In the implementation of business processes, they are usually run in multiple threads, that is, one process has multiple threads, and multiple threads run in parallel to improve performance. In the multi-threaded model, if the vulnerable function is a public function, it is possible that all threads will call it. If the public function is directly hot-patched, it is possible that one or some threads are running the public function, which means that thread A is running the function and thread B is modifying the function. In this state, the program will crash and it is unreliable.
[0004] In the prior art, the common sampling practice is to stop the entire process and then perform patch modification, or start a new process with a patch to replace the old process. Both methods will cause a long business downtime, and the hot patch repair is not real-time enough, which has a great impact on the business and user experience.
[0005] In addition, the prior art also provides a method that waits for all services to be in the main function and paused before repairing. The defect of this method is that if a thread is always busy and has many ready events to execute, it will take a long time to return to the main function and enter the paused state, and other threads also need to continue waiting for this thread, resulting in a long wait for the patch repair of the entire process. At the same time, the thread is suspended and resumed, which has a large response to the running thread. Summary of the invention
[0006] The purpose of this application is to provide a process upgrade method, device, electronic device and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the real-time problem of hot patching of business processes.
[0007] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0008] In a first aspect, an embodiment of the present application provides a process upgrade method, wherein the process includes a main thread and at least one sub-thread, and the method includes:
[0009] The main thread receives a hot patch upgrade message and inserts a hot patch upgrade event into each sub-thread in the process, wherein the hot patch upgrade event has the highest priority in each sub-thread;
[0010] Each of the sub-threads responds to the hot patch upgrade event according to the execution information of the current event, and returns response information to the main thread;
[0011] The main thread receives response information returned by each of the child threads, where the response information is used to indicate whether the child thread has entered a state where the hot patch upgrade is to be executed;
[0012] The main thread determines whether to execute the hot patch upgrade according to each of the response information, and if so, executes the hot patch upgrade.
[0013] Optionally, each of the sub-threads responds to the hot patch upgrade event according to the execution information of the current event and returns response information to the main thread, including:
[0014] If there is a current event being executed in the child thread, the child thread generates an upgrade mark after the execution of the current event is completed, and returns a response message to the main thread indicating that the hot patch upgrade is in a state to be executed;
[0015] If the child thread does not have a current event being executed, the child thread generates the upgrade mark and returns response information to the main thread indicating that the state of the hot patch upgrade is to be executed.
[0016] Optionally, the main thread determines whether to execute the hot patch upgrade according to the response information, including:
[0017] The main thread obtains the upgrade mark from each of the sub-threads;
[0018] The main thread determines whether to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
[0019] Optionally, the main thread determines whether to execute the hot patch upgrade according to each of the response information and each of the upgrade marks, including:
[0020] The main thread determines, according to each of the response information, each of the upgrade marks, and the first preset duration, whether all of the child threads have entered the state of waiting to execute the hot patch upgrade;
[0021] If yes, the main thread executes the hot patch upgrade; if no, the main thread sends a message of resuming operation to each sub-thread.
[0022] Optionally, the main thread determines whether all sub-threads have entered the state of waiting to execute the hot patch upgrade according to each of the response information, each of the upgrade marks, and the first preset duration, including:
[0023] Within the first preset time period, the main thread determines whether all the child threads have entered the state of waiting to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
[0024] Optionally, after the main thread sends the information of resuming operation to each sub-thread, the following steps are included:
[0025] After a second preset time period, the main thread reinserts the hot patch upgrade event into each of the sub-threads.
[0026] Optionally, after the main thread executes the hot patch upgrade, the following steps are included:
[0027] The main thread sends an upgrade completion indication to each of the sub-threads;
[0028] Each of the sub-threads executes the to-be-executed events in the sub-thread according to the upgrade completion indication.
[0029] In a second aspect, an embodiment of the present application further provides a process upgrade device, the device comprising:
[0030] An insertion module, used for the main thread to receive a hot patch upgrade message and insert a hot patch upgrade event into each sub-thread in the process, wherein the hot patch upgrade event has the highest priority in each sub-thread;
[0031] A response module, used for the sub-thread to respond to the hot patch upgrade event according to the execution information of the current event, and return response information to the main thread;
[0032] A receiving module, configured for each of the main threads to receive response information returned by each of the child threads, wherein the response information is used to indicate whether the child thread has entered a state where the hot patch upgrade is to be executed;
[0033] The judging module is used for the main thread to judge whether to execute the hot patch upgrade according to the response information, and if so, execute the hot patch upgrade.
[0034] Optionally, the response module is specifically used for:
[0035] If there is a current event being executed in the child thread, the child thread generates an upgrade mark after the execution of the current event is completed, and returns a response message to the main thread indicating that the hot patch upgrade is in a state to be executed;
[0036] If the child thread does not have a current event being executed, the child thread generates the upgrade mark and returns response information to the main thread indicating that the state of the hot patch upgrade is to be executed.
[0037] Optionally, the judgment module is specifically used for:
[0038] The main thread obtains the upgrade mark from each of the sub-threads;
[0039] The main thread determines whether to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
[0040] Optionally, the judgment module is specifically used for:
[0041] The main thread determines, according to each of the response information, each of the upgrade marks, and the first preset duration, whether all of the child threads have entered the state of waiting to execute the hot patch upgrade;
[0042] If yes, the main thread executes the hot patch upgrade; if no, the main thread sends a message of resuming operation to each sub-thread.
[0043] Optionally, the judgment module is specifically used for:
[0044] Within the first preset time period, the main thread determines whether all the child threads have entered the state of waiting to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
[0045] Optionally, the judgment module is specifically used for:
[0046] After a second preset time period, the main thread reinserts the hot patch upgrade event into each of the sub-threads.
[0047] Optionally, the judgment module is specifically used for:
[0048] The main thread sends an upgrade completion indication to each of the sub-threads;
[0049] Each of the sub-threads executes the to-be-executed events in the sub-thread according to the upgrade completion indication.
[0050] In the third aspect, an embodiment of the present application also provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the application is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the process upgrade method described in the first aspect above.
[0051] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is read and executes the steps of the process upgrade method described in the first aspect above.
[0052] The beneficial effects of this application are:
[0053] The present application provides a process upgrade method, device, electronic device and storage medium, which inserts a hot patch upgrade event into each sub-thread according to the received hot patch upgrade message through the main thread, and determines whether to perform the hot patch upgrade according to the response information returned by each sub-thread for the hot patch upgrade event. It can solve the real-time performance of hot patch repair of business processes and reduce the business impact when hot patches are used to repair vulnerabilities. There is no need to stop the entire process to perform patch repair, which causes the business to be suspended for too long, resulting in insufficient real-time performance of hot patch repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A flowchart of a process upgrade method provided in an embodiment of the present application;
[0056] Figure 2 A flowchart of another process upgrade method provided in an embodiment of the present application;
[0057] Figure 3 A flowchart of another process upgrade method provided in an embodiment of the present application;
[0058] Figure 4 A schematic diagram of a device for a process upgrade method provided in an embodiment of the present application;
[0059] Figure 5 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0061] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0062] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0063] Optionally, the process upgrade method provided in the embodiment of the present application is applied to an electronic device, which may be a terminal device with computing and display capabilities, such as a mobile phone, a tablet computer, a laptop computer, a PDA, a desktop computer, or a server. Specifically, it may be applied to an application in a terminal device, such as an APP (application, mobile phone software) of a mobile phone, an application system on a computer, etc.
[0064] Optionally, the electronic device may include multiple business software, and each business software usually runs on the electronic device in the form of a business process. When a vulnerability exists in a running business process, the vulnerability in the business process can be repaired by hot patching the running business process using the method provided in the embodiment of the present application. This can solve the real-time problem of hot patching the business process and reduce the business impact when the vulnerability is repaired by hot patching.
[0065] The specific implementation process of the process upgrade provided in the embodiment of the present application is explained in detail below.
[0066] Figure 1 The present invention provides a flowchart of a process upgrade method provided by an embodiment of the present invention. The execution subject of the method is the aforementioned electronic device, and the method is applied to a process to be hot-patch upgraded on the electronic device. Figure 1 As shown, the method includes:
[0067] S101: The main thread receives a hot patch upgrade message and inserts a hot patch upgrade event into each sub-thread in the process.
[0068] Optionally, the process to be hot-patched refers to a process that has a vulnerability and needs to fix the vulnerability. The process includes a main thread and at least one child thread, and the main thread and each child thread can respectively include one or more events. The main thread can execute each event in the main thread, and each child thread can execute the events contained in each child thread.
[0069] Optionally, when a process needs to be hot-patched, a hot-patched upgrade message is sent to the main thread, and the main thread can generate a hot-patched upgrade event based on the received hot-patched upgrade message, and insert the hot-patched upgrade event into each sub-thread in the process, and the hot-patched upgrade event has the highest priority in each sub-thread. In other words, if there are multiple events to be executed in a thread, they are executed based on the priority level, and the high-priority event is executed first, followed by the low-priority event.
[0070] Exemplarily, a process to be hot-patch upgraded may include a main thread A, and sub-threads B, C, D, and E. When the main thread A receives a hot-patch upgrade message, it partially inserts hot-patch upgrade events into sub-threads B, C, D, and E, and the hot-patch upgrade events inserted into sub-threads B, C, D, and E have the highest priority.
[0071] S102: The child thread responds to the hot patch upgrade event according to the execution information of the current event, and returns response information to the main thread.
[0072] The current event refers to the event currently being executed by each sub-thread when inserting the hot patch upgrade event, that is, when each sub-thread inserts the hot patch upgrade event, the sub-thread may have an event being executed at this time, so the sub-thread responds to the hot patch upgrade event according to the execution information at the current time and returns response information to the main thread. The response information may include the identification information of each sub-thread.
[0073] Exemplarily, continuing with the above-mentioned main thread A, and sub-thread B, sub-thread C, sub-thread D and sub-thread E as examples, sub-thread B can return response information B to the main thread based on the execution information of the current event of the sub-thread; sub-thread C can return response information C to the main thread based on the execution information of the current event of the sub-thread; sub-thread D can return response information D to the main thread based on the execution information of the current event of the sub-thread; sub-thread E can return response information E to the main thread based on the execution information of the current event of the sub-thread.
[0074] S103: The main thread receives response information returned by each sub-thread.
[0075] The response information may be used to indicate whether the child thread has entered a state where a hot patch upgrade is to be executed. If the response information received is yes, it indicates that the child thread has entered a state where a hot patch upgrade is to be executed; if the response information received is no, it indicates that the child thread has not yet entered a state where a hot patch upgrade is to be executed.
[0076] Exemplarily, main thread A may receive response information B returned by child thread B, response information C returned by child thread C, response information D returned by child thread D, and response information E returned by child thread E.
[0077] S104: The main thread determines whether to perform a hot patch upgrade based on each response information.
[0078] If so, the main thread performs a hot patch upgrade, that is, the main thread can start applying the hot patch. Specifically, the main thread can apply the hot patch through a traditional function replacement method.
[0079] Exemplarily, the main thread A may determine whether to execute a hot patch upgrade in the main thread A according to the response information B, the response information C, the response information D, and the response information E.
[0080] In this embodiment, the main thread inserts a hot patch upgrade event into each sub-thread according to the received hot patch upgrade message, and determines whether to perform the hot patch upgrade according to the response information returned by each sub-thread for the hot patch upgrade event. This can solve the real-time performance of hot patch repair of the business process and reduce the business impact of hot patch repair vulnerabilities. It is not necessary to stop the entire process to perform patch repair, which will cause the business to stop for a long time, resulting in insufficient real-time performance of hot patch repair.
[0081] Optionally, in the above S102, the sub-thread responds to the hot patch upgrade event according to the execution information of the current event and returns response information to the main thread, which may include:
[0082] Optionally, if there is a current event being executed in the child thread, the child thread generates an upgrade mark after the current event is executed, and returns a response message to the main thread indicating that the hot patch upgrade has entered a state to be executed. Specifically, when the main thread inserts a hot patch upgrade event into the child thread, and the child thread has a current event being executed, the child thread will continue to execute the current event normally. After the current event is executed, the child thread can enter the hot patch upgrade event with the highest priority, that is, enter the state to be executed for the hot patch upgrade. The child thread generates an upgrade mark and returns a response message to the main thread. The upgrade mark refers to the upgrade mark generated in each child thread, which is used to indicate that the child thread has entered a state to be executed for the hot patch upgrade.
[0083] Optionally, if there is no current event being executed in the child thread, the child thread generates an upgrade mark and returns a response message to the main thread indicating that the hot patch upgrade is in the waiting state. Specifically, when the main thread inserts a hot patch upgrade event into the child thread, and there is no current event being executed in the child thread at this time, the child thread directly enters the hot patch upgrade event with the highest priority, that is, enters the waiting state of the hot patch upgrade, generates an upgrade mark in the child thread, and returns a response message to the main thread.
[0084] In this embodiment, when a sub-thread completes the current event being run, the hot patch upgrade event with the highest priority is executed first based on the priority, that is, the main thread is notified that the sub-thread has entered the state of waiting for hot patch upgrade, and there is no need to wait for all events in each sub-thread to be completed before hot patch upgrade, which causes the patch repair of the entire process to wait for a long time. In addition, by generating an upgrade mark in each sub-thread, it can respond to the main thread that the sub-thread is not processing other events at this time, and it is safe to upgrade at this time.
[0085] Figure 2 A flowchart of another process upgrade method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, in the above S104, the main thread determines whether to perform a hot patch upgrade according to each response information, which may include:
[0086] S201, the main thread obtains an upgrade mark from each sub-thread.
[0087] Specifically, the main thread can query the upgrade mark in each child thread. If the child thread has entered the state of waiting for hot patch upgrade, the main thread can query the upgrade mark of the child thread; if the child thread is still executing the current event and has not entered the state of waiting for hot patch upgrade, the main thread cannot query the upgrade mark of the child thread.
[0088] S202: The main thread determines whether to perform a hot patch upgrade based on the response information and the upgrade mark.
[0089] Specifically, the main thread can determine whether each sub-thread enters a state of waiting for hot patch upgrade based on the received response information of each sub-thread and the acquired upgrade mark of each sub-thread, thereby determining whether the main thread executes the hot patch upgrade.
[0090] Optionally, if the response information received by the main thread from a child thread is yes, that is, the child thread has entered a state of waiting for hot patch upgrade, and the main thread obtains the upgrade mark of the child thread from the child thread, then it is determined that the child thread has entered a state of waiting for hot patch upgrade; if the response information received by the main thread is yes, but the main thread has not obtained the upgrade mark of the child thread from the child thread, then it is determined that the child thread has not entered a state of waiting for hot patch upgrade; if the response information received by the main thread is no, that is, the child thread has not entered a state of waiting for hot patch upgrade, and the main thread has not obtained the upgrade mark of the child thread from the child thread, then it is determined that the child thread has not entered a state of waiting for hot patch upgrade. Then, the main thread can determine whether the main thread executes the hot patch upgrade according to whether each determined child thread has entered a state of waiting for hot patch upgrade.
[0091] Optionally, in S202, the main thread determines whether to perform a hot patch upgrade according to the response information and the upgrade mark, which may include:
[0092] Optionally, the main thread determines whether all child threads have entered a state of waiting for hot patch upgrade according to the response information, the upgrade mark, and the first preset time. If so, the main thread executes the hot patch upgrade; if not, the main thread sends a message of resuming operation to each child thread, wherein each child thread refers to a child thread that has entered a state of waiting for hot patch upgrade.
[0093] Optionally, if the main thread determines that all child threads have entered the state of waiting for hot patch upgrade, the main thread can execute the hot patch upgrade; if the main thread determines that not all child threads have entered the state of waiting for hot patch upgrade, that is, some child threads are still executing current events at this time, and some child threads have entered the state of waiting for hot patch upgrade, then the main thread sends a message of resuming operation to the child threads that have entered the state of waiting for hot patch upgrade, so that the child threads that have entered the state of waiting for hot patch upgrade can resume operation and execute other events without being in the state of waiting for hot patch upgrade, that is, without waiting. At the same time, all child threads clear the inserted hot patch upgrade events.
[0094] In this embodiment, when all child threads have entered the state of waiting for hot patch upgrade, the main thread starts to execute the hot patch upgrade; if some child threads have not entered the state of waiting for hot patch upgrade, the main thread sends a message of resuming operation to the child threads that have entered the state of waiting for hot patch upgrade, so that the child threads that have entered the state of waiting for hot patch upgrade do not need to wait too long, which affects the execution of other events in the child thread.
[0095] Optionally, the main thread determines whether all sub-threads have entered a state of waiting for hot patch upgrade according to the response information, the upgrade mark and the first preset duration, which may include:
[0096] Optionally, within a first preset time period, the main thread determines whether all child threads have entered a state to be hot patch upgraded according to the response information and the upgrade mark. The first preset time period refers to the first preset time period starting from the current time, and the current time refers to the time when the main thread inserts the hot patch upgrade event into each child thread.
[0097] Specifically, within the first preset time after the main thread inserts a hot patch upgrade event into each sub-thread, the main thread determines whether all sub-threads have entered a state of waiting for hot patch upgrades based on the response information returned by each sub-thread and the upgrade mark of each sub-thread. The first preset time is, for example, T1. If the main thread has not obtained the upgrade marks of some sub-threads after waiting for T1, it is considered that the current business of these sub-threads is busy, and a message of resuming operation is sent to these sub-threads, and the hot patch upgrade events in all sub-threads are cleared at this time; if the upgrade marks of all sub-threads can be obtained after waiting for T1, it means that all sub-threads have entered a state of waiting for hot patch upgrades, and the main thread can perform the hot patch upgrade.
[0098] Optionally, after the main thread sends the information of resuming operation to each sub-thread, the following may be included:
[0099] Optionally, after a second preset time, the main thread re-inserts the hot patch upgrade event into each sub-thread. The second preset time refers to a second preset time starting from the current time, and the current time refers to the time when the main thread sends a message of resuming operation to each sub-thread, and the second preset time is greater than the first preset time.
[0100] Optionally, as can be seen from the above, after the first preset time, if not all child threads have entered the state of waiting for hot patch upgrade, the main thread sends a message of resuming operation to the child threads that have entered the state of waiting for hot patch upgrade, and clears the hot patch upgrade events in all child threads. After waiting for the second preset time, the main thread re-inserts the hot patch upgrade event into each child thread and sets the priority of the hot patch upgrade event to the highest.
[0101] Figure 3 A flowchart of another process upgrade method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, after the main thread executes the hot patch upgrade, it may include:
[0102] S301. The main thread sends an upgrade completion indication to each sub-thread.
[0103] Optionally, after the main thread completes the hot patch upgrade, an upgrade completion indication is sent to all child threads.
[0104] S302: Each sub-thread executes the pending events in the sub-thread according to the upgrade completion indication.
[0105] Optionally, when each sub-thread receives the upgrade completion indication sent by the main thread, the hot patch upgrade event in each sub-thread can be eliminated, and the pending events in each sub-thread can continue to be executed, where the pending events refer to the other events remaining in the sub-thread when the sub-thread enters the state of pending hot patch upgrade after the hot patch upgrade event is inserted.
[0106] Figure 4 A schematic diagram of a process upgrade method provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the device comprises:
[0107] Insertion module 401, used for the main thread to receive the hot patch upgrade message and insert the hot patch upgrade event into each sub-thread in the process, wherein the hot patch upgrade event has the highest priority in each sub-thread;
[0108] A response module 402, configured for the sub-thread to respond to the hot patch upgrade event according to the execution information of the current event, and return response information to the main thread;
[0109] A receiving module 403, configured for the main thread to receive response information returned by each of the sub-threads, wherein the response information is used to indicate whether the sub-thread has entered a state to be executed for the hot patch upgrade;
[0110] The judgment module 404 is used for the main thread to judge whether to execute the hot patch upgrade according to the response information, and if so, execute the hot patch upgrade.
[0111] Optionally, the response module 402 is specifically configured to:
[0112] If there is a current event being executed in the child thread, the child thread generates an upgrade mark after the execution of the current event is completed, and returns a response message to the main thread indicating that the hot patch upgrade is in a state to be executed;
[0113] If the child thread does not have a current event being executed, the child thread generates the upgrade mark and returns response information to the main thread indicating that the state of the hot patch upgrade is to be executed.
[0114] Optionally, the determining module 404 is specifically configured to:
[0115] The main thread obtains the upgrade mark from each of the sub-threads;
[0116] The main thread determines whether to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
[0117] Optionally, the determining module 404 is specifically configured to:
[0118] The main thread determines, according to each of the response information, each of the upgrade marks, and the first preset duration, whether all of the child threads have entered the state of waiting to execute the hot patch upgrade;
[0119] If yes, the main thread executes the hot patch upgrade; if no, the main thread sends a message of resuming operation to each sub-thread.
[0120] Optionally, the determining module 404 is specifically configured to:
[0121] Within the first preset time period, the main thread determines whether all the child threads have entered the state of waiting to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
[0122] Optionally, the determining module 404 is specifically configured to:
[0123] After a second preset time period, the main thread reinserts the hot patch upgrade event into each of the sub-threads.
[0124] Optionally, the determining module 404 is specifically configured to:
[0125] The main thread sends an upgrade completion indication to each of the sub-threads;
[0126] Each of the sub-threads executes the to-be-executed events in the sub-thread according to the upgrade completion indication.
[0127] Figure 5 This is a structural block diagram of an electronic device 500 provided in an embodiment of the present application. Figure 5 As shown, the electronic device may include: a processor 501 and a memory 502 .
[0128] Optionally, a bus 503 may also be included, wherein the memory 502 is used to store machine-readable instructions executable by the processor 501 (for example, Figure 4 Inserting module, response module, receiving module and execution instructions corresponding to the judgment module in the device, etc.), when the electronic device 500 is running, the processor 501 communicates with the memory 502 through the bus 503, and the method steps in the above method embodiment are executed by the processor 501.
[0129] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method steps in the above-mentioned process upgrade method embodiment are executed.
[0130] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0131] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0132] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A process upgrade method, characterized in that: The process includes a main thread and at least one sub-thread, and the method includes: The main thread receives a hot patch upgrade message and inserts a hot patch upgrade event into each sub-thread in the process, wherein the hot patch upgrade event has the highest priority in each sub-thread; Each of the sub-threads responds to the hot patch upgrade event according to the execution information of the current event, and returns response information to the main thread; The main thread receives response information returned by each of the child threads, where the response information is used to indicate whether the child thread has entered a state where the hot patch upgrade is to be executed; The main thread determines whether to execute the hot patch upgrade according to each of the response information, and if so, executes the hot patch upgrade.
2. The process upgrade method according to claim 1, characterized in that: Each of the sub-threads responds to the hot patch upgrade event according to the execution information of the current event, and returns response information to the main thread, including: If there is a current event being executed in the child thread, the child thread generates an upgrade mark after the execution of the current event is completed, and returns a response message to the main thread indicating that the hot patch upgrade is in a state to be executed; If the child thread does not have a current event being executed, the child thread generates the upgrade mark and returns response information to the main thread indicating that the state of the hot patch upgrade is to be executed.
3. The process upgrade method according to claim 2, characterized in that: The main thread determines whether to execute the hot patch upgrade according to the response information, including: The main thread obtains the upgrade mark from each of the sub-threads; The main thread determines whether to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
4. The process upgrade method according to claim 3, characterized in that: The main thread determines whether to execute the hot patch upgrade according to each of the response information and each of the upgrade marks, including: The main thread determines, according to each of the response information, each of the upgrade marks, and the first preset duration, whether all of the child threads have entered the state of waiting to execute the hot patch upgrade; If yes, the main thread executes the hot patch upgrade; if no, the main thread sends a message of resuming operation to each sub-thread.
5. The process upgrade method according to claim 4, characterized in that: The main thread determines, according to each of the response information, each of the upgrade marks, and the first preset duration, whether all of the sub-threads have entered the state of waiting to execute the hot patch upgrade, including: Within the first preset time period, the main thread determines whether all the child threads have entered the state of waiting to execute the hot patch upgrade according to each of the response information and each of the upgrade marks.
6. The process upgrade method according to claim 4, characterized in that: After the main thread sends the information of resuming operation to each sub-thread, it includes: After a second preset time period, the main thread reinserts the hot patch upgrade event into each of the sub-threads.
7. The process upgrade method according to claim 4, characterized in that: After the main thread executes the hot patch upgrade, the method further includes: The main thread sends an upgrade completion indication to each of the sub-threads; Each of the sub-threads executes the to-be-executed events in the sub-thread according to the upgrade completion indication.
8. A process upgrade device, characterized in that: include: An insertion module is used for the main thread to receive a hot patch upgrade message and insert a hot patch upgrade event into each sub-thread in the process, wherein the hot patch upgrade event has the highest priority in each sub-thread; A response module, configured for each of the sub-threads to respond to the hot patch upgrade event according to the execution information of the current event, and return response information to the main thread; A receiving module, used for the main thread to receive response information returned by each of the sub-threads, wherein the response information is used to indicate whether the sub-thread has entered a state to be executed for the hot patch upgrade; The judgment module is used for the main thread to judge whether to execute the hot patch upgrade according to the response information, and if so, execute the hot patch upgrade.
9. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the steps of the process upgrade method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the process upgrade method according to any one of claims 1 to 7 are executed.