Cross-platform non-intrusive simulation model scheduling method and device

By directly scheduling the dynamic library in DLL format in the Linux operating system, using the non-invasive model encapsulation scheduling method, the compilation and maintenance problems of cross-platform runtime are solved, and efficient simulation model scheduling and operation are achieved.

CN120011007APending Publication Date: 2025-05-16BEIJING LINGWEI JUNRONG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411887522.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

When existing simulation systems run across platforms, they need to recompile dynamic libraries, resulting in inconvenience in authorization and version upgrades, and increase maintenance workload.

Method used

The non-invasive model encapsulation scheduling method is adopted to directly schedule dynamic libraries in the DLL format in the Linux operating system. By analyzing the Windows PE Binary specification, the resource configuration files are obtained, the function mapping is established, the thread resources are initialized, and the register content is modified to achieve compatibility of function calling methods.

Benefits of technology

The dynamic library in the same simulation model DLL format is seamlessly run and scheduled in different operating system platforms, reducing the dependence during the compilation period, improving the operation efficiency, and simplifying the maintenance process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120011007A_ABST
    Figure CN120011007A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-platform non-intrusive simulation model scheduling method and device, and the method comprises the steps: calling a simulation model dynamic library in a DLL format in Linux: when the simulation model dynamic library is loaded, analyzing a DLL binary file of a simulation model according to a Windows PE Binary standard, and obtaining a resource configuration file; analyzing the function import table, and establishing Windows related function mapping which is internally realized; the related resources of the thread are initialized; modifying the register content of the Linux platform, and modifying a function calling register mode and a push mode; creating or distributing computer CPU (Central Processing Unit) kernel and memory resources, and initializing a DLL (Dynamic Link Library) entry function; data input and output are realized through a DLL interface, and scheduling of the simulation model dynamic library is completed. According to the method and device, a non-intrusive model packaging scheduling method can be adopted, the format does not need to be recompiled and changed, the dynamic library in the DLL format is directly scheduled in Linux, and the operation function and efficiency are not affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer simulation, and more specifically, to a cross-platform non-intrusive simulation model scheduling method and device thereof. Background Art

[0002] Generally, simulation systems need to run and schedule various simulation models, and realize simulation functions by periodically advancing simulation model solutions. The use and maintenance of simulation models are important contents of simulation system deployment and implementation. With the development of business needs, more and more simulation systems need to be compatible with the operation modes of different operating system platforms, but the integration of cross-platform simulation models increases the maintenance workload. In addition, in existing simulation systems, the operation of simulation models generally adopts the dynamic library call method. The dynamic libraries running on different operating system platforms (Windows or Linux) are different. For example, the model dynamic library running in Windows is in DLL format, which needs to be recompiled into the So format dynamic library in Linux before it can be integrated into Linux for use, which brings many inconveniences to the authorization and version upgrade of simulation models. Summary of the invention

[0003] The present invention provides a cross-platform non-intrusive simulation model scheduling method and device thereof, which can adopt a non-intrusive model encapsulation scheduling method, directly schedule a dynamic library in DLL format in a Linux operating system without recompiling and changing the format, and the operating function and efficiency are not affected.

[0004] In order to achieve these purposes and other advantages of the present invention, in a first aspect, the present invention provides a cross-platform non-intrusive simulation model scheduling method, the steps of calling a simulation model dynamic library in DLL format under a Linux operating system include: When loading the simulation model dynamic library, the DLL binary file of the simulation model is parsed according to the Windows PE Binary specification to obtain a resource configuration file, wherein the resource configuration file includes a function import table and a function export table, a Heap memory mapping relationship table, and a thread-related resource table; Parse the obtained function import table and establish a mapping to the internally implemented Windows related functions; Initialize thread-related resources to implement resource application for thread creation; Modify the register content of the Linux operating system platform, and modify the function call register method and stack push method according to the Windows function specification; Create or allocate the computer's CPU core and memory resources, and initialize the DLL entry function; Data input and output are realized through the DLL interface to complete the scheduling of the simulation model dynamic library.

[0005] Preferably, in the cross-platform non-intrusive simulation model scheduling method, the thread-related resources include: a program counter, a register set and a stack space.

[0006] Preferably, in the cross-platform non-intrusive simulation model scheduling method, the modification of the register content of the Linux operating system platform specifically comprises: modifying the values ​​of the program register and the stack pointer, and modifying the value of the status register, so as to adjust the running state of the simulation model dynamic library function.

[0007] Preferably, in the cross-platform non-intrusive simulation model scheduling method, the function call register mode includes: segment, flag, instruction pointer and addressing; the stack push mode includes: parameter passing, return address, stack frame allocation and register state saving.

[0008] Preferably, in the cross-platform non-intrusive simulation model scheduling method, the initialization DLL entry function specifically includes: initializing variable macros, modifying pre-call memory, and mapping the call function.

[0009] In a second aspect, the present invention further provides a cross-platform non-intrusive simulation model scheduling device, which is applied to the cross-platform non-intrusive simulation model scheduling method, comprising: The analyzer module is used to parse the DLL binary file of the simulation model according to the Windows PE Binary specification to obtain the resource configuration file; The parser module is used to parse the obtained function import table and establish a mapping to the internally implemented Windows related functions; The pre-processing module is used to initialize thread-related resources to realize resource application for thread creation; modify the register content of the Linux operating system platform, and modify the function call register mode and stack push mode according to the Windows function specification; create or allocate the computer's CPU core and memory resources, and initialize the DLL entry function; The calling module realizes data input and output through the DLL interface and completes the scheduling of the simulation model dynamic library.

[0010] In a third aspect, the present invention also provides an electronic device, comprising: one or more processors; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the cross-platform non-intrusive simulation model scheduling method.

[0011] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the cross-platform non-intrusive simulation model scheduling method.

[0012] The present invention at least includes the following beneficial effects: when the present invention calls the simulation model dynamic library in DLL format under the Linux operating system, in the process of loading the simulation model dynamic library, the analyzer module first parses the DLL binary file of the simulation model according to the Windows PE Binary specification to obtain the resource configuration file, and then the parser module parses the obtained function import table to establish the Windows related function mapping to the internal implementation; then the pre-processing module initializes the thread related resources to realize the resource application for thread creation; modifies the register content of the Linux operating system platform, and modifies the function call register mode and the stack push mode according to the Windows function specification; creates or allocates the CPU core and memory resources of the computer, and initializes the DLL entry function; finally, the calling module realizes the input and output of data through the DLL interface, and completes the scheduling of the simulation model dynamic library. Therefore, when the present invention loads the dynamic library in the simulation model DLL format, the interface or class reference method is not used for integration, which reduces the compile-time dependence; when the scheduling DLL is running, the software program does not control the DLL process, and only realizes the interaction of data by accessing its memory and register information, thereby realizing the non-invasive scheduling of the DLL. After actual testing, the execution efficiency of scheduling and running the simulation model dynamic library in DLL format in the Linux operating system is equivalent to or slightly better than the operation of DLL in Windows (about 3%). In summary, the present invention aims at the problem of cross-platform simulation model operation and maintenance. By means similar to a loader, without affecting the stability of model operation, a non-intrusive model encapsulation scheduling method is adopted to achieve the same simulation model DLL format dynamic library, which can be scheduled and run in different operating system platforms.

[0013] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 Schematic diagram of the process of a cross-platform non-intrusive simulation model scheduling method in an embodiment of the present invention; Figure 2 Schematic diagram of the module relationship of the cross-platform non-intrusive simulation model scheduling device in an embodiment of the present invention. DETAILED DESCRIPTION

[0015] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.

[0016] It should be understood that the terms such as “having”, “including” and “comprising” used herein do not exclude the existence or addition of one or more other elements or combinations thereof.

[0017] like Figure 1~Figure 2 As shown, the embodiment of the present invention provides a cross-platform non-intrusive simulation model scheduling method, and the steps of calling a simulation model dynamic library in DLL format under a Linux operating system include: Step S10: When loading the simulation model dynamic library, the DLL binary file of the simulation model is parsed according to the Windows PE Binary specification to obtain a resource configuration file, wherein the resource configuration file includes a function import table and a function export table, a Heap memory mapping relationship table, a thread-related resource table, a function pointer offset, etc.

[0018] Step S20: parse the obtained function import table and establish a mapping to the internally implemented Windows related functions.

[0019] Among them, the Windows-related function LvWinAPI covers 24 categories and 422 basic APIs under the Windows operating system, including files, threads, memory management, and process synchronization.

[0020] Step S30: Initialize thread-related resources (TLS) to implement resource application for thread creation.

[0021] The thread-related resources (TLS) include: a program counter, a register set and a stack space.

[0022] Step S40: modify the register content of the Linux operating system platform, and modify the function call register mode and stack push mode according to the Windows function specification.

[0023] The modification of the register content of the Linux operating system platform specifically includes: modifying the values ​​of the program register and the stack pointer, and modifying the value of the status register, so as to adjust the running state of the simulation model dynamic library function. The function call register mode includes: segment, flag, instruction pointer and addressing; the stack push mode includes: parameter passing, return address, stack frame allocation and register state saving.

[0024] Step S50: Create or allocate the CPU core and memory resources of the computer, and initialize the DLL entry function.

[0025] The initialization DLL entry function specifically includes: initializing variable macros, modifying pre-call memory, and mapping the calling function.

[0026] Step S60: Implement data input and output through the DLL interface to complete the scheduling of the simulation model dynamic library.

[0027] In summary, the embodiment of the present invention does not use interface or class reference method integration when loading the dynamic library in the simulation model DLL format, thereby reducing the compile-time dependency; when scheduling the DLL to run, the software program does not control the DLL process, but only implements data interaction by accessing its memory and register information, thereby realizing non-invasive scheduling of the DLL.

[0028] In a second aspect, the present invention further provides a cross-platform non-intrusive simulation model scheduling device, which is applied to the cross-platform non-intrusive simulation model scheduling method, comprising: The analyzer module is used to parse the DLL binary file of the simulation model according to the Windows PE Binary specification to obtain the resource configuration file; The parser module is used to parse the obtained function import table and establish a mapping to the internally implemented Windows related functions; The pre-processing module is used to initialize thread-related resources to realize resource application for thread creation; modify the register content of the Linux operating system platform, and modify the function call register mode and stack push mode according to the Windows function specification; create or allocate the computer's CPU core and memory resources, and initialize the DLL entry function; The calling module realizes data input and output through the DLL interface and completes the scheduling of the simulation model dynamic library.

[0029] Therefore, the method and device provided in the embodiments of the present invention, to solve the problem of cross-platform simulation model operation and maintenance, adopts non-intrusive model encapsulation and scheduling technology through means similar to a loader, without affecting the operational stability of the simulation model, and realizes the dynamic library of the same simulation model in DLL format, which can be operated and scheduled on different operating system platforms.

[0030] Another embodiment of the present invention also provides an electronic device, comprising: one or more processors; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the cross-platform non-intrusive simulation model scheduling method.

[0031] Yet another embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the cross-platform non-intrusive simulation model scheduling method is implemented.

[0032] Through the description of the above implementation mode, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits, etc. However, for the present invention, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, RandomAccess Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0033] The following is a specific example to illustrate this.

[0034] Test environment: 1) Computer main configuration: a) CPU processor: i7-14700KF, 20 cores and 28 threads; b) Memory: 32GB, DDR5, frequency 6800MHz.

[0035] 2) Operating system: a) Windows environment: Windows 10 version; b) Linux environment: CentOS 7.9 version.

[0036] (2) Running example The simulation scheduling engine is written in C++ code and can be compiled and run successfully in Windows and Linux environments. The simulation model uses the DLL dynamic library file under Windows. The simulation model function is to calculate the mechanical motion of objects and uses the general motion equation formula for step-by-step solution with a solution step length of 100 milliseconds.

[0037] (3) Testing process Under the condition of two computers with the same configuration, 100 test simulation models are called through the simulation scheduling engine to solve them in parallel, the pre-prepared calculation parameters are input, and the calculation result output time of the 100 simulation models is monitored.

[0038] (4) Test results Within 100 seconds, a single simulation model was solved 1000 times, and 100 simulation models were solved in parallel. Under the Linux operating system, 100 simulation models had a solution output time of less than 100 milliseconds, and under the Windows operating system, 96 to 98 simulation models had a solution output time of less than 100 milliseconds. The operating efficiency was slightly lower by 2% to 4%.

[0039] The number of devices and processing scales described here are used to simplify the description of the present invention. Applications, modifications and variations of the present invention will be obvious to those skilled in the art.

[0040] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.

Claims

1. A cross-platform non-intrusive simulation model scheduling method, characterized in that: The steps of calling the simulation model dynamic library in DLL format under the Linux operating system include: When loading the simulation model dynamic library, the DLL binary file of the simulation model is parsed according to the Windows PE Binary specification to obtain a resource configuration file, wherein the resource configuration file includes a function import table and a function export table, a Heap memory mapping relationship table, and a thread-related resource table; Parse the obtained function import table and establish a mapping to the internally implemented Windows related functions; Initialize thread-related resources to implement resource application for thread creation; Modify the register content of the Linux operating system platform, and modify the function call register method and stack push method according to the Windows function specification; Create or allocate the computer's CPU core and memory resources, and initialize the DLL entry function; Data input and output are realized through the DLL interface to complete the scheduling of the simulation model dynamic library.

2. The cross-platform non-intrusive simulation model scheduling method according to claim 1, characterized in that: The thread-related resources include: a program counter, a register set and a stack space.

3. The cross-platform non-intrusive simulation model scheduling method according to claim 1, characterized in that: The modification of the register content of the Linux operating system platform specifically includes: modifying the values ​​of the program register and the stack pointer, and modifying the value of the status register, so as to adjust the running state of the simulation model dynamic library function.

4. The cross-platform non-intrusive simulation model scheduling method according to claim 1, characterized in that: The function call register mode includes: segment, flag, instruction pointer and addressing; the stack push mode includes: parameter transfer, return address, stack frame allocation and register state preservation.

5. The cross-platform non-intrusive simulation model scheduling method according to claim 1, characterized in that: The initialization DLL entry function specifically includes: initializing variable macros, modifying pre-call memory, and mapping the calling function.

6. A cross-platform non-intrusive simulation model scheduling device, applied to the cross-platform non-intrusive simulation model scheduling method according to any one of claims 1 to 5, characterized in that: include: The analyzer module is used to parse the DLL binary file of the simulation model according to the Windows PE Binary specification to obtain the resource configuration file; The parser module is used to parse the obtained function import table and establish a mapping to the internally implemented Windows related functions; The pre-processing module is used to initialize thread-related resources to realize resource application for thread creation; modify the register content of the Linux operating system platform, and modify the function call register mode and stack push mode according to the Windows function specification; create or allocate the computer's CPU core and memory resources, and initialize the DLL entry function; The calling module realizes data input and output through the DLL interface and completes the scheduling of the simulation model dynamic library.

7. An electronic device, characterized in that include: one or more processors; And a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the cross-platform non-intrusive simulation model scheduling method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that A computer program is stored on the storage medium, and when the program is executed by the processor, the cross-platform non-intrusive simulation model scheduling method described in any one of claims 1 to 5 is implemented.