Shared-Memory Message Queue for Faster Inter-Process Communication
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Inter-process communication using the MQTT protocol is inefficient due to its reliance on a central broker, which limits direct communication between clients.
Innovation Solution
Establishing a message queue in a shared memory space with a queue header and message storage area, utilizing pointer information to read or write message bodies efficiently, and employing concurrency control through mutual exclusion locks.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If MQTT protocol with central broker is used for inter-process communication, then message routing and subscription management are simplified, but communication efficiency deteriorates due to indirect communication path
Solution Approach 1:
The patent introduces a shared memory space as an intermediary structure that enables direct communication between processes while maintaining the organizational benefits of message queues. The message queue is implemented within shared memory, allowing processes to access message data directly without broker mediation, thus resolving the contradiction between simplified routing and communication efficiency.
Solution Approach 2:
The patent merges the message queue structure with shared memory technology, combining the organizational benefits of queues with the high-speed access of shared memory. This integration allows processes to communicate directly through shared memory while maintaining message queue semantics, eliminating the need for indirect broker-based communication and improving efficiency.
2Productivity
If shared memory with message queue is used, then inter-process communication efficiency is improved through direct access, but data integrity may deteriorate without proper concurrency control
Solution Approach 1:
The patent uses mutual exclusion locks as intermediaries to control access to the shared message queue. These locks mediate between multiple processes accessing shared memory, ensuring that only one process can modify the queue structure at a time, thus maintaining data integrity while allowing efficient concurrent access.
Solution Approach 2:
The patent implements preliminary concurrency control by acquiring mutual exclusion locks before accessing or modifying message queue data. This preliminary action prevents race conditions and ensures data integrity before any read or write operations occur on the shared memory message queue.
3Speed
If pointer-based direct memory access is used, then communication speed is improved, but system safety may worsen due to potential memory access violations
Solution Approach 1:
The patent creates a universal message queue structure in shared memory that can be safely accessed by multiple processes simultaneously. The standardized queue structure with defined headers and boundaries provides a safe interface for pointer-based access, allowing high-speed communication while preventing memory access violations through consistent structural rules.
Solution Approach 2:
The patent performs preliminary validation of pointer integrity through the structured message queue format. By defining fixed headers, boundaries, and access protocols before memory access operations, the system ensures safe pointer-based access without sacrificing the speed benefits of direct memory access.
Data Source
Figure 1~4
Figure 5
Figure 6
AI summary
Embodiments of the present disclosure provide a communication method, apparatus, and system, an edge computing device, and a storage medium. By establishing a message queue in a shared memory space and defining a data structure of the message queue, a process may obtain pointer information by parsing a queue header of the message queue, and read a message body from a message storage area or write the message body to the message storage area based on the pointer information, which combines an efficient access characteristic of a shared memory and high scalability, decoupling, and other advantages of the message queue, thereby improving efficiency of inter-process communication, and utilizes an asynchronous feature of the message queue, thereby improving concurrency of the inter-process communication.