CN100337204C - Online software updating method - Google Patents

Online software updating method Download PDF

Info

Publication number
CN100337204C
CN100337204C CNB2004100885711A CN200410088571A CN100337204C CN 100337204 C CN100337204 C CN 100337204C CN B2004100885711 A CNB2004100885711 A CN B2004100885711A CN 200410088571 A CN200410088571 A CN 200410088571A CN 100337204 C CN100337204 C CN 100337204C
Authority
CN
China
Prior art keywords
upgrading
software
thread
resources
marshalling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CNB2004100885711A
Other languages
Chinese (zh)
Other versions
CN1770108A (en
Inventor
卢庆明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2004100885711A priority Critical patent/CN100337204C/en
Publication of CN1770108A publication Critical patent/CN1770108A/en
Application granted granted Critical
Publication of CN100337204C publication Critical patent/CN100337204C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The present invention discloses a software on-line updating method which comprises the steps that resources in software, which need to be updated together, are grouped to form different grouping resources, the processing procedures of visit grouping resources, which are related in the software operation process, are patched, the grouping resources are respectively updated, the patches of the processing procedures of the visit grouping resources, which are related in the software, are restored, and other resources outside the grouping in the software are updated. The present invention supports the update relating to a plurality of threads and data structure type change, and can satisfy the updating requirement under the application occasion without service interruption, and the reliability and the uniformity in the software update process are fully ensured.

Description

Method for software on-line upgrading
Technical Field
The invention relates to the technical field of software, in particular to a method for upgrading software on line.
Background
In order to match the development of computer technology, software providers are also constantly updating and upgrading their various software to improve the functionality of computers. Most of the existing software upgrading belongs to a mode of replacing partial files of an original program, generally, system restarting or application program restarting is needed before or after upgrading is completed, service interruption is caused in the upgrading process, and the target of online upgrading cannot be achieved.
With the increasingly widespread application of information technology in various aspects of social life, the requirements of various industries on the fault-free operation of software are increasingly strong, and the requirements on the continuous operation of a system without interruption are also increasingly high (such as commercial website background transaction programs and power plant control), and with the development of services, the service upgrade and modification of the software under the continuous operation condition also become a trend and a necessity.
At present, some software providers can conveniently update the version of software in time according to the requirements of users, and also provide the function of software online upgrade. Generally, the online upgrade scheme of software adopts a method of function process address replacement, as shown in fig. 1, and the process reorganization and new process establishment, and new data structure variable establishment are performed inside the replacement function process. This scheme makes the software requirements for online upgrade more stringent, for example, the software to be patched cannot be multithreaded, cannot access common variables, and the upgrade process cannot modify the internal data structure of the system. Therefore, the application of this solution also has the following drawbacks:
(1) support for global variable data structure changes cannot be provided, especially in the case of multiple threads accessing common variables. For example, multiple threads need to access one variable at the same time, which may cause conflict in the access of the internal variables of the system, and the variable cannot be patched, so that the purpose of online upgrade cannot be achieved.
(2) If a local static variable is stored in the patched function, the variable cannot be patched, and the content of the variable cannot be read and updated.
(3) The risk of service flow confusion and program exception exists because if the current thread is located in the code of the a function, the a function may call the patched B function, the calling mode of the B function is changed, and the a is required to implement the call in a new mode, which may cause service flow confusion or program exception.
Disclosure of Invention
The invention aims to provide a method for upgrading software online, which aims to solve the problem that the software online upgrading in the prior art cannot provide support for changing a global variable data structure.
The purpose of the invention is realized by the following technical scheme:
a method for upgrading software online, comprising:
A. grouping resources which need to be upgraded together in software to form different grouped resources;
B. patching a processing flow related to accessing grouped resources in the software in the running process of the software;
C. after patching is carried out on a processing flow related to accessing marshalling resources, upgrading the marshalling resources when a thread where the marshalling resources are located is in a safe state;
D. recovering patches in the software that relate to a process flow that accesses marshalled resources;
E. and upgrading resources needing upgrading outside the groups in the software.
The step B comprises the following steps:
and B1, establishing a thread migration control table, wherein the thread migration control table comprises the thread identification and the thread state related to the grouped resources.
B2, patching the processing flow related to the access grouping resources in the software according to the thread migration control table.
The step B2 includes:
b21, setting the thread related to the grouped resources into a locked state before the patch program is operated to patch the processing flow;
and B22, setting the thread related to the grouped resource to be in a non-locking state after the system runs the patch program.
The step C specifically comprises the following steps:
c1, judging whether the marshalling meets marshalling upgrading conditions according to a preset mode;
and C2, upgrading the marshalling meeting the marshalling upgrading conditions.
The predetermined manner includes:
after the thread related to the marshalling resource is set to be in a non-locking state every time, judging whether the marshalling meets marshalling upgrading conditions; or
And traversing all marshalling at fixed time, and judging whether the marshalling meets the upgrading condition.
The step C2 further includes: and setting the process of upgrading the grouping into a critical section state.
The condition meeting the marshalling upgrading is specifically as follows: all threads involved in the marshalling resource upgrade process are in an unlocked state.
The step E comprises the following steps:
e1, establishing a software upgrading thread list, wherein the software upgrading thread list comprises all threads involved by programs needing to be patched in the software.
And E2, upgrading the resources needing upgrading outside the group in the software according to the software upgrading thread list.
The resources that need to be upgraded together include: common variables, functions, processes.
And the calling and returning modes of the patch function in the patch program are the same as those of the replaced grouped resources.
The step B further comprises the following steps:
patching one most frequently used processing flow of each thread in the software;
and when the most frequently used processing flow patch is called, the corresponding related thread state equipment is in a non-locking state.
According to the technical scheme provided by the invention, the upgrading resources which affect each other are grouped, and the upgrading of the function process and the variable data structure which affect each other and are associated with each other is completed in one process, so that the upgrading of the software supports the upgrading of the data structure type, and the upgrading of different data in batches is supported; and providing concurrent access control to multiple threads in the upgrading process of the common variable data structure, so that the upgrading process is completed when the multiple threads are in a safe and non-conflict state; the function process with special requirements is completed through a double-patch process (a patch program completes the control upgrading process and the effective process after the upgrading process is completed), and the unordered process of software upgrading is converted into an ordered controllable process. The invention can meet the upgrading requirement under the condition that the required service cannot be interrupted in the application occasion, strengthen the smooth transition of software upgrading and ensure the reliability and consistency of the software upgrading process.
Drawings
FIG. 1 is a diagram illustrating a prior art software online upgrade scheme;
FIG. 2 is a diagram of the software online upgrade implementation architecture of the present invention;
FIG. 3 is a flow chart of the present invention software upgrade on-line;
FIG. 4 is a schematic diagram of a consist upgrade in the method of the present invention;
FIG. 5 is a schematic diagram of a patch implementation structure required for software upgrade in the method of the present invention;
fig. 6 is an initialization process of the resource mapping table after the software to be upgraded is loaded with the patch.
Detailed Description
First, abbreviations used in the present invention are explained as follows:
PAS(Patched Application System):
the patched application system refers to an original application system to be subjected to software upgrading;
PAP(Patch Application):
a patch, which is a new additional program to replace the original application system, is an independent application program;
PCS(Patch Control Stub):
the patch control pile module resides in the PAS to complete the control of the patch process;
PCC(Patch Control Center):
the patch coordination control center is positioned in the PAP, needs to reside in the PCS during upgrading, and coordinates to complete a module for realizing the patch to take effect in the PAS;
PCF(Patch Control Function):
a patch control function, which refers to a control function group that completes patch application control in the PCC;
PF(Patch Function):
a patch function, a new function and code located in the PAP that will be validated in the PAS, or a function and code that replaces the old process flow.
As known to those skilled in the art, software upgrades can be broadly categorized into the following types:
(1) the upgrading process does not relate to the data structure change condition and the multithreading condition, and only changes the business processing flow;
(2) the upgrading process comprises the change of the data structure, but the influence range of the change of the data structure is within one thread, and other threads are not involved;
(3) the upgrade process involves changes to the data structure of variables that involve concurrent access of the process flows in multiple threads.
Therefore, for the different software upgrading types, the following problems need to be considered in the software online upgrading process:
the change coordination of the front and rear flows is required to be ensured in the upgrading process; the change of the data structure needs to consider the flow conflict processing in the multi-thread concurrent execution, including the situation that different threads execute the same or different program code segments; for changes to data structure variables, the upgrade process should provide an upgrade process flow, i.e., which data the new data structure variable is to be converted from the old data structure variable copy. Because single-thread software upgrading can be regarded as a special case of the same multithreading condition, and upgrading without data structure upgrading can be regarded as the condition that data upgrading is empty, different types of software upgrading can be regarded as the upgrading process of the data structure change of the common variable under the multithreading condition.
In consideration of upgrading of common variables with data structure change under the condition of multithreading, the core idea of the invention is as follows:
(1) data and control function processes and the like which have mutual influence and dependence and need to be upgraded are grouped, so that the data and the control function processes do not influence each other in the upgrading process, and do not influence each other before and after upgrading. The access and modification of system resources in the application system PAS to be patched by the patch PAP are realized by means of resource mapping, including static variables. The resource mapping mode refers to that a compiler can generate some MAP files in the PAS generation process, for example, Build is carried out after VC compiling option setting generates the MAP files, executable files and MAP files are generated, and the MAP files comprise relative addresses of the public functions and the public variables in the program engineering in the future, namely the addresses after relocation. After the PAP is loaded to the PAS, a jump instruction is added at the function address according to the address information, the function can be switched to a newly specified address when the PAS calls the function, pointers with the same structures as those of variables in the PAS are defined in the PAP, the values of the pointers are set to be the common variable address values specified in the MAP, the variable defined in the PAP is the variable in the PAS, and the process is the resource mapping.
(2) And a patch control pile PCS module is arranged in a patch application system PAS to provide functions of thread monitoring of an application program, loading control support of a patch program section and the like.
(3) And a PCC module of a patch coordination control center is arranged in the PAP of the patch program to control the whole process of realizing the patch process, realize the functions of data conversion control of the patch, realization of a patch control function, initialization of a patch program section and the like, and simultaneously provide a predefined process for the PCS to realize the control of starting the PCC process by the PCS.
(4) In the interior of the patch control function PCF, the support of the grouping upgrading process under the condition of multithreading is realized, and the integrity of the grouping upgrading process and the consistency of data are ensured.
(5) After the PAS links the PAP into the PAS program space, the PAP initialization process will be performed first, including generation of the upgraded data space, completion of the function replacement function of all PCFs (done in critical sections), completion of the PAP to PAS resources mapping, and so on.
(6) In the process of data structure change (i.e. upgrade), the influence of multithreading needs to be considered, because each thread is in different code areas, on one hand, mutual exclusion needs to be realized for accessing common data, on the other hand, codes executed in the data upgrade process need to be coordinated and unified, the situation that one thread is executed according to a new patch function and the other thread is executed according to an old code cannot occur, thus, an exception or data inconsistency occurs, and the data upgrade process needs to be performed when the related thread is in a safe or non-conflict state.
In order that those skilled in the art will better understand the technical solution of the present invention, the following detailed description of the present invention is provided in conjunction with the accompanying drawings and embodiments.
Referring to fig. 2, fig. 2 is a structure diagram for implementing online software upgrade of the present invention:
applications that require online upgrades include thread ID1, thread ID2, and thread ID 3. During the running process of the application program, the patch control stub PCS is responsible for reading an external patch PAP into the application program and calling a predefined start function thereof. The control method of the process can be freely set according to the requirements, for example, the control method is realized through a UI (user operation interface) and a self-defined network protocol, namely, the interactive interface between the user and the PCS is self-defined and is realized through a network.
If the PCS supports the automatic patching function after the application program is restarted, the function of executing a patch program interface after the application program is restarted needs to be added into the PCS.
The flow of implementing the software online upgrade is shown in fig. 3, and includes the following steps:
step 301: and grouping the resources which need to be upgraded together in the software to form different grouped resources.
Resources that need to be upgraded together include: common variables, functions, procedures, etc., and other items in which changes need to be made, such as file structures, databases, etc. The resources are mutually influenced and depended, the operation of a plurality of threads on the resources is involved, the upgrading of the resources in each group needs to be carried out simultaneously, the upgrading process between the groups is not influenced mutually, and the upgrading process are not influenced mutually. Therefore, the mutual influence between the resources caused by upgrading in the software running process is avoided.
For other variables such as private variables, upgrading can be realized by means of predefined mapping in the program.
Step 302: and establishing a thread migration control table, wherein the thread migration control table comprises threads and thread states related to the grouped resources. That is to say, the thread migration control table represents all the thread lists related to the data structure upgrade in the patched application PAS and the current state of each thread, and may adopt the following data unit structure:
STRUCT{ThreadID,Status}
wherein Status represents whether the current state of the thread in the upgrading process is safe (non-locking state), and the state (Status value) of each thread unit in the thread migration control table is in the locking state during initialization.
Step 303: and patching a processing flow related to accessing grouping resources in the software according to the thread migration control table in the running process of the software.
It should be noted that, in order to ensure the security of software upgrade, the threads involved in the grouped resources need to be set to a locked state before the process flow is patched; each process flow (thread) involving a grouped resource may have all of its required patches applied to it before the thread can be set to an unlocked state.
In this way, after all threads related to the grouped resources are patched, each grouped resource can be upgraded respectively. Then, the next step is proceeded to.
Step 304: and judging whether the marshalling meets marshalling upgrading conditions or not according to a preset mode, wherein the marshalling upgrading conditions refer to whether all processing flows related to accessing the marshalling resources are patched and meet upgrading requirements or not, namely whether all threads related to the marshalling resource upgrading process are in an unlocked state or not. Because the thread related to the grouping is already patched only when all threads involved in the grouping resource upgrading process are in a non-locking state, the function in the thread does not influence the upgrading of the grouping.
According to the method of the present invention, for a certain application program, there may be a plurality of groups at the same time, and the detection of the upgrade condition of each group and the upgrade process may be performed in a plurality of ways, such as:
after the thread related to each marshalling resource is set to be in a non-locking state, judging whether the marshalling meets the marshalling upgrading condition, and calling the marshalling process meeting the upgrading condition to realize upgrading, so that the marshalling resources can be upgraded successively in the running process of software, and only a single marshalling upgrading process is called for each upgrading;
if the upgrading is not carried out successively, traversing of each marshalling can be carried out at regular time, whether the marshalling meets the upgrading condition or not is judged, and the upgrading process is called to complete the upgrading of the marshalling resources when the condition is met.
Or the marshalling meeting the upgrading condition can be put into a marshalling upgrading queue, and then the marshalling in the queue is upgraded successively.
In a word, different marshalling resources can be upgraded in different modes, and the different modes can be flexibly selected without influencing the operation of the program.
Step 305: and upgrading the marshalling meeting the marshalling upgrading condition, namely replacing marshalling resources by the patch program.
The grouping resources comprise: common variables, functions, procedures, etc. that require one completion of the upgrade of these interacting resources during each consist upgrade process to avoid impact on other resources when upgrading a single resource within the consist.
In order to avoid other unexpected problems caused by system switching of threads in the upgrading process, such as the situation of thread interruption, the process of grouping upgrading can be set to be in a critical section state. A so-called critical section is a simple synchronous object that can only be used within the same process to ensure that only one thread can apply to the object. Typical API (application program interface) functions associated with critical sections are:
VOID InitializeCritical SECTION (LPCRITICAL _ SECTION lpCritical SECTION): generating a critical section;
VOID DeleteCritical SECTION (LPCRITICAL _ SECTION lpCritical SECTION): deleting the critical section;
VOID Enterprise SECTION (LPCRITICAL _ SECTION lpCritical SECTION): entering a critical section, namely applying for locking, and if the critical section is being used by other threads, the function waits until the other threads release;
BOOL TryEnterprise SECTION (LPCRITICAL _ SECTION lpCritical SECTION): entering a critical section, which is equivalent to applying for locking, and if the critical section is being used by other threads, the function immediately returns FALSE without waiting, unlike the Entercriticalsection;
VOID LeaveCritical SECTION (LPCRITICAL _ SECTION lpCritical SECTION): and exiting the critical zone is equivalent to applying for unlocking.
Step 306: patches in the recovery software that are involved in the process flow of accessing grouped resources. Because these patches are set for upgrading each grouped resource, and are not programs needed for real software upgrading, after the grouped resource is upgraded, the upgrading of other resources in the software except for the grouped resource is converted into the upgrading process of single-thread without data structure change. The patches within the threads involved in grouping resources are then restored,
then, go to step 307: upgrading other resources in the software outside the grouping.
For example, a software upgrading thread list is established, where the software upgrading thread list includes all threads involved in a program that needs to be patched, and the other resources outside the group in the software are upgraded according to the software upgrading thread list.
Upgrades to grouped resources may be represented by FIG. 4:
the software program includes 2 threads: thread 1 includes 3 functions: FUNC1, FUNC2, FUNC3, thread 2 includes 3 functions: FUNC4, FUNC5, FUNC 6. The functions FUNC1 and FUNC2 in the thread 1 and the function FUNC5 in the thread 2 are related to grouping, and these functions are first replaced by the patch PAP, and the thread state is set to Lock (locked state) at the entry of the replacement function, and the original processing function is still called. Because the upgrade process has not been completed in the current situation, it is still necessary to ensure the normal operation of the system by executing the original function flow. When the thread is left, namely the original function FUNC is executed, the thread state is set to UnLock (non-locked state). Then, the patch control function PCF determines whether the grouping is upgradable (i.e. thread 1 and thread 2 are both in UnLock state), if so, replaces the FUNC1, FUNC2, and FUNC5, which need to be modified, and other functions that need to be replaced, completes the upgrade, and if the FUNC1, FUNC2, and FUNC5 can be reserved, restores the functions.
The above marshalling upgrade process is done in software running and the call and return to the patch function PF in the patch PAP is the same as the call and return to the replaced marshalling resource.
In order to increase the upgrading chance in the software running process and simultaneously prevent the upgrading thread from falling into idle running and the condition that the upgrading cannot be realized, a patch coordination control center PCC can be established, PCC initialization codes are written, a function which is called most frequently by each thread is patched in the codes, in the processing flow, the PCC is informed that the thread enters an Unlock state, and meanwhile, the original processing flow, namely the FUNC function before replacement, is executed. Since the upgrading process is started, it is assumed that all thread states are unsafe, and the threads are considered to be safe only after the threads call the patch control function, because the threads may be executed in a function to be upgraded, and meanwhile, because the number of times and the probability of accessing the patch control function cannot be measured, if the patch control function PCF is not well positioned and cannot be called by the threads, the thread states are still unsafe, which leads to difficulty in proceeding the upgrading process, so that the patching can be performed on some frequently called functions, and the upgrading opportunity can be increased.
As mentioned above, the process of software online upgrade in the present invention is implemented by reading an external patch PAP into the software to be upgraded through the patch control stub PCS, as shown in fig. 5, where the patch PAP includes the following parts:
1. the patch function PF: new function functions and codes to be validated in the patched application PAS or function functions and codes replacing the old process flow in the patching PAP.
2. Patch coordination control center PCC: when upgrading, the module needs to reside in the PCS, coordinates to complete the implementation of the patch in the PAS, and provides the following functions:
(1) and the PCS calls the starting of the patching operation through the interface PIF of the PCS of the same patch control pile.
(2) Resource mapping table RMT: the mapping mirror image of the resource variable in the patch program PAP to the resource in the application program PAS to be patched is realized, and the realization process can be realized by reading the mapping file of the PAS or establishing a resource mapping table in the PAS. In order to implement the mapping operation of the resources early in patch start-up, the specific call is implemented by an interface PIF process.
The patch function PF uses RMT to access resources in the application PAS.
The RMT structure is represented as follows:
Strcut{ValueAddr,ValueName,ValueType}
wherein, ValueAddr is the address of the variable pointer in PAP, ValueName is the name of the resource to be mapped, which can be the name of the function or the variable, and ValueType is the type of the resource.
(3) Thread migration control table TTCT: all thread lists related to data structure upgrading in the application PAS and their current state are represented, and the specific data unit structure is as follows:
STRUCT{ThreadID,Status}
wherein, Status represents whether the current state of the thread in the upgrading process is safe (Unlock), and the value of Status of each unit in the TTCT is Lock when initializing.
(4) Grouping upgrade control table GTCT: the common variable data structure modification control in the multi-thread case is supported, and the specific structure of the data unit is as follows:
STRUCT{GroupID,ThreadID_List,Transfer_Proc,bTrasferIsOk}
wherein,
the GroupID is a variable (grouping) ID value of a data structure to be converted, and is uniformly distributed in the patch PAP, and the GroupID does not conflict with each other in service, so that several data variables which need to be upgraded and have mutual influence and related function processes can be distributed to one GroupID.
The ThreadID _ List is a thread conversion List, and refers to a thread ID List involved in the variable data structure upgrading process represented by the GroupID, and in order to ensure that the normal flow of each thread is not affected in the data upgrading process and ensure the consistency of data and services, all thread IDs involved in the variable data structure change need to be listed.
Transfer _ Proc points to the address of the function process that implements the data upgrade in the patch PAP, by which the correct upgrade of the data is implemented.
bTrasferIsOk indicates that the GroupID has completed the data upgrade, initially false.
(5) Grouping upgrade control process GTC: the method realizes the change process of resources in the grouping under the condition of multithreading, realizes grouping upgrading together with a Patch Control Function (PCF), and ensures the consistency and the integrity of the service and the data of each thread. Meanwhile, the implementation of Notify _ Thread _ GroupID (a function for judging whether grouping meets the upgrading condition) is provided, and the specific flow of the function is as follows:
set Thread _ Status ═ InputParam _ Lock _ seq (set the Status of the Thread to the Lock field of the input parameter, i.e. the third parameter of Notify _ Thread _ GroupID)
if Get _ GroupID _ Of _ allneedledetthreadds _ Status _ area _ Unlock the (looking up a state Of all threads involved is a grouping Of Unlock)
call Transfer _ Proc _ By _ GroupID (calling the data upgrade process of the GroupID to realize the upgrade of all resources in the grouping)
set bTrasferIsOk_From_GroupID=true
If one considers completing the switch as soon as possible, the above three operations are repeated until all the groups that can be upgraded complete the upgrade.
3. The patch control function PCF: the control function for completing patch application control in a patch coordination control center PCC realizes a grouping access control process, and the code structure of the control function when accessing grouping resources is as follows:
if Lock _ GroupID _ success (locking DTCT specifically grouping the thread state corresponding to ID)
Then
Execute _ Old _ Process (Old flow before upgrade execution)
Unlock _ GroupID (Unlock thread state)
Else
Execute _ New _ Process (flow after execution of upgrade)
End
The flow of the Lock _ GroupID _ success is as follows:
If bTrasferIsOk_Is_True_of_GroupID Then Return Error
Else
Notify_Thread_GroupID(Current_ThreadID,GroupID,Lock)
lock _ Data _ of _ group (groupid) (locking the specific Data in the group, can call the old code that accessed the resource originally and concurrently)
Return OK
End
Wherein, the procedure of Unlock _ GroupID is as follows:
Notify_Thread_GroupID(Current_ThreadID,GroupID,UnLock)
the method needs to be initialized after the patch program is dynamically loaded, and comprises the following three processes:
1. resource mapping table RMT initialization:
first, in step 601: entering an RMT initialization process;
then, go to step 602: reading MAP (mapping) information in patch PAP;
step 603: reading a record in the MAP;
step 604: judging whether the name and the type in the record are the same as the record in the resource mapping table RMT or not;
if so, go to step 605: assigning the value of the resource address recorded by the RMT to a relative address defined in the MAP;
if not, go back to step 603: the next record in the MAP is read.
2. Initialization of a grouping upgrade control table GTCT and a thread migration control table TTCT:
setting bTrasferIsOk of all records in the GTCT table to FALSE;
status of all records in the TTCT table is set to Lock.
3. And (3) operating a grouping upgrade control process GTC:
and replacing the specified function in the PAS by each PCF in the patch control function PCF group, wherein the replacement process needs to be completed in a critical area.
After the PCF replaces the function in the PAS, when the PAS accesses the function replaced by the PCF, the PAS is redirected to the PCF, and then the PCF realizes the control of the grouping upgrading process under the condition of multithreading.
In the process of data structure change (i.e. upgrade), the influence of multithreading needs to be considered, because each thread is in different code areas, on one hand, mutual exclusion needs to be realized for accessing common data, on the other hand, codes executed in the data upgrade process need to be coordinated and unified, the situation that one thread is executed according to a new patch function and the other thread is executed according to an old code cannot occur, thus, an exception or data inconsistency occurs, and the data upgrade process needs to be performed when the related thread is in a safe or non-conflict state. Therefore, before accessing the grouped resources, the Thread is set to Lock through a Notify _ Thread _ GroupID function, and after accessing, the Thread is set to Unlock.
Judging whether the grouping meets the upgrading condition in the Notify _ Thread _ GroupID after the Thread Unlock is set each time, namely judging whether the states of all threads related to the grouping are safe, and calling the upgrading process to realize upgrading if the conditions are met. If the marshalling needs to be upgraded according to a certain sequence, only the upgrading process of a single marshalling is called, otherwise, the traversal of each marshalling is carried out, and the upgrading process is called when the conditions are met. To prevent the occurrence of a thread interrupt, the upgrade process needs to be set as a critical section.
And after all the marshalling is upgraded, completing the upgrading process of other resources outside the marshalling, namely completing the replacement of the patch function PF. After the PF replacement is completed, some functions of the software need to be restored, that is, a patch restoration operation is performed, and some functions that do not actually implement the patch flow are restored.
By this, the online upgrading process of the application program related to the data structure change of the common variable under the multithread condition is completed.
While the present invention has been described with respect to the embodiments, those skilled in the art will appreciate that there are numerous variations and permutations of the present invention without departing from the spirit of the invention, and it is intended that the appended claims cover such variations and modifications as fall within the true spirit of the invention.

Claims (11)

1. A method for upgrading software online is characterized by comprising the following steps:
A. grouping resources which need to be upgraded together in software to form different grouped resources;
B. patching a processing flow related to accessing grouped resources in the software in the running process of the software;
C. after patching is carried out on a processing flow related to accessing marshalling resources, upgrading the marshalling resources when a thread where the marshalling resources are located is in a safe state;
D. recovering patches in the software that relate to a process flow that accesses marshalled resources;
E. and upgrading resources needing upgrading outside the groups in the software.
2. The method for upgrading software online according to claim 1, wherein the step B comprises:
and B1, establishing a thread migration control table, wherein the thread migration control table comprises the thread identification and the thread state related to the grouped resources.
B2, patching the processing flow related to the access grouping resources in the software according to the thread migration control table.
3. The method for upgrading software online according to claim 2, wherein the step B2 includes:
b21, setting the thread related to the grouped resources into a locked state before the patch program is operated to patch the processing flow;
and B22, setting the thread related to the grouped resource to be in a non-locking state after the system runs the patch program.
4. The method for upgrading software online according to claim 3, wherein the step C specifically includes:
c1, judging whether the marshalling meets marshalling upgrading conditions according to a preset mode;
and C2, upgrading the marshalling meeting the marshalling upgrading conditions.
5. The method for upgrading software online according to claim 4, wherein the predetermined manner comprises:
after the thread related to the marshalling resource is set to be in a non-locking state every time, judging whether the marshalling meets marshalling upgrading conditions; or
And traversing all marshalling at fixed time, and judging whether the marshalling meets the upgrading condition.
6. The method for upgrading software online according to claim 4, wherein the step C2 further comprises: and setting the process of upgrading the grouping into a critical section state.
7. The method for upgrading software online according to claim 4, wherein the condition that the group upgrading is satisfied is specifically: all threads involved in the marshalling resource upgrade process are in an unlocked state.
8. The method for upgrading software on line according to claim 1 or 2, wherein the step E comprises:
e1, establishing a software upgrading thread list, wherein the software upgrading thread list comprises all threads involved by programs needing to be patched in the software.
And E2, upgrading the resources needing upgrading outside the group in the software according to the software upgrading thread list.
9. The method for software online upgrade according to claim 1, wherein the resources needed to implement upgrade together comprise: common variables, functions, processes.
10. The method for on-line upgrading of software according to claim 3, wherein the patch function in the patch program is called and returned in the same way as the replaced grouped resource.
11. The method for upgrading software online according to claim 1, wherein the step B further comprises:
patching one most frequently used processing flow of each thread in the software;
and when the most frequently used processing flow patch is called, the corresponding related thread state equipment is in a non-locking state.
CNB2004100885711A 2004-11-05 2004-11-05 Online software updating method Active CN100337204C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004100885711A CN100337204C (en) 2004-11-05 2004-11-05 Online software updating method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004100885711A CN100337204C (en) 2004-11-05 2004-11-05 Online software updating method

Publications (2)

Publication Number Publication Date
CN1770108A CN1770108A (en) 2006-05-10
CN100337204C true CN100337204C (en) 2007-09-12

Family

ID=36751430

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004100885711A Active CN100337204C (en) 2004-11-05 2004-11-05 Online software updating method

Country Status (1)

Country Link
CN (1) CN100337204C (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101206575B (en) * 2006-12-19 2010-05-19 大唐移动通信设备有限公司 Software patch on-line upgrade method, veneer and system
CN100432931C (en) * 2006-12-22 2008-11-12 中兴通讯股份有限公司 Method for implementing long jumping dynamic patch in embedded system
CN102663298B (en) * 2012-04-06 2014-12-17 北京空间飞行器总体设计部 Safety online detecting system facing to terminal computers
CN103761126B (en) * 2014-01-07 2017-03-15 中国神华能源股份有限公司 The upgrade method of application program and device
CN104111848B (en) * 2014-06-27 2017-04-26 华中科技大学 Multi-thread software dynamic upgrading method based on asynchronous check points
CN104504341B (en) * 2015-01-21 2018-01-23 联想(北京)有限公司 A kind of Loopholes of OS restorative procedure and device
CN107870777A (en) * 2016-09-23 2018-04-03 中兴通讯股份有限公司 A kind of hot patch implementation method and device, terminal
CN109766131B (en) * 2017-11-06 2022-04-01 上海宝信软件股份有限公司 System and method for realizing intelligent automatic software upgrading based on multithreading technology
CN109729136A (en) * 2018-05-14 2019-05-07 网联清算有限公司 Proxy server dissemination method and publisher server
CN109828768A (en) * 2018-12-21 2019-05-31 福建新大陆支付技术有限公司 A kind of management method and system of software patch
CN109754511B (en) * 2019-01-14 2021-05-14 深圳前海微众银行股份有限公司 Shopping cart equipment firmware updating method, system, platform, gateway and storage medium
CN110489140B (en) * 2019-07-11 2023-06-06 平安科技(深圳)有限公司 Software upgrading method and device, computer equipment and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5309730A (en) * 1993-05-28 1994-05-10 Honeywell Inc. Thermostat for a gas engine heat pump and method for providing for engine idle prior to full speed or shutdown
US6202208B1 (en) * 1998-09-29 2001-03-13 Nortel Networks Limited Patching environment for modifying a Java virtual machine and method
US6594683B1 (en) * 1998-01-23 2003-07-15 Sun Microsystems, Inc. Method, apparatus and computer program product for locking interrelated data structures in a multi-threaded computing environment
US20030140082A1 (en) * 2002-01-23 2003-07-24 Nec Corporation Patch processing system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5309730A (en) * 1993-05-28 1994-05-10 Honeywell Inc. Thermostat for a gas engine heat pump and method for providing for engine idle prior to full speed or shutdown
US6594683B1 (en) * 1998-01-23 2003-07-15 Sun Microsystems, Inc. Method, apparatus and computer program product for locking interrelated data structures in a multi-threaded computing environment
US6202208B1 (en) * 1998-09-29 2001-03-13 Nortel Networks Limited Patching environment for modifying a Java virtual machine and method
US20030140082A1 (en) * 2002-01-23 2003-07-24 Nec Corporation Patch processing system and method

Also Published As

Publication number Publication date
CN1770108A (en) 2006-05-10

Similar Documents

Publication Publication Date Title
CN100337204C (en) Online software updating method
CN1171145C (en) Request dispatch sequence for automatic software configuration
CN1224903C (en) Module-by-module verification
CN101076168A (en) Method for managing intelligent interminal system and intelligent terminal
CN1203404C (en) Full-delay interlinkage with module-by-module verification
CN1143208C (en) Apparatus and method for conversion of messages
CN1291313C (en) System and method for the automatic installation and configuration of an operating system
CN1791862A (en) Operating systems
CN1208720C (en) High speed buffer storage of non-confidence module used in fulfilling module identification
CN1617099A (en) Application identity for software products
CN1737779A (en) Method and system for expanding peripherals
CN1781075A (en) Device memory management during electronic file updating
CN1858742A (en) Method and system for realizing update data in real time data bank
CN1967485A (en) Method and system for realizing J2EE application
WO2021142761A1 (en) Chip patching method and chip
CN1906598A (en) Information processing apparatus, memory area management method, and computer program
CN1786925A (en) TTCN-3 testing system basedon C++ mapping and its testing method
CN1848111A (en) Realizing method of a data operating interface used in internal-memory database
CN1696910A (en) Efficient software patching
CN1091842A (en) The interrupt system and the method that comprise user interface
CN1595324A (en) Method of managing the information on the release of restriction on use
CN1892615A (en) Software-action description, fetching and controlling method with virtual address space characteristic
CN1659513A (en) Method and apparatus for writing data to a non-volatile memory
CN113849200B (en) Installation optimization method and system for android application in android compatible environment
CN1308812C (en) Method of controlling user's downloading of softwave from Internet

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant