IP Library › Granted Patent US 11,281,445
Granted Patent B2
US 11,281,445 · App. 16/710,511 · Granted Mar 22, 2022

Method, apparatus, device and storage medium for upgrading application

Inventors: Linsi Yuan (Beijing, CN); Yingming Mao (Beijing, CN); Li Wang (Beijing, CN); Yu Zhang (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
G06F8/65G06F9/44521
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,281,445
App. No.
16/710,511
Granted
Mar 22, 2022
Kind
B2
Abstract

Embodiments of the present disclosure relate to the field of cloud computing, and specifically to a method, apparatus, device, and computer storage medium for upgrading an application. The method may include: determining, for a first thread executed by a first process of a first application, a first function invoked by the first thread; determining a second function corresponding to the first function in a second application, the first application to be upgraded to the second application, and the first function to be upgraded to the second function; replacing a first dynamic link library of the first application comprising the first function based on a second dynamic link library of the second application comprising the second function; and updating the first process based on the second dynamic link library, such that the updated first process runs the second function in the second application.

Claims (76)

1. A method for upgrading an application, comprising:

determining, for a first thread executed by a first process of a first application, a first function invoked by the first thread;

determining a second function corresponding to the first function in a second application, the first application to be upgraded to the second application, and the first function to be upgraded to the second function;

replacing a first dynamic link library of the first application comprising the first function based on a second dynamic link library of the second application comprising the second function;

adding a first registration document and a second registration document to the first dynamic link library and the second dynamic link library respectively, a numerical value of a first variable included in the first registration document being dynamically updated during execution of the first thread; and

updating the first process based on the second dynamic link library, such that the updated first process runs the second function in the second application.

2. The method according to claim 1 , wherein the updating the first process based on the second dynamic link library comprises:

acquiring address mapping of the first process, the address mapping comprising a first address of the first function in an address space of the first process;

updating the first address of the first function in the address mapping using a second address of the second function in the address space; and

restarting the first thread, such that the restarted first thread invokes the second function in the second dynamic link library based on the updated address mapping.

3. The method according to claim 2 , wherein the method further comprises acquiring the first address of the first function in the address space, the acquiring comprising:

for a given address of a group of addresses comprised in a first executable file of the first application,

acquiring a function name associated with the given address; and

identifying the given address as the first address, in response to determining the function name matching the first function.

4. The method according to claim 3 , wherein the method further comprises:

eliminating, in response to determining the first thread being restarted, a part of the first executable file from a memory of a computing device running the first application, the part of the first executable file being loaded into the memory to determine the first address.

5. The method according to claim 2 , wherein the method further comprises:

loading the second dynamic link library into the address space; and

acquiring the second address of the second function in the address space based on the loaded second dynamic link library.

6. The method according to claim 1 , wherein the method further comprises:

for a third function except for the first function in the first dynamic link library, acquiring a third address of the third function in the address space;

acquiring a fourth address of a fourth function corresponding to the third function in the second dynamic link library in the address space; and

updating the third address in the address mapping using the fourth address.

7. The method according to claim 2 , wherein the updating the first process based on the second dynamic link library comprises:

determining the first variable associated with the first dynamic link library, an address of the first variable being allocated during compilation of the first application;

determining a second variable corresponding to the first variable in the second application; and

setting the second variable based on the numerical value of the first variable.

8. The method according to claim 7 , wherein the setting the second variable based on the numerical value of the first variable comprises:

synchronizing the second registration document based on the first registration document; and

updating a numerical value of the second variable based on the second registration document.

9. The method according to claim 8 , wherein the updating a numerical value of the second variable based on the second registration document comprises:

causing the restarted first thread to read the numerical value of the second variable from the second registration document.

10. The method according to claim 1 , wherein the first application and the second application are generated by dynamic compilation respectively; and

the first dynamic link library and the second dynamic link library comprise core service logics of the first application and the second application respectively.

11. An apparatus for upgrading an application, comprising:

at least one processor; and

a memory storing instructions, the instructions when executed by the at least one processor, causing the at least one processor to perform operations, the operations comprising:

determining, for a first thread executed by a first process of a first application, a first function invoked by the first thread;

determining a second function corresponding to the first function in a second application, the first application to be upgraded to the second application, and the first function to be upgraded to the second function;

replacing a first dynamic link library of the first application comprising the first function based on a second dynamic link library of the second application comprising the second function;

adding a first registration document and a second registration document to the first dynamic link library and the second dynamic link library respectively, a numerical value of a first variable included in the first registration document being dynamically updated during execution of the first thread; and

updating the first process based on the second dynamic link library, such that the updated first process runs the second function in the second application.

12. The apparatus according to claim 11 , wherein the updating the first process based on the second dynamic link library comprises:

acquiring address mapping of the first process, the address mapping comprising a first address of the first function in an address space of the first process;

updating the first address of the first function in the address mapping using a second address of the second function in the address space; and

restarting the first thread, such that the restarted first thread invokes the second function in the second dynamic link library based on the updated address mapping.

13. The apparatus according to claim 12 , wherein the operations further comprise acquiring the first address of the first function in the address space, the acquiring comprising:

acquiring, for a given address of a group of addresses comprised in a first executable file of the first application, a function name associated with the given address; and

identifying the given address as the first address, in response to determining the function name matching the first function.

14. The apparatus according to claim 13 , wherein the operations further comprise:

eliminating, in response to determining the first thread being restarted, a part of the first executable file from a memory of a computing device running the first application, the part of the first executable file being loaded into the memory to determine the first address.

15. The apparatus according to claim 12 , wherein the operations further comprise:

loading the second dynamic link library into the address space; and

acquiring the second address of the second function in the address space based on the loaded second dynamic link library.

16. The apparatus according to claim 11 , wherein the operations further comprise:

acquiring, for a third function except for the first function in the first dynamic link library, a third address of the third function in the address space;

acquiring a fourth address of a fourth function corresponding to the third function in the second dynamic link library in the address space; and

updating the third address in the address mapping using the fourth address.

17. The apparatus according to claim 12 , wherein the operations further comprise:

determining the first variable associated with the first dynamic link library, an address of the first variable being allocated during compilation of the first application;

determining a second variable corresponding to the first variable in the second application; and

setting the second variable based on the numerical value of the first variable.

18. The apparatus according to claim 17 , wherein the setting the second variable based on a-the numerical value of the first variable comprises:

synchronizing the second registration document based on the first registration document; and

updating a numerical value of the second variable based on the second registration document.

19. The apparatus according to claim 18 , wherein the updating a numerical value of the second variable based on the second registration document comprises:

causing the restarted first thread to read the numerical value of the second variable from the second registration document.

20. The apparatus according to claim 11 , wherein

the first application and the second application are generated by dynamic compilation respectively; and

the first dynamic link library and the second dynamic link library comprise core service logics of the first application and the second application respectively.

21. A non-transitory computer readable storage medium, storing a computer program thereon, wherein the program, when executed by a processor, causes the processor to perform operations, the operations comprising:

determining, for a first thread executed by a first process of a first application, a first function invoked by the first thread;

determining a second function corresponding to the first function in a second application, the first application to be upgraded to the second application, and the first function to be upgraded to the second function;

replacing a first dynamic link library of the first application comprising the first function based on a second dynamic link library of the second application comprising the second function;

adding a first registration document and a second registration document to the first dynamic link library and the second dynamic link library respectively, a numerical value of a first variable included in the first registration document being dynamically updated during execution of the first thread; and

updating the first process based on the second dynamic link library, such that the updated first process runs the second function in the second application.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 2, 2020
From: YUAN, LINSI; MAO, YINGMING; WANG, LI; ZHANG, YU
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
Reel/Frame 051403/0516 →
Priority Claims (1)
CN 201910544728.3 · Jun 21, 2019 · national
Continuity (1)
Related Publication 20200401392A1 · Dec 24, 2020