CN117931478A - Inter-process communication method, inter-process communication device and storage medium - Google Patents

Inter-process communication method, inter-process communication device and storage medium Download PDF

Info

Publication number
CN117931478A
CN117931478A CN202410111911.5A CN202410111911A CN117931478A CN 117931478 A CN117931478 A CN 117931478A CN 202410111911 A CN202410111911 A CN 202410111911A CN 117931478 A CN117931478 A CN 117931478A
Authority
CN
China
Prior art keywords
message
processor
communication
inter
processing unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410111911.5A
Other languages
Chinese (zh)
Inventor
吴双
周泽海
卢金
程波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Zhongguan Automation Technology Co ltd
Original Assignee
Wuhan Zhongguan Automation Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Zhongguan Automation Technology Co ltd filed Critical Wuhan Zhongguan Automation Technology Co ltd
Priority to CN202410111911.5A priority Critical patent/CN117931478A/en
Publication of CN117931478A publication Critical patent/CN117931478A/en
Pending legal-status Critical Current

Links

Abstract

The application provides an inter-process communication method, an inter-process communication device and a storage medium, and relates to the technical field of communication. The method comprises the following steps: acquiring a message of a first process in a first processing core on a current processor; analyzing the message and determining a second process to which the message is to be sent; and sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation. According to the method, the current inter-process communication scene can be determined according to the position relation between the process of sending the data and the process of receiving the data, so that the communication mode corresponding to the current communication scene is triggered, reliable inter-process communication is realized, inter-process communication of different edge computing modules is met, and the method is higher in practicability.

Description

Inter-process communication method, inter-process communication device and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to an inter-process communication method, an inter-process communication device, and a storage medium.
Background
Edge computing is off-line in cloud computing, is close to the equipment side, has quick response capability, and cannot cope with occasions of large amount of computing and storage. In the implementation of edge computation, a reliable inter-process communication is necessary.
The edge computing module is usually a multi-core processor, but may also be a heterogeneous multi-core processor or a module composed of a plurality of processors. There is a need for an inter-process communication method that can satisfy various types of edge computing modules.
Disclosure of Invention
The application aims to overcome the defects in the prior art and provide an inter-process communication method, device and storage medium, so that the reliability and instantaneity of inter-process communication are improved, and the inter-process communication under various processor types can be met.
In order to achieve the above purpose, the technical scheme adopted by the embodiment of the application is as follows:
In a first aspect, an embodiment of the present application provides an inter-process communication method, including:
Acquiring a message of a first process in a first processing core on a current processor, wherein the message comprises communication data; the current processor is a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system;
Analyzing the message and determining a second process to which the message is to be sent;
And sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation.
Optionally, the parsing the message, determining a second process to which the message is to be sent, includes:
and analyzing the message through a message transmission driving module or a message processing unit in the current processor, and determining the identification of a second process to which the message is transmitted and the identification of a processing core to which the second process belongs.
Optionally, the sending the message to the second process according to the position relationship between the first process and the second process and the inter-process communication mode corresponding to the position relationship includes:
and if the first process and the second process are positioned in the same type of processing core on the same processor, sending the message to the second process through a message processing unit in the current processor based on a network communication interface.
Optionally, the sending the message to the second process according to the position relationship between the first process and the second process and the inter-process communication mode corresponding to the position relationship includes:
If the first process and the second process are located in different types of processing cores on the same processor, the message is encapsulated through a message transmission driving module in the current processor to obtain an encapsulated message, and the encapsulated message is transmitted to a message processing unit in the current processor;
and sending the encapsulated message to the second process through the message processing unit.
Optionally, the encapsulating the message to obtain an encapsulated message includes:
and encapsulating the message into data with a specified format, and obtaining the encapsulated message, wherein the specified format is a data format which meets the transmission with a network communication interface.
Optionally, the sending the message to the second process according to the position relationship between the first process and the second process and the inter-process communication mode corresponding to the position relationship includes:
If the first process and the second process are located on different processors, sending, by a message transmission driving module in the current processor, read information of the message to a message processing unit in the current processor, where the read information includes: the read address and the read length of the message;
and reading the message from the memory through the message processing unit according to the read information, and sending the message to the second process.
Optionally, the reading, by the message processing unit, the message from the memory according to the read information includes:
And acquiring the message indicated by the reading length from the reading address in the memory by the message processing unit in a direct memory access mode.
Optionally, the sending the message to the second process includes:
And sending the message to a message processing unit in a processor to which the second process belongs through a hardware interface, and carrying out local broadcasting on the message by the message processing unit in the processor to which the second process belongs.
In a second aspect, an embodiment of the present application further provides an inter-process communication apparatus, including: the device comprises an acquisition module, an analysis module and a communication module;
The acquisition module is used for acquiring a message of a first process in a first processing core on the current processor, wherein the message comprises communication data; the current processor is a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system;
the analysis module is used for analyzing the message and determining a second process to which the message is to be sent;
The communication module is used for sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation.
Optionally, the parsing module is specifically configured to parse the message through a message transmission driving module or a message processing unit in the current processor, and determine an identifier of a second process to which the message is to be sent and an identifier of a processing core to which the second process belongs.
Optionally, the communication module is specifically configured to send, if the first process and the second process are located in the same type of processing core on the same processor, the message to the second process through a message processing unit in the current processor based on a network communication interface.
Optionally, the communication module is specifically configured to encapsulate the message by using a message transmission driving module in the current processor if the first process and the second process are located in different processing cores on the same processor, obtain an encapsulated message, and transmit the encapsulated message to a message processing unit in the current processor;
and sending the encapsulated message to the second process through the message processing unit.
Optionally, the communication module is specifically configured to encapsulate the message packet into data in a specified format, so as to obtain the encapsulated message packet, where the specified format is a data format that satisfies transmission with a network communication interface.
Optionally, the communication module is specifically configured to send, if the first process and the second process are located on different processors, read information of the message to a message processing unit in the current processor through a message transmission driving module in the current processor, where the read information includes: the read address and the read length of the message; and reading the message from the memory through the message processing unit according to the read information, and sending the message to the second process.
Optionally, the communication module is specifically configured to obtain, by using a direct memory access manner by using the message processing unit, the message indicated by the read length from the read address in the memory.
Optionally, the communication module is specifically configured to send the message to a message processing unit in a processor to which the second process belongs through a hardware interface, and locally broadcast the message by the message processing unit in the processor to which the second process belongs.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a storage medium, and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is operating, the processor executing the machine-readable instructions to implement an inter-process communication method as provided in the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs an inter-process communication method as provided in the first aspect.
The beneficial effects of the application are as follows:
The application provides an inter-process communication method, a device and a storage medium, wherein the method comprises the following steps: acquiring a message of a first process in a first processing core on a current processor; analyzing the message and determining a second process to which the message is to be sent; and sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation. According to the method, the current inter-process communication scene can be determined according to the position relation between the process of sending the data and the process of receiving the data, so that the communication mode corresponding to the current communication scene is triggered, reliable inter-process communication is realized, inter-process communication of different edge computing modules is met, and the method is higher in practicability.
And secondly, the zero copy transparent transmission drive of the TCP/IP protocol stack is removed based on the kernel, so that the transmission rate is improved, the delay is reduced, and meanwhile, the safety is improved through a custom protocol under the condition of less expenditure.
In addition, compared with the traditional ubus communication mode, the communication mode of the scheme improves the transmission rate, improves the maximum length of the transmissible data, and enables the inter-process transmission of larger data to be possible.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an architecture of an interprocess communication system according to an embodiment of the application;
FIG. 2 is a schematic flow chart of an inter-process communication method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating inter-process communication of a multi-core processor according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating another method of interprocess communication according to an embodiment of the application;
FIG. 5 is a schematic diagram illustrating inter-process communication of a heterogeneous multi-core processor according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating another method for interprocess communication according to an embodiment of the application;
FIG. 7 is a schematic diagram of an edge computation module of a multiprocessor according to an embodiment of the present application;
FIG. 8 is a schematic diagram illustrating process communication between multiple processors according to an embodiment of the present application;
FIG. 9 is a schematic diagram of an inter-process communication device according to an embodiment of the present application;
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for the purpose of illustration and description only and are not intended to limit the scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this disclosure, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to or removed from the flow diagrams by those skilled in the art under the direction of the present disclosure.
In addition, the described embodiments are only some, but not all, embodiments of the application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
The internet of things is an important means for realizing industry digital transformation, and will promote new industry ecology and business modes. The intellectualization of the Internet of things can be improved by means of edge calculation, and the Internet of things can be promoted to root in the ground in various vertical industries. Edge computing is off-line in cloud computing, is close to the equipment side, has quick response capability, and cannot cope with occasions of large amount of computing and storage. In the implementation of edge computation, a reliable inter-process communication is necessary.
In a specific engineering application, the edge computing module may be a multi-core processor (such as 4 ARM (ADVANCED RISC MACHINES, embedded processor) Cortex-a cores, etc.), a heterogeneous multi-core processor (such as 4 ARM Cortex-a cores plus one or more ARM Cortex-M cores), or an edge computing module (subsystem) composed of multiple processors (including ARM/MIPS (Microprocessor without Interlocked PIPELINE STAGES, instruction set architecture) processor, FPGA (Field Programmable GATE ARRAY ), etc.).
The existing inter-process communication methods are many, but the trusted communication connection needs to establish a stable connection (similar to three handshakes of TCP (Transmission Control Protocol, transmission control protocol)), and the inter-process communication interface with the characteristic is known as ubus system bus provided in OpenWRT, and ubus is realized based on unix socket (local socket); the ubus module consists of three parts, including ubusd daemon, ubus interface library (libubus. So) and ubus command line tools. ubus is internally represented by a structure of blob_buf, blob_attr, etc., and length is 65536 bytes at maximum, so ubus is not suitable for transmitting large amounts of data. Meanwhile ubus cannot realize communication among heterogeneous cores, and further cannot realize process communication among different processors in a system module.
The scheme provides an inter-process communication method which is realized based on a micro system, can simultaneously meet the requirements of inter-process communication under the scenes of multi-core processors, heterogeneous multi-core processors and different processors, and realizes the reliability, the safety, the real-time performance and the applicability of the inter-process communication.
It should be noted that the term "comprising" will be used in embodiments of the application to indicate the presence of the features stated hereafter, but not to exclude the addition of other features.
Fig. 1 is a schematic diagram of an architecture of an interprocess communication system according to an embodiment of the application. As shown in fig. 1, may include: the hardware interface layer, kernel space and user space, the hardware IO (Input/Output) buffer of the hardware interface layer can be used for buffering the message, the message transmission driving module of the kernel space can be used for transmitting the message to the message processing unit in the user space, the message processing unit in the user space can analyze and broadcast the message, the message processing unit can analyze and broadcast the message based on the user state protocol stack in the user space, and the like, and finally the message is transmitted to the data receiving process through the message processing unit.
The user mode protocol stack cuts the protocol and only supports partial protocols, so that the cost and the time delay can be reduced. The communication between processes can be carried out according to the protocol supported by the user state protocol stack, so that normal communication is ensured, and the cost is reduced.
FIG. 2 is a schematic flow chart of an inter-process communication method according to an embodiment of the present application; the execution subject of the method may be a processor. As shown in fig. 2, the method may include:
S101, acquiring a message of a first process in a first processing core on a current processor, wherein the current processor is a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system.
The present processor may refer to a processor performing the flow of the method, and the method of the present application may be applied to a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system. Thus, the current processor may be a multi-core processor, or a heterogeneous multi-core processor, or may be one processor in a multi-processor system.
In one mode, the message of the first process in the first processing core can be actively acquired according to a preset interval time, if the message can be acquired, communication is performed according to the method, and if the message cannot be acquired, the message can be continuously acquired when the next interval time arrives.
In another manner, when a data transmission request is received, a message of a first process in the first processing core may be acquired according to the request. The first processing core may be any one of the current processors. The first process may be any process in the first processing core.
S102, analyzing the message, and determining a second process to which the message is to be sent.
Optionally, the message packet may carry an identifier of a destination address to which the message packet is to be sent, and the destination address may include the identifier of the second proceeding. Thus, by parsing the message, the second process to which the message is to be sent can be determined.
S103, according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation, sending the message to the second process.
Optionally, according to the position relationship between the first process and the second process, that is, according to the position relationship between the two processes of communication, an inter-process communication mode corresponding to the position relationship may be adopted to send the message of the first process to the second process.
The positional relationship between the first process and the second process may be determined according to information such as a processing core to which the first process belongs, a processor to which the first process belongs, a processing core to which the second process belongs, a processor to which the second process belongs, and the like.
It may be understood that the current communication scenario may be determined according to the positional relationship between the first process and the second process, and the current communication scenario may include: a multi-core processor communication scene, a heterogeneous multi-core processor communication scene, and a communication scene among different processors in a multiprocessor system; and the corresponding communication mode can be determined according to the communication scene.
If the communication scene is the multi-core processor communication scene, adopting a communication mode corresponding to the multi-core processor communication scene; if the communication scene is the heterogeneous multi-core processor communication scene, adopting a communication mode corresponding to the heterogeneous multi-core processor communication scene; if the communication scene among different processors in the multiprocessor system is adopted, adopting a communication mode corresponding to the multiprocessor communication scene. The communication modes corresponding to the communication scenes are different, and the communication modes can be realized based on the inter-process communication system provided by the scheme, so that inter-process reliable communication under different scenes is realized.
In summary, the inter-process communication method provided in this embodiment includes: acquiring a message of a first process in a first processing core on a current processor; analyzing the message and determining a second process to which the message is to be sent; and sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation. According to the method, the current inter-process communication scene can be determined according to the position relation between the process of sending the data and the process of receiving the data, so that the communication mode corresponding to the current communication scene is triggered, reliable inter-process communication is realized, inter-process communication of different edge computing modules is met, and the method is higher in practicability.
Optionally, in step S102, the parsing the message to determine the second process to which the message is to be sent may include: and analyzing the message through a message transmission driving module or a message processing unit in the current processor, and determining the identification of the second process to which the message is transmitted and the identification of the processing core to which the second process belongs.
In some embodiments, the message may be actively acquired by a message transmission driving module or a message processing unit in the current processor, or may be passively received by the message transmission driving module or the message processing unit in the current processor, where the message transmission driving module or the message processing unit may parse the message to acquire an identifier of the second process to which the message is to be sent and an identifier of a processing core to which the second process belongs.
Optionally, in step S103, according to the positional relationship between the first process and the second process and the inter-process communication manner corresponding to the positional relationship, the sending the message to the second process may include: if the first process and the second process are located in the same type of processing core on the same processor, the message is sent to the second process through the message processing unit in the current processor based on the network communication interface.
In one implementation, when the first process and the second process are located on the same type of processing core on the same processor, then it may be determined that the inter-process communication is currently in the multi-core processor scenario, where two situations exist: the first, the first process and the second process are located on different processing cores in the multi-core processor respectively; second, both the first process and the second process are located on the same processing core in the multi-core processor. But whether located in different processing cores or the same processing core, the first process and the second process are located in the same type of processing core on the same processor, since all processing cores of the multi-core processor are the same type. And the process communication between the processing cores of the same type in the same processor can be realized directly based on the network communication interface.
Fig. 3 is a schematic diagram of inter-process communication of a multi-core processor according to an embodiment of the present application. In such a communication scenario of the multi-core processor, the message is directly transmitted in a network communication manner based on the message processing unit, and the kernel space does not need to participate in corresponding processing.
In one implementation, the message processing unit may implement communication between the first process and the second process at the message processing unit based on unix socket communication of the user state protocol stack Fstack. The message processing unit may send the message of the first process to the second process according to the determined identifier of the second process.
Unix socket is an inter-process communication mechanism used for inter-process communication of the same host. It does not need to go through the network protocol stack, does not need to pack and unpack, calculate checksum, maintain serial number response, etc., and the message will not be lost or out of order, but just copy the data in the message processing unit from one process to another.
FIG. 4 is a flowchart illustrating another method of interprocess communication according to an embodiment of the application; optionally, in step S103, according to the positional relationship between the first process and the second process and the inter-process communication manner corresponding to the positional relationship, the sending the message to the second process may include:
S201, if the first process and the second process are located in different types of processing cores on the same processor, the message is packaged through a message transmission driving module in the current processor, so as to obtain a packaged message, and the packaged message is transmitted to a message processing unit in the current processor.
In some cases, when the first process and the second process are located in different types of processing cores on the same processor, i.e., in a communication scenario of heterogeneous multi-core processors, communication directly in a network communication manner is not supported due to the need for cross-core communication.
Then, the message transmission driving module may receive a message transmitted based on IPCC (inter-processor communication controller, inter-core communication controller), encapsulate the message, and transmit the encapsulated message to the message processing unit.
S202, the packaged message is sent to a second process through a message processing unit.
After the message reaches the message processing unit, the message processing unit can analyze the encapsulated message, wherein the protocol analysis can be performed based on Fstack, and the encapsulated message is sent to the second process according to the analyzed identifier of the second process.
Fig. 5 is a schematic diagram of inter-process communication of a heterogeneous multi-core processor according to an embodiment of the present application. The heterogeneous multi-core processor includes: cortex-A53 core and Cortex-M4 core. The Cortex-A53 core is provided with a process 1 and a process 2, the Cortex-M4 core is provided with an MCU (Microcontroller Unit ) thread, and after the message in the MCU thread is transmitted based on a TCP/IP (Transmission Control Protocol/Internet Protocol ) protocol, the message is transmitted to a message transmission driving module of the processor through IPCC, and the message is packaged by the message transmission driving module and then transmitted to the message processing unit.
Optionally, in step S201, the message is encapsulated, so as to obtain an encapsulated message, which may include: and encapsulating the message into data with a specified format to obtain an encapsulated message, wherein the specified format is a data format which meets the transmission with a network communication interface.
In some embodiments, it may be to package the message into unix socket data format. So that the message may be transmitted based on the network communication interface.
FIG. 6 is a flowchart illustrating another method for interprocess communication according to an embodiment of the application; optionally, in step S103, according to the positional relationship between the first process and the second process and the inter-process communication manner corresponding to the positional relationship, the sending the message to the second process may include:
S301, if the first process and the second process are located on different processors, sending read information of a message to a message processing unit in a current processor through a message transmission driving module in the current processor, wherein the read information comprises: read address and read length of message.
In some cases, when the first process and the second process are located on different processors, that is, in a communication scenario of multiple processors, the read information of the message may be sent to the message processing unit through the message transmission driving module.
Fig. 7 is a schematic diagram of an edge calculation module of a multiprocessor according to an embodiment of the present application, where, as shown in fig. 7, the edge calculation module may be composed of different types of processors such as an MPU (Micro Processing Unit, microprocessor), an MCU (Microcontroller Unit ), an FPGA (Field Programmable GATE ARRAY, field programmable gate array), and the like. And the processors can communicate by adopting the communication modes of the steps S301-S302.
S302, reading the message from the memory through the message processing unit according to the read information, and sending the message to the second process.
Therefore, the message processing unit can pull the message to the message processing unit based on the read address of the message, thereby realizing zero copy transparent driving of the kernel.
In the conventional manner, the kernel socket interface is required to be used for acquiring the message, and the message is actually subjected to copy once, and the data copy is performed once from the kernel socket to the message processing unit, so that the data transmission delay is larger, and the real-time performance cannot be ensured.
In the embodiment, the message is directly transmitted to the message processing unit in a kernel zero copy mode, so that the real-time performance and the safety of data transmission are improved.
Optionally, in step S302, according to the read information, reading, by the message processing unit, the message from the memory may include: and acquiring the message indicated by the reading length from the memory under the reading address by the message processing unit in a direct memory access mode.
In one implementation, the message processing unit may be based on DMA (Direct Memory Access ), and pull the message to the message processing unit according to the read address and the read length of the message sent by the message transmission driving module.
Fig. 8 is a schematic diagram of process communication between multiple processors according to an embodiment of the present application. The message transmission driving module of the current processor can acquire the read information of the message from the hardware IO buffer memory, wherein the read information can comprise the read address and the read length of the message, and the read information is sent to the message processing unit on the current processor. Therefore, the message processing unit on the processor can pull and cancel the message from the hardware IO buffer memory according to the read address and the read length of the message based on the DMA (Direct Memory Access ) mode. And after the message is analyzed, data transmission is carried out according to the identification of the second process.
It should be noted that, in the communication scenario of the heterogeneous multi-core processor, since the heterogeneous multi-core processor does not support the DMA data mapping manner, when the message is transmitted to the message processing unit through the message transmission driving module, the same manner as in the multiprocessor scenario cannot be used for processing.
In this embodiment, for process communication in heterogeneous multi-core processor scenarios and multi-processor scenarios, zero copy transparent driving of the TCP/IP protocol stack can be removed based on the core, and the message is transmitted to the message processing unit in a transparent manner, so that the message is not required to be copied to the core once and then to the message processing unit once, thereby improving transmission efficiency with less overhead and reducing delay.
Optionally, in step S302, sending the message to the second process may include: and sending the message to a message processing unit in a processor to which the second process belongs through a hardware interface, and locally broadcasting the message by the message processing unit in the processor to which the second process belongs.
In the multiprocessor communication scenario, after the message processing unit of the current processor acquires the message, the message processing unit can analyze the message and acquire the identifier of the second process. Judging whether the second process is a process on the processor, if so, transmitting the message to the second process directly based on the network communication interface. If the second process is not the process on the processor, the message can be transmitted to the message processing unit on the processor where the second process is located based on the hardware interface, and the message processing unit on the processor where the second process is located broadcasts the message in the processor where the second process is located.
Referring to fig. 8, when both the second process and the first process are located on the current processor (for example, the first process is process 1 on processor 1 and the second process is process 2 on processor 1), the message processing unit of the current processor may directly transmit the message of the first process to the second process based on the network communication interface.
When the second process and the first process are located on different processors (for example, the first process is process 1 on processor 1, the second process is process 1 on processor 2), the message processing unit of processor 1 transmits the message to the message processing unit on processor 2 through the hardware interface, and the message processing unit on processor 2 broadcasts the message in processor 2.
A process needing information in the processor 2 receives the information, analyzes the information message through Fstack, confirms whether the information message is needed by the process, and if the information message is needed by the process, acquires communication data from the information message; if the message is not the message required by the user, the message is not processed.
In summary, the inter-process communication method provided in this embodiment includes: acquiring a message of a first process in a first processing core on a current processor; analyzing the message and determining a second process to which the message is to be sent; and sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation. According to the method, the current inter-process communication scene can be determined according to the position relation between the process of sending the data and the process of receiving the data, so that the communication mode corresponding to the current communication scene is triggered, reliable inter-process communication is realized, inter-process communication of different edge computing modules is met, and the method is higher in practicability.
And secondly, the zero copy transparent transmission drive of the TCP/IP protocol stack is removed based on the kernel, so that the transmission rate is improved, the delay is reduced, and meanwhile, the safety is improved through a custom protocol under the condition of less expenditure.
In addition, compared with the traditional ubus communication mode, the communication mode of the scheme improves the transmission rate, improves the maximum length of the transmissible data, and enables the inter-process transmission of larger data to be possible.
The following describes a device, equipment, a storage medium, etc. for executing the inter-process communication method provided by the present application, and specific implementation processes and technical effects thereof are referred to above, and are not described in detail below.
Fig. 9 is a schematic diagram of an inter-process communication device according to an embodiment of the present application, where functions implemented by the inter-process communication device correspond to steps executed by the method described above. The apparatus may be understood as any of the three types of processors described above, and as shown in fig. 9, the apparatus may include: an acquisition module 910, a parsing module 920, and a communication module 930;
An obtaining module 910, configured to obtain a message of a first process in a first processing core on a current processor, where the message includes communication data; the current processor is a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system;
the parsing module 920 is configured to parse the message and determine a second process to which the message is to be sent;
the communication module 930 is configured to send the message to the second process according to the location relationship between the first process and the second process and the inter-process communication manner corresponding to the location relationship.
Optionally, the parsing module 920 is specifically configured to parse the message through a message transmission driving module or a message processing unit in the current processor, and determine an identifier of the second process to which the message is to be sent and an identifier of a processing core to which the second process belongs.
Optionally, the communication module 930 is specifically configured to send, if the first process and the second process are located in the same type of processing core on the same processor, the message to the second process through the message processing unit in the current processor based on the network communication interface.
Optionally, the communication module 930 is specifically configured to encapsulate, if the first process and the second process are located in different types of processing cores on the same processor, the message through a message transmission driving module in the current processor, obtain an encapsulated message, and transmit the encapsulated message to a message processing unit in the current processor;
and sending the packaged message to a second process through a message processing unit.
Optionally, the communication module 930 is specifically configured to encapsulate the message into data with a specified format, so as to obtain an encapsulated message, where the specified format is a data format that satisfies transmission with the network communication interface.
Optionally, the communication module 930 is specifically configured to send, if the first process and the second process are located on different processors, read information of the message to the message processing unit in the current processor through the message transmission driving module in the current processor, where the read information includes: reading address and reading length of message; and reading the message from the memory through the message processing unit according to the read information, and sending the message to the second process.
Optionally, the communication module 930 is specifically configured to obtain, by using a direct memory access manner by using the message processing unit, the message indicated by the read length from the read address in the memory.
Optionally, the communication module 930 is specifically configured to send the message to a message processing unit in a processor to which the second process belongs through a hardware interface, and locally broadcast the message by the message processing unit in the processor to which the second process belongs.
The foregoing apparatus is used for executing the method provided in the foregoing embodiment, and its implementation principle and technical effects are similar, and are not described herein again.
The above modules may be one or more integrated circuits configured to implement the above methods, for example: one or more Application SPECIFIC INTEGRATED Circuits (ASIC), or one or more microprocessors (DIGITAL SINGNAL processor, DSP), or one or more field programmable gate arrays (Field Programmable GATE ARRAY, FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
The modules may be connected or communicate with each other via wired or wireless connections. The wired connection may include a metal cable, optical cable, hybrid cable, or the like, or any combination thereof. The wireless connection may include a connection through a LAN, WAN, bluetooth, zigBee, or NFC, or any combination thereof. Two or more modules may be combined into a single module, and any one module may be divided into two or more units. It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the method embodiments, and are not repeated in the present disclosure.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the device may be a computing device with a data processing function.
The apparatus may include: a processor 801, and a storage medium 802.
The storage medium 802 is used to store a program, and the processor 801 calls the program stored in the storage medium 802 to execute the above-described method embodiment. The specific implementation manner and the technical effect are similar, and are not repeated here.
In which a storage medium 802 stores program code that, when executed by the processor 801, causes the processor 801 to perform various steps in an inter-process communication method according to various exemplary embodiments of the application described in the above section of the description of the exemplary method.
The Processor 801 may be a general purpose Processor such as a Central Processing Unit (CPU), digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field programmable gate array (Field Programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
The storage medium 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The storage medium may include at least one type of storage medium, and may include, for example, flash Memory, a hard disk, a multimedia card, a card-type storage medium, a random access storage medium (Random Access Memory, RAM), a static random access storage medium (Static Random Access Memory, SRAM), a programmable Read-Only storage medium (Programmable Read Only Memory, PROM), a Read-Only storage medium (ROM), a charged erasable programmable Read-Only storage medium (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only storage, EEPROM), a magnetic storage medium, a magnetic disk, an optical disk, and the like. A storage medium is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The storage medium 802 of the present application may also be circuitry or any other device capable of implementing a storage function for storing program instructions and/or data.
Optionally, the present application also provides a program product, such as a computer readable storage medium, comprising a program for performing the above-described method embodiments when being executed by a processor.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform some of the steps of the methods according to the embodiments of the application. And the aforementioned storage medium includes: u disk, mobile hard disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.

Claims (10)

1. An inter-process communication method, comprising:
Acquiring a message of a first process in a first processing core on a current processor, wherein the message comprises communication data; the current processor is a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system;
Analyzing the message and determining a second process to which the message is to be sent;
And sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation.
2. The method of claim 1, wherein the parsing the message to determine a second process to which the message is to be sent comprises:
and analyzing the message through a message transmission driving module or a message processing unit in the current processor, and determining the identification of a second process to which the message is transmitted and the identification of a processing core to which the second process belongs.
3. The method according to claim 1, wherein the sending the message to the second process according to the positional relationship between the first process and the second process and the inter-process communication manner corresponding to the positional relationship includes:
and if the first process and the second process are positioned in the same type of processing core on the same processor, sending the message to the second process through a message processing unit in the current processor based on a network communication interface.
4. The method according to claim 1, wherein the sending the message to the second process according to the positional relationship between the first process and the second process and the inter-process communication manner corresponding to the positional relationship includes:
If the first process and the second process are located in different types of processing cores on the same processor, the message is encapsulated through a message transmission driving module in the current processor to obtain an encapsulated message, and the encapsulated message is transmitted to a message processing unit in the current processor;
and sending the encapsulated message to the second process through the message processing unit.
5. The method of claim 4, wherein encapsulating the message to obtain an encapsulated message comprises:
and encapsulating the message into data with a specified format, and obtaining the encapsulated message, wherein the specified format is a data format which meets the transmission with a network communication interface.
6. The method according to claim 1, wherein the sending the message to the second process according to the positional relationship between the first process and the second process and the inter-process communication manner corresponding to the positional relationship includes:
If the first process and the second process are located on different processors, sending, by a message transmission driving module in the current processor, read information of the message to a message processing unit in the current processor, where the read information includes: the read address and the read length of the message;
and reading the message from the memory through the message processing unit according to the read information, and sending the message to the second process.
7. The method according to claim 6, wherein the reading, by the message processing unit, the message from the memory according to the read information includes:
And acquiring the message indicated by the reading length from the reading address in the memory by the message processing unit in a direct memory access mode.
8. The method of claim 6, wherein the sending the message to the second process comprises:
And sending the message to a message processing unit in a processor to which the second process belongs through a hardware interface, and carrying out local broadcasting on the message by the message processing unit in the processor to which the second process belongs.
9. An interprocess communication apparatus comprising: the device comprises an acquisition module, an analysis module and a communication module;
The acquisition module is used for acquiring a message of a first process in a first processing core on the current processor, wherein the message comprises communication data; the current processor is a multi-core processor, or a heterogeneous multi-core processor, or one processor in a multi-processor system;
the analysis module is used for analyzing the message and determining a second process to which the message is to be sent;
The communication module is used for sending the message to the second process according to the position relation between the first process and the second process and the inter-process communication mode corresponding to the position relation.
10. A computer readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when executed by a processor, implements the inter-process communication method according to any of claims 1 to 8.
CN202410111911.5A 2024-01-25 2024-01-25 Inter-process communication method, inter-process communication device and storage medium Pending CN117931478A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410111911.5A CN117931478A (en) 2024-01-25 2024-01-25 Inter-process communication method, inter-process communication device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410111911.5A CN117931478A (en) 2024-01-25 2024-01-25 Inter-process communication method, inter-process communication device and storage medium

Publications (1)

Publication Number Publication Date
CN117931478A true CN117931478A (en) 2024-04-26

Family

ID=90750476

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410111911.5A Pending CN117931478A (en) 2024-01-25 2024-01-25 Inter-process communication method, inter-process communication device and storage medium

Country Status (1)

Country Link
CN (1) CN117931478A (en)

Similar Documents

Publication Publication Date Title
US10324873B2 (en) Hardware accelerated communications over a chip-to-chip interface
CN108268328B (en) Data processing device and computer
US7231638B2 (en) Memory sharing in a distributed data processing system using modified address space to create extended address space for copying data
US20200380361A1 (en) Directed and interconnected grid dataflow architecture
JP2007528074A (en) Speeding up TCP (TRANSPORTCONTROLROTOCOL) stack processing
WO2022032984A1 (en) Mqtt protocol simulation method and simulation device
US10609125B2 (en) Method and system for transmitting communication data
CN112615822A (en) Message processing method and device, computing equipment and readable storage medium
US11016769B1 (en) Method and apparatus for processing information
CN115499505B (en) USB network card and communication method
US8135851B2 (en) Object request broker for accelerating object-oriented communications and method
US9240952B2 (en) System and method for communication between networked applications
CN115639954A (en) Data transmission method, device, equipment and medium
US20120191768A1 (en) Offloading the processing of signals
CN116257471A (en) Service processing method and device
CN117931478A (en) Inter-process communication method, inter-process communication device and storage medium
CN116860391A (en) GPU computing power resource scheduling method, device, equipment and medium
CN115904259A (en) Processing method and related device for NVMe (non-volatile memory) standard instruction
US7716683B2 (en) Distributed graphics processing apparatus and method
US8904062B2 (en) Network control model driver
US8176117B2 (en) Accelerator for object-oriented communications and method
WO2023082609A1 (en) Data processing method and related device
WO2017096919A1 (en) Data return method, receiving method, return apparatus, and reception apparatus
CN116781586A (en) gRPC flow analysis method, device, equipment and medium
CN117938659A (en) Method for intercepting Ethernet data message and vehicle-mounted device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination