CN113778742A - Program execution method, program processing method, and related apparatus - Google Patents

Program execution method, program processing method, and related apparatus Download PDF

Info

Publication number
CN113778742A
CN113778742A CN202010961301.6A CN202010961301A CN113778742A CN 113778742 A CN113778742 A CN 113778742A CN 202010961301 A CN202010961301 A CN 202010961301A CN 113778742 A CN113778742 A CN 113778742A
Authority
CN
China
Prior art keywords
aeb
program
target
jump instruction
intermittent system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010961301.6A
Other languages
Chinese (zh)
Inventor
关楠
陈秋林
于洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to PCT/CN2021/098819 priority Critical patent/WO2021249377A1/en
Publication of CN113778742A publication Critical patent/CN113778742A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation

Abstract

The application discloses a program execution method, which can be applied to the field of multi-program concurrent intermittent systems, and comprises the following steps: the intermittent system device acquires a first program, before executing a jump instruction of the first program, the intermittent system device saves a modified variable in code executed after a last detection point, the part of code can be regarded as an AEB, and the saving step is equivalent to executing a detection point; and then jumps to an AEB of the second program in accordance with the jump instruction. According to the variable modification method and device, the detection point codes for saving the variables are added at the first jump instruction, so that each variable modified by the AEB is determined, and the variables needing to be saved can be reduced.

Description

Program execution method, program processing method, and related apparatus
The present application claims priority from chinese patent application entitled "a synchronized multitasking, intermittent system and computer device" filed by the chinese patent office on 09.06.2020, application No. 202010526406.9, the entire contents of which are incorporated herein by reference.
Technical Field
The present application relates to the field of multitasking and concurrent intermittent systems, and more particularly, to a program executing method, a program processing method, and related apparatuses.
Background
Intermittent system equipment is usually powered by collecting energy in the environment, including solar energy, wind energy, heat energy, radio frequency energy and the like, so that a power supply does not need to be connected at any time, and a battery does not need to be replaced or charged, so that the intermittent system equipment can be applied to wider scenes. However, the environment in which the intermittent system equipment is located may be very unstable, the energy collected by the equipment cannot make the equipment continuously operate, and the equipment is frequently powered off.
In order to advance the execution of the program, the intermittent system device inserts a detection point in the program, when the program runs to the detection point, the device saves variables to ensure that the device can continue to execute from the last recorded detection point after restarting until the program runs completely. The following illustrates the amount of data that the intermittent system device needs to hold variables. In one stage of the program, three detection points, namely detection point 1, detection point 2 and detection point 3, are arranged in succession. The device executes the program in sequence, and when the program runs to detection point 2, the device needs to save all the variables that have been modified during the execution of detection point 1 to detection point 2. When the intermittent system equipment is applied to synchronous processing of multitask concurrency, the synchronous processing enables different programs in the equipment to run cooperatively and be executed alternately. The intermittent system device inserts the detection point under the cooperation of multiple programs. In the case of such a cooperative detection point, it is not sufficient for the device to determine which variables are modified at detection point 2, i.e. the device only saves the above variables. To ensure that the system can return to check point 2 to run properly after restarting, the system saves all variables that may have been modified by the concurrent program.
In the multitask concurrent synchronous processing, different programs can be executed alternately, so that all variables which can be modified are all the variables of the whole intermittent system equipment, the data quantity saved when the variables are saved is greatly increased, and the operation efficiency of the equipment is reduced.
Disclosure of Invention
The application provides a program execution method and related equipment, which can reduce the data volume of variables needing to be stored by intermittent system equipment, thereby improving the running efficiency of the equipment. A first aspect of the application provides a program execution method.
The method comprises the following steps: the intermittent system device acquires a first program including one or more Atomic Execution Blocks (AEBs), the one or more AEBs including a first target AEB, the first target AEB including a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction for instructing a jump from the first program to the second program. After the second target AEB is executed by the intermittent system device, the intermittent system device saves the modified variable in the second target AEB before executing the first jump instruction. If the first jump instruction is executed by the intermittent system device, the intermittent system device jumps from the first program to a first AEB of a second program, the second program comprising one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
It can be seen that the method proposed by the present application equates the first jump instruction to a detection point, in other words, the operation of saving the variable is also performed at the first jump instruction.
It should be noted that, the equivalence of the first jump instruction to one detection point is not to replace the first jump instruction with one detection point so as to cancel the first jump instruction, because the original jump relationship of the program cannot be changed by the present application. The first jump instruction is equivalent to a detection point in the present application, and can be implemented by any one of the following manners: 1. the intermittent system equipment takes the first jump instruction as an interface of a subprogram, saves the modified variable in the second target AEB by calling the subprogram, and executes jump after saving the variable; 2. the intermittent system device or the first device adds a code (e.g. the first node code in fig. 6 b) that implements the detection point before the first jump instruction. The so-called first jump instruction to divide the first target AEB into the second target AEB and the third target AEB can be regarded as being after the first jump instruction is equivalent to a detection point which divides the first target AEB into the second target AEB and the third target AEB.
The first target AEB is substantially divided into 2 AEBs because the gapping system device will hold the modified variables in the second target AEB while executing the first node code or first jump instruction in the first target AEB. For the convenience of understanding the technical solution in the present application, the first target AEB (AEB 2 in fig. 6) may be understood as 2 AEBs in the first program, the 2 AEBs being the second target AEB (second target AEB604 in fig. 6) and the third target AEB (second target AEB606 in fig. 6), respectively, the second target AEB preceding the first jump instruction, and the third target AEB following the first jump instruction. At this time, the intermittent system device equates the first jump instruction or the first node code to one detection point. Since no jump instruction is included in the second target AEB, the intermittent system device can determine the variable that has been modified in the second target AEB at this detection point. And since the jump instruction is not included in the third target AEB, the intermittent system device may determine the variable that has been modified in the third target AEB after the intermittent system device executes the third target AEB. Thus, each of the variables modified by the AEB in the first target AEB are determined so that the intermittent system equipment can save only the variables modified in the second target AEB after the second target AEB is executed; the intermittent system device may only need to save the modified variable in the third target AEB after executing the third target AEB. Compared with the method for cooperatively detecting the point, which needs to store all the variables of the whole intermittent system equipment, the program execution method can reduce the data volume of the variables needing to be stored by the intermittent system equipment, thereby improving the operation efficiency of the equipment.
Based on the first aspect of the present application, in a first implementation manner of the first aspect of the present application, after the intermittent system equipment executes the third target AEB, before the intermittent system equipment executes the second AEB of the first program, the method further includes: the intermittent system saves the modified variable in the third target AEB, the modified variable in the second target AEB is not saved, and the second AEB is an AEB after the first target AEB. Wherein the second AEB and the first target AEB are different AEBs in the first program and the first AEB is an AEB in the second program. For example, taking FIG. 8 as an example, the first target AEB is AEB2, the second AEB is AEB3, and the first AEB is the AEB between detection point 5 and detection point 6. The first target AEB is substantially divided into 2 AEBs because the gapping system device will hold the modified variables in the second target AEB while executing the first node code or first jump instruction in the first target AEB. Thus, the first target AEB is named differently than the first AEB, the second AEB. In the present application, the variable modified in the second target AEB is not held means that the action of holding the variable is not performed in the above-described period, and the action of holding the variable may be performed in other periods. The above-mentioned time period refers to after the intermittent system apparatus executes the third target AEB, before the intermittent system apparatus executes the second AEB. The above-mentioned time period may also be understood as the time between the first jump instruction and the subsequent detection point. In the cascade rollback technique, and in the background art, at least the variables that need to be saved at this point of detection are the variables that will be modified in the first target AEB. According to the method and the device, the modified variable in the second target AEB is not stored, so that the data volume required to be stored by the intermittent system equipment is reduced, and the operation efficiency of the equipment is improved.
In a second implementation form of the first aspect of the present application, in the first implementation form of the first aspect of the present application, the intermittent system device acquires a third program, the third program comprising the first node code after the second target AEB before the first jump instruction. The intermittent system equipment realizes saving the modified variable in the second target AEB by executing the first node code. Wherein, adding the first node code can be understood as a preprocessing process for the first program. The first node code is specifically configured to enable saving the modified variable in the second target AEB. By preprocessing the first program before executing the first program, the operating efficiency of the third program in the intermittent system equipment is improved.
In a third implementation manner of the first aspect of the present application, after the first node code determines the first jump instruction for the first device, the location of the first node code may be before the first jump instruction and after the second target AEB, where the location is added according to the location of the first jump instruction. The first device is not an intermittent system device, and the intermittent system device receives the third program transmitted by the first device. The electric quantity supply and the data processing capacity of the intermittent system equipment are generally limited, the pretreatment process is completed through the first equipment, the workload of the intermittent system equipment can be reduced, and the operation efficiency of the intermittent system equipment is improved.
In a fourth implementation manner of the first aspect of the present application, based on the first aspect of the present application or any one of the first to third implementation manners of the first aspect, the first program includes an object identifier. If the target identification is detected, the intermittent system equipment determines that the first program meets the requirement of the intermittent system equipment on the first program, the requirement of the intermittent system equipment on the first program is that a node code is added before each jump instruction in the first program, each jump instruction comprises a first jump instruction, and the node code comprises the first node code. The first program in the present embodiment is a preprocessed first program, and may be referred to as a third program. When the intermittent system device runs a jump instruction, the intermittent system device jumps from the first program to the other program. The application defines that the first device adds node code before each jump instruction in the first program. It should be noted that, if a certain jump instruction in the first program already includes node code before the jump instruction, the first device may not need to add node code before the jump instruction. If the intermittent system apparatus executes the first program without being preprocessed, an error may occur in the operation of the intermittent system apparatus. By adding the target identifier to the preprocessed first program, the intermittent system equipment can reversely determine that the program without the target identifier is the program without the preprocessing, so that the running errors of the intermittent system equipment are reduced.
Based on the fourth implementation manner of the first aspect of the present application, in the fifth implementation manner of the first aspect of the present application, if the first program does not meet the requirement of the intermittent system device for the first program, the intermittent system device displays the prompt message. Wherein the first program failing to meet the requirements of the intermittent system device for the first program means that the intermittent system device does not detect the target identifier. If the first program does not meet the requirement of the intermittent system equipment on the first program, the intermittent system equipment can generate errors when running the first program. If the intermittent system does not display the prompt message, a debugger or a user may not be able to find that the first program cannot run. Intermittent system devices generally cannot be connected with a network through wires or even wirelessly. If the configuration of the first program cannot be completed in one installation or data update, the subsequent reconfiguration causes more loss. Therefore, the intermittent system displays the prompt information, and can prompt the user to preprocess the first program, so that the configuration cost is reduced.
In a sixth implementation form of the first aspect of the present application, based on the first aspect of the present application or any one of the first to fifth implementation forms of the first aspect, the method further includes: the intermittent system device acquires a second program, the second program including one or more AEBs, the one or more AEBs including a fourth target AEB, the fourth target AEB including a second jump instruction, the second jump instruction dividing the fourth target AEB into a fifth target AEB and a sixth target AEB, the fifth target AEB preceding the second jump instruction, the sixth target AEB following the second jump instruction, the second jump instruction instructing a jump from the second program to the first program. After the fifth target AEB is executed by the intermittent system device, the intermittent system device saves the modified variable in the fifth target AEB before executing the second jump instruction; if the second jump instruction is executed by the intermittent system device, the operation of the intermittent system device jumps from the fifth target AEB of the second program to the third target AEB of the first program. Wherein even if the third target AEB of the first program is jumped back by the second jump instruction, the modified variable in the third target AEB can be determined after the intermittent system device finishes executing the third target AEB, that is, the variable to be saved at the next detection point of the third target AEB does not include the modified variable in the fifth target AEB, and the modified variable in the third target AEB and the modified variable in the fifth target AEB are independent of each other. Therefore, not only the amount of data that the intermittent system apparatus needs to save for the first program and the second program can be reduced, but also the stability of the intermittent system apparatus can be improved.
A second aspect of the present application provides a program processing method, the program being run on a clearance system apparatus.
The method comprises the following steps: the first device acquires a first program. The first device determines a first jump instruction in the first program such that after the second target AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction. The first device may be a batch system device or not. When the first device is not the intermittent system device, the first device may add a node code or identification before the first jump instruction in the first program after determining the first jump instruction. If the node code is added, the intermittent system equipment can save the modified variable in the second target AEB according to the node code after the second target AEB is executed by the intermittent system equipment; if the addition is an identification, so that the intermittent system equipment adds a node code at the identification, the intermittent system equipment can save the modified variable in the second target AEB according to the node code. When the first device is the intermittent system device, the first device may add a node code before the first jump instruction or use the first jump instruction as a program interface for jumping to the node code, so that the first device executes the node code first and then executes an action of jumping to the second program after executing the second target AEB. The modified variable in the second target AEB refers to a corresponding variable modified according to the instruction in the second target AEB during the intermittent system equipment executing the second target AEB, and the variable is the modified variable. The first jump instruction is intermediate the first target AEB, dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction. The first program includes one or more AEBs, the one or more AEBs including a first target AEB. The first jump instruction, when executed, may cause the intermittent system device to jump from the first program to a first AEB of a second program, the second program including one or more AEBs, the first AEB being the first AEB to be executed after the jump to the second program.
Wherein the intermittent system device equates the first jump instruction or the first node code to a detection point. Since no jump instruction is included in the second target AEB, the intermittent system device can determine the variable that has been modified in the second target AEB at this detection point. And since the jump instruction is not included in the third target AEB, the intermittent system device may determine the variable that has been modified in the third target AEB after the intermittent system device executes the third target AEB. Thus, each of the variables modified by the AEB in the first target AEB are determined so that the intermittent system equipment can save only the variables modified in the second target AEB after the second target AEB is executed; the intermittent system device may only need to save the modified variable in the third target AEB after executing the third target AEB. Compared with the method for cooperatively detecting the point, which needs to store all the variables of the whole intermittent system equipment, the program execution method can reduce the data volume of the variables needing to be stored by the intermittent system equipment, thereby improving the operation efficiency of the equipment.
In a first embodiment of the second aspect of the present application, after the intermittent system equipment executes the third target AEB, the modified variable in the third target AEB is saved, the modified variable in the second target AEB is not saved, and the second AEB is one AEB after the first target AEB, before the intermittent system equipment executes the second AEB of the first program. The modified variable in the second target AEB is not saved, which means that the action of saving the variable is not performed in the above time period, and the action of saving the variable may be performed in other time periods. The above-mentioned time period refers to after the intermittent system apparatus executes the third target AEB, before the intermittent system apparatus executes the second AEB. In the cascade rollback technique, and in the background art, at least the variables that need to be saved at this point of detection are the modified variables in the first target AEB. According to the method and the device, the modified variable in the second target AEB is not stored, so that the data volume required to be stored by the intermittent system equipment is reduced, and the operation efficiency of the equipment is improved.
In a second implementation manner of the second aspect of the present application, after the first device determines the first jump instruction in the first program, the method further includes: the first device adds a first node code after the second target AEB before the first jump instruction of the first program to generate a third program, the first node code for execution by the intermittent system device to effect saving of the modified variable in the second target AEB. Wherein, adding the first node code can be understood as a preprocessing process for the first program. The first node code is specifically configured to enable saving the modified variable in the second target AEB. By preprocessing the first program before executing the first program, the operating efficiency of the third program in the intermittent system equipment is improved.
In a third implementation manner of the second aspect of the present application, after the third program is generated, the method further includes: the first device transmits the third program to the intermittent system device. Wherein the application defines that the first device is not a batch system device. The electric quantity supply and the data processing capacity of the intermittent system equipment are generally limited, the pretreatment process is completed through the first equipment, the workload of the intermittent system equipment can be reduced, and the operation efficiency of the intermittent system equipment is improved.
In a fourth implementation manner of the second aspect of the present application, after the first device determines the first jump instruction in the first program, the method further includes: the method comprises the steps that target identification is added into a first program by first equipment, the target identification is used for enabling the intermittent system equipment to determine that the first program meets the requirement of the intermittent system equipment on the first program when the target identification is detected by the intermittent system equipment, the requirement of the intermittent system equipment on the first program is that a node code is added in front of each jump instruction in the first program, each jump instruction comprises a first jump instruction, and the node code comprises the first node code. Wherein the intermittent system device jumps from the first program to the other program when the intermittent system device runs a jump instruction. The application defines that the first device adds node code before each jump instruction in the first program. It should be noted that, if a certain jump instruction in the first program already includes node code before the jump instruction, the first device may not need to add node code before the jump instruction. If the intermittent system equipment executes the first program which is not preprocessed, the operation of the intermittent system equipment can generate errors. By adding the target identifier to the preprocessed first program, the intermittent system equipment can reversely determine that the program without the target identifier is the program without the preprocessing, so that the running errors of the intermittent system equipment are reduced.
In a fifth implementation form of the first aspect of the present application, based on the second aspect of the present application or any one implementation form of the first to fourth implementation forms of the second aspect, the method further comprises: the first device determines a second jump instruction in the second program such that after the fifth target AEB is executed by the intermittent system device, the modified variable in the fifth target AEB is saved before the second jump instruction is executed, the second jump instruction is in the middle of the fourth target AEB, the fourth target AEB is divided into the fifth target AEB and a sixth target AEB, the fifth target AEB precedes the second jump instruction, the sixth target AEB succeeds the second jump instruction, and after the second jump instruction is executed, the intermittent system may jump from the fifth target AEB of the second program to the third target AEB of the first program. Wherein even if the third target AEB of the first program is jumped back by the second jump instruction, the modified variable in the third target AEB can be determined after the intermittent system device finishes executing the third target AEB, that is, the variable to be saved at the next detection point of the third target AEB does not include the modified variable in the fifth target AEB, and the modified variable in the third target AEB and the modified variable in the fifth target AEB are independent of each other. Therefore, not only the amount of data that the intermittent system apparatus needs to save for the first program and the second program can be reduced, but also the stability of the intermittent system apparatus can be improved.
A third aspect of the present application provides an apparatus for executing a program. The device includes: a fetch module to fetch a first program, the first program comprising one or more atomic execution modules AEBs, the one or more AEBs comprising a first target AEB, the first target AEB comprising a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction to instruct a jump from the first program to a second program; a save module to save the modified variable in the second target AEB after the second target AEB is executed by the apparatus and before the first jump instruction is executed; a jump module to jump from the first program to the first AEB of the second program if the first jump instruction is executed by the apparatus, the second program including one or more AEBs, the first AEB being a first AEB to be executed after jumping to the second program.
Based on the third aspect of the present application, in the first embodiment of the third aspect of the present application, after the apparatus executes the third target AEB, before the apparatus executes the second AEB of the first program, the saving module is further configured to save the modified variable in the third target AEB, the modified variable in the second target AEB is not saved, and the second AEB is a first AEB after the first target AEB.
Based on the first implementation manner of the third aspect of the present application, in a second implementation manner of the third aspect of the present application, the obtaining module is specifically configured to obtain a third program, where the third program includes the first program, and the second target AEB includes a first node code after the second target AEB and before the first jump instruction of the third program; the saving module is specifically configured to implement saving the modified variable in the second target AEB by executing the first node code.
Based on the second implementation manner of the third aspect of the present application, in a third implementation manner of the third aspect of the present application, the first node code is added according to a location of the first jump instruction after the first jump instruction is determined for the first device; the obtaining module is specifically configured to receive the third program sent by the first device.
Based on the third aspect of the present application or any one of the first to third embodiments of the third aspect, in a fourth embodiment of the third aspect of the present application, the first program includes a target identifier; the device further comprises: a determining module, configured to determine that the first program meets a requirement of the intermittent system device for the first program if the target identifier is detected, where the requirement of the intermittent system device for the first program is that a node code is added before each jump instruction in the first program, where each jump instruction includes the first jump instruction, and the node code includes the first node code.
In a fifth implementation form of the third aspect of the present application, based on the fourth implementation form of the third aspect of the present application, the apparatus further comprises: and the display module is used for displaying prompt information if the third program does not meet the requirement of the device on the third program.
In a sixth implementation form of the third aspect of the present application, the obtaining module is further configured to obtain the second program, where the second program includes one or more AEBs, the one or more AEBs include the fourth target AEB, and the fourth target AEB includes a second jump instruction, the second jump instruction divides the fourth target AEB into a fifth target AEB and a sixth target AEB, the fifth target AEB precedes the second jump instruction, the sixth target AEB follows the second jump instruction, and the second jump instruction is used to instruct a jump from the second program to the first program; the save module is further to save the modified variable in the fifth target AEB after the fifth target AEB is executed by the apparatus and before the second jump instruction is executed; the jump module is further to jump from the fifth target AEB of the second program to the third target AEB of the first program if the second jump instruction is executed by the apparatus.
Reference may be made to the preceding description relating to the first aspect for a description of the advantageous effects of the third aspect of the present application.
A fourth aspect of the present application provides an apparatus for processing a program. The device includes: the acquisition module is used for acquiring a first program; a determining module, configured to determine a first jump instruction in the first program, so that after the second target atomic execution module AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction, the first jump instruction is intermediate a first target AEB, dividing the first target AEB into the second target AEB and a third target AEB, the second target AEB precedes the first jump instruction, the third target AEB follows the first jump instruction, the first target AEB is an AEB of the first program, after the first jump instruction is executed, the intermittent system device can be caused to jump from the first procedure to the first AEB of the second procedure, the second program includes one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
In a first embodiment of the fourth aspect of the present application, after the intermittent system equipment executes the third target AEB, the modified variable in the third target AEB is saved and the modified variable in the second target AEB is not saved before the intermittent system equipment executes the second AEB of the first program, the second AEB being one AEB after the first target AEB.
In a second implementation manner of the fourth aspect of the present application, based on the first implementation manner of the fourth aspect of the present application, the apparatus further comprises: an adding module, configured to add a first node code after the second target AEB before the first jump instruction of the first program to generate a third program, where the first node code is to be executed by the intermittent system device to save the modified variable in the second target AEB.
In a third embodiment of the fourth aspect of the present application, in the second embodiment based on the fourth aspect of the present application, the apparatus further comprises:
and the sending module is used for sending the third program to the intermittent system equipment.
Based on the fourth aspect of the present application, or any one implementation manner of the first implementation manner to the third implementation manner of the fourth aspect, in the fourth implementation manner of the fourth aspect of the present application, the adding module is further configured to add a target identifier in the first program, where the target identifier is used by the intermittent system device when detected, so that the intermittent system device determines that the first program meets the requirement of the intermittent system device for the first program, where the requirement of the intermittent system device for the first program is that a node code is added before each jump instruction in the first program, where each jump instruction includes the first jump instruction, and the node code includes the first node code.
According to a fourth aspect of the present application, or any one of the first to fourth embodiments of the fourth aspect, in a fifth embodiment of the fourth aspect of the present application, the determining module is further configured to determine a second jump instruction in the second program, so that after a fifth target AEB is executed by the intermittent system device, the modified variable in the fifth target AEB is saved prior to executing the second rotate instruction, the second jump instruction is intermediate a fourth target AEB, dividing the fourth target AEB into the fifth target AEB and a sixth target AEB, the fifth target AEB precedes the second jump instruction, the sixth target AEB follows the second jump instruction, the second jump instruction is executed, the intermittent system device may be caused to jump from the fifth target AEB of the second program to the third target AEB of the first program. Reference may be made to the description relating to the foregoing second aspect for a description of the beneficial effects of the fourth aspect of the present application.
A fifth aspect of the present application provides an apparatus for executing a program. The apparatus includes a processor and a memory, the memory having stored therein a first program and a handler, the processor to retrieve the first program from the memory, process the first program according to the handler, the first program including one or more atomic execution modules (AEBs), the one or more AEBs including a first target AEB, the first target AEB including a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction to instruct a jump from the first program to a second program; the processor is specifically configured to save the modified variable in the second target AEB after the second target AEB is executed by the device and before the first jump instruction is executed; the processor is specifically configured to jump from the first program to the first AEB of the second program if the first jump instruction is executed by the device, the second program including one or more AEBs, the first AEB being a first AEB to be executed after jumping to the second program.
In a first embodiment of the fifth aspect of the present application, after the apparatus executes the third target AEB, the processor is specifically configured to save the modified variable in the third target AEB before the apparatus executes a second AEB of the first program, the modified variable in the second target AEB not being saved, the second AEB being a first AEB after the first target AEB.
In a second implementation form of the fifth aspect of the present application, based on the first implementation form of the fifth aspect of the present application, the processor is specifically configured to obtain a third program, where the third program includes the first program, the third program includes a first node code after the second target AEB and before the first jump instruction; the processor is specifically configured to enable saving the modified variable in the second target AEB by executing the first node code.
In a third implementation manner of the fifth aspect of the present application, based on the second implementation manner of the fifth aspect of the present application, the first node code is added according to a location of the first jump instruction after determining the first jump instruction for the first device; the processor is specifically configured to receive the third program sent by the first device.
In a fourth embodiment of the fifth aspect of the present application, based on the fifth aspect of the present application or any one of the first to third embodiments of the fifth aspect, the first program includes an object identifier; the processor is specifically configured to determine that the first program meets the requirement of the intermittent system device for the first program if the target identifier is detected, where the requirement of the intermittent system device for the first program is that a node code is added before each jump instruction in the first program, where each jump instruction includes the first jump instruction, and the node code includes the first node code.
Based on the fourth implementation manner of the fifth aspect of the present application, in a fifth implementation manner of the fifth aspect of the present application, the processor is specifically configured to display a prompt message if the third program does not meet the requirement of the device for the third program.
In a sixth implementation form of the fifth aspect of the present application, the processor is specifically configured to obtain the second program, where the second program includes one or more AEBs, the one or more AEBs include the fourth target AEB, and the fourth target AEB includes a second jump instruction, the second jump instruction dividing the fourth target AEB into a fifth target AEB and a sixth target AEB, the fifth target AEB precedes the second jump instruction, the sixth target AEB follows the second jump instruction, and the second instruction is used to instruct a jump from the second program to the first program; the processor is specifically configured to save the modified variable in the fifth target AEB after the fifth target AEB is executed by the apparatus and before the second jump instruction is executed; the processor is specifically configured to jump from the fifth target AEB of the second program to the third target AEB of the first program if the second jump instruction is executed by the apparatus.
A sixth aspect of the present application provides an apparatus for processing a program. The device comprises a processor and a memory, wherein a first program and a processing program are stored in the memory, and the processor is used for acquiring the first program from the memory and processing the first program according to the processing program; the processor is specifically configured to obtain a first program; the processor is specifically configured to determine a first jump instruction in the first program, so that after the second target atomic execution module AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction, the first jump instruction is intermediate a first target AEB, dividing the first target AEB into the second target AEB and a third target AEB, the second target AEB precedes the first jump instruction, the third target AEB follows the first jump instruction, the first target AEB is an AEB of the first program, after the first jump instruction is executed, the intermittent system device can be caused to jump from the first procedure to the first AEB of the second procedure, the second program includes one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
In a first embodiment of the sixth aspect of the present application, after the intermittent system equipment executes the third target AEB, the modified variable in the third target AEB is saved and the modified variable in the second target AEB is not saved before the intermittent system equipment executes the second AEB of the first program, the second AEB being one AEB after the first target AEB.
In a second implementation form of the sixth aspect of the present application, based on the first implementation form of the sixth aspect of the present application, the processor is specifically configured to add a first node code after the second target AEB before the first jump instruction of the first program to generate a third program, the first node code being configured to be executed by the intermittent system device to implement saving of the modified variable in the second target AEB.
In a third implementation form of the sixth aspect of the present application, based on the second implementation form of the sixth aspect of the present application, the processor is specifically configured to send a third program to the intermittent system device.
Based on the sixth aspect of the present application or any one implementation manner of the first to third implementation manners of the sixth aspect, in a fourth implementation manner of the sixth aspect of the present application, the processor is specifically configured to add a target identifier to the first program, where the target identifier is used when detected by the intermittent system device, so that the intermittent system device determines that the first program meets a requirement of the intermittent system device for the first program, where the requirement of the intermittent system device for the first program is that a node code is added before each jump instruction in the first program, where each jump instruction includes the first jump instruction, and the node code includes the first node code.
According to a sixth aspect of the present application, or any one of the first to fourth embodiments of the sixth aspect, in a fifth embodiment of the sixth aspect of the present application, the processor is specifically configured to determine a second jump instruction in the second program, so that after a fifth target AEB is executed by the intermittent system device, the modified variable in the fifth target AEB is saved prior to executing the second rotate instruction, the second jump instruction is intermediate a fourth target AEB, dividing the fourth target AEB into the fifth target AEB and a sixth target AEB, the fifth target AEB precedes the second jump instruction, the sixth target AEB follows the second jump instruction, the second jump instruction is executed, the intermittent system device may be caused to jump from the fifth target AEB of the second program to the third target AEB of the first program. Reference may be made to the description relating to the foregoing second aspect for a description of the beneficial effects of the fourth aspect of the present application.
A seventh aspect of the embodiments of the present application provides a computer storage medium, where instructions are stored in the computer storage medium, and when executed on a computer, the instructions cause the computer to perform the method according to the first aspect or any one of the embodiments of the first aspect; or, performing the method as in any one of the embodiments of the second aspect or the second aspect above.
An eighth aspect of the embodiments of the present application provides a computer program product, and when the computer program product is executed on a computer, instructions that when executed on the computer cause the computer to perform the method according to the first aspect or any one of the embodiments of the first aspect; or, performing the method as in any one of the embodiments of the second aspect or the second aspect above.
Drawings
FIG. 1 is a schematic flow chart of an atomized execution program of an intermittent system device;
FIG. 2a is a flowchart illustrating a process of cooperative probing;
FIG. 2b is a flowchart illustrating the execution of a cascaded rollback technique;
FIG. 3 is a flow chart illustrating a processing procedure in an embodiment of the present application;
FIG. 4 is a diagram illustrating an application scenario in an embodiment of the present application;
FIG. 5 is a flowchart illustrating a program processing method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of the first program before and after adding the first node code in the embodiment of the present application;
fig. 7 is another schematic structural diagram of the first program before and after adding the first node code in the embodiment of the present application;
FIG. 8 is a flowchart illustrating the operation of a first program according to an embodiment of the present invention;
FIG. 9 is a schematic flow chart of n applications running in a batch system facility;
FIG. 10 is another schematic flow diagram of n applications running in a batch system facility;
FIG. 11 is a schematic structural diagram of an apparatus for processing programs in the embodiment of the present application;
FIG. 12 is a schematic structural diagram of an apparatus for executing a program according to an embodiment of the present application;
fig. 13 is a schematic structural view of a first device or gap system device in the embodiment of the present application.
Detailed Description
The embodiment of the application provides a program execution method, a program processing method and related equipment, which are applied to the field of multitask concurrent intermittent systems and can reduce variables needing to be stored by intermittent system equipment, so that the operation efficiency of the equipment is improved.
With the popularization of the internet of things and the development of communication technology. The internet of things equipment will have explosive growth in the next decade. It is therefore a challenge how to drive such a huge number of internet of things devices. The traditional battery power supply mode is limited by using scenes and disadvantages in the aspect of environmental protection, and becomes a bottleneck of the development of the internet of things. Recent studies propose batch systems. The batch system operates in a batch system plant. Intermittent system devices may harvest energy, such as solar, wind, thermal energy, in the environment in which the device is located to maintain operation of the device. The intermittent system breaks through the limitation of the battery to the Internet of things equipment, so that the intermittent system equipment can be applied to wider scenes, and the energy supply mode of the intermittent system equipment is more environment-friendly. However, the environment of the intermittent system equipment may be very unstable, the energy collected by the system may not enable the system to operate continuously, and the phenomenon of frequent power failure of the system exists.
After the conventional operating system is powered off, the required operations are re-executed from the entry of the program before the power-off after restart. In intermittent system equipment, under the condition of frequent power failure, in order to ensure the propulsive property of the system and realize intermittent calculation technology, the following method can be adopted: intermittent system devices frequently save the system state during operation, i.e. insertion of a detection point in a program. Because each detection point stores necessary information for the system to continue executing, the system continues executing from the last detection point after each power failure, but does not continue executing at the entrance of the program before the power failure. As shown in fig. 1, fig. 1 is a schematic flow chart of an atomization execution program of an intermittent system device. Program 1 includes detection point 1, detection point 2, detection point 3, and detection point 4. The four detection points are arranged in a front-back order. In the embodiment of the present application, the determination manner of the front-back order of the program is according to the execution order of the program. As shown in fig. 1, the program 1 is executed to the detection point 1 and then to the detection point 2, so that the detection point 1 is before the detection point 2 and the detection point 2 is after the detection point 1. Between detection point 1 and detection point 2, program 1 includes Atomic Execution Block (AEB) 1. Between detection point 2 and detection 3, procedure 1 includes AEB 2. Between detection point 3 and detection point 4, procedure 1 includes AEB 3. For convenience of description, it is assumed that AEB1 includes variable modification code: a ═ x 1; AEB2 includes variable modification code: a is x2, b is x 3; AEB3 includes variable modification code: c is x4 and d is x 5. The intermittent system device carries an intermittent system which runs a first program 1. When run to check point 2, the intermittent system saves the modified variable in AEB1, i.e., saves a-x 1; when run to check point 3, the batch system saves the modified variables in AEB2, i.e., a-x 2 and b-x 3. And so on until the execution of the program 1 is completed. If the intermittent system equipment is powered off at the D1 point, the intermittent system is restarted and then the system is recovered to the detection point 3, and the execution is continued from the detection point 3. It is noted that each TASK in a TASK-based intermittent system, or code segment between two detection points in a detection point technique, can be considered an AEB. When an application saves only the modified variables in the application at the end, the application can be considered to include an AEB, which also satisfies the conditions for atomic execution.
In fig. 1, the intermittent system does not jump to other program execution in the middle of every two detection points, so that the modified variables between each detection point and the last detection point can be statically predicted, and other programs refer to programs other than program 1. A program is also sometimes called a task, and for example, in the process of executing a plurality of programs alternately, one or more programs among the plurality of programs are not completely executed in one execution process, and therefore, the execution of a plurality of programs alternately is also called a multitask concurrent synchronization process. When the intermittent system device is applied to the synchronous processing of multitask concurrency, after the synchronization between programs is added, due to the synchronous operation, such as the access to mutually exclusive resources, the high-priority program is awakened, and the like, the executing program may jump away to execute other programs at any time. It is therefore difficult at a certain detection point of a program to determine the variables that have been modified during the execution of that detection point of the program to a detection point on the program. Therefore, in order to ensure the normal operation of the system, the cooperative detection point technology needs to backup data of the whole system at each detection point, which causes low system operation efficiency. As shown in fig. 2a, fig. 2a is a schematic diagram illustrating a program execution flow of the cooperative probing point technique. Fig. 2a includes program 1, program 2, and program 3. When the intermittent system device runs to the jump instruction 201 between the detection point 2 and the detection point 3, the intermittent system device jumps from the program 1 to the detection point 5 of the program 2. When the intermittent system device runs to the jump instruction 202 between the detection point 6 and the detection point 7, the intermittent system device jumps from the program 2 to the program 3, and then jumps to the return program 2 through the jump instruction 203 in the program 3. At detection point 3, it is difficult for the intermittent system device to determine a variable modified outside the program 1 between detection point 3 and detection point 2, for example, a variable modified between detection point 5 and detection point 7 in the program 2, due to a jump between programs, and therefore all variables of all programs in the intermittent system device can be saved only pessimistically. Similarly, at the time of detecting point 2, since the system may jump from the program 1 to other program execution from the time of detecting point 1 to the time of detecting point 2, the intermittent system device cannot determine whether there is a jump instruction between the detecting point 1 and the detecting point 2, and therefore, at the time of detecting point 2, all variables in the intermittent system need to be saved, that is, a system-wide variable needs to be saved at each detecting point.
In addition, there are multiple rollback problems in existing cascaded rollback techniques, which can result in AEB repeat execution. As shown in fig. 2b, fig. 2b is a schematic diagram illustrating a program execution flow of the cascaded rollback technique. Fig. 2b includes program 1 and program 2. When the intermittent system device runs to jump instruction 204 between detection 2 and detection point 3, the intermittent system device jumps from program 1 to detection point 5 of program 2. The intermittent system equipment starts from the detection point 5, executes the program 2 according to the code sequence of the program 2, and continues to execute after jumping to the jump instruction 205 after the detection point 7 and jumping back to the jump instruction 204 of the program. In the tandem rollback technique, the intermittent system device will only save the variables modified from the detection point to the last detection point at each detection point. If a power-off event occurs at point D2 in the program 2, the intermittent system device should return to the detection point 6 to continue execution after the intermittent system device is restarted. However, the variables modified between detection point 2 and jump instruction 204 are not saved. Program 1 also needs to be re-executed starting from jump instruction 204 back to detect 2. At this time, if the intermittent system device starts executing at the detection point 2, since the re-execution of the detection point 2 causes the re-execution of the program from the detection point 5 to the detection point 6, the modified variable between the detection point 5 and the detection point 6 does not need to be saved. Therefore, the state of program 2 should not return only to detection point 6, but should return to detection point 5. Therefore, the program 2 rolls back 2 detection points, and the program 1 rolls back 1 detection point, which means that the program 2 rolls back 2 times and the program 1 rolls back 1 time. After rolling back to detection point 2, the code between detection point 2 and jump instruction 204, the code between detection point 5 and detection point 6, and the code between detection point 6 and D2 all need to be executed repeatedly, i.e., 3 AEBs are executed repeatedly. Fig. 2b is only a simple example, and in practical applications, if other detection points are included between the detection point 5 and the detection point 6, the program 2 needs to roll back more times, and the AEB needs to be executed repeatedly more often.
In order to reduce the data amount of variables needing to be saved by the intermittent system at the detection point, the embodiment of the application provides a method for processing the intermittent system program. In the method, a program (also referred to as a first program in the following embodiment) is preprocessed, so that a jump instruction is equivalent to a detection point during the execution of the program by the intermittent system device, and a first target AEB where the jump instruction is located is divided into a second target AEB and a third target AEB, so that the intermittent system device can determine modified variables in the second target AEB and the third target AEB respectively, thereby reducing the data amount of variables which need to be saved by the intermittent system device and improving the operating efficiency of the intermittent system device. Further, the method in the embodiment of the application can solve the problem of repeated execution of AEB caused by multiple times of rollback in the cascading rollback technology.
It should be noted that the first, second, third, and other modifiers mentioned in the embodiments of the present application are only for distinguishing different objects, and do not have a sequential meaning.
For convenience of understanding the method provided in the embodiments of the present application, a processing flow of the program is described first. Referring to fig. 3, fig. 3 is a flow chart illustrating a processing procedure in the embodiment of the present application. As shown in fig. 3, the processing flow of the program may include program writing 301, program preprocessing 302, and program execution 303. Programming 301 refers to the process of generating a program, including but not limited to manual input, software generation, and the like. The program preprocessing 302 refers to a process of preprocessing all or a part of the written program based on the program writing, such as automatic correction, compiling, adding detection points, and the like. Adding a detection point is essentially adding a node code, and when the node code is run, completing the detection point needs to complete work. The program preprocessing in the embodiment of the application mainly comprises the steps of scanning a first program, determining a first jump instruction in the first program, and adding a first node code before the first jump instruction. It should be noted that the program preprocessing in the embodiment of the present application may be performed simultaneously with other preprocessing, for example, simultaneously with compiling, or simultaneously with automatic correction. In particular, a first jump instruction in a first program is determined and a first node code is added before the first jump instruction, and the process can be realized by writing and running a software code; alternatively, determining the first jump instruction in the first program may be performed by computer auto-scanning, and adding the first node code before the first jump instruction may be performed manually. For example, after determining a first jump instruction in the first program, if there is no first node code before the first jump instruction, the device may issue a prompt prompting the user to add the first node code before the first jump instruction. It should be noted that the division of the processing flow of the program into the program writing 301, the program preprocessing 302 and the program execution 303 is for the convenience of understanding the present application, and should not be taken as a condition for limiting the present application, or a clear definition of the boundary of the flow division of the program is not required. For example, during the program writing process, a first jump instruction in the first program may also be determined, and the first node code is added before the first jump instruction.
The processing flow of the program is explained above, and the processing flow of the program is roughly divided into program writing 301, program preprocessing 302 and program execution 303. The process flow needs a specific computer device to execute, and different steps can be completed in different computer devices or in the same computer device. For example, the program writing 301 is completed in the first device, the first device sends the completed first program to the intermittent system device, and the intermittent system device performs the program preprocessing 302 and the program execution 303. Alternatively, referring to fig. 4, fig. 4 is a schematic diagram of an application scenario in an embodiment of the present application, as shown in fig. 4, a first program is obtained in a first device 401, and the first program may be written in the first device 401 or written in another device. After the first program is acquired, the first device 401 performs preprocessing 302 on the first program to obtain a third program. After obtaining the third program, the first device transfers the third program to the intermittent system device 402, and the step of executing the program 303 is performed in the intermittent system device 402. In the embodiment of the present application, fig. 4 will be described as an example in the following, and the description of the scenario in fig. 4 may be referred to for corresponding processing in other scenarios.
In the scenario of fig. 4, the first device 401 may be a desktop computer, a notebook, or a smartphone, etc. Intermittent system device 402 may be a bracelet, a bluetooth headset, a shared bicycle lock, or a sweeping robot, among others. The first device 401 may or may not establish a connection with the intermittent system device 402. If the first device 401 establishes a connection with the intermittent system device 402, the connection mode may be a wired connection or a wireless connection, and the wireless connection may be a wireless hotspot or bluetooth. If the first device 401 does not establish a connection with the intermittent system device 402, the third program may be transferred by means of a storage medium, such as a usb disk. It should be appreciated that if the intermittent system device 402 is capable of performing the steps performed by the first device 401, the method for processing the intermittent system program provided in the practice of the present application may be performed by the intermittent system device 402 alone, or it may be understood that the first device is an intermittent system device.
The technical solution in the present application will be described below with reference to the accompanying drawings. For example, the features or contents identified by broken lines in the drawings related to the embodiments of the present application can be understood as optional operations or optional structures of the embodiments.
Referring to fig. 5, fig. 5 is a flowchart illustrating a processing method of an intermittent system program supporting synchronization according to an embodiment of the present application.
In step 501, a first device obtains a first program.
The first program is acquired at the first device, and the first program can be written in the first device or written by other devices.
In step 502, the first device determines a first jump instruction in a first program.
The first device may scan the first program through software to determine a first jump instruction in the first program. The function of the first jump instruction is to enable the intermittent system device to jump from the first program to the second program after running the first jump instruction. Thus, the first jump instruction may have a special format, or a special code, so that by scanning the first program, the location of the first jump instruction may be determined. When the first program comprises 1000 lines of code that are executed in sequence, the location of the first jump instruction may be understood as the number of lines in which the first jump instruction is located. It should be determined that the first jump instruction includes a special format, or the special code is determined according to the requirement of the intermittent system device on the running program, or the industry specification, and the embodiment of the present application does not make a relevant limitation on the specific code structure of the first jump instruction.
It should be noted that the number of rows is not the only identification manner of the "location" of the first jump instruction, and if the "location" is determined by other manners according to the writing specification of the first program, such as a segment number, a function name, and the like, the "location" of the first jump instruction may also be identified by other manners.
In step 503, the first device adds the first node code before the first jump instruction to generate a third program.
The first device adds a first node code, equivalent to adding a detection point at the location of the first node code. The first program may or may not have been subjected to AEB partitioning before the first device added the first node code. Or, in the embodiment of the present application, adding the first node code by the first device may be understood as a supplement to the AEB partition, or may be understood as being performed simultaneously with the AEB partition. These two cases will be described separately below. In accordance with the foregoing description, AEB partitioning may include adding detection points, or performing partitioning of TASK, etc.
First, it is described that the first device adds the first node code as a complement to the AEB partitioning. Referring to fig. 6, fig. 6 is a schematic structural diagram of a first program (corresponding to program 1 in the figure) before and after adding a first node code in the embodiment of the present application. FIG. 6a is a schematic diagram of a first program, which has undergone AEB partitioning, before a first node code is added. A first jump instruction 601 is included between detection point 2 and detection point 3, i.e., first jump instruction 601 is included in AEB 2. After the first device determines the location of the first jump instruction 601, the first device adds a first node code before the first jump instruction 601. As shown in fig. 6b, fig. 6b is a schematic structural diagram of a first program after a first node code is added in the embodiment of the present application, and the first program after the first node code is added may also be referred to as a third program. Wherein the position of the node code 602 is equivalent to the position of the detection point 1; the position of node code 603 is equivalent to the position of detection point 2; the location of node code 607 is equivalent to the location of detection point 3; the location of node code 608 is equivalent to the location of detection point 4. The first jump instruction 601 divides the AEB2 into a second target AEB604 and a third target AEB606 in execution order, and AEB2 can be understood as the first target AEB. The first device adds a first node code 605 between the second target AEB604 and the first jump instruction 601 to obtain a third program.
It should be understood that, for convenience of description, the embodiment of the present application distinguishes common codes from node codes in the AEB, and therefore the definition of the AEB in fig. 6b is only for convenience of understanding the technical solution in the embodiment of the present application. If the AEB and the node code in fig. 6b, for example, AEB3 and node code 608, are understood as one AEB, the technical effect of the technical solution provided by the embodiment of the present application will not be affected.
Here, an explanation is made on a node code, which may be the first node code 605 described above. Here, the node codes are divided into two types, one is a substantial node code and the other is an identification node code.
The substantive node code includes information on variables that need to be modified. For example, AEB1 includes the code: a ═ x 1; the code is used to assign the value of x1 to variable a. If the node code 603 is a substantial node code, the node code 603 includes the variable a, and the node code 603 does not complete the action of saving a ═ x1 in the form of a jump procedure or a call procedure. When the intermittent system device executes the first program after adding the first node code, that is, executes the third program, the intermittent system device can complete the operation of saving a ═ x1 by the node code 603 without calling another program.
The identifying node code does not include information of the variable. For example, AEB1 includes the code: if the node code 603 is an identifying node code, the node code 603 includes a variable a that is not included, i.e., the node code 603 itself does not need to know the specific modified variable. When the intermittent system device specifically executes the first program after adding the first node code, that is, executes the third program, the intermittent system device treats the node code 603 as a save node. The intermittent system device obtains, at the node code 603, a variable, for example, a variable a ═ x1, which has been modified by the intermittent system, in a time period from the last save node (node code 602) to the save node (node code 603), in the form of a jump program or a call program.
The substantive node code determines which variables need to be saved before the variables are modified; the identifying node code determines which variables are saved after the variables are modified. The number of variables that both actually hold may be different.
First, a case where the node code 603 is a substantial node code is described, for example, AEB1 further includes an if statement that b is x2 when a certain condition is satisfied. Let b be x0 before AEB1 is executed. If node code 603 is substantive node code, node code 603 includes a and b. When the conditions are met, the variables stored by the intermittent system equipment according to the node codes 603 are as follows: a is x1, and b is x 2. When the condition is not met, the variables stored by the intermittent system equipment according to the node codes 603 are as follows: a is x1, and b is x 0. It should be noted that it is not described herein that the intermittent system device may also determine whether to save b by determining whether the values of b are the same before and after the execution of AEB 1. For example, when the condition is not satisfied, then the value of b does not change before and after the execution of AEB1, so the intermittent system device may not save b at node code 603; if the condition is satisfied, the value of b changes before and after the execution of AEB1, and the intermittent system device saves the new value of b at node code 603.
Describing the case where the node code 603 is an identifying node code second, for example, AEB1 further includes an if statement that b is x2 under condition 1. Let b be x0 before AEB1 is executed. If node code 603 is an identifying node code, then node code 603 does not include a and b. When condition 1 is satisfied, the variables saved by the intermittent system device according to the node code 603 are: a is x1, and b is x 2. When the condition 1 is not satisfied, the variables stored by the intermittent system device according to the node code 603 are: x 1. Because the instruction with b ═ x2 is not executed when condition 1 is not satisfied, that is, in the time period from the last saved node (node code 602) to the saved node (node code 603), the modified variable does not include b ═ x 2.
A summary is made herein of the substantive node codes and the identifying node codes. Program 1, which uses identifying node code, can have a smaller volume than program 1, which uses substantial node code. Because identifying code is typically an entry to a subroutine, it need not include code that specifically performs the save action. Wherein the code of the save action includes a modified variable, and the volume is the data size of the program 1. But the intermittent system devices require additional procedures to identify and execute the identifying node code. Compared with the program 1 using the identification node code, the program 1 using the substantive node code has better generalization, and the intermittent system equipment does not need additional programs to identify and execute the substantive node code and can better run in different intermittent equipment. The use of identifying node code is advantageous when there are more programs that the intermittent system device needs to execute, because additional programs can be common to multiple programs, thereby reducing the size of each of the multiple programs.
Returning to the foregoing description, the relationship of the first device adding the first node code to the AEB partition is defined.
Second, describing the first device adding the first node code is understood to be concurrent with the AEB partition, or AEB partition. Referring to fig. 7, fig. 7 is another schematic structural diagram of the first program before and after adding the first node code in the embodiment of the present application. Fig. 7a is a schematic structural diagram of the first program before the first node code is added. In fig. 7a, program 1 includes a first jump instruction 701. After the first device determines the location of the first jump instruction 701, the first device performs AEB partitioning on the first program, wherein the AEB partitioning includes adding a first node code before the first jump instruction 701. As shown in fig. 7b, fig. 7b is a schematic structural diagram of the first program after AEB division is performed in the embodiment of the present application. In FIG. 7b, the first device divides the first program into 4 AEBs, AEB1709, second target AEB704, third target AEB706 and AEB3710, respectively. The 4 AEBs are divided by node codes 703, 705, 707. First node code 705 is between second target AEB704 and first jump instruction 701. Node code 702 is also included before AEB1, and node code 708 is also included after AEB 3.
With regard to the above description, several points are supplemented here.
1. It should be understood that, because the embodiment of the present application needs to distinguish the common codes from the node codes in the AEB, the definition of the AEB in fig. 7b is only for convenience of understanding the technical solution in the embodiment of the present application. If the AEB3 and the node code 708 in fig. 7b are understood as one AEB, the technical effect of the technical solution provided by the embodiment of the present application will not be affected. The normal code is a code for completing the function of the program 1 except for the node code, and the node code is used for storing variables, and if the intermittent system device does not have an event such as power failure, the realization of the function of the program 1 is not affected by the existence of the node code.
2. The exemplary program 1 may be a part of a program, and is only for illustration and is not limited to whether the exemplary program 1 is complete.
3. FIG. 7b and FIG. 6b do not necessarily have a relationship, i.e., FIG. 7b and FIG. 6b may differ, for example, the code length of the second target AEB704 in FIG. 7b may not be equal to the code length of the second target AEB604 in FIG. 6b, or the position of the node code 603 may not be equal to the position of the node code 703.
4. The jump instruction included in the program 1 in fig. 7a does not necessarily have to have only one first jump instruction 701, and in practical applications, the program 1 may include 1 or more jump instructions. When the program 1 includes a plurality of jump instructions, after different jump instructions are executed by the intermittent system device, the operation of the intermittent system device may jump to the same program or may jump to different programs. For example, a first jump instruction indicates a jump to the second program, a fourth jump instruction indicates a jump to the fourth program, and a fifth jump instruction indicates a jump to the second program. Even if a plurality of jump instructions jump to the same program, the jump instructions can jump to different positions of the same program or the same position.
After the first node code is added to the first program after the AEB division, or after the first node code is added in the process of the AEB division, the obtained program is referred to as a third program in this embodiment, and in other embodiments, it may also be understood that the first program is also added, and only the first node code is modified and added.
In step 504, the first device adds a target identification to the third program.
The first device may add the target identification to the third program after adding the node code before all the jump instructions in the program 1. And when the target identifier is detected by the intermittent system equipment, the intermittent system equipment determines that the third program meets the requirement of the intermittent system equipment on the third program, and the requirement of the intermittent system equipment on the third program is that a node code is added before each jump instruction in the third program. Regarding the format of the target identifier, the first device may be pre-agreed with the intermittent system device, and the specific format of the target identifier is not limited herein. It should be noted that, if a node code is already included before a jump instruction in the program 1, the first device may not need to add the node code before the jump instruction.
It should be noted that the third program will run in the intermittent system device, and the first device needs to transfer the third program to the intermittent system device. Therefore, the target identifier does not necessarily need to be carried inside the third program, as long as the target identifier and the third program establish an association relationship. For example, the first device carries the object identifier and the third program in a folder, and transmits the folder to the intermittent system device. When the target identifier is carried inside the third program, the target identifier may be carried at the beginning of the third program. Because the processing capacity of the intermittent system equipment is generally limited, the target identifier is carried at the beginning of the third program, so that the target identifier can be scanned when the intermittent system equipment starts to run the third program, and the data processing capacity of the intermittent system equipment is reduced.
In step 505, the first device transmits a third program to the intermittent system device.
And the first equipment sends a third program to the intermittent system equipment, wherein the third program also comprises a target identifier and the corresponding relation between the third program and the target identifier.
In step 506, the intermittent system device detects whether a third identifier is present.
The third program is for running in the intermittent system device, and therefore the intermittent system device can detect whether there is a target identification corresponding to the third program. If the first device does not perform step 504, the intermittent system device does not detect the target identifier corresponding to the third program.
In step 507, if the target identifier is not detected, the intermittent system device displays a prompt message.
And if the target identifier is not detected, the intermittent system equipment determines that the third program does not conform to the requirement of the intermittent system equipment on the third program, the requirement of the intermittent system equipment on the third program is that a node code is added before each jump instruction in the third program, each jump instruction comprises a first jump instruction, and the node code comprises the first node code. If the intermittent system device executes the first program that does not pass the requirement, an error may occur in the operation of the intermittent system device. In connection with fig. 6a, and the related description of the background art, it can be seen that at detection point 3, the batch system apparatus of the background art needs to save all the variables of the entire batch system, while in the present implementation, in connection with fig. 6b, the batch system apparatus can reduce the saved variables, for example, only the modified variables in AEB2, or only the modified variables in the third target AEB. If the first node code is not added before the first jump instruction 601, that is, the third program does not meet the requirement of the intermittent system device, the intermittent system device should save the variables of the whole intermittent system, but the intermittent system device defaults to add the first node code before the first jump instruction, and only save the variables modified in the third target AEB at the detection point 3. Therefore, if an event such as power failure occurs, an operation error may occur. By adding the target identifier to the preprocessed third program, the intermittent system device can reversely determine that the program without the target identifier is the program without the target identifier, so that the running error of the intermittent system device is reduced.
And if the target identifier corresponding to the third program is not detected, the intermittent system equipment determines that the third program is not qualified. The intermittent system device may present a prompt to inform a user or a program debugger that the third program is not in compliance with the requirements of the intermittent system device for the program. For example, the reminder information may include the following: the program is not subjected to preprocessing operation, the requirements of the intermittent system on the program are not met, and errors can occur if the program is forcibly operated.
Optionally, as shown in fig. 4, if the intermittent system device 402 establishes a connection with the first device 401, the intermittent system device may also display a prompt message through the first device.
In step 508, if the target identification is detected, the intermittent system device may run a third program.
And if the intermittent system equipment detects the target identifier corresponding to the third program, the intermittent system equipment determines that the third program meets the requirement of the intermittent system equipment on the program. It should be determined that, if the first device does not add the first node code before the first jump instruction, the target identifier is still added to the first program, and the intermittent system device may still determine that the first program meets the requirements of the intermittent system device for the program. Since the processing capacity of the intermittent system device is generally limited, the intermittent system device may not substantially confirm whether the first node code is added before the first jump instruction.
Adding the target identification to the third program by the first device is an optional operation. Therefore, if the first device does not add the target identifier to the third program, the intermittent system device may directly run the third program without performing the step of detecting the target identifier.
The following description of the actions generated when the intermittent system device runs the third program will be made by taking the third program in fig. 6b as an example for the convenience of understanding. Referring to fig. 8, fig. 8 is a schematic flow chart illustrating program operation according to an embodiment of the present application. Fig. 8a is a schematic structural diagram equivalent to the program of fig. 6 b. Fig. 8a is more clear in embodying the flow than fig. 6b, and thus fig. 8b is used to embody the differences between the third program after preprocessing and the cooperative detection point technology, namely, the cascaded rollback technology, in which reference is made to the description of the first program in fig. 2a with respect to the operation of the first program in the cooperative detection point technology, and in which reference is made to the description of the first program in fig. 2b with respect to the operation of the first program in the cascaded rollback technology with respect to the operation of the first program in the aforementioned fig. 2 b. Fig. 6b is more clear in embodying the structure than fig. 8a, and the aforementioned fig. 6b is used for showing the modification of the program structure of the first device.
As shown in fig. 8a, the program 2 depicted in fig. 8a may be understood as the second program, and the program 3 may be understood as the aforementioned third program, or the first program after adding the first node code. The intermittent system device executes the third program in the order of codes in the third program. When the intermittent system device executes to the first node code 605, the intermittent system device saves the modified variable in the second target AEB. In the conventional cooperative detection point technique and the cascaded rollback technique, no variables are saved here.
In step 509, the intermittent system device jumps to the first AEB of the second program according to the first jump instruction 601.
The first AEB is the first AEB to be executed in the second program. In fig. 8b, the first AEB can understand the AEB between detection 5 and detection point 6. The jump above is also understood to be a jump to detection point 5.
After the intermittent system device has run to the fourth target AEB, the modified variables in the fifth target AEB are saved according to a second jump instruction in the second program in step 510.
As shown in fig. 8b, the fourth target AEB can be understood as the AEB between detection point 7 and detection 8 in procedure 2. Program 2 also undergoes corresponding preprocessing, which includes adding node code 801 before the second jump instruction 802. While the intermittent system device executes the node code 801, the intermittent system device saves the modified variable in the fifth target AEB. The second jump instruction 802 divides the fourth target AEB into a fifth target AEB that can be understood as an AEB between the detection point 7 and the node code 801 and a sixth target AEB that can be understood as an AEB between the node code 801 and the detection point 8.
In other embodiments, the fourth target AEB may be the first AEB.
In step 511, the intermittent system device jumps to the first jump instruction according to the second jump instruction and then continues the execution.
Referring to fig. 8, after the intermittent system device executes the second jump instruction 802, it jumps to the first jump instruction 601 and then continues to execute the program 1.
In other embodiments, subsequent execution to detection point 3, the intermittent system device saves only the modified variables in the third target AEB606 and does not save the modified variables in the second target AEB 604. In the cooperative check point technique, the intermittent system device saves variables of the entire system at check point 3. In the cascading rollback technique, the intermittent system equipment will save the modified variables in AEB 2. The embodiments of the present application retain fewer variables at detection point 3, whether compared to the tandem rollback technique or the cooperative detection point technique.
In contrast to the cooperative detection point technique, although the embodiment of the present application increases the variables saved at the first node code 605, the saved variables may be decreased as a whole. In contrast to the cascade rollback, please refer to fig. 8b, if a power down event occurs at D3 in procedure 2. Since the modified variable from detection point 2 to first jump instruction 601 is saved at first node code 605, program 1 does not need to roll back, and program 2 only needs to roll back to detection point 6. After the power supply is resumed, the gap system apparatus continues execution from detection point 6 of program 2 based on the data saved in detection point 6. Compared to the cascaded rollback outage event depicted in fig. 2b, the rollback number in the embodiment of the present application is 1, and the number of AEBs repeatedly executed is 1. After the power supply of the intermittent system device is resumed, it is possible to determine which program should be executed by the priority determination of the scheduler. For example, if the priority of the program 4 is higher than that of the priority program 2, the program 4 is executed after the power supply of the clearance system device is resumed. If program 2 has a higher priority than program 4, execution begins at check point 6.
In the above description of the technical solution in the embodiment of the present application, the first program includes only one jump instruction. Further, the method is carried out. In practical applications, if the first program includes 1 or more jump instructions, node code is added before each jump instruction. It should be determined that if the node code is included before the part of the jump instruction, it may not be necessary to add the node code before the part of the jump instruction. If the node code is added before each jump instruction, the intermittent system equipment can be ensured to execute the action of saving the variable before the intermittent system equipment jumps from the third program to the second program in the process of executing the first program 1. For convenience of description, a condition in which each jump instruction is preceded by a node code in the third program is referred to as condition 1. If the first program does not include a jump instruction, the first program also satisfies condition 1.
In the embodiment of the present application, the first program may be an Application Program Interface (API), a scheduler, or an application program, which is also called an application task. An API is a convention for linking different components of a software system, also known as an application programming interface. The API is mainly intended to provide the capability of applications and developers to access a set of routines without accessing source code or understanding details of internal working mechanisms, and mainly includes windows API and linux API provided by various embedded operating systems, and the like. The scheduler is an application for determining the execution order of programs, and generally determines the priority of different programs to allow a program with a high priority to be preferentially executed. In a multi-program concurrent intermittent system, the existence of a scheduler can reasonably allocate programs to be preferentially executed. In a broad sense, the API and scheduler are also a kind of application.
The third program in the embodiment of the present application satisfies the condition of the atomic execution, that is, the third program includes one or more AEBs, and at the end of the AEB, there is an action of executing the save variable, or the first program is divided by the AEBs. In the embodiment of the present application, the preprocessing process of the first program may be understood as a supplement to the AEB partition, and may also be understood as a part of the AEB partition. If the preprocessing process in the embodiments of the present application is understood to be complementary to the AEB partitioning, the first program may have been subjected to the AEB partitioning before being subjected to the preprocessing. The following description will take the first program as an example, and divide an API into an AEB as an example. In order for the API to meet the requirements of atomic execution, the AEB partitioning can also be understood as a transformation of the API.
The code of the API before AEB partitioning is as follows:
Figure BDA0002680631070000191
the code of the AEB-partitioned API is as follows:
Figure BDA0002680631070000192
Figure BDA0002680631070000201
in the API code after AEB division, or in the present AEB, codes under __ COMMIT (__ share), and __ share () can be understood as node codes.
In the AEB modification described above, Schedule () was moved. This code is used to jump to the scheduler execution, so Schedule () is a jump instruction. When the API satisfies condition 1, no jump instruction occurs in any AEB in the API, and thus the Schedule () is moved. Although Schedule () is not embodied in the above-described program, after executing the API, the scheduler may be called by default, i.e., after the API, Schedule () may be included, i.e., the jump instruction may still exist. That is, in the API modification, on the basis of the move jump instruction, a node code __ COMMIT (__ share) is added before the jump instruction. Thus, only one way of AEB modification is illustrated herein.
It should be determined that the above is only a modification of the API to an AEB, and in practice, an API may be modified to one or more AEBs. Moreover, the modification manner here is only an example, and in practical applications, other modification manners may be available, and are not specifically described here.
It is described above that the third program may be an API, and that a modification of the API is described. The following describes a flow chart of the intermittent system device running n applications when the application, the API and the scheduler all satisfy the condition of the atomization execution and satisfy the condition 1, where n is an integer greater than 1.
Referring to fig. 9, fig. 9 is a schematic flow chart of n applications running in the intermittent system device.
After the intermittent system device has finished executing the AEB1a in application 1, the modified variables in AEB1a are saved. Where AEB1a is not necessarily the first AEB in application 1. Also, the node code is omitted from FIG. 9, it is also understood that the node code is at the end of each AEB. After one AEB is executed, the scheduler is started to execute, the scheduler determines which application program is executed subsequently, and if the scheduler determines that the application program 1 is executed subsequently, the intermittent system device executes a jump instruction 1a, wherein the jump instruction 1a is behind the AEB1 a. The intermittent system device jumps to API1a according to jump instruction 1 a. API1a may be considered an AEB. After an AEB is executed, the scheduler is started to execute, and the scheduler determines which application to execute subsequently, assuming that the scheduler determines to execute application 2 subsequently. The intermittent system device starts execution from AEB2a in application 2, where AEB2a is not necessarily the first AEB in application 1. After the intermittent system device has finished executing the AEB2a in application 2, the modified variables in AEB2a are saved. The subsequent derivation is similar to the foregoing, and is not repeated here. By enabling the application program, the API and the scheduler to meet the condition of the atomization execution and meet the condition 1, the action of saving the variable is executed before the jump instruction is executed each time when the intermittent system equipment is in operation. Or, the intermittent system device in the embodiment of the present application executes the jump instruction only after one AEB is finished, and does not execute the jump instruction in the middle of one AEB.
In fig. 9, the scheduler process is required after each AEB execution. In other embodiments, when the API is called after the AEB of the application is finished, it may not be processed by the scheduler. As shown in fig. 10, fig. 10 is another schematic flow diagram of n applications running in the intermittent system device, after AEB1a is finished, API1a needs to be called, in the process, there is no scheduler involved, and after AEB1a is executed, API1a is directly executed through jump instruction 1 a. Since calling the API is an operation that the application program needs to do frequently, it is desirable that the process does not require the participation of a scheduler, thereby improving the operating efficiency of the intermittent system device.
It should be determined that fig. 9 is only a schematic flow chart of the intermittent system device running n applications in the embodiment of the present application. In practical applications, the flow diagram is not determined. For example, the jump instruction 1a does not have to be the jump API1a, but the application 3 is jumped, or the application 1 does not have the jump instruction 1a, and for example, the API1a and the API2a may be the same API. The flow in a batch system plant therefore changes too much and fig. 9 is only intended as an illustration.
The program processing method and the program execution method in the embodiments of the present application are described above, and the program processing apparatus in the embodiments of the present application is described below.
Referring to fig. 11, fig. 11 is a schematic structural diagram of an apparatus for processing a program according to an embodiment of the present disclosure.
The device includes:
an obtaining module 1101 configured to obtain a first program;
a determining module 1102, configured to determine a first jump instruction in the first program, so that after the second target atomic execution module AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction, the first jump instruction is intermediate a first target AEB, dividing the first target AEB into the second target AEB and a third target AEB, the second target AEB precedes the first jump instruction, the third target AEB follows the first jump instruction, the first target AEB is an AEB of the first program, after the first jump instruction is executed, the intermittent system device can be caused to jump from the first procedure to the first AEB of the second procedure, the second program includes one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
In other embodiments, the apparatus may further include a sending module or an adding module, and the like. The modules in the apparatus are specifically configured to perform all or part of the operations that the first device in the embodiment corresponding to fig. 5 may perform.
Referring to fig. 12, fig. 12 is a schematic structural diagram of an apparatus for executing a program according to an embodiment of the present application.
The device includes:
a fetching module 1201 for fetching a first program, the first program comprising one or more atomic execution modules AEB, the one or more AEBs comprising a first target AEB, the first target AEB comprising a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction for instructing a jump from the first program to a second program;
a saving module 1202 for saving the modified variable in the second target AEB after the second target AEB is executed by the apparatus and before the first jump instruction is executed;
a jump module 1203 configured to jump from the first program to the first AEB of the second program if the first jump instruction is executed by the apparatus, the second program including one or more AEBs, the first AEB being a first AEB to be executed after jumping to the second program.
In other embodiments, the apparatus may further comprise a determination module or a presentation module, etc. The modules in the apparatus are specifically configured to perform all or part of the operations that the clearance system apparatus in the embodiments corresponding to fig. 5 or fig. 8 may perform.
The above describes a device for executing a program in the embodiment of the present application, and the following describes a first apparatus and a batch system apparatus in the embodiment of the present application.
Referring to fig. 13, fig. 13 is a schematic structural diagram of an apparatus for processing a program or an apparatus for executing a program according to an embodiment of the present application.
As shown in fig. 13, a program processing device or program executing device 1300 includes a processor 1310, and a memory 1320 coupled to the processor 1310. The processor 1310 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP. The processor may also be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof. The processor 1310 may refer to one processor or may include a plurality of processors.
Memory 1320 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory 1320 may also include a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), an FRAM memory, a flash memory, a Hard Disk Drive (HDD) or a solid-state drive (SSD); the memory 1320 may also include a combination of the above types of memory.
When fig. 13 is a schematic diagram of the structure of the apparatus that processes the program:
processor 1310 is configured to obtain a first program;
the processor 1310 is further configured to determine a first jump instruction in the first program, such that after the second target atomic execution module AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction, the first jump instruction is intermediate a first target AEB, dividing the first target AEB into the second target AEB and a third target AEB, the second target AEB precedes the first jump instruction, the third target AEB follows the first jump instruction, the first target AEB is an AEB of the first program, after the first jump instruction is executed, the intermittent system device can be caused to jump from the first procedure to the first AEB of the second procedure, the second program includes one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
In other embodiments, the processor 1310 is further configured to execute, after executing the computer readable instructions in the memory 1320, all operations that the first device can perform, according to the instructions of the computer readable instructions, for example, the operations that the first device performs in the embodiment corresponding to fig. 5.
When fig. 13 is a schematic view of the structure of an apparatus executing a program:
the processor 1310 is configured to obtain a first program comprising one or more atomic execution modules AEB, the one or more AEBs comprising a first target AEB, the first target AEB comprising a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction being configured to instruct a jump from the first program to a second program;
the processor 1310 is further configured to save the modified variable in the second target AEB after the second target AEB is executed by the apparatus and before the first jump instruction is executed;
the processor 1310 is further configured to jump from the first program to the first AEB of the second program if the first jump instruction is executed by the apparatus, the second program including one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
In other embodiments, processor 1310 is further configured to execute, after executing the computer-readable instructions in memory 1320, all operations that may be performed by the clearance system device, such as the operations performed by the clearance system device in the embodiments corresponding to fig. 5 or fig. 8, as indicated by the computer-readable instructions.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media that can store program codes, such as a flash disk, a removable hard disk, a ROM, a RAM, a magnetic or optical disk, and the like.

Claims (28)

1. A program execution method, comprising:
an intermittent system device acquires a first program comprising one or more atomic execution modules (AEBs), the one or more AEBs comprising a first target AEB, the first target AEB comprising a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction being for instructing a jump from the first program to a second program;
after the second target AEB is executed by the intermittent system device, the intermittent system device saves the modified variable in the second target AEB before executing the first jump instruction;
if the first jump instruction is executed by the intermittent system device, the intermittent system device jumps from the first program to the first AEB of the second program, the second program comprising one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
2. The method of claim 1, wherein after the intermittent system device executes the third target AEB, before the intermittent system device executes the second AEB of the first program, the method further comprises:
the intermittent system saves the modified variables in the third target AEB, the modified variables in the second target AEB are not saved, and the second AEB is the first AEB after the first target AEB.
3. The method of claim 2, wherein the intermittent system device acquiring the first program comprises:
the intermittent system device obtaining a third program, the third program comprising the first program, the third program comprising a first node code after the second target AEB before the first jump instruction;
if the second target AEB is executed by the intermittent system equipment, the intermittent system equipment saving the modified variable in the second target AEB comprises:
the intermittent system device saves the modified variable in the second target AEB by executing the first node code.
4. The method as claimed in claim 3, wherein the first node code is added according to the location of the first jump instruction after the first jump instruction is determined for the first device;
the intermittent system device acquiring the third program includes:
and the intermittent system equipment receives the third program sent by the first equipment.
5. The method of any of claims 1 to 4, wherein the first program includes an object identifier, the method further comprising:
if the target identifier is detected, the intermittent system device determines that the first program meets the requirement of the intermittent system device on the first program, the requirement of the intermittent system device on the first program is that a node code is added before each jump instruction in the first program, wherein each jump instruction comprises the first jump instruction, and the node code comprises the first node code.
6. The method of claim 5, further comprising:
and if the first program does not meet the requirement of the intermittent system equipment on the first program, the intermittent system equipment displays prompt information.
7. The method of any one of claims 1 to 6, further comprising:
the intermittent system device obtaining the second program, the second program comprising one or more AEBs, the one or more AEBs comprising the fourth target AEB, the fourth target AEB comprising a second jump instruction, the second jump instruction dividing the fourth target AEB into a fifth target AEB and a sixth target AEB, the fifth target AEB preceding the second jump instruction, the sixth target AEB following the second jump instruction, the second jump instruction for instructing a jump from the second program to the first program;
after the fifth target AEB is executed by the intermittent system device, the intermittent system device saves the modified variable in the fifth target AEB before executing the second jump instruction;
if the second jump instruction is executed by the intermittent system device, the intermittent system device jumps from the fifth target AEB of the second program to the third target AEB of the first program.
8. A program processing method, the program being run on a batch system device, characterized by comprising:
the method comprises the steps that a first device obtains a first program;
the first device determines a first jump instruction in the first program so that after the second target atomic execution module AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction, the first jump instruction is intermediate a first target AEB, dividing the first target AEB into the second target AEB and a third target AEB, the second target AEB precedes the first jump instruction, the third target AEB follows the first jump instruction, the first target AEB is an AEB of the first program, after the first jump instruction is executed, the intermittent system device can be caused to jump from the first procedure to the first AEB of the second procedure, the second program includes one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
9. The method of claim 8 wherein after the intermittent system equipment executes the third target AEB, the modified variables in the third target AEB are saved before the intermittent system equipment executes a second AEB of the first program, the modified variables in the second target AEB are not saved, the second AEB being one AEB after the first target AEB.
10. The method of claim 9, wherein after the first device determines a first jump instruction in the first program, the method further comprises:
the first device adds first node code to the second target AEB before the first jump instruction of the first program to generate a third program, the first node code for execution by the intermittent system device to effect saving of the modified variable in the second target AEB.
11. The method of claim 10, wherein after generating the third program, the method further comprises:
the first device sends the third program to the intermittent system device.
12. The method according to any one of claims 8 to 11, wherein after the first device determines a first jump instruction in the first program, the method further comprises:
the first device adds a target identifier in the first program, wherein the target identifier is used for determining that the first program meets the requirement of the intermittent system device on the first program when detected by the intermittent system device, and the requirement of the intermittent system device on the first program is that a node code is added before each jump instruction in the first program, wherein each jump instruction comprises the first jump instruction, and the node code comprises the first node code.
13. The method according to any one of claims 8 to 12, further comprising:
the first device determines a second jump instruction in the second program such that after a fifth target AEB is executed by the intermittent system device, the modified variable in the fifth target AEB is saved before the second jump instruction is executed, the second jump instruction is in the middle of a fourth target AEB that is divided into the fifth target AEB and a sixth target AEB, the fifth target AEB precedes the second jump instruction, the sixth target AEB follows the second jump instruction, and after the second jump instruction is executed, the intermittent system device may be caused to jump from the fifth target AEB of the second program to the third target AEB of the first program.
14. An apparatus for executing a program, comprising:
a fetch module to fetch a first program, the first program comprising one or more atomic execution modules AEBs, the one or more AEBs comprising a first target AEB, the first target AEB comprising a first jump instruction, the first jump instruction dividing the first target AEB into a second target AEB and a third target AEB, the second target AEB preceding the first jump instruction, the third target AEB following the first jump instruction, the first jump instruction to instruct a jump from the first program to a second program;
a save module to save the modified variable in the second target AEB after the second target AEB is executed by the apparatus and before the first jump instruction is executed;
a jump module to jump from the first program to the first AEB of the second program if the first jump instruction is executed by the apparatus, the second program including one or more AEBs, the first AEB being a first AEB to be executed after jumping to the second program.
15. The apparatus of claim 14, wherein after the apparatus executes the third target AEB, before the apparatus executes a second AEB of the first program, the saving module is further configured to save the modified variables in the third target AEB, the modified variables in the second target AEB not being saved, the second AEB being a first AEB after the first target AEB.
16. The apparatus according to claim 15, wherein the obtaining module is specifically configured to obtain a third program, the third program comprising the first program, the third program comprising a first node code after the second target AEB and before the first jump instruction;
the saving module is specifically configured to implement saving the modified variable in the second target AEB by executing the first node code.
17. The apparatus as claimed in claim 16, wherein the first node code is added for the first device according to the location of the first jump instruction after determining the first jump instruction;
the obtaining module is specifically configured to receive the third program sent by the first device.
18. The apparatus of any of claims 14 to 17, wherein the first program comprises a target identifier;
the device further comprises:
a determining module, configured to determine that the first program meets a requirement of the intermittent system device for the first program if the target identifier is detected, where the requirement of the intermittent system device for the first program is that a node code is added before each jump instruction in the first program, where each jump instruction includes the first jump instruction, and the node code includes the first node code.
19. The apparatus of claim 18, further comprising:
and the display module is used for displaying prompt information if the third program does not meet the requirement of the device on the first program.
20. The apparatus of any of claims 14 to 19, wherein the fetch module is further configured to fetch the second program, the second program comprising one or more AEBs, the one or more AEBs comprising the fourth target AEB, the fourth target AEB comprising a second jump instruction, the second jump instruction dividing the fourth target AEB into a fifth target AEB and a sixth target AEB, the fifth target AEB preceding the second jump instruction, the sixth target AEB following the second jump instruction, the second jump instruction being configured to instruct a jump from the second program to the first program;
the save module is further to save the modified variable in the fifth target AEB after the fifth target AEB is executed by the apparatus and before the second jump instruction is executed;
the jump module is further to jump from the fifth target AEB of the second program to the third target AEB of the first program if the second jump instruction is executed by the apparatus.
21. An apparatus for processing a program, comprising:
the acquisition module is used for acquiring a first program;
a determining module, configured to determine a first jump instruction in the first program, so that after the second target atomic execution module AEB is executed by the intermittent system device, the modified variable in the second target AEB is saved prior to executing the first jump instruction, the first jump instruction is intermediate a first target AEB, dividing the first target AEB into the second target AEB and a third target AEB, the second target AEB precedes the first jump instruction, the third target AEB follows the first jump instruction, the first target AEB is an AEB of the first program, after the first jump instruction is executed, the intermittent system device can be caused to jump from the first procedure to the first AEB of the second procedure, the second program includes one or more AEBs, the first AEB being the first AEB to be executed after jumping to the second program.
22. The apparatus of claim 21, wherein after the intermittent system device executes the third target AEB, the modified variables in the third target AEB are saved before the intermittent system device executes a second AEB of the first program, the modified variables in the second target AEB are not saved, the second AEB being one AEB after the first target AEB.
23. The apparatus of claim 22, further comprising:
an adding module, configured to add a first node code after the second target AEB before the first jump instruction of the first program to generate a third program, where the first node code is to be executed by the intermittent system device to save the modified variable in the second target AEB.
24. The apparatus of claim 23, further comprising:
and the sending module is used for sending the third program to the intermittent system equipment.
25. The apparatus according to any one of claims 21 to 24, wherein the adding module is further configured to add a target identifier to the first program, where the target identifier is configured to be detected by the intermittent system device, so that the intermittent system device determines that the first program conforms to the requirement of the intermittent system device for the first program, where the requirement of the intermittent system device for the first program is that a node code is added before each jump instruction in the first program, where each jump instruction includes the first jump instruction, and the node code includes the first node code.
26. The apparatus of any one of claims 21 to 25 wherein the determining module is further configured to determine a second jump instruction in the second program such that after a fifth target AEB is executed by the intermittent system device, the modified variable in the fifth target AEB is saved before the second jump instruction is executed, the second jump instruction is in the middle of a fourth target AEB that divides the fourth target AEB into the fifth target AEB and a sixth target AEB, the fifth target AEB is before the second jump instruction, the sixth target AEB is after the second jump instruction, and after the second jump instruction is executed, the intermittent system device is enabled to jump from the fifth target AEB of the second program to the third target AEB of the first program.
27. An apparatus for executing a program, comprising:
a processor and a memory, the memory having stored therein a first program and a processing program, the processor being configured to retrieve the first program from the memory and process the first program according to the processing program, a processing method comprising any one of the methods of claims 1 to 7.
28. An apparatus for processing a program, comprising:
a processor and a memory, the memory having stored therein a first program and a processing program, the processor being configured to retrieve the first program from the memory and process the first program in accordance with the processing program, a processing method comprising any one of the methods of the preceding claims 8 to 13.
CN202010961301.6A 2020-06-09 2020-09-14 Program execution method, program processing method, and related apparatus Pending CN113778742A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/098819 WO2021249377A1 (en) 2020-06-09 2021-06-08 Program execution method, program processing method, and related device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2020105264069 2020-06-09
CN202010526406 2020-06-09

Publications (1)

Publication Number Publication Date
CN113778742A true CN113778742A (en) 2021-12-10

Family

ID=78835000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010961301.6A Pending CN113778742A (en) 2020-06-09 2020-09-14 Program execution method, program processing method, and related apparatus

Country Status (2)

Country Link
CN (1) CN113778742A (en)
WO (1) WO2021249377A1 (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216792B (en) * 2008-01-14 2010-06-09 中兴通讯股份有限公司 Real-time operating system tasks management process and device of real-time operating system
US9740562B2 (en) * 2010-12-20 2017-08-22 Microsoft Technology Licensing, Llc Method for checkpointing and restoring program state
CN102831054B (en) * 2012-06-30 2015-12-02 华为技术有限公司 Program breakpoint disposal route and device
US9026504B2 (en) * 2013-02-04 2015-05-05 Bank Of America Corporation Multi-row database data loading for enterprise workflow application
US10176074B2 (en) * 2016-09-21 2019-01-08 Lenvio Inc. Computed call/jump target resolution via behavior computation
CN111143142B (en) * 2019-12-26 2021-05-04 江南大学 Universal check point and rollback recovery method

Also Published As

Publication number Publication date
WO2021249377A1 (en) 2021-12-16

Similar Documents

Publication Publication Date Title
CN107783975B (en) Method and device for synchronous processing of distributed databases
CN110806923B (en) Parallel processing method and device for block chain tasks, electronic equipment and medium
US20140181831A1 (en) DEVICE AND METHOD FOR OPTIMIZATION OF DATA PROCESSING IN A MapReduce FRAMEWORK
US9146779B2 (en) System and method for migrating an application
CN109032796B (en) Data processing method and device
CN105068865A (en) Task scheduling method and apparatus
CN104954411A (en) Method for sharing network resource by distributed system, terminal thereof and system thereof
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN112445598B (en) Task scheduling method and device based on quartz, electronic equipment and medium
EP2551768A1 (en) Multi-core system and start-up method
CN114328098A (en) Slow node detection method and device, electronic equipment and storage medium
CN105373563B (en) Database switching method and device
CN110955503B (en) Task scheduling method and device
CN110908644B (en) Configuration method and device of state node, computer equipment and storage medium
CN103049305A (en) Multithreading method of dynamic code conversion of loongson multi-core central processing unit (CPU) simulation
CN112181724A (en) Big data disaster tolerance method and device and electronic equipment
CN113778742A (en) Program execution method, program processing method, and related apparatus
CN111767126A (en) System and method for distributed batch processing
CN108984405B (en) Performance test method, device and computer readable storage medium
US8291419B2 (en) Fault tolerant system for execution of parallel jobs
US20180352028A1 (en) Method and device for dispatching replication tasks in network storage device
JP7122299B2 (en) Methods, apparatus, devices and storage media for performing processing tasks
CN115599507A (en) Data processing method, execution workstation, electronic device and storage medium
US9396044B2 (en) Memory efficient thread-level speculation
CN108243204B (en) Process running state display method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination