# US 2018/0321956 A1 · Multi-version asynchronous dynamic software update system and method for applications with multiple threads

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2018/0321956 A1
- Document ID: US20180321956A1
- Status: Published application
- Kind: A1
- Application number: 15/584,785
- Filed: 2017-05-02
- Published: 2018-11-08
- Earliest claimed: 2017-05-02
- Assignees: Huawei Technologies Co., Ltd.
- Inventors: Kai-Ting Amy Wang; Peng Wu; Brice Dobry; Haichuan Wang
- Web page: https://patentgrep.com/patent/US20180321956A1

## CPC

- G06F 9/44536: {Selecting among different versions}
- G06F 8/656: while running
- G06F 9/3893: {controlled in tandem, e.g. multiplier-accumulator}
- G06F 9/44521: {Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading}
- G06F 9/44526: {Plug-ins; Add-ons}
- G06F 9/449: {Object-oriented method invocation or resolution}
- G06F 9/52: Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F 8/434: {Pointers; Aliasing}
- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F 9/223: {Execution means for microinstructions irrespective of the microinstruction function, e.g. decoding of microinstructions and nanoinstructions; timing of microinstructions; programmable logic arrays; delays and fan-out problems}
- G06F 9/44552: {Conflict resolution, i.e. enabling coexistence of conflicting executables}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and system for using multiple versions of a software component, includes storing, in memory, a first function table that points to executable code in the memory for functions from a first version of the software component, and storing, in the memory, a second function table that points to executable code in the memory for functions from a second version of the software component, referencing the first function table, when running a first application thread, to execute the functions from the first version of the software component; and referencing the second function table, when running a second application thread that is active concurrently with the first application thread, to execute the functions from the second version of the software component.

## Claims

### Claim 1

A method for using a software component, comprising:
storing, in memory, a first function table that points to executable code in the memory for functions from a first version of the software component;
storing, in the memory, a second function table that points to executable code in the memory for functions from a second version of the software component;
referencing the first function table, when running a first application thread, to execute the functions from the first version of the software component; and
referencing the second function table, when running a second application thread that is active concurrently with the first application thread, to execute the functions from the second version of the software component.

### Claim 2 (depends on 1)

The method of claim 1 wherein the first function table and the second function table are stored as objects in a linked list.

### Claim 3 (depends on 1)

The method of claim 1 comprising:
setting a global pointer to point to the first function table;
copying the global pointer to a local pointer of the first application thread, wherein the first application thread uses its local pointer to reference the first function table;
setting the global pointer to point to the second function table; and
copying the global pointer to a local pointer of the second application thread, wherein the second application thread uses its local pointer to reference the second function table.

### Claim 4 (depends on 3)

The method of claim 3 comprising copying the global pointer to the local pointer of the first application thread to update the first application thread to the functions from the second version of the software component.

### Claim 5 (depends on 4)

The method of claim 4 comprising de-allocating memory for the first version of the software component when no application threads have a local pointer that references the first function table.

### Claim 6 (depends on 3)

The method of claim 3 comprising:
monitoring for a signal indicating that the second version of the software component is available,
wherein the second function table is stored in the memory and the global pointer is set to point to the second function table after detecting the signal.

### Claim 7 (depends on 1)

The method of claim 1 comprising including a pointer in the second function table that points to the first function table.

### Claim 8 (depends on 1)

The method of claim 1 wherein the application is a Go program and the running threads are goroutines.

### Claim 9

A processing system configured to support a live software component update, comprising:
a processing device;
a memory associated with the processing device;
a non-transient storage for storing instructions that when loaded to the memory and executed by the processing device cause the processing system to:
store, in the memory, a first function table that points to executable code in the memory for functions from a first version of a software component;
store, in the memory, a second function table that points to executable code in the memory for functions from a second version of the software component;
reference the first function table, when running a first thread of an application, to execute the functions from the first version of the software component; and
reference the second function table, when running a second thread of the application that is active concurrently with the first thread, to execute the functions from the second version of the software component.

### Claim 10 (depends on 9)

The system of claim 9 wherein the instructions:
cause the processing system to reference the first function table, when running the first thread of an application, by: setting a global pointer to point to the first function table when the first function table is stored; and setting, when the first thread is created, a local pointer of the first thread equal to the global pointer; and
cause the processing system to reference the second function table, when running the second thread of the application, by: setting the global pointer to point to the second function table when the second function table is stored; and subsequently setting, when the second thread is created, a local pointer of the second thread equal to the global pointer.

### Claim 11 (depends on 10)

The system of claim 10 wherein the instructions cause the processing system to:
for each of the threads of the application, asynchronously set the local pointer of the thread to a current value of the global pointer if the local pointer is not equal to the current value of the global pointer.

### Claim 12 (depends on 11)

The system of claim 11 wherein the instructions cause the processing system to:
maintain a counter for each of the stored function tables that identifies a number of active threads having local pointers that point to the function table; and
delete stored function tables that are not pointed at by the local pointers of any active threads.

### Claim 13 (depends on 9)

The system of claim 9 wherein the function tables are stored in the memory as a linked list of shared objects.

### Claim 14 (depends on 13)

The system of claim 13 where in the function tables are stored in a cache region of the memory allocated to the application.

### Claim 15 (depends on 9)

The system of claim 9 wherein the application is a Go program and the threads are goroutines.

### Claim 16

A computer program product comprising a non-transient storage medium storing instructions to cause a processing device to:
store, in memory allocated to a program, a first function table that points to executable code in the memory for functions from a first version of a software component;
store, in the memory, a second function table that points to executable code in the memory for functions from a second version of the software component;
reference the first function table, when running a first application thread, to execute the functions from the first version of the software component; and
reference the second function table, when running a second application thread that is active concurrently with the first application thread, to execute the functions from the second version of the software component.

### Claim 17 (depends on 16)

The computer program product of claim 16 wherein the first function table and the second function table are stored as shared objects in a linked list.

### Claim 18 (depends on 16)

The computer program product of claim 16 wherein the instructions cause a processing device to:
set a global pointer to point to the first function table;
copy the global pointer to a local pointer of the first application thread, wherein the first application thread uses its local pointer to reference the first function table;
set the global pointer to point to the second function table; and
copy the global pointer to a local pointer of the second application thread, wherein the second application thread uses its local pointer to reference the second function table.

### Claim 19

A method for supporting multiple update versions of a software component that is used by multiple threads of an application, comprising:
storing, in memory allocated to the application, executable code for a first version of the software component;
storing, in the memory, executable code for an update version of the software component;
running, by a first thread of the application, the executable code for the first version of the software component; and
running, by a second thread of the application that is active concurrently with the first thread, the executable code for the update version of the software component.

### Claim 20 (depends on 19)

The method of claim 19 wherein executable code for multiple versions of the software component are concurrently stored in the memory and each version has one or more associated callable functions, the method comprising:
storing, in the memory, a respective function table for each version, each function table including pointers to respective locations in the memory of the functions associated with the version;
setting a global pointer value to point to the respective function table for the version that is the most recent of the versions; and
setting, at different times for a plurality of threads of the application, a respective thread local pointer equal to the global pointer value;
wherein running the executable code comprises calling one or more of the functions based on the function table that is pointed to by the thread local pointer of a calling thread.

### Claim 21

A processing system configured to support a live software component update, comprising:
a processing device;
a memory associated with the processing device;
a non-transient storage for storing instructions that when loaded to the memory and executed by the processing device cause the processing system to:
store, in a portion of the memory allocated to the application, executable code for a first version of the software component;
store, in the memory, executable code for an update version of the software component;
run, by a first thread of the application, the executable code for the first version of the software component; and
run, by a second thread of the application that is active concurrently with the first thread, the executable code for the update version of the software component.
