Inter-process communication method and system
By combining a shared memory management module and an event-triggered mechanism with memory pool management and other optimization methods, the problems of high data copy overhead and low synchronization efficiency in traditional inter-process communication are solved, achieving efficient and reliable inter-process communication to meet the needs of high real-time and high-concurrency applications.
Patent Information
- Application Number
- CN202511896560.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-03-06
AI Technical Summary
Traditional inter-process communication mechanisms suffer from high data copying overhead, low synchronization and notification efficiency, and complex resource contention, leading to system throughput bottlenecks, poor real-time response capabilities, and instability.
By employing a shared memory management module and an event-triggered mechanism, combined with memory pool management, free slot detection, data verification, mutex locks, and message priority sorting, direct data reading and writing and fast interaction between processes are achieved, memory resource allocation and usage are optimized, and data integrity and orderly transmission are ensured.
Significantly reduce communication latency, improve system resource utilization, enhance communication reliability and real-time performance, avoid data loss or conflicts, and strengthen system stability and emergency response capabilities.
Smart Images

Figure CN121614294A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer system technology, specifically to an inter-process communication method and system. Background Technology
[0002] In the field of computer software and operating systems, inter-process communication (IPC) is a core foundation for realizing complex application functions. Modern software systems, such as large databases, cloud computing platforms, and real-time trading systems, generally adopt a modular, microservice architecture, deploying different functions in independent processes and completing complex tasks through inter-process collaboration. This makes efficient, low-latency inter-process data exchange a key factor affecting the overall system performance.
[0003] Traditional inter-process communication (IPC) mechanisms mainly include pipes, message queues, semaphores, and sockets. These methods mostly require deep involvement of the operating system kernel, with data needing to be copied from the sending process's user space buffer to the kernel buffer, and then from the kernel buffer to the receiving process's user space buffer—at least two data copies. For applications requiring frequent transmission of large amounts of data, such as video processing, scientific simulations, and high-speed data acquisition, the CPU overhead and memory bandwidth consumption from these multiple data copies are extremely significant, becoming a major bottleneck restricting system throughput—the "copy overhead" problem. Furthermore, the synchronization and notification efficiency of traditional communication mechanisms is low. The receiving process needs to check for new messages through polling or blocking. Polling continuously consumes CPU resources, while blocking causes the process to suspend, affecting real-time response capabilities. Simultaneously, when multiple processes compete for shared resources, complex synchronization primitives are required to ensure data consistency, resulting in complex programming models and a high risk of deadlocks or data races, severely impacting system stability and development efficiency. Existing mechanisms are no longer sufficient to meet the communication needs of modern high-concurrency, high-real-time applications. Therefore, we propose an IPC method and system to address these problems. Summary of the Invention
[0004] The purpose of this invention is to provide an inter-process communication method and system to solve the problems mentioned in the background art.
[0005] The technical solution of the present invention is: an inter-process communication method and system, including a shared memory management module, wherein the shared memory management module is data-connected to a sending process interface module and a receiving process interface module respectively, the sending process interface module is signal-connected to an event mailbox management module, and the event mailbox management module is signal-connected to the receiving process interface module; The shared memory management module includes a memory pool management unit, which is signal-connected to an address mapping unit, and the address mapping unit is signal-connected to a slot status management unit. The event mailbox management module includes a message queue unit, and the message queue unit is signal-connected to a synchronization primitive unit. The sending process interface module includes an API interface unit, which is signal-connected to a data writing unit, and the data writing unit is signal-connected to an event notification unit. The receiving process interface module includes an API interface unit, which is signal-connected to an event listening unit, which is signal-connected to a data reading unit, and which is signal-connected to a resource release unit.
[0006] Preferably, the memory pool management unit is signal-connected to a memory allocation optimization unit, and the memory allocation optimization unit is signal-connected to an address mapping unit.
[0007] Preferably, the slot status management unit is signal-connected to an idle slot detection unit, and the idle slot detection unit is data-connected to the data writing unit of the sending process interface module.
[0008] Preferably, the synchronization primitive unit is signal-connected to a mutex lock unit, and the mutex lock unit is signal-connected to the message queue unit.
[0009] Preferably, the data writing unit is signal-connected to a data verification unit, and the data verification unit is signal-connected to an event notification unit.
[0010] Preferably, the event monitoring unit is signal-connected to a timeout processing unit, and the timeout processing unit is signal-connected to the data reading unit.
[0011] Preferably, the resource release unit is signal-connected to a memory reclamation unit, and the memory reclamation unit is data-connected to the memory pool management unit of the shared memory management module.
[0012] Preferably, the message queue unit is signal-connected to a message priority sorting unit, and the message priority sorting unit is signal-connected to the event listening unit of the receiving process interface module. This invention provides an improved inter-process communication method and system, which, compared with the prior art, has the following improvements and advantages: Firstly, this invention combines a shared memory management module with an event triggering mechanism to achieve direct data reading and writing and rapid interaction between processes, significantly reducing communication latency and meeting the needs of high real-time scenarios.
[0013] Secondly, this invention achieves the effect of reasonable allocation and efficient reuse of memory resources through the synergy of the memory pool management unit, the free slot detection unit, and the memory reclamation function, thereby reducing memory waste and leakage and improving system resource utilization.
[0014] Thirdly, this invention, through a data verification unit, a mutex lock unit, and a message priority sorting function, achieves the effect of ensuring the integrity of communication data and orderly transmission, avoiding data loss or conflict, and improving communication reliability. Attached Figure Description
[0015] The present invention will be further explained below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of the core architecture of the system of this invention; Figure 2 This is a data transmission flowchart of the present invention; Figure 3 This is a flowchart of the data receiving process of the present invention; Figure 4 This is a flowchart of the shared memory management process of the present invention. Detailed Implementation
[0016] The present invention will now be described in detail, and the technical solutions in the embodiments of the present invention will be clearly and completely described. 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.
[0017] This invention provides an improved inter-process communication method and system. The technical solution of this invention is as follows: like Figure 1 - Figure 4 As shown, an inter-process communication method and system includes a shared memory management module, characterized in that: the shared memory management module is data-connected to a sending process interface module and a receiving process interface module respectively, the sending process interface module is signal-connected to an event mailbox management module, and the event mailbox management module is signal-connected to the receiving process interface module; The shared memory management module includes a memory pool management unit, which is signal-connected to an address mapping unit, and the address mapping unit is signal-connected to a slot status management unit. The event mailbox management module includes a message queue unit, and the message queue unit is connected to a synchronization primitive unit via a signal. The sending process interface module includes an API interface unit, which is connected to a data writing unit via a signal, and the data writing unit is connected to an event notification unit via a signal. The receiving process interface module includes an API interface unit, which is connected to an event listening unit. The event listening unit is connected to a data reading unit, which is connected to a resource release unit.
[0018] Furthermore, the memory pool management unit is signal-connected to the memory allocation optimization unit, which is signal-connected to the address mapping unit. Through the combined action of the memory pool management unit and the memory allocation optimization unit, the optimization unit selects the allocation algorithm after considering the data block size and lifecycle. This achieves reasonable memory space partitioning and utilization, and eliminates memory fragmentation caused by frequent allocation and release, thereby improving memory utilization and the stability of the system during long-term operation.
[0019] Furthermore, the slot status management unit is signal-connected to the idle slot detection unit, which is data-connected to the data writing unit of the sending process interface module. The detection unit uses both the slot status management unit and the idle slot detection unit to monitor the occupancy status of each slot in the memory pool in real time. When a slot is provided to the sending process interface, it returns the slot that is in an idle state, allowing the sending process to write to the specified target. This solves the problem of blindly trying multiple possible positions and relying on luck, thereby greatly improving the efficiency and success rate of data writing.
[0020] Furthermore, the synchronization primitive unit is connected to a mutex unit, which is connected to the message queue unit. By combining the synchronization primitive unit and the mutex unit, when a process accesses the shared message queue, the mutex lock ensures that only one process modifies it at any given time, thus achieving mutual constraint among multiple processes and preventing data competition, overwriting, or inconsistent data reading caused by concurrent operations of multiple processes.
[0021] Furthermore, the data writing unit is connected to a data verification unit, which is connected to the event notification unit. By having the data writing unit and the data verification unit cooperate, the verification unit performs calculations to obtain relevant verification information before or after writing data into the shared memory, which is then added to the data. This can prevent data errors caused by hardware or software reasons from going unnoticed, thus improving the reliability of communication.
[0022] Furthermore, the event listening unit is signal-connected to a timeout processing unit, which is signal-connected to the data reading unit. The event listening unit triggers the timeout processing unit, initiating a timeout while the event listener is waiting for an event. If no event is received within the timeout period, a pre-defined callback function is executed. This process also facilitates asynchronous non-blocking communication between processes, resolving the issue of the receiving process being perpetually suspended while waiting for messages, thus improving system robustness and fault tolerance.
[0023] Furthermore, the resource release unit is signal-connected to the memory reclamation unit, which is data-connected to the memory pool management unit of the shared memory management module. Through the cooperation of the resource release unit and the memory reclamation unit, when the receiving process finishes reading, the resource release unit will tell the memory reclamation unit to mark the corresponding memory slot as free and return it to the memory pool, thereby realizing the problem of automatic recycling and reuse of memory resources, preventing memory leaks caused by forgetting to release resources, and meeting the need for resource recycling.
[0024] Furthermore, the message queue unit is signal-connected to a message priority sorting unit, which in turn is signal-connected to the event listening unit of the receiving process interface module. Utilizing the linkage mechanism between the message queue unit and the message priority sorting unit, messages are sorted according to their inherent or attached priority attributes. This resolves the issue of all messages entering a single message queue at the same rate, which could delay urgent tasks and further improve the system's emergency response capabilities.
[0025] The foregoing description enables those skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method and system for inter-process communication, comprising a shared memory management module, characterized by: The shared memory management module is connected with a sending process interface module and a receiving process interface module respectively, the sending process interface module is connected with an event mailbox management module, and the event mailbox management module is connected with the receiving process interface module; The shared memory management module comprises a memory pool management unit, the memory pool management unit is connected with an address mapping unit, and the address mapping unit is connected with a slot state management unit; The event mailbox management module comprises a message queue unit, and the message queue unit is connected with a synchronization primitive unit; The sending process interface module comprises an API interface unit, the API interface unit is connected with a data writing unit, and the data writing unit is connected with an event notification unit; The receiving process interface module comprises an API interface unit, the API interface unit is connected with an event listening unit, the event listening unit is connected with a data reading unit, and the data reading unit is connected with a resource releasing unit.
2. The inter-process communication method and system of claim 1, wherein: The memory pool management unit is connected with a memory allocation optimization unit, and the memory allocation optimization unit is connected with the address mapping unit.
3. The inter-process communication method and system of claim 1, wherein: The slot state management unit is connected with a free slot detection unit, and the free slot detection unit is connected with the data writing unit of the sending process interface module.
4. The inter-process communication method and system of claim 1, wherein: The synchronization primitive unit is connected with a mutex unit, and the mutex unit is connected with the message queue unit.
5. The inter-process communication method and system of claim 1, wherein: The data writing unit is connected with a data checking unit, and the data checking unit is connected with the event notification unit.
6. The inter-process communication method and system of claim 1, wherein: The event listening unit is connected with a timeout processing unit, and the timeout processing unit is connected with the data reading unit.
7. The inter-process communication method and system of claim 1, wherein: The resource releasing unit is connected with a memory recycling unit, and the memory recycling unit is connected with the memory pool management unit of the shared memory management module.
8. The inter-process communication method and system of claim 1, wherein: The message queue unit is connected with a message priority sorting unit, and the message priority sorting unit is connected with the event listening unit of the receiving process interface module.