Program running method, device and system and storage medium
By replacing and executing the operation code of the AI program on the host side, saving the results in the storage space, and sending reading and processing codes to the terminal side, the problem of the terminal side's operation volume exceeding the bottleneck is solved, and the operation performance of the AI program is improved.
Patent Information
- Application Number
- CN202311584829.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-23
AI Technical Summary
During the operation of the artificial intelligence program, the terminal side needs to execute a large amount of operation code, which may exceed the operation bottleneck on the terminal side, reducing the performance of running AI programs on the terminal side.
By replacing and executing the operation code on the host side, the operation result is saved in the storage space, and the reading and processing code is sent to the terminal side, so that the terminal side only needs to read and process the value of the variable from the storage space, without executing the operation code.
It effectively avoids the problem of the terminal side exceeding the computing bottleneck due to executing the computing code, and improves the performance of the terminal side running AI programs.
Smart Images

Figure CN120029625A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, device, system and storage medium for running a program. Background Art
[0002] Artificial intelligence (AI) programs are usually run through devices, which include a host side and a terminal side. The host side can compile the AI program to obtain a binary program, send the binary program to the terminal side, and the terminal side runs the binary program.
[0003] For example, the host side of the device may be the central processing unit (CPU) of the device, and the terminal side of the device may be the graphics processing unit (GPU) of the device. In other words, the CPU may compile the AI program to obtain a binary AI program, send the binary AI program to the GPU, and the GPU runs the binary AI program.
[0004] The AI program may include an operation code, which includes a variable, at least one variable parameter and an operation rule. When the terminal side runs the operation code, it obtains the parameter value of the at least one variable parameter, and performs an operation on the parameter value of the at least one variable parameter based on the operation rule to obtain the variable value of the variable.
[0005] The AI program may include more computing codes, which will result in a large number of computing operations when the terminal side runs the AI program. The required amount of computing may exceed the computing bottleneck on the terminal side, thereby reducing the performance of the AI program running on the terminal side. Summary of the invention
[0006] The present application provides a method, device, system and storage medium for running a program to improve the performance of running a program on a terminal side. The technical solution is as follows:
[0007] In the first aspect, the present application provides a method for running a program, the method is applied to a host side included in a device, the device also includes a terminal side, the terminal side includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to a first variable in the device, and the first variable and at least one first variable parameter satisfy a first operation rule. In the method, a parameter value of the at least one first variable parameter is obtained. The variable value of the first variable is saved in the first storage space, and the variable value of the first variable is the result of operating the parameter value of the at least one first variable parameter based on the first operation rule. Send a first message to the terminal side, the first message is used to instruct the terminal side to read the variable value of the first variable from the first storage space and process the variable value of the first variable by running the first code.
[0008] Since the first program includes a first code, the first code is used to read the first storage space and process the first variable, and the first storage space is the storage space corresponding to the first variable in the device. In this way, the host side obtains the parameter value of the at least one first variable parameter, saves the variable value of the first variable to the first storage space, and sends the first information to the terminal side. The terminal side reads the variable value of the first variable from the first storage space and processes the variable value of the first variable by running the first code. In this way, the terminal side does not need to calculate the parameter value of the at least one first variable parameter based on the first operation rule, which avoids the amount of calculation on the terminal side exceeding the calculation bottleneck on the terminal side, and improves the performance of the terminal side running the program.
[0009] In a possible implementation, the host side includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and the at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable. The second code and the third code included in the second program are replaced with the first code to obtain the first program; and the first program is sent to the terminal side. In this way, the first program does not include the operation code, so that the terminal side does not need to execute the operation code when running the first program.
[0010] In another possible implementation, the variable value of the first variable is a result obtained by calculating the parameter value of the at least one first variable parameter currently obtained based on the first calculation rule when the parameter value of the at least one first variable parameter currently obtained is different from the parameter value of the at least one first variable parameter obtained last time. This can reduce the number of calculations on the host side.
[0011] In another possible implementation, the host side includes a third program, the third program includes a judgment code and multiple branch codes, the judgment code includes a second variable parameter and a judgment condition, and the multiple branch codes correspond to multiple judgment results. The parameter value of the second variable parameter is obtained. It is judged whether the parameter value of the second variable parameter meets the judgment condition to obtain the target judgment result. The branch code corresponding to the target judgment result is sent to the terminal side, and the terminal side is used to run the branch code corresponding to the target judgment result. In this way, the amount of code sent to the terminal side can be reduced.
[0012] In another possible implementation, the first code includes a read code for reading the first storage space, thereby ensuring that when the first code is executed, the terminal side reads the variable value of the first variable from the first storage space.
[0013] In another possible implementation, the read code includes a read instruction and an address of the first storage space, and the read instruction is used to instruct to read data stored in the first storage space indicated by the address.
[0014] In the second aspect, the present application provides a method for running a program, the method is applied to a terminal side included in a device, the device also includes a host side, the terminal side includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to a first variable in the device, and the first variable and at least one first variable parameter satisfy a first operation rule. In the method, a first message is received, the first message is sent by the host side when saving a variable value of the first variable to the first storage space, and the changed value of the first variable is obtained by the host side calculating the parameter value of at least one first variable parameter based on the first operation rule. By running the first code, the variable value of the first variable is read from the first storage space, and the variable value of the first variable is processed.
[0015] Since the first program includes the first code, the first code is used to read the first storage space and process the first variable, and the first storage space is the storage space corresponding to the first variable in the device. In this way, the host side saves the variable value of the first variable to the first storage space. By running the first code, the terminal side reads the variable value of the first variable from the first storage space and processes the variable value of the first variable. In this way, the terminal side does not need to calculate the parameter value of the at least one first variable parameter based on the first operation rule, which avoids the amount of calculation on the terminal side exceeding the calculation bottleneck on the terminal side, and improves the performance of the terminal side running the program.
[0016] In a possible implementation, the host side includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and the at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable. The first program sent by the host side is received, and the first program is a program obtained by replacing the second code and the third code included in the second program with the first code on the host side. In this way, the first program does not include the operation code, so that the terminal side does not need to execute the operation code when running the first program.
[0017] In another possible implementation, the host side includes a third program, the third program includes a judgment code and multiple branch codes, the judgment code includes a second variable parameter and a judgment condition, and the multiple branch codes correspond to multiple judgment results. The branch code corresponding to the target judgment result is received, and the target judgment result is the result obtained by the host side judging whether the parameter value of the second variable parameter meets the judgment condition. The branch code corresponding to the target judgment result is run. In this way, the host side can reduce the amount of code sent to the terminal side.
[0018] In another possible implementation manner, the first code includes a read code for reading the first storage space.
[0019] In another possible implementation, the read code includes a read instruction and an address of the first storage space, and based on the read instruction, a variable value of the first variable stored in the first storage space indicated by the address is read.
[0020] In a third aspect, the present application provides a device for running a program, for executing the method in the first aspect or any possible implementation of the first aspect. Specifically, the device includes a unit for executing the method in the first aspect or any possible implementation of the first aspect.
[0021] In a fourth aspect, the present application provides a device for running a program, for executing the method in the second aspect or any possible implementation of the second aspect. Specifically, the device includes a unit for executing the method in the second aspect or any possible implementation of the second aspect.
[0022] In a fifth aspect, the present application provides a device for running a program, the device comprising a processor and a memory. The processor and the memory may be connected via an internal connection. The memory is used to store the program, and the processor is used to execute the program in the memory, so that the device executes the method in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0023] In a sixth aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device cluster, causes the computing device cluster to execute a method in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0024] In a seventh aspect, the present application provides a computer-readable storage medium comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0025] In an eighth aspect, the present application provides a chip comprising a memory and a processor, the memory being used to store computer instructions, and the processor being used to call and run the computer instructions from the memory to execute the method in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0026] In a ninth aspect, the present application provides a system for running a program, the system comprising the apparatus described in the third aspect and the apparatus described in the fourth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of a device structure provided in an embodiment of the present application;
[0028] Figure 2 is another schematic diagram of a device structure provided in an embodiment of the present application;
[0029] Figure 3 It is a flow chart of a method for running a program provided in an embodiment of the present application;
[0030] Figure 4 is a flow chart of another method for running a program provided in an embodiment of the present application;
[0031] Figure 5 It is a schematic diagram of the structure of a device for running a program provided in an embodiment of the present application;
[0032] Figure 6 is a schematic diagram of the structure of another device for running a program provided in an embodiment of the present application;
[0033] Figure 7 is a schematic diagram of the structure of another device for running a program provided in an embodiment of the present application;
[0034] Figure 8 is a schematic diagram of the structure of another device for running a program provided in an embodiment of the present application;
[0035] Fig. 9 It is a schematic diagram of the system structure of a running program provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] See also Figure 1 The embodiment of the present application provides a device 100, which is used to run a program. Optionally, the program can be an AI program or the like.
[0037] The device 100 includes: a host side 101 and a terminal side 102. The host side 101 can compile the program to be run to obtain a binary program, and send the binary program to the terminal side 102. The terminal side 102 can receive the binary program and run the binary program.
[0038] For the sake of convenience, the program sent to the terminal side 102 for running after compilation is called the first program, and the program located in the host side 101 before compilation is called the second program. That is, the first program is compiled from the second program.
[0039] The second program may include a large number of operation codes. For each operation code in the second program, the operation code includes a variable, at least one variable parameter and an operation rule, and the operation code is used to describe whether the variable and the at least one variable parameter satisfy the operation rule.
[0040] The operation code is an operation, and the parameter value belonging to the at least one variable parameter is operated based on the operation rule to obtain the variable value of the variable. The second program may also include a processing code corresponding to the operation code, and the processing code is used to process the variable value of the variable.
[0041] For example, the second program includes an operation code: var=a+b, which is an addition operation. In the operation code, var is a variable, a and b are two variable parameters, and a+b is an operation rule. The operation code indicates that the parameter value of the variable parameter a and the parameter value of the variable parameter b are summed to obtain the variable value of the variable var.
[0042] The second program may also include a processing code corresponding to the operation code, and the processing code is as follows:
[0043]
[0044]
[0045] The processing code is used to process the variable value of the variable var.
[0046] The second program may include a large amount of operation codes, and the first program obtained by compiling the second program also includes a large amount of operation codes. In other words, the second program includes a large amount of operation operations, and the first program also includes a large amount of operation operations. When the terminal side runs the first program, it will run the large amount of operation codes, that is, execute the large amount of operation operations.
[0047] For each operation code, when the terminal side 102 runs the operation code, it is necessary to obtain the parameter value of at least one variable parameter included in the operation code, and perform operation on the parameter value of the at least one variable parameter to obtain the variable value of the variable.
[0048] For example, assuming that when the terminal side 102 runs the operation code var=a+b, it needs to obtain the parameter value of variable parameter a and the parameter value of variable parameter b, and add the parameter value of variable parameter a and the parameter value of variable parameter b to obtain the variable value of variable var.
[0049] Therefore, when the terminal side 102 runs each operation code, it is performing an operation and requires an amount of operation. If the first program has a large amount of operation codes, the terminal side 102 needs to perform a large amount of operation, resulting in a large amount of operation required to run the first program, which may exceed the operation bottleneck of the terminal side 102 and reduce the performance of the terminal side 102 running the first program.
[0050] The host side 101 has a high computing performance, and the computing bottleneck of the host side 101 may be high, which may be much higher than the computing bottleneck of the terminal side 102. If a large number of computing operations in the second program are stripped out and placed on the host side 101 for execution, the host side 101 compiles the content of the second program except for the large number of computing operations, and the obtained first program does not include the large number of computing operations. In this way, when the terminal side 102 runs the first program, the large number of computing operations will not be executed, so that the amount of computing required for the terminal side 102 to run the first program will not exceed the computing bottleneck of the terminal side 102, thereby improving the performance of the terminal side 102 running the first program.
[0051] In some embodiments, the host side 101 may be a CPU, etc., and the terminal side 102 may be a GPU, etc. The GPU is good at processing matrix data or vector data, but slightly inferior to computing, so the computing bottleneck of the GPU is not high. When the first program running on the GPU includes a large amount of computing code, the amount of computing required for the GPU to run the first program will exceed the computing bottleneck of the GPU.
[0052] Therefore, a large number of computing operations in the second program are stripped out and executed by the CPU. The CPU compiles the contents of the second program except for the large number of computing operations, and the first program obtained does not include the large number of computing operations. When the GPU runs the first program, the large number of computing operations will not be executed, thereby improving the performance of the GPU running the first program.
[0053] In some embodiments, see Figure 2 The device 100 also includes a memory 103, which may be a memory or a hard disk.
[0054] In order to improve the performance of the terminal side 102 running the first program, the host side 101 can run a large number of computing operations in the second program, obtain a large number of running results, and save the large number of running results to the memory 103. When the terminal side 102 runs the first program, it can read the large number of computing results from the memory 103 and run the first program based on the large number of computing results. The detailed implementation process can refer to the method for running a program provided in any of the following embodiments.
[0055] See also Figure 3 , the present application embodiment provides a method 300 for running a program, the method 300 is applied to Figure 1 or Figure 2 The device 100 shown, the method 300 includes the following process.
[0056] Step 301: The host side obtains a second program, which includes an operation code and a processing code. The operation code is used to describe whether a variable and at least one variable parameter satisfy an operation rule, and the processing code is used to process the variable.
[0057] The processing code is a code corresponding to the operation code, and the processing code may be located after the operation code in the second program. When the operation code is executed, the parameter value of the at least one variable parameter can be operated based on the operation rule to obtain the variable value of the variable. When the processing code is executed, the variable value of the variable can be processed.
[0058] The second program may include a plurality of operation codes and at least one processing code corresponding to each operation code.
[0059] For example, the second program includes the following lines of code:
[0060]
[0061] The second program includes a first operation code and a second operation code. The first operation code is var=a+b, and the first operation code is used to sum the parameter value of the variable parameter a and the parameter value of the variable parameter b to obtain the variable value of the variable var1. The first processing code corresponding to the first operation code is if(var1>10), and the first processing code is used to determine whether the variable value of the variable var1 is greater than 10. If the variable value of the variable var1 is greater than 10, parallel computing is performed. Parallel_computing(sin(vector)) is the operation to implement the parallel computing.
[0062] The second operation code is var2=c*d, and the second operation code is used to multiply the parameter value of variable parameter c and the parameter value of variable parameter d to obtain the variable value of variable var2. The second processing code corresponding to the second operation code is e=var2, and the second processing code is used to assign the variable value of variable var2 to variable e.
[0063] Step 302: The host side replaces the operation code included in the second program and the processing code corresponding to the operation code with the first code to obtain the first program. The first code is used to read the storage space and process the variable. The storage space is the storage space corresponding to the variable in the device.
[0064] In step 302, the host side may replace the operation code included in the second program and the processing code corresponding to the operation code with the first code through the following operations 3021 to 3023.
[0065] 3021: The host side identifies the operation code included in the second program and the processing code corresponding to the operation code.
[0066] The structure of the operation code often includes a variable, at least one variable parameter and an operation rule, and the variable is obtained by operating at least one variable parameter based on the operation rule.
[0067] The host side can identify an operation code that satisfies the structure in the second program, obtain the variables included in the operation code, and identify a code including the variable after the operation code, which is a processing code corresponding to the operation code for processing the variable.
[0068] For example, for the above-mentioned second program, on the host side in the second program, the operation code var1 = a + b that satisfies the above structure is recognized. The operation code var1 = a + b includes the variable var1, variable parameters a and b, and the operation rule "a + b". Then, after the operation code var1 = a + b, the code including the variable var1, i.e., if(var1>10), is recognized. The code if(var1>10) is the processing code corresponding to the operation code var1 = a + b for processing the variable var1.
[0069] 3022: The host side allocates storage space for the variables included in the operation code, and stores the address of the storage space, the variables included in the operation code, at least one variable parameter, and the operation rule in the corresponding relationship of address, variable, variable parameter, and operation rule.
[0070] The storage space is located in the memory included in the device where the host side is located. The storage space is used to store the variable value of the variable, and the variable value of the variable is the variable value obtained by running the operation code.
[0071] For example, the host side allocates storage space 1 for the variable var1, and stores the address address1 of the storage space 1, the variable var1 included in the operation code var1 = a + b, variable parameters a and b, and the operation rule "a + b" in the corresponding relationship of address, variable, variable parameter, and operation rule shown in Table 1 below.
[0072] Table 1
[0073] address variable Variable parameters Operation rules address1 var1 a, b a+b
[0074] In some embodiments, the address of the storage space is a logical relative address.
[0075] 3023: The host side replaces the operation code included in the second program and the processing code corresponding to the operation code with a first code, and the first code is used to read the storage space and process the variable.
[0076] In some embodiments, the first code includes a read code for reading the storage space. Optionally, the read code includes a read instruction and the address of the storage space, and the read instruction is used to indicate reading the data stored in the storage space indicated by the address.
[0077] For example, the host side replaces the operation code var1=a+b included in the second program and the processing code if(var1>10) corresponding to the operation code var1=a+b with the first code 1, and the first code 1 is if(load(address1)>10). The first code 1 includes the read code load(address1), and the read code load(address1) includes the read instruction load and the address address1 of the storage space 1.
[0078] The host side repeats the process of 3021-3023 to identify other operation codes included in the second program and other processing codes corresponding to the other operation codes, and then replaces the other operation codes included in the second program and other processing codes corresponding to the other codes with corresponding first codes. After replacing each operation code included in the second program and the processing code corresponding to each operation code with the corresponding first code, the first program is obtained.
[0079] For another example, in the second program, the host side recognizes the operation code var2=c*d that satisfies the above structure, and the operation code var2=c*d includes the variable var2, the variable parameters c and d, and the operation rule "c*d". Then, after the operation code var2=c*d, the code e=var2 including the variable var2 is recognized, and the code e=var2 is the processing code for processing the variable var2 corresponding to the operation code var2=c*d.
[0080] The host side allocates storage space 2 for variable var2, and stores the address address2 of storage space 2, the variable var2 included in the operation code var2=c*d, the variable parameters c and d, and the operation rule "c*d" in the corresponding relationship among the address, variable, variable parameters and operation rules shown in Table 1 above. The result is shown in Table 2 below.
[0081] Table 2
[0082] address variable Variable parameters Operation rules address1 var1 a, b a+b address2 var2 c. d. c*d
[0083] The host side replaces the operation code var2=c*d and the processing code e=var2 corresponding to the operation code var2=c*d included in the second program with the first code 2, and the first code 2 is e=load(address2). The first code 2 includes the read code load(address2), and the read code includes the read instruction load and the address address2 of the storage space 2.
[0084] This results in the following first program:
[0085] if(load(address1)>10)
[0086] {
[0087] Systemout.println("hello!");
[0088] }
[0089] e=load(address2).
[0090] Step 303: The host side sends the first program to the terminal side.
[0091] In step 303, the host side compiles the first program to obtain the first program in binary form, and sends the first program in binary form to the terminal side. The terminal side receives the first program and saves the first program.
[0092] Since each operation code and the processing code corresponding to each operation code in the second program are replaced by the first code corresponding to each, the first program is obtained. And each first code in the first program is used to read the storage space corresponding to the variable and process the variable, so the first program does not include the operation code, that is, the first program does not include the operation operation.
[0093] For each variable in the second program, the host side can calculate and obtain the variable value of each variable, and save the variable value of each variable in the storage space corresponding to each variable. The detailed implementation process is as follows.
[0094] Step 304: The host side obtains the parameter value of at least one variable parameter, and obtains at least one variable, the address of the storage space corresponding to each variable and the operation rule, each variable corresponding to part or all of the variable parameters in the at least one variable parameter.
[0095] The parameter value of the at least one variable parameter may be input by a user received by the host side, or may be generated by the host side.
[0096] Based on the at least one variable parameter, the host side obtains the corresponding variable, the address of the storage space corresponding to the variable and the operation rule from the corresponding relationship between the address, the variable, the variable parameter and the operation rule. And / or,
[0097] The host side obtains the corresponding variable, the address of the storage space corresponding to the variable and the operation rule from the correspondence between the address, the variable, the variable parameter and the operation rule based on the partial variable parameters included in the at least one variable parameter.
[0098] For example, the host side obtains the parameter value of variable parameter a as 10, the parameter value of variable parameter b as 2, the parameter value of variable parameter c as 3, and the parameter value of variable parameter d as 4. Then, based on variable parameter a and variable parameter b, the corresponding variable var1, the address address1 of storage space 1 corresponding to the variable var1, and the operation rule a+b are obtained from the correspondence between addresses, variables, variable parameters, and operation rules shown in Table 2. And, based on variable parameter c and variable parameter d, the corresponding variable var2, the address address2 of storage space 2 corresponding to the variable var2, and the operation rule c*d are obtained from the correspondence between addresses, variables, variable parameters, and operation rules shown in Table 2.
[0099] Step 305: For each variable, the host side operates the parameter values of one or more variable parameters corresponding to the variable based on the operation rules corresponding to the variable, obtains the variable value of the variable, and saves the variable value of the variable in the storage space corresponding to the variable.
[0100] For the variable and one or more variable parameters corresponding to the variable, if the parameter values of the one or more variable parameters currently obtained are different from the parameter values of the one or more variable parameters obtained last time, the host side calculates the parameter values of the one or more variable parameters currently obtained based on the calculation rules corresponding to the variable to obtain the variable value of the variable, and replaces the data stored in the storage space corresponding to the variable with the variable value of the variable. If the parameter values of the one or more variable parameters currently obtained are the same as the parameter values of the one or more variable parameters obtained last time, the host side does not need to recalculate to obtain the variable value of the variable.
[0101] For example, for variable var1, the parameter values of one or more variable parameters corresponding to the variable var1 include the parameter value 10 of variable parameter a and the parameter value 2 of variable parameter b. The address of the storage space corresponding to the variable var1 is the address address1 of storage space 1, and the operation rule corresponding to the variable var1 is a+b. Based on the operation rule a+b, the host side sums the parameter value 10 of variable parameter a and the parameter value 2 of variable parameter b to obtain the variable value of variable var1 as 12. Based on the address address1 of storage space 1, the variable value 12 of variable var1 is saved in storage space 1.
[0102] For another example, for variable var2, the parameter values of one or more variable parameters corresponding to the variable var2 include parameter value 3 of variable parameter c and parameter value 4 of variable parameter d. The address of the storage space corresponding to the variable var2 is address address2 of storage space 2, and the operation rule corresponding to the variable var2 is c*d. Based on the operation rule c*d, the host side multiplies the parameter value 3 of variable parameter c and the parameter value 4 of variable parameter d to obtain the variable value of variable var2 as 12. Based on address address2 of storage space 2, the variable value 12 of variable var2 is saved in storage space 2.
[0103] In step 304, if the host side calculates the variable value of each variable in the second program and saves the variable value of each variable in the storage space corresponding to each variable, the terminal side can be notified to run the first program according to the following operations.
[0104] Step 306: The host side sends first information to the terminal side, where the first information is used to notify the terminal side to run the first program.
[0105] Step 303 is an optional step. Step 303 may not be executed first. Instead, after executing step 304, the host side sends the first information to the terminal side. The first information includes the first program.
[0106] Step 307: The terminal side receives the first information, reads the variable value of the variable from the storage space by running the first code in the first program, and processes the variable value of the variable.
[0107] In step 307, the terminal side receives the first information and runs the first program based on the first information. When running to the first code in the first program, the first code includes a read code, the read code includes a read instruction and an address of a storage space, based on the read instruction, the storage space corresponding to the address is determined, the variable value of the variable stored in the storage space is read, and the variable value of the variable is processed.
[0108] For example, the terminal side receives the first information, and runs the above-mentioned first program based on the first information. When running to the first code if(load(address1)>10) in the first program, the first code if(load(address1)>10) includes a read code load(address1). The read code load(address1) includes a read instruction load and an address address1 of storage space 1, and storage space 1 is used to store the variable value 12 of variable var1. Based on the read instruction load, the host side determines the storage space 1 corresponding to the address address1, and reads the variable value 12 of the variable var1 stored in the storage space 1. Determine whether the variable value 12 of the variable var1 is greater than 10, and determine that the variable value 12 of the variable var1 is greater than 10, and perform parallel computing.
[0109] When the first code e=load(address2) in the first program is run, the first code e=load(address2) includes a read code load(address2). The read code load(address2) includes a read instruction load and an address address2 of a storage space 2, and the storage space 2 is used to store a variable value 12 of a variable var2. Based on the read instruction load, the host side determines the storage space 2 corresponding to the address address2, and reads the variable value 12 of the variable var2 stored in the storage space 2. The value of the variable e is assigned to the variable value 12 of the variable var2.
[0110] After executing step 307, the host side can also obtain the parameter value of at least one variable parameter, and obtain at least one variable, the address of the storage space corresponding to each variable and the operation rule, that is, it can return to the execution starting from the above step 304, the host side recalculates the variable value of each variable in the second program, and saves the variable value of each variable in the storage space corresponding to each variable, and then sends the first information to the terminal side. When the terminal side receives the first information, it starts to run the first program.
[0111] In an embodiment of the present application, the host side replaces the operation code and processing code included in the second program with the first code to obtain the first program, the operation code is used to describe the operation rules between the variable and at least one variable parameter, the processing code is used to process the variable, and the first code is used to read the storage space corresponding to the variable and process the variable. The host side sends the first program to the terminal side, and the terminal side saves the first program. The host side can obtain the parameter value of at least one variable parameter, and obtain at least one variable, the address and operation rule of the storage space corresponding to each variable based on at least one variable parameter, and each variable corresponds to part or all of the variable parameters in the at least one variable parameter. For each variable and one or more variable parameters corresponding to the variable, the parameter value of one or more variable parameters corresponding to the variable is calculated based on the operation rule corresponding to the variable, and the variable value of the variable is obtained, and the variable value of the variable is saved in the storage space corresponding to the variable. Then, the terminal side runs the first program, and when running to the first code in the first program, based on the address of the storage space of the variable included in the first code, the variable value of the variable is read from the storage space, and the variable value of the variable is processed. Since the host side calculates the parameter values of one or more variable parameters corresponding to the variable to obtain the variable value of the variable, the terminal side reads the variable value of the variable from the storage space when executing the first program and processes the variable value of the variable. As a result, the terminal side does not need to run the operation code, that is, it does not need to execute a large number of operation operations in the second program, thereby avoiding the amount of operation on the terminal side when executing the first program exceeding the operation bottleneck of the terminal side, and improving the performance of the terminal side running the first program.
[0112] See also Figure 4 , the present application embodiment provides a method 400 for running a program, the method 400 is applied to Figure 1 or Figure 2 The device 100 shown, the method 400 includes the following process.
[0113] Step 401: the host side obtains a third program, the third program includes a judgment code and multiple branch codes, the judgment code includes variable parameters and judgment conditions, and the multiple branch codes correspond to multiple judgment results.
[0114] For example, the host side obtains the third program shown below:
[0115] if(C>10)
[0116] Systemout.Println("holle");
[0117] else
[0118] Systemout.Println("C").
[0119] The third program includes a judgment code if (C>10), a first branch code Systemout.Println ("holle"), and a second branch code Systemout.Println ("C").
[0120] The judgment code if(C>10) includes the variable parameter C and the judgment condition whether the parameter value of the variable parameter C is greater than 10. The first branch code Systemout.Println("holle") corresponds to the first judgment result "the parameter value of the variable parameter C is greater than 10". The second branch code Systemout.Println("C") corresponds to the second judgment result "the parameter value of the variable parameter C is not greater than 10".
[0121] Step 402: The host side obtains the parameter value of the variable parameter.
[0122] In step 402, the host side receives the parameter value of the variable parameter input by the user, or the host side generates the parameter value of the variable parameter.
[0123] For example, the parameter value of the variable parameter C received by the host side from the user is 11.
[0124] Step 403: The host side determines whether the parameter value of the variable parameter satisfies the determination condition, and obtains a target determination result.
[0125] For example, the host side determines whether the parameter value 11 of the variable parameter C is greater than 10, and the target judgment result obtained is "the parameter value of the variable parameter C is greater than 10", that is, the target judgment result is the above-mentioned first judgment result.
[0126] Step 404: the host side sends the branch code corresponding to the target judgment result to the terminal side, and the terminal side is used to run the branch code corresponding to the target judgment result.
[0127] For example, the target judgment result is the first judgment result, and the branch code corresponding to the first judgment result is the first branch code Systemout.Println("holle"). The host side sends the first branch code Systemout.Println("holle") to the terminal side. The terminal side receives the first branch code Systemout.Println("holle") and runs the first branch code Systemout.Println("holle") to output "hello".
[0128] In the embodiment of the present application, since the third program includes a judgment code and multiple branch codes, the judgment code includes variable parameters and judgment conditions, and the multiple branch codes correspond to multiple judgment results, the host side obtains the parameter value of the variable parameter, judges whether the parameter value of the variable parameter satisfies the judgment condition, obtains the target judgment result, and sends the branch code corresponding to the target judgment result to the terminal side, and the terminal side is used to run the branch code corresponding to the target judgment result. In this way, the host side does not need to send the entire third program to the terminal side, but sends part of the code in the third program to the terminal side, reducing the amount of code that needs to be sent. Since the terminal side directly runs the branch code corresponding to the target judgment result, there is no need for the terminal side to perform branch judgment, which speeds up the hit of the branch code on the terminal side.
[0129] See also Figure 5 , the embodiment of the present application provides a device 500 for running a program, the device 500 is located on a device, the device is Figure 1 or Figure 2 The device shown, or Figure 3 The device or Figure 4 The device in the method 400 shown. The device also includes a terminal side, the terminal side includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to a first variable in the device, and the first variable and at least one first variable parameter satisfy a first operation rule. The device 500 includes:
[0130] The processing unit 501 is used to obtain a parameter value of at least one first variable parameter;
[0131] The processing unit 501 is further configured to save a variable value of a first variable to a first storage space, where the variable value of the first variable is a result of operating a parameter value of at least one first variable parameter based on a first operation rule;
[0132] The sending unit 502 is used to send first information to the terminal side, where the first information is used to instruct the terminal side to read the variable value of the first variable from the first storage space and process the variable value of the first variable by running the first code.
[0133] Optionally, the detailed implementation process of the processing unit 501 obtaining the parameter value of at least one first variable parameter can be found in Figure 3 The relevant contents of step 304 of the method 300 are not described in detail here.
[0134] Optionally, the detailed implementation process of the processing unit 501 saving the variable value of the first variable to the first storage space is shown in Figure 3 The relevant contents of step 305 of the method 300 are not described in detail here.
[0135] Optionally, the detailed implementation process of the sending unit 502 sending the first information to the terminal side is shown in Figure 3 The relevant contents of step 306 of the method 300 are not described in detail here.
[0136] Optionally, the device 500 includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable;
[0137] The processing unit 501 is further configured to replace the second code and the third code included in the second program with the first code to obtain the first program;
[0138] The sending unit 502 is further configured to send the first program to the terminal side.
[0139] Optionally, the processing unit 501 replaces the second code and the third code included in the second program with the first code to obtain the detailed implementation process of the first program. Figure 3 The relevant contents of step 302 of the method 300 are not described in detail here.
[0140] Optionally, the detailed implementation process of the sending unit 502 sending the first program to the terminal side is shown in Figure 3 The relevant contents of step 303 of the method 300 are not described in detail here.
[0141] Optionally, the variable value of the first variable is a result obtained by operating the parameter value of at least one first variable parameter currently acquired based on a first operation rule when the parameter value of at least one first variable parameter currently acquired is different from the parameter value of at least one first variable parameter acquired last time.
[0142] Optionally, the device 500 includes a third program, the third program includes a judgment code and a plurality of branch codes, the judgment code includes a second variable parameter and a judgment condition, and the plurality of branch codes correspond to a plurality of judgment results;
[0143] The processing unit 501 is further used to obtain a parameter value of a second variable parameter; determine whether the parameter value of the second variable parameter satisfies a determination condition, and obtain a target determination result;
[0144] The sending unit 502 is further used to send the branch code corresponding to the target judgment result to the terminal side, and the terminal side is used to run the branch code corresponding to the target judgment result.
[0145] Optionally, the processing unit 501 obtains the parameter value of the second variable parameter; determines whether the parameter value of the second variable parameter satisfies the judgment condition, and obtains the target judgment result. For a detailed implementation process, see Figure 4 The relevant contents of steps 402 - 403 of the method 400 are not described in detail here.
[0146] Optionally, the detailed implementation process of the sending unit 502 sending the branch code corresponding to the target judgment result to the terminal side can be found in Figure 4 The relevant contents of step 404 of the method 400 are not described in detail here.
[0147] Optionally, the first code includes a read code for reading the first storage space.
[0148] Optionally, the read code includes a read instruction and an address of the first storage space, and the read instruction is used to instruct to read data stored in the first storage space indicated by the address.
[0149] In an embodiment of the present application, since the first program includes a first code, the first code is used to read the first storage space and process the first variable, and the first storage space is a storage space corresponding to the first variable in the device. In this way, the processing unit obtains the parameter value of the at least one first variable parameter, saves the variable value of the first variable to the first storage space, and the sending unit sends the first information to the terminal side. The terminal side reads the variable value of the first variable from the first storage space and processes the variable value of the first variable by running the first code. In this way, the terminal side does not need to calculate the parameter value of the at least one first variable parameter based on the first operation rule, which avoids the amount of calculation on the terminal side exceeding the calculation bottleneck on the terminal side, and improves the performance of the terminal side running the program.
[0150] See also Figure 6 , the embodiment of the present application provides a device 600 for running a program, the device 600 is located on a device, the device is Figure 1 or Figure 2 The device shown, or Figure 3 The device or Figure 4 The device in the method 400 is shown. The device also includes a host side, the device 600 includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to a first variable in the device, and the first variable and at least one first variable parameter satisfy a first operation rule. The device 600 includes:
[0151] The receiving unit 601 is used to receive first information, where the first information is sent by the host side when saving the variable value of the first variable to the first storage space, and the changed value of the first variable is obtained by the host side calculating the parameter value of at least one first variable parameter based on the first calculation rule;
[0152] The processing unit 602 is used to read the variable value of the first variable from the first storage space by running the first code, and process the variable value of the first variable.
[0153] Optionally, the detailed implementation process of the receiving unit 601 receiving the first information is shown in Figure 3 The relevant contents of step 307 of the method 300 are not described in detail here.
[0154] Optionally, the processing unit 602 reads the variable value of the first variable from the first storage space by running the first code, and processes the variable value of the first variable. Figure 3 The relevant contents of step 307 of the method 300 are not described in detail here.
[0155] Optionally, the host side includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable; the receiving unit 601 is further used to:
[0156] A first program sent by the host side is received, where the first program is a program obtained by replacing the second code and the third code included in the second program with the first code by the host side.
[0157] Optionally, the detailed implementation process of the receiving unit 601 receiving the first program sent by the host side can be found in Figure 3 The relevant contents of step 303 of the method 300 are not described in detail here.
[0158] Optionally, the host side includes a third program, the third program includes a judgment code and a plurality of branch codes, the judgment code includes a second variable parameter and a judgment condition, and the plurality of branch codes correspond to the plurality of judgment results;
[0159] The receiving unit 601 is further configured to receive a branch code corresponding to a target judgment result, where the target judgment result is a result obtained by the host side judging whether a parameter value of a second variable parameter satisfies a judgment condition;
[0160] The processing unit 602 is further used to run the branch code corresponding to the target judgment result.
[0161] Optionally, the detailed implementation process of the receiving unit 601 receiving the branch code corresponding to the target judgment result can be found in Figure 4 The relevant contents of step 404 of the method 400 are not described in detail here.
[0162] Optionally, the detailed implementation process of the processing unit 602 running the branch code corresponding to the target judgment result can be found in Figure 4 The relevant contents of step 404 of the method 400 are not described in detail here.
[0163] Optionally, the first code includes a read code for reading the first storage space.
[0164] Optionally, the read code includes a read instruction and an address of the first storage space, and the processing unit 602 is used to read, based on the read instruction, a variable value of a first variable stored in the first storage space indicated by the address.
[0165] Optionally, the processing unit 602 reads the variable value of the first variable stored in the first storage space indicated by the address based on the read instruction. Figure 3 The relevant contents of step 307 of the method 300 are not described in detail here.
[0166] In the embodiment of the present application, since the first program includes the first code, the first code is used to read the first storage space and process the first variable, and the first storage space is the storage space corresponding to the first variable in the device. In this way, the host side saves the variable value of the first variable to the first storage space. The processing unit reads the variable value of the first variable from the first storage space and processes the variable value of the first variable by running the first code. In this way, the processing unit does not need to calculate the parameter value of the at least one first variable parameter based on the first operation rule, thereby avoiding the amount of calculation exceeding the operation bottleneck of the device 600, and improving the performance of the running program.
[0167] See also Figure 7 , the present application embodiment provides a schematic diagram of a device 700 for running a program. The device 700 may be as follows Figure 1 Or the host side of the device shown in 2, such as Figure 3 The host side of the method 300 shown, or Figure 4 The host side of the method 400 is shown. The apparatus 700 comprises at least one processor 701 , an internal connection 702 , a memory 703 and at least one transceiver 704 .
[0168] The device 700 is a hardware structure device that can be used to implement Figure 5 The functional modules in the device 500 are as follows. For example, those skilled in the art may think of Figure 5 The processing unit 501 in the device 500 shown can be implemented by the at least one processor 701 calling the code in the memory 703. Figure 5 The sending unit 502 in the illustrated apparatus 500 may be implemented by the at least one transceiver 704 .
[0169] The device 700 may also be used to implement the host-side functions in any of the above embodiments.
[0170] The processor 701 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0171] The internal connection 702 may include a path to transmit information between the components. The internal connection 702 may be a single board or a bus.
[0172] The at least one transceiver 704 is used to communicate with other devices or communication networks.
[0173] The memory 703 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0174] The memory 703 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 701. The processor 701 is used to execute the application code stored in the memory 703, and cooperate with at least one transceiver 704, so that the device 700 implements the functions of the method of the present patent.
[0175] In a specific implementation, as an embodiment, the processor 701 may include one or more CPUs, such as Figure 7 CPU0 and CPU1 in.
[0176] In a specific implementation, as an embodiment, the apparatus 700 may include multiple processors, for example Figure 7The processors 701 and 707 therein. Each of these processors can be a single-CPU processor or a multi-CPU processor. The processors herein can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0177] See Figure 8 , an embodiment of the present application provides a schematic diagram of a device 800 for running a program. The device 800 can be the terminal side in the device as shown in Figure 1 or 2, the terminal side in the method 300 as shown in Figure 3 , or the terminal side in the method 400 as shown in Figure 4 . The device 800 includes at least one processor 801, an internal connection 802, a memory 803, and at least one transceiver 804.
[0178] The device 800 is a device with a hardware structure and can be used to implement Figure 6 the functional modules in the device 600 described above. For example, those skilled in the art can conceive that Figure 6 the processing unit 602 in the device 600 as shown in can be implemented by the at least one processor 801 calling the code in the memory 803, Figure 6 and the receiving unit 601 in the device 600 as shown in can be implemented by the at least one transceiver 804.
[0179] The device 800 can also be used to implement the functions of the terminal side in any of the above embodiments.
[0180] The above-mentioned processor 801 can be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the solution of the present application.
[0181] The above-mentioned internal connection 802 can include a path for transmitting information between the above components. The internal connection 802 can be a single board or a bus, etc.
[0182] The above at least one transceiver 804 is used to communicate with other devices or communication networks.
[0183] The above-mentioned memory 803 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this. The memory can exist independently and be connected to the processor through a bus. The memory can also be integrated with the processor.
[0184] The memory 803 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 801. The processor 801 is used to execute the application code stored in the memory 803, and cooperate with at least one transceiver 804, so that the device 800 implements the functions of the method of the present patent.
[0185] In a specific implementation, as an embodiment, the processor 801 may include one or more CPUs, such as Figure 8 CPU0 and CPU1 in.
[0186] In a specific implementation, as an embodiment, the apparatus 800 may include multiple processors, for example Figure 8 801 and processor 807 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0187] See also Fig. 9 The embodiment of the present application provides a system 900 for running a program, and the system 900 includes: Figure 5 The device 500 shown and Figure 6 The device 600 shown, or the system 900 includes Figure 7 The device 700 shown and Figure 8 The device 800 is shown.
[0188] like Figure 5 The device 500 shown or as Figure 7 The device 700 shown can be the host side 901, such as Figure 6 The device 600 shown and as Figure 8 The device 800 shown can be the terminal side 902.
[0189] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a disk, an optical disc, etc.
[0190] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method of running a program, It is characterized in that The method is applied to a host side included in a device, the device also includes a terminal side, the terminal side includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to the first variable in the device, and the first variable and at least one first variable parameter satisfy a first operation rule, the method includes: Obtaining a parameter value of the at least one first variable parameter; Saving a variable value of the first variable in the first storage space, where the variable value of the first variable is a result of operating the parameter value of the at least one first variable parameter based on the first operation rule; Sending first information to the terminal side, where the first information is used to instruct the terminal side to read the variable value of the first variable from the first storage space and process the variable value of the first variable by running the first code.
2. The method according to claim 1, It is characterized in that The host side includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and the at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable; the method also includes: Replacing the second code and the third code included in the second program with the first code to obtain the first program; The first program is sent to the terminal side.
3. The method according to claim 1 or 2, It is characterized in that The variable value of the first variable is a result obtained by operating the parameter value of the at least one first variable parameter currently obtained based on the first operation rule when the parameter value of the at least one first variable parameter currently obtained is different from the parameter value of the at least one first variable parameter obtained last time.
4. The method according to any one of claims 1 to 3, It is characterized in that The host side includes a third program, the third program includes a judgment code and a plurality of branch codes, the judgment code includes a second variable parameter and a judgment condition, and the plurality of branch codes correspond to a plurality of judgment results; the method further includes: Obtaining a parameter value of the second variable parameter; Determine whether the parameter value of the second variable parameter satisfies the judgment condition, and obtain a target judgment result; The branch code corresponding to the target judgment result is sent to the terminal side, and the terminal side is used to run the branch code corresponding to the target judgment result.
5. The method according to any one of claims 1 to 4, It is characterized in that The first code includes a read code for reading the first storage space.
6. The method according to claim 5, It is characterized in that The read code includes a read instruction and an address of the first storage space, and the read instruction is used to instruct to read data stored in the first storage space indicated by the address.
7. A method of running a program, It is characterized in that The method is applied to a terminal side included in a device, the device also includes a host side, the terminal side includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to the first variable in the device, and the first variable and at least one first variable parameter satisfy a first operation rule, the method includes: receiving first information, wherein the first information is sent by the host side when saving the variable value of the first variable to the first storage space, and the changed value of the first variable is obtained by the host side calculating the parameter value of the at least one first variable parameter based on the first calculation rule; By running the first code, the variable value of the first variable is read from the first storage space, and the variable value of the first variable is processed.
8. The method according to claim 7, It is characterized in that The host side includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and the at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable; the method also includes: The first program sent by the host side is received, where the first program is a program obtained by replacing the second code and the third code included in the second program with the first code by the host side.
9. The method according to claim 7 or 8, It is characterized in that The host side includes a third program, the third program includes a judgment code and a plurality of branch codes, the judgment code includes a second variable parameter and a judgment condition, and the plurality of branch codes correspond to a plurality of judgment results; The method further comprises: receiving a branch code corresponding to a target judgment result, wherein the target judgment result is a result obtained by the host side judging whether a parameter value of the second variable parameter satisfies the judgment condition; Run the branch code corresponding to the target judgment result.
10. The method according to any one of claims 7 to 9, It is characterized in that The first code includes a read code for reading the first storage space.
11. The method according to claim 10, It is characterized in that The reading code includes a read instruction and an address of the first storage space, and the reading the variable value of the first variable from the first storage space by running the first code includes: Based on the read instruction, the variable value of the first variable stored in the first storage space indicated by the address is read.
12. A device for running a program, It is characterized in that The device is located on a device, the device further includes a terminal side, the terminal side includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to the first variable in the device, the first variable and at least one first variable parameter satisfy a first operation rule, and the device includes: A processing unit, configured to obtain a parameter value of the at least one first variable parameter; The processing unit is further configured to save a variable value of the first variable to the first storage space, where the variable value of the first variable is a result of operating the parameter value of the at least one first variable parameter based on the first operation rule; A sending unit is used to send first information to the terminal side, where the first information is used to instruct the terminal side to read the variable value of the first variable from the first storage space and process the variable value of the first variable by running the first code.
13. The device according to claim 12, It is characterized in that The device includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and the at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable; The processing unit is further configured to replace the second code and the third code included in the second program with the first code to obtain the first program; The sending unit is further used to send the first program to the terminal side.
14. The device according to claim 12 or 13, It is characterized in that The variable value of the first variable is a result obtained by operating the parameter value of the at least one first variable parameter currently obtained based on the first operation rule when the parameter value of the at least one first variable parameter currently obtained is different from the parameter value of the at least one first variable parameter obtained last time.
15. The device according to any one of claims 12 to 14, It is characterized in that The device includes a third program, the third program includes a judgment code and a plurality of branch codes, the judgment code includes a second variable parameter and a judgment condition, and the plurality of branch codes correspond to a plurality of judgment results; The processing unit is further configured to obtain a parameter value of the second variable parameter; determine whether the parameter value of the second variable parameter satisfies the determination condition, and obtain a target determination result; The sending unit is further used to send the branch code corresponding to the target judgment result to the terminal side, and the terminal side is used to run the branch code corresponding to the target judgment result.
16. The device according to any one of claims 12 to 15, It is characterized in that The first code includes a read code for reading the first storage space.
17. The device according to claim 16, It is characterized in that The read code includes a read instruction and an address of the first storage space, and the read instruction is used to instruct to read data stored in the first storage space indicated by the address.
18. A device for running a program, It is characterized in that The device is located on a device, the device further includes a host side, the device includes a first program, the first program includes a first code, the first code is used to read a first storage space and process a first variable, the first storage space is a storage space corresponding to the first variable in the device, the first variable and at least one first variable parameter satisfy a first operation rule, and the device includes: a receiving unit, configured to receive first information, wherein the first information is sent by the host side when saving the variable value of the first variable to the first storage space, and the changed value of the first variable is obtained by the host side calculating the parameter value of the at least one first variable parameter based on the first calculation rule; A processing unit is used to read the variable value of the first variable from the first storage space and process the variable value of the first variable by running the first code.
19. The device according to claim 18, It is characterized in that The host side includes a second program, the second program includes a second code and a third code, the second code is used to describe that the first variable and the at least one first variable parameter satisfy the first operation rule, and the third code is used to process the first variable; the receiving unit is further used to: The first program sent by the host side is received, where the first program is a program obtained by replacing the second code and the third code included in the second program with the first code by the host side.
20. The device according to claim 18 or 19, It is characterized in that The host side includes a third program, the third program includes a judgment code and a plurality of branch codes, the judgment code includes a second variable parameter and a judgment condition, and the plurality of branch codes correspond to a plurality of judgment results; The receiving unit is further configured to receive a branch code corresponding to a target judgment result, wherein the target judgment result is a result obtained by the host side judging whether a parameter value of the second variable parameter satisfies the judgment condition; The processing unit is further used to run the branch code corresponding to the target judgment result.
21. The device according to any one of claims 18 to 20, It is characterized in that The first code includes a read code for reading the first storage space.
22. The device according to claim 21, It is characterized in that The read code includes a read instruction and an address of the first storage space, and the processing unit is used to read the variable value of the first variable stored in the first storage space indicated by the address based on the read instruction.
23. A device for running a program, the device comprising a processor and a memory, It is characterized in that The memory is used to store a program, and the processor is used to call the program in the memory so that the device executes the method according to any one of claims 1 to 11.
24. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a computer, the method according to any one of claims 1 to 11 is implemented.
25. A system for running a program, It is characterized in that The system includes a host side and a terminal side, the host side is used to execute the method according to any one of claims 1-6, and the terminal side is used to execute the method according to any one of claims 7-11.