Simulation control method and system with rollback and pushback mechanism
Patent Information
- Application Number
- CN202610859062.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-10-20
AI Technical Summary
但是,传统仿真系统的运行机制决定了其无法支持这样的业务场景
[0006]综上,本发明提出的一种具有回滚与复推机制的仿真控制方法及系统,通过双进程构建的快照备份和恢复机制,可以在执行仿真任务时快速恢复到所需要的时间点;同时,通过引入了灵活的仿真任务更改机制,可以提供更加便利和可扩展性的仿真测试,从而实现了对仿真系统快速恢复和灵活调整运行状态的效果。
Smart Images

Figure FT_1 
Figure FT_2
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer simulation technology, and in particular relates to a simulation control method and system with rollback and pushback mechanisms. Background Technology
[0002] With the widespread application of simulation technology in various fields such as industrial simulation, traditional simulation systems execute a unidirectional, irreversible, and unalterable simulation process. However, in business scenarios, there are frequent needs to revert to a previous point in time for simulation, and to modify the simulation verification scheme when reverting to a previous point in time. However, the operating mechanism of traditional simulation systems dictates that they cannot support such business scenarios. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention proposes a simulation control method and system with rollback and pushback mechanisms.
[0004] The first aspect of this invention proposes a simulation control method with rollback and re-pullback mechanisms, the method comprising: In response to receiving a first instruction that meets the first preset condition, the execution of the first process performing the first simulation operation is paused and the first running status information of the first process is saved; The first instruction is parsed to obtain the first snapshot file information corresponding to the rollback time; Send a rollback instruction containing information about the first snapshot file to the second process associated with the first process; In response to receiving the first rollback status information returned by the second process, a re-pull instruction is obtained; wherein, the re-pull instruction includes operation information for performing the second simulation operation, and the first rollback status information includes process metadata information, register execution context information, first process user-mode memory data information, and file system association information; Based on the operation information, the user-mode memory data information of the first process is modified to obtain the user-mode memory data information of the second process. Based on the second rollback status information, the first running status information is modified to the second running status information corresponding to the rollback time and the second simulation operation; wherein, the second rollback status information includes the process metadata information, the register execution context information, the second process user-mode memory data information, and the file system association information; Based on the second running status information, the first process is resumed.
[0005] A second aspect of the present invention provides a simulation control system with rollback and pushback mechanisms, the system comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to implement the method described in the first aspect of the present invention.
[0006] In summary, the simulation control method and system proposed in this invention, which has rollback and pushback mechanisms, can quickly restore to the required time point when executing simulation tasks through a snapshot backup and recovery mechanism constructed by dual processes. At the same time, by introducing a flexible simulation task modification mechanism, it can provide more convenient and scalable simulation testing, thereby achieving the effect of rapid recovery and flexible adjustment of the simulation system's operating state. Attached Figure Description
[0007] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0008] Figure 1 This is a flowchart illustrating a simulation control method with rollback and re-pullback mechanisms proposed in an embodiment of the present invention.
[0009] Figure 2 This is a schematic diagram of the structure of a simulation control system with rollback and pushback mechanisms proposed in an embodiment of the present invention. Detailed Implementation
[0010] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0011] Appendix Figure 1 The first aspect of this invention illustrates a simulation control method 100 with rollback and re-pullback mechanisms, comprising: Step 101: In response to receiving a first instruction that meets the first preset condition, pause the execution of the first process performing the first simulation operation and save the first running status information of the first process.
[0012] Rollback generally refers to returning a specific application or system to a state at a specific prior point in time; re-running generally refers to running a specific application or system under new conditions. In this embodiment of the invention, rollback refers to returning the system or program performing the simulation to a state at a specific prior point in time, while re-running refers to the system or program performing the simulation receiving a new simulation command or simulation scheme during the simulation process and then performing the simulation according to the new simulation command or simulation scheme.
[0013] In one optional embodiment, the first instruction satisfying the first preset condition includes a simulation rollback instruction or a program crash instruction; when the first instruction is a simulation rollback instruction, the rollback time is obtained from the simulation rollback instruction; when the first instruction is a program crash instruction, the rollback time is obtained based on the current first running time and a predetermined time interval. For example, if a simulation rollback instruction containing a specified time is received, the simulation rollback is performed according to the specified time. If the simulation system or program crashes, a program crash instruction will also be issued to indicate a rollback. In this case, a rollback time is selected according to a predetermined strategy, such as one or two days from the current running time as the rollback time.
[0014] Step 102: Parse the first instruction to obtain the first snapshot file information corresponding to the rollback time.
[0015] In one optional embodiment, obtaining the first snapshot file information corresponding to the rollback time includes: based on the rollback time, using a preset mapping table to find the corresponding first snapshot file information.
[0016] In one optional embodiment, the step of searching for the corresponding first snapshot file information using a preset mapping table based on the rollback time includes: searching for corresponding time point data in the mapping table based on the rollback time; if corresponding time point data is found, using the file information corresponding to the time point data in the mapping table as the first snapshot file information; if no corresponding time point data is found, using the file information corresponding to the time point data closest to the rollback time found in the mapping table as the first snapshot file information. It is understood that any fuzzy search strategy can be used to establish and determine the association between the rollback time and the time point data in the mapping table.
[0017] The first snapshot file information generally refers to the filename of the snapshot file, but it can also be any information that can uniquely identify the snapshot file. It is understood that any data structure capable of generating associations can be used to store the matching relationship between point-in-time data and the first snapshot file information. Of course, it is also possible to find the first snapshot file information without establishing a matching relationship. In an optional embodiment, the snapshot file name can be directly set to the runtime of the corresponding simulation program or system when the snapshot file is created, and a list of snapshot files can be displayed in the form of a file list when the user inputs a simulation rollback command, allowing direct selection of a snapshot file from a specific time.
[0018] In one optional embodiment, the runtime of the simulation system or program and the information of the first snapshot file corresponding to the snapshot file can be written into a preset mapping table when the snapshot file is generated.
[0019] Step 103: Send a rollback instruction containing the information of the first snapshot file to the second process associated with the first process.
[0020] In this embodiment of the invention, a first process is used to perform simulation operations, and a second process is used to perform snapshot-related operations. The second process and the first process are associated, thereby enabling the independent parallel execution of simulation and snapshot operations. Furthermore, both the second process and the first process can access a preset mapping table.
[0021] Step 104: In response to receiving the first rollback status information returned by the second process, obtain the re-pull instruction; wherein, the re-pull instruction includes operation information for performing the second simulation operation, and the first rollback status information includes process metadata information, register execution context information, first process user-mode memory data information, and file system association information.
[0022] In one optional embodiment, the first rollback status information comes from the snapshot file found by the second process using the snapshot file information. For example, after the second process finds the corresponding snapshot file by filename, it extracts the information recorded in the snapshot file for recovery and feeds it back as the first rollback status information.
[0023] In one optional embodiment, the process metadata information includes process identification information, process tree structure information, user identification information, environment variable information, and command-line parameter information; the register execution context information includes program counter information, stack pointer information, general-purpose register information, floating-point vector register information, and flag register information; the first process user-mode memory data information includes code segment mapping information, heap memory page information, stack memory page information, anonymous memory page information, and memory virtual address mapping relationship information; the file system association information includes file open descriptor table information, file read / write offset information, standard input / output stream status information, and file open mode information. It should be understood that the above information is exemplary information related to the program that those skilled in the art would generally use when restoring the program, but the above information can be added or deleted as needed.
[0024] In an optional embodiment, before obtaining the rollback instruction, the method further includes: performing a data integrity check on the first rollback status information; if the data integrity check fails, forming second snapshot file information; wherein the formation time corresponding to the second snapshot file information is earlier than the formation time corresponding to the first snapshot file information; and sending a rollback instruction containing the second snapshot file information to the second process.
[0025] Step 105: Based on the operation information, modify the user-mode memory data information of the first process to obtain the user-mode memory data information of the second process.
[0026] The operational information includes data for the new simulation scheme or task. The execution data of the existing simulation scheme or task is typically stored in the process's user-mode memory. Therefore, the simulation system or program can be made to run according to the new simulation scheme or task by directly modifying the process's user-mode memory. For example, if the existing simulation scheme or task requires simulating the motion of a sphere of a specific size, while the new scheme requires simulating the motion of a cube of a different size, the simulation system or program can be made to simulate the cube by modifying the size and shape data in the process's user-mode memory. It is understandable that if process metadata, register execution context information, and file system association information also have related data that needs to be changed, these can also be modified simultaneously to support the new simulation scheme or task.
[0027] Step 106: Based on the second rollback status information, modify the first running status information to the second running status information corresponding to the rollback time and the second simulation operation; wherein, the second rollback status information includes the process metadata information, the register execution context information, the second process user-mode memory data information, and the file system association information.
[0028] Step 107: Based on the second running status information, resume the running of the first process.
[0029] In one optional embodiment, in response to receiving a second instruction that meets a second preset condition, a snapshot backup instruction is sent to the second process; the snapshot backup instruction is used to instruct the second process to perform a snapshot backup of the first process's first running status information and the current second running time.
[0030] In one optional embodiment, the second instruction that satisfies the second preset condition is an instruction to perform backups based on a predetermined period.
[0031] Figure 2 The structure of a simulation control system 200 with rollback and rewind mechanisms according to a second aspect of the present invention is shown. The system 200 includes: at least one processor 201; and a memory 202 communicatively connected to the at least one processor. The memory 202 stores instructions executable by the at least one processor 201, which, when executed by the at least one processor 201, enable the at least one processor 201 to implement the following method steps: Step 1: In response to receiving a first instruction that meets the first preset condition, pause the execution of the first process performing the first simulation operation and save the first running status information of the first process.
[0032] Rollback generally refers to returning a specific application or system to a state at a specific prior point in time; re-running generally refers to running a specific application or system under new conditions. In this embodiment of the invention, rollback refers to returning the system or program performing the simulation to a state at a specific prior point in time, while re-running refers to the system or program performing the simulation receiving a new simulation command or simulation scheme during the simulation process and then performing the simulation according to the new simulation command or simulation scheme.
[0033] In one optional embodiment, the first instruction satisfying the first preset condition includes a simulation rollback instruction or a program crash instruction; when the first instruction is a simulation rollback instruction, the rollback time is obtained from the simulation rollback instruction; when the first instruction is a program crash instruction, the rollback time is obtained based on the current first running time and a predetermined time interval. For example, if a simulation rollback instruction containing a specified time is received, the simulation rollback is performed according to the specified time. If the simulation system or program crashes, a program crash instruction will also be issued to indicate a rollback. In this case, a rollback time is selected according to a predetermined strategy, such as one or two days from the current running time as the rollback time.
[0034] Step 2: Parse the first instruction to obtain the first snapshot file information corresponding to the rollback time.
[0035] In one optional embodiment, obtaining the first snapshot file information corresponding to the rollback time includes: based on the rollback time, using a preset mapping table to find the corresponding first snapshot file information.
[0036] In one optional embodiment, the step of searching for the corresponding first snapshot file information using a preset mapping table based on the rollback time includes: searching for corresponding time point data in the mapping table based on the rollback time; if corresponding time point data is found, using the file information corresponding to the time point data in the mapping table as the first snapshot file information; if no corresponding time point data is found, using the file information corresponding to the time point data closest to the rollback time found in the mapping table as the first snapshot file information. It is understood that any fuzzy search strategy can be used to establish and determine the association between the rollback time and the time point data in the mapping table.
[0037] The first snapshot file information generally refers to the filename of the snapshot file, but it can also be any information that can uniquely identify the snapshot file. It is understood that any data structure capable of generating associations can be used to store the matching relationship between point-in-time data and the first snapshot file information. Of course, it is also possible to find the first snapshot file information without establishing a matching relationship. In an optional embodiment, the snapshot file name can be directly set to the runtime of the corresponding simulation program or system when the snapshot file is created, and a list of snapshot files can be displayed in the form of a file list when the user inputs a simulation rollback command, allowing direct selection of a snapshot file from a specific time.
[0038] In one optional embodiment, the runtime of the simulation system or program and the information of the first snapshot file corresponding to the snapshot file can be written into a preset mapping table when the snapshot file is generated.
[0039] Step 3: Send a rollback command containing the information of the first snapshot file to the second process associated with the first process.
[0040] In this embodiment of the invention, a first process is used to perform simulation operations, and a second process is used to perform snapshot-related operations. The second process and the first process are associated, thereby enabling the independent parallel execution of simulation and snapshot operations. Furthermore, both the second process and the first process can access a preset mapping table.
[0041] Step 4: In response to receiving the first rollback status information returned by the second process, obtain the re-push instruction; wherein, the re-push instruction includes operation information for performing the second simulation operation, and the first rollback status information includes process metadata information, register execution context information, first process user-mode memory data information, and file system association information.
[0042] In one optional embodiment, the first rollback status information comes from the snapshot file found by the second process using the snapshot file information. For example, after the second process finds the corresponding snapshot file by filename, it extracts the information recorded in the snapshot file for recovery and feeds it back as the first rollback status information.
[0043] In one optional embodiment, the process metadata information includes process identification information, process tree structure information, user identification information, environment variable information, and command-line parameter information; the register execution context information includes program counter information, stack pointer information, general-purpose register information, floating-point vector register information, and flag register information; the first process user-mode memory data information includes code segment mapping information, heap memory page information, stack memory page information, anonymous memory page information, and memory virtual address mapping relationship information; the file system association information includes file open descriptor table information, file read / write offset information, standard input / output stream status information, and file open mode information. It should be understood that the above information is exemplary information related to the program that those skilled in the art would generally use when restoring the program, but the above information can be added or deleted as needed.
[0044] In an optional embodiment, before obtaining the rollback instruction, the method further includes: performing a data integrity check on the first rollback status information; if the data integrity check fails, forming second snapshot file information; wherein the formation time corresponding to the second snapshot file information is earlier than the formation time corresponding to the first snapshot file information; and sending a rollback instruction containing the second snapshot file information to the second process.
[0045] Step 5: Based on the operation information, modify the user-mode memory data information of the first process to obtain the user-mode memory data information of the second process.
[0046] The operational information includes data for the new simulation scheme or task. The execution data of the previous simulation scheme or task is generally stored in the process's user-mode memory. Therefore, the simulation system or program can be made to run according to the new simulation scheme or task by directly modifying the process's user-mode memory data. For example, if the previous simulation scheme or task required simulating the motion of a sphere of a specific size, while the new simulation scheme requires simulating the motion of a cube of a different size, the simulation system or program can be made to start simulating the cube by modifying the process's user-mode memory data. It is understandable that if process metadata, register execution context information, and file system association information also have related data that needs to be modified, these can also be modified simultaneously to support the new simulation scheme or task.
[0047] Step Six: Based on the second rollback status information, modify the first running status information to the second running status information corresponding to the rollback time and the second simulation operation; wherein, the second rollback status information includes the process metadata information, the register execution context information, the second process user-mode memory data information, and the file system association information.
[0048] Step 7: Based on the second running status information, resume the running of the first process.
[0049] In one optional embodiment, in response to receiving a second instruction that meets a second preset condition, a snapshot backup instruction is sent to the second process; the snapshot backup instruction is used to instruct the second process to perform a snapshot backup of the first process's first running status information and the current second running time.
[0050] In one optional embodiment, the second instruction that satisfies the second preset condition is an instruction to perform backups based on a predetermined period.
[0051] In summary, the simulation control method and system proposed in this invention, which has rollback and pushback mechanisms, can quickly restore to the required time point when executing simulation tasks through a snapshot backup and recovery mechanism constructed by dual processes. At the same time, by introducing a flexible simulation task modification mechanism, it can provide more convenient and scalable simulation testing, thereby achieving the effect of rapid recovery and flexible adjustment of the simulation system's operating state.
[0052] It should be noted that, in the several embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the embodiments described above are merely illustrative; for instance, the division of units or steps is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or steps may be combined or integrated into another system or step, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0053] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0054] Furthermore, in the various embodiments of the present invention, the functional units or method steps can be integrated into one processing unit or one method step, or each unit or method step can exist separately physically or functionally, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or in the form of hardware plus software functional units.
[0055] It should be noted that the embodiments provided in this invention are all illustrative, and different embodiments can be arbitrarily and reasonably combined. For the sake of brevity, not all possible combinations of the various technical features in the above embodiments are described; however, as long as such combinations do not contradict each other, they should all be considered to fall within the scope of this specification. Furthermore, it should be understood that the systems and methods disclosed in the embodiments provided in this invention can be implemented in other ways or with modifications. Any substitutions made in hardware or software, or any modifications made without departing from the concept of this invention, are within the protection scope of this invention.
Claims
1. A simulation control method with rollback and re-progression mechanisms, characterized in that, include: In response to receiving a first instruction that meets the first preset condition, the execution of the first process performing the first simulation operation is paused and the first running status information of the first process is saved; The first instruction is parsed to obtain the first snapshot file information corresponding to the rollback time; Send a rollback instruction containing information about the first snapshot file to the second process associated with the first process; In response to receiving the first rollback status information returned by the second process, a re-pull instruction is obtained; wherein, the re-pull instruction includes operation information for performing the second simulation operation, and the first rollback status information includes process metadata information, register execution context information, first process user-mode memory data information, and file system association information; Based on the operation information, the user-mode memory data information of the first process is modified to obtain the user-mode memory data information of the second process. Based on the second rollback status information, the first running status information is modified to the second running status information corresponding to the rollback time and the second simulation operation; wherein, the second rollback status information includes the process metadata information, the register execution context information, the second process user-mode memory data information, and the file system association information; Based on the second running status information, the first process is resumed.
2. The simulation control method with rollback and re-progression mechanism according to claim 1, characterized in that: The first instruction that satisfies the first preset condition includes a simulation rollback instruction or a program crash instruction. When the first instruction is a simulation rollback instruction, the rollback time is obtained from the simulation rollback instruction; When the first instruction is a program crash instruction, the rollback time is obtained based on the current first running time and a predetermined time interval.
3. The simulation control method with rollback and re-progression mechanism according to claim 2, characterized in that: The information obtained for the first snapshot file corresponding to the rollback time includes: Based on the rollback time, the corresponding first snapshot file information is found using a preset mapping table.
4. The simulation control method with rollback and re-push mechanism according to claim 3, characterized in that: The step of looking up the corresponding first snapshot file information using a preset mapping table based on the rollback time includes: Based on the rollback time, the corresponding time point data is retrieved from the mapping table; If the corresponding time point data is found, the file information corresponding to the time point data in the mapping table is used as the first snapshot file information; If no corresponding time point data is found, the file information corresponding to the time point data closest to the rollback time found in the mapping table will be used as the first snapshot file information.
5. The simulation control method with rollback and re-pullback mechanism according to claim 4, characterized in that: The first rollback status information comes from the snapshot file found by the second process using the snapshot file information.
6. The simulation control method with rollback and re-progression mechanism according to claim 5, characterized in that: The process metadata information includes process identity information, process tree structure information, user identity information, environment variable information, and command line parameter information; The register execution context information includes program counter information, stack pointer information, general-purpose register information, floating-point vector register information, and flag register information; The user-mode memory data information of the first process includes code segment mapping information, heap memory page information, stack memory page information, anonymous memory page information, and memory virtual address mapping relationship information; The file system association information includes file open descriptor table information, file read / write offset information, standard input / output stream status information, and file open mode information.
7. The simulation control method with rollback and re-push mechanism according to claim 6, characterized in that, Before obtaining the re-pushing instruction, the following steps are also included: Perform a data integrity check on the first rollback status information; If the data integrity check fails, a second snapshot file is generated; wherein the generation time of the second snapshot file is earlier than the generation time of the first snapshot file. Send a rollback command containing information about the second snapshot file to the second process.
8. The simulation control method with rollback and re-push mechanism according to claim 7, characterized in that, In response to receiving a second instruction that meets the second preset condition, a snapshot backup instruction is sent to the second process; the snapshot backup instruction is used to instruct the second process to perform a snapshot backup of the first process's first running status information and the current second running time.
9. A simulation control method with rollback and re-progression mechanisms according to claim 8, characterized in that: The second instruction that satisfies the second preset condition is an instruction to perform backup based on a predetermined period.
10. A simulation control system with rollback and re-pullback mechanisms, the system comprising: At least one processor; And a memory communicatively connected to at least one processor; wherein the memory stores instructions executable by at least one processor, the instructions being executed by at least one processor to enable the at least one processor to implement the method as described in any one of claims 1-9.