Containerized simulation virtual time synchronization system and method based on dynamic library hijacking
By deploying a time hijacking agent and coordination device in containerized network simulation, and utilizing dynamic library hijacking technology to achieve virtual time control of the simulation process, the problem of uncontrollable time in existing technologies is solved, and simulation acceleration and resource optimization are achieved. It is applicable to Kubernetes and Docker environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTHWEST UNIVERSITY FOR NATIONALITIES
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-12
AI Technical Summary
Existing containerized network simulation technology cannot accelerate the simulation process, resulting in low efficiency of large-scale, long-cycle experiments and serious waste of computing resources, failing to meet the needs of high-concurrency, fast-paced automated testing.
A containerized simulation virtual time synchronization system based on dynamic library hijacking is adopted. By deploying a time hijacking agent in the container and a time coordination device on the host machine, the system uses dynamic library hijacking technology to intercept time-related requests, thereby realizing virtual time control and synchronization of the simulation process.
It accelerates simulation time, improves the R&D iteration efficiency of large-scale, long-cycle experiments, ensures high repeatability of simulation results, and reduces resource overhead. It is suitable for standard Kubernetes or Docker container environments.
Smart Images

Figure CN122195580A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of containerized network simulation technology, specifically relating to a containerized simulation virtual time synchronization system and method based on dynamic library hijacking. Background Technology
[0002] With the rapid development of cloud computing and network technologies, the demand for large-scale, high-precision network simulation is growing. In scenarios such as building network digital twins or conducting complex network protocol tests, in order to maximize the reproduction of the real network environment's operating state and ensure high fidelity of the simulation, industry and academia are gradually turning to containerization technology as the mainstream simulation platform. Unlike traditional low-fidelity simulations that only simulate protocol logic at the software level, containerization technology allows running a large number of independent instances containing complete operating systems and real network protocol stacks in single-machine or cluster environments, thereby achieving accurate replication of real network behavior with extremely low resource overhead.
[0003] Current mainstream containerized network simulation solutions, such as conventional test environments based on Docker or Kubernetes, typically employ a strategy of directly using the host machine's physical clock. In this approach, while containers achieve isolation in terms of file system, process space, and network namespace, they remain completely transparent with the host kernel in the time dimension. When the simulation process running inside the container obtains the time via standard system calls, it directly reads the real-time hardware clock maintained by the host operating system kernel. The flow of time in the simulation world is forcibly locked at a 1:1 ratio with the real world, and all container nodes are passively synchronized with the host machine's NTP time source, lacking an independent time control dimension.
[0004] The most significant drawback of this technical solution is its inability to accelerate the simulation process, resulting in extremely low efficiency for large-scale, long-cycle experiments. In network protocol verification or distributed system testing, there are often numerous sleep-waiting operations, such as TCP retransmission timeouts, Hello packet intervals in routing protocols, and heartbeat detection. Because the passage of time is tied to physical time, the CPU must be truly idle during these waiting periods, unable to skip idle periods without computational tasks. This not only forces simulation scenarios to take several days of real-world time to run, severely hindering R&D iteration speed, but also results in a huge waste of host machine computing resources and power during the several-minute sleep wait periods, as the host CPU does not perform any effective computational tasks but is occupied by the simulation process, failing to meet the demands of high-concurrency, fast-paced automated testing. Summary of the Invention
[0005] To address the aforementioned shortcomings in existing technologies, the containerized simulation virtual time synchronization system and method based on dynamic library hijacking provided by this invention solves the technical problems of uncontrollable time and distributed timing inconsistencies caused by the strong dependence of existing containerized simulation technologies on physical clocks.
[0006] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows: Firstly, a containerized simulation virtual time synchronization system based on dynamic library hijacking is provided, comprising a time hijacking proxy device distributed in the container, a time coordination device distributed on the host machine, and a cross-domain data exchange interface for storing global virtual time; the time hijacking proxy device includes: The dynamic injection and symbol overriding module is used to inject isomorphic interception functions. The dynamic library path is written to the container environment variables, and the target simulation business process is established. The mapping relationship; Intercept the running target simulation service process and determine the type of request initiated by the target simulation service process; The time query redirection module is used when initiating a time query request, and adopts... Read global virtual time And return a success status code to the caller; The blocking semantics virtualization module is used when the initiated request is a blocking request. Calculate the target wake-up time And then uploaded to the time coordination device, after which exist Check if it is less than during update. If so, then wait. renew, Suspend the target simulation process; otherwise Release the suspension of the target simulation process; The time coordination device is used to receive the target wake-up time of the blocking semantic virtualization modules in all containers, update the next time according to the minimum target wake-up time or the default heartbeat interval, and update the global virtual time of the cross-domain data exchange interface using the next time.
[0007] Furthermore, the isomorphic interception function It is a software unit with both isomorphic external interfaces and heterogeneous internal mechanisms, used for transparent takeover and seamless time redirection of the target simulation business process. It includes an external standard interface layer and an internal processing mechanism layer. The standard interface layer replicates the appearance characteristics of the target system functions, including function names, parameter lists and return value types. The internal processing mechanism layer encapsulates a data access handle and a virtual time processing unit; the data access handle is used to establish a data channel between the host user space and the target simulation business process; the virtual time processing unit executes two processing paths: for time query requests, it reads the global virtual time. For blocking requests, execute the corresponding operation of the blocking semantic virtualization module.
[0008] Furthermore, the time coordination device includes a global timing arrangement module and an atomic time distribution module; The global timing orchestration module internally maintains a global time request min-heap, which is used to include the target wake-up times uploaded by the blocking semantic virtualization modules in all containers into the min-heap and perform topological sorting; and to update the next time step according to the minimum target wake-up time or the default heartbeat interval in the min-heap. The atomic time distribution module is used to receive the next moment calculated by the global time series orchestration module and use the next moment to update the global virtual time of the cross-domain data exchange interface.
[0009] Furthermore, methods for updating the next time step based on the minimum target wake-up time in the min-heap or the default heartbeat interval include: A1. Determine if the min-heap is empty. If it is, proceed to step A3; otherwise, proceed to step A2. A2. Read the minimum target wake-up time in the min-heap and update the next time step to be equal to the minimum target wake-up time; A3. Based on the default heartbeat interval Calculate the next time step .
[0010] Furthermore, adopt Calculate the target wake-up time The methods include: Obtain the expected waiting time passed from the target simulation service process. Global virtual time for cross-domain data exchange interfaces; The global virtual time is used as the virtual time reference for the current moment. And use isomorphic interception function Calculate the target wake-up time .
[0011] Furthermore, the dynamic injection and symbol overriding module includes constraint injection, dynamic library loading, address remapping, and process interception; The constraint injection is used to install a dynamic library with an internally encapsulated isomorphic interception function, write its path as an environment variable into the Linux operating system's environment variables, and inject it into the container's initial process context. The dynamic library loading is used to read the information of the dynamic library and map it to the virtual memory space of the target simulation business process when the target simulation business process starts, and to generate a list of pointers including the entry address of the isomorphic interception function. The address remapping is used to traverse all undefined symbol references in the target simulation service process. When a reference is located in the input intercepted symbol set, the corresponding isomorphic interception function is searched in the pointer list. The entry address, and establish The linked list mapping relationship; The process interception is used to employ Intercept the running target simulation business process and determine the type of request initiated by the target simulation business process.
[0012] Furthermore, adopt Read global virtual time The success status code returned to the caller further includes: use Read global virtual time And according to the return value type of the standard interface layer Perform the calculation: For the timeval structure corresponding to the gettimeofday interface, the isomorphic interception function performs integer division. Get the number of seconds and perform mixed operations. Get the microseconds. For mold taking operation; For the timesspec structure corresponding to the clock_gettime interface, the isomorphic interception function performs integer division. Get the number of seconds and perform the modulo operation. mod Obtain the nanoseconds; After the calculation is complete, the isomorphic interception function updates the calculation result to the memory address passed in by the target simulation business process and returns a success status code to the caller.
[0013] Secondly, a synchronization method for a containerized simulation virtual time synchronization system based on dynamic library hijacking is provided, which includes the following steps: S1. Initialize the global virtualization time to zero, and encapsulate the isomorphic interception function. The dynamic library path is written to the container environment variables, and the target simulation business process is established. The mapping relationship; S2. When the target simulation service process is running, adopt... Intercept it, and proceed to step S3 if the request initiated in the target simulation business process is a time query request, and proceed to step S4 if the request is a blocking request; S3 Read global virtual time Then return a success status code to the caller, and proceed to step S6; S4, Adopt Calculate the target wake-up time It is then uploaded to the time coordination device, which updates the next moment based on the minimum target wake-up time or the default heartbeat interval, and uses the next moment to update the global virtual time; S5 Polling the cross-domain data exchange interface, in Check during update Is it less than ,if, Suspend the target simulation process and continue with step S5; otherwise Stop the polling and release the suspension of the target simulation business process, then proceed to step S6; S6. Determine whether the target simulation business process has ended. If so, terminate all containers and generate a report; otherwise, return to step S2.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: 1) Achieve ultra-real-time simulation acceleration. By using blocking semantic virtualization technology, the physical waiting time of the application is transformed into active detection of virtual time updates. This allows skipping idle periods without computational tasks and compressing physical wait times of several seconds into microsecond-level operations. As a result, the simulation speed is no longer limited by the passage of physical time, significantly improving the R&D iteration efficiency of large-scale, long-cycle experiments.
[0015] 2) Ensuring high repeatability of simulation results. By constructing a unique global virtual timeline for the entire system, all simulation nodes are forced to strictly update their logical time according to the unified global virtual time, effectively eliminating timing deviations caused by host CPU scheduling jitter. This ensures that the causal order of simulation events is absolutely consistent and stably reproducible in complex concurrent competition scenarios.
[0016] 3) Extremely low resource overhead and high scalability. This system is implemented based on user-space dynamic link libraries, avoiding frequent kernel context switching and resulting in extremely low CPU and memory resource consumption. Combined with a high-concurrency cross-domain data exchange interface based on a memory file system, a single coordinator can efficiently drive the synchronous operation of hundreds or thousands of container nodes, which can well support the construction needs of large-scale network ranges or digital twin clusters.
[0017] 4) Wide applicability and non-intrusiveness. Utilizing the standard Linux dynamic linking mechanism (which encapsulates isomorphic interception functions) (The dynamic library path is written to the container environment variable). This invention allows direct takeover of existing network software without modifying the source code of the simulation application, recompiling the binary file, or modifying the host kernel. The system runs entirely in user space, offering high security and easy deployment and migration in standard Kubernetes or Docker container environments. Attached Figure Description
[0018] Figure 1 This is a block diagram illustrating the principle of a containerized simulation virtual time synchronization system based on dynamic library hijacking.
[0019] Figure 2 This is a flowchart of a containerized simulation virtual time synchronization method based on dynamic library hijacking. Detailed Implementation
[0020] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0021] like Figure 1 As shown, the containerized simulation virtual time synchronization system based on dynamic library hijacking provided by this solution includes a time hijacking agent distributed in the container, a time coordination device distributed on the host machine, and a cross-domain data exchange interface for storing global virtual time.
[0022] In this scheme, the system establishes an operating principle based on interception-freeze-on-demand execution. The system utilizes dynamic injection technology to establish a checkpoint at the entry point of a process initiating a system call, intercepting all time-related requests. Once a request is intercepted, the instructions originally pointing to the kernel by the target simulation process are suspended, and the process logically enters a time-frozen state, stripping itself of its attributes that flow with physical time. Only upon receiving an external time coordination instruction is the process assigned a new virtual timestamp and unblocked. This mechanism transforms continuous physical time into discrete, controllable logical steps.
[0023] This system establishes a single virtual clock source for the entire system, which is maintained uniformly by a time coordination device. Time hijacking agents distributed across various containers act as distributed sensors and actuators, aggregating intercepted time requests to the time coordination device. The time coordination device calculates the global time step based on causal dependencies, ensuring that the distributed container cluster strictly follows a unified virtual time pace in an asynchronous physical environment.
[0024] The time hijacking proxy device includes: The dynamic injection and symbol overriding module is used to inject isomorphic interception functions. The dynamic library path is written to the container environment variables, and the target simulation business process is established. The mapping relationship; Intercept the running target simulation business process and determine the type of request initiated by the target simulation business process.
[0025] In implementation, this solution preferably uses the isomorphic interception function. This software unit, characterized by both isomorphic external interfaces and heterogeneous internal mechanisms, is used for transparent takeover and seamless time redirection of the target simulation process. It comprises an external standard interface layer and an internal processing mechanism layer. The standard interface layer replicates the appearance characteristics of the target system functions (target system functions = standard system interfaces provided by the Linux operating system kernel related to time acquisition and process blocking), including function names, parameter lists, and return value types. This completely consistent interface design enables… Disguised as a standard system function of the operating system, it can be automatically called by the program by taking advantage of the operating system's dynamic linking mechanism, thus becoming the only entry point between the business process and the underlying kernel.
[0026] The internal processing mechanism layer encapsulates a data access handle and a virtual time processing unit. The data access handle is a protected static variable that is automatically initialized and protected by an atomic flag when the program first runs, establishing a direct data channel from user space to the external virtual time source. In other words, the data access handle is used to establish a data channel between the host user space and the target simulation business process. The virtual time processing unit executes two processing paths: for time query requests, it reads the global virtual time. For blocking requests, execute the corresponding operation of the blocking semantic virtualization module.
[0027] In one embodiment of the present invention, the dynamic injection and symbol overriding module includes constraint injection, dynamic library loading, address remapping, and process interception; The constraint injection is used to install a dynamic library with an internally encapsulated isomorphic interception function, write its path as an environment variable into the Linux operating system's environment variables, and inject it into the container's initial process context. The dynamic library loading is used to read the information of the dynamic library and map it to the virtual memory space of the target simulation business process when the target simulation business process starts, and to generate a list of pointers including the entry address of the isomorphic interception function. The address remapping is used to traverse all undefined symbol references in the target simulation service process. When a reference is located in the input intercepted symbol set, the corresponding isomorphic interception function is searched in the pointer list. The entry address, and establish The linked list mapping relationship; The process interception is used to employ Intercept the running target simulation business process and determine the type of request initiated by the target simulation business process.
[0028] The time query redirection module is used when initiating a time query request, and adopts... Read global virtual time It also returns a success status code to the caller; the detailed implementation process is as follows: use Read global virtual time And according to the return value type of the standard interface layer Perform the calculation: For the timeval structure corresponding to the gettimeofday interface, the isomorphic interception function performs integer division. Get the number of seconds and perform mixed operations. Get the microseconds. For mold taking operation; For the timesspec structure corresponding to the clock_gettime interface, the isomorphic interception function performs integer division. Get the number of seconds and perform the modulo operation. mod Obtain the nanoseconds; After the calculation is complete, the isomorphic interception function updates the calculation result to the memory address passed in by the target simulation business process and returns a success status code to the caller.
[0029] In the time query redirection module, before performing a global virtual time read, the interception function first initiates the channel establishment and data access handle status check logic. It checks the initialization status bits within the target simulation business process. If it detects that the current process does not yet hold a data access handle, it then proceeds according to the configured path. The memory mapping interface is called to establish a direct read channel to the shared memory area, and the memory mapping operation instruction (mmap) is called to project the shared memory into the virtual address space of the current process and assign the first address of the mapped memory to the data access handle, thereby establishing a high-speed physical channel for reading virtual memory. Read global virtual time It is based on the established high-speed physical channel for data reading.
[0030] The blocking semantics virtualization module is used when the initiated request is a blocking request. Calculate the target wake-up time And then uploaded to the time coordination device, after which exist Check if it is less than during update. If so, then wait. renew, Suspend the target simulation process; otherwise Release the suspension of the target simulation process.
[0031] In this plan Unsuspending the target simulation process means restoring its execution context to the state it should have been in after the original system call successfully executed. This involves simulating the original system's physical waiting process and returning a success status code. Through this process, the physical wait that would have taken hours can be completed within microseconds at the instant the simulation time jumps and updates, achieving time compression and acceleration.
[0032] During implementation, this solution preferably adopts... Calculate the target wake-up time The methods include: Obtain the expected waiting time passed from the target simulation service process. Global virtual time for cross-domain data exchange interfaces; The global virtual time is used as the virtual time reference for the current moment. And use isomorphic interception function Calculate the target wake-up time .
[0033] The time coordination device is used to receive the target wake-up time of the blocking semantic virtualization modules in all containers, update the next time according to the minimum target wake-up time or the default heartbeat interval, and use the next time to update the global virtual time of the cross-domain data exchange interface.
[0034] In this scheme, the time coordination device may include a global timing orchestration module and an atomic time distribution module; The global timing orchestration module internally maintains a global time request min-heap, which is used to include the target wake-up times uploaded by the blocking semantic virtualization modules in all containers into the min-heap and perform topological sorting; and to update the next time step according to the minimum target wake-up time or the default heartbeat interval in the min-heap. The atomic time distribution module is used to receive the next moment calculated by the global time series orchestration module and use the next moment to update the global virtual time of the cross-domain data exchange interface.
[0035] In one embodiment of the present invention, the method for updating the next time step based on the minimum target wake-up time in the min-heap or the default heartbeat interval includes: A1. Determine if the min-heap is empty. If it is, proceed to step A3; otherwise, proceed to step A2. A2. Read the minimum target wake-up time in the min-heap and update the next time step to be equal to the minimum target wake-up time; A3. Based on the default heartbeat interval Calculate the next time step .
[0036] like Figure 2 As shown, this solution also provides a synchronization method for a containerized simulation virtual time synchronization system based on dynamic library hijacking. This method S includes steps S1 to S6: S1. Initialize the global virtualization time to zero, and encapsulate the isomorphic interception function. The dynamic library path is written to the container environment variables, and the target simulation business process is established. The mapping relationship; S2. When the target simulation service process is running, adopt... Intercept it, and proceed to step S3 if the request initiated in the target simulation business process is a time query request, and proceed to step S4 if the request is a blocking request; S3 Read global virtual time Then return a success status code to the caller, and proceed to step S6; S4, Adopt Calculate the target wake-up time It is then uploaded to the time coordination device, which updates the next moment based on the minimum target wake-up time or the default heartbeat interval, and uses the next moment to update the global virtual time; S5 Polling the cross-domain data exchange interface, in Check during update Is it less than ,if, Suspend the target simulation process and continue with step S5; otherwise Stop the polling and release the suspension of the target simulation business process, then proceed to step S6; S6. Determine whether the target simulation business process has ended. If so, terminate all containers and generate a report; otherwise, return to step S2.
[0037] The following section describes the implementation, deployment environment, and configuration of the containerized simulation virtual time synchronization system and synchronization method in this solution: This embodiment is built on a standard Linux operating system, utilizing the namespace and control group features provided by its kernel to achieve isolation of simulation nodes. The specific basic environment and dependent component configurations are as follows: 1. Host operating system and kernel requirements The simulation host machine uses a Linux distribution, and a kernel version of at least 4.x is recommended to ensure stable support for container runtime and underlying system calls. The host machine needs to be configured with a precise system clock source as a reference for physical time, ensuring the scheduling accuracy of the central time coordination device itself.
[0038] 2. Building key dependency components In constructing the time bus medium, to balance the performance requirements of high-frequency read / write operations with atomicity, this embodiment does not use conventional disk storage. Instead, a dedicated directory ` / var / run / sim_platform / sync / ` is created in the host machine's memory file system. Within this directory, a file named `global_time_bus` is created as the unique absolute time source across the entire network. At the file permission control level, the system executes the `chmod 644` operation and sets the file owner to the user group of the time coordination device process.
[0039] During the container image building phase of the simulation node, a non-intrusive principle is followed. Through layered building specifications, dynamic injection and symbol overriding modules are implanted without modifying the business source code: First, the pre-compiled time interception dynamic link library libtime_intercept.so is copied to the standard system library path / usr / lib / x86_64-linux-gnu / in the image; Second, the index configuration of this library is added to the / etc / ld.so.conf.d / directory of the image to ensure that the dynamic linker can automatically recognize and load the interception module when the container starts, thus laying the foundation for system call hijacking.
[0040] 3. Environment of the time coordination device During the startup phase, the time coordination device issues key configurations to activate the time takeover mechanism, which mainly include: Environment variable set: LD_PRELOAD is used to force the interception library to be loaded before libc; SIM_TIME_FILE is set to specify the time reading path within the container; SIM_NO_CACHE=1 is configured to disable the microsecond-level cache of the interception library, forcing each gettimeofday call to penetrate to the file system, thus meeting the consistency requirements of step-by-step simulation and accurate pausing.
[0041] Storage volume mounting strategy: The host machine's global_time_bus file is mapped to a target path within the container in read-only mode using Bind Mount technology. This establishes a unidirectional data channel, ensuring that the container can only read time updates and cannot tamper with them.
[0042] Isolation configuration: Remove the container's permission to modify the system time by using --cap-drop=SYS_TIME, preventing internal processes from breaking the simulation's encapsulation through calls such as settimeofday.
[0043] 4. Under the above deployment environment and configuration, simulate a typical distributed network scenario containing multiple sensor nodes (containers A and B) and a central data processing node (container C). During the simulation startup phase, the host machine first starts the time coordination device in user space, requests and initializes the system-wide unique cross-domain data exchange shared memory (located in / var / run / sim_platform / sync / global_time_bus), and sets the global virtual address time... Reset to 0. Subsequently, simulation containers A, B, and C are started via container runtime. The system uses the LD_PRELOAD environment variable to force each business process to load the libtime_intercept.so dynamic library. Without modifying the business source code, the dynamic injection and symbol overriding module transparently takes over the target system functions such as time query class and blocking class. The window for obtaining time in the container has been redirected to the dynamic library provided by this invention.
[0044] When the simulation starts, the business process within sensor container A executes the data acquisition loop, initiating a blocking request with a `nanosleep(100ms)` pause. (Homogeneous interception function) Intercept the call and block the kernel suspend instruction by reading the current real-time global virtual timestamp. And combined with the expected waiting time Calculate the target wake-up time . via shared memory uplink The request is registered in the global time request min-heap of the central coordinator. Then, in user mode, it enters a conditional polling state and actively relinquishes CPU resources, causing the business process to be logically suspended. Upon sensing the request, the central time coordination device extracts the earliest wake-up time (100ms) from the top of the min-heap to determine the virtual time for the next moment. The time interval is 100ms. The atomic time distribution module then uses hardware-level atomic pointers to write this value into cross-domain shared memory, making the time update instantly visible to the entire network.
[0045] During this process, container C triggers a `gettimeofday` query request to record the collected logs. Its internal isomorphic interception function... By directly retrieving the current 100ms from shared memory using atomic read logic, adapting it into a standard time structure, and immediately returning it to the business process, high-precision virtual time injection is achieved. Simultaneously, container A, in a polling state, detects... Once the logic gate opens, the interception function unsuspends the process and returns a success status code, allowing the business process to resume execution and report data.
[0046] As demonstrated in this example, the data acquisition wait, which originally required 100ms of real physical time, is compressed into microsecond-level logical decisions within the simulation environment, achieving a balance between physical time compression and logical timing fidelity. This solution, while preserving the causal relationships of business timing, achieves ultra-real-time acceleration and logical determinism in large-scale cluster simulation.
[0047] In summary, the containerized simulation virtual time synchronization system and synchronization method provided in this solution transforms the blocking and waiting behavior based on physical time duration into a logical triggering mechanism based on virtual time updates, achieving complete decoupling between simulation time and physical time. This enables global coordination and instantaneous time jumps for large-scale simulation clusters, freeing simulation progress from being limited by the passage of physical time and significantly improving the R&D iteration efficiency of large-scale, long-cycle experiments.
Claims
1. A containerized simulation virtual time synchronization system based on dynamic library hijacking, characterized in that, This includes a time hijacking agent distributed within a container, a time coordination device distributed on the host machine, and a cross-domain data exchange interface for storing global virtual time; the time hijacking agent includes: The dynamic injection and symbol overriding module is used to inject isomorphic interception functions. The dynamic library path is written to the container environment variables, and the target simulation business process is established. The mapping relationship; Intercept the running target simulation service process and determine the type of request initiated by the target simulation service process; The time query redirection module is used when initiating a time query request, and adopts... Read global virtual time And return a success status code to the caller; The blocking semantics virtualization module is used when the initiated request is a blocking request. Calculate the target wake-up time And then uploaded to the time coordination device, after which exist Check if it is less than during update. If so, then wait. renew, Suspend the target simulation process; otherwise Release the suspension of the target simulation process; The time coordination device is used to receive the target wake-up time of the blocking semantic virtualization modules in all containers, update the next time according to the minimum target wake-up time or the default heartbeat interval, and update the global virtual time of the cross-domain data exchange interface using the next time.
2. The containerized simulation virtual time synchronization system based on dynamic library hijacking according to claim 1, characterized in that, The isomorphic interception function It is a software unit with both isomorphic external interfaces and heterogeneous internal mechanisms, used for transparent takeover and seamless time redirection of the target simulation business process. It includes an external standard interface layer and an internal processing mechanism layer. The standard interface layer replicates the appearance characteristics of the target system functions, including function names, parameter lists and return value types. The internal processing mechanism layer encapsulates a data access handle and a virtual time processing unit; the data access handle is used to establish a data channel between the host user space and the target simulation business process; the virtual time processing unit executes two processing paths: for time query requests, it reads the global virtual time. For blocking requests, execute the corresponding operation of the blocking semantic virtualization module.
3. The containerized simulation virtual time synchronization system based on dynamic library hijacking according to claim 1, characterized in that, The time coordination device includes a global timing arrangement module and an atomic time distribution module; The global timing orchestration module internally maintains a global time request min-heap, which is used to include the target wake-up times uploaded by the blocking semantic virtualization modules in all containers into the min-heap and perform topological sorting; and to update the next time step based on the minimum target wake-up time in the min-heap or the default heartbeat interval. The atomic time distribution module is used to receive the next time step calculated by the global time series orchestration module and use the next time step to update the global virtual time of the cross-domain data exchange interface.
4. The containerized simulation virtual time synchronization system based on dynamic library hijacking according to claim 3, characterized in that, Methods for updating the next time step based on the minimum target wake-up time in the min-heap or the default heartbeat interval include: A1. Determine if the min-heap is empty. If it is, proceed to step A3; otherwise, proceed to step A2. A2. Read the minimum target wake-up time in the min-heap and update the next time step to be equal to the minimum target wake-up time; A3. Based on the default heartbeat interval Calculate the next time step .
5. The containerized simulation virtual time synchronization system based on dynamic library hijacking according to claim 1, characterized in that, use Calculate the target wake-up time The methods include: Obtain the expected waiting time passed from the target simulation service process. Global virtual time for cross-domain data exchange interfaces; The global virtual time is used as the virtual time reference for the current moment. And use isomorphic interception function Calculate the target wake-up time .
6. The containerized simulation virtual time synchronization system based on dynamic library hijacking according to claim 1, characterized in that, The dynamic injection and symbol overriding module includes constraint injection, dynamic library loading, address remapping, and process interception. The constraint injection is used to install a dynamic library with an internally encapsulated isomorphic interception function, write its path as an environment variable into the Linux operating system's environment variables, and inject it into the container's initial process context. The dynamic library loading is used to read the information of the dynamic library and map it to the virtual memory space of the target simulation business process when the target simulation business process starts, and to generate a list of pointers including the entry address of the isomorphic interception function. The address remapping is used to traverse all undefined symbol references in the target simulation service process. When a reference is located in the input intercepted symbol set, the corresponding isomorphic interception function is searched in the pointer list. The entry address, and establish The linked list mapping relationship; The process interception is used to employ Intercept the running target simulation business process and determine the type of request initiated by the target simulation business process.
7. The containerized simulation virtual time synchronization system based on dynamic library hijacking according to claim 2, characterized in that, use Read global virtual time The success status code returned to the caller further includes: use Read global virtual time And according to the return value type of the standard interface layer Perform the calculation: For the timeval structure corresponding to the gettimeofday interface, the isomorphic interception function performs integer division. Get the number of seconds and perform mixed operations. Get the microseconds. For mold taking operation; For the timesspec structure corresponding to the clock_gettime interface, the isomorphic interception function performs integer division. Get the number of seconds and perform the modulo operation. mod Obtain the nanoseconds; After the calculation is complete, the isomorphic interception function updates the calculation result to the memory address passed in by the target simulation business process and returns a success status code to the caller.
8. The synchronization method for a containerized simulation virtual time synchronization system based on dynamic library hijacking according to any one of claims 1-7, characterized in that, Including the following steps: S1. Initialize the global virtualization time to zero, and encapsulate the isomorphic interception function. The dynamic library path is written to the container environment variables, and the target simulation business process is established. The mapping relationship; S2. When the target simulation service process is running, adopt... Intercept it, and proceed to step S3 if the request initiated in the target simulation business process is a time query request, and proceed to step S4 if the request is a blocking request; S3 Read global virtual time Then return a success status code to the caller, and proceed to step S6; S4, Adopt Calculate the target wake-up time It is then uploaded to the time coordination device, which updates the next moment based on the minimum target wake-up time or the default heartbeat interval, and uses the next moment to update the global virtual time; S5 Polling the cross-domain data exchange interface, in Check during update Is it less than ,if, Suspend the target simulation process and continue with step S5; otherwise Stop the polling and release the suspension of the target simulation business process, then proceed to step S6; S6. Determine whether the target simulation business process has ended. If so, terminate all containers and generate a report; otherwise, return to step S2.