CN113326151A - Inter-process communication method, device, equipment, system and storage medium - Google Patents

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

Info

Publication number
CN113326151A
CN113326151A CN202110606085.8A CN202110606085A CN113326151A CN 113326151 A CN113326151 A CN 113326151A CN 202110606085 A CN202110606085 A CN 202110606085A CN 113326151 A CN113326151 A CN 113326151A
Authority
CN
China
Prior art keywords
shared memory
sending
socket application
end socket
memory channel
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.)
Withdrawn
Application number
CN202110606085.8A
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.)
Pairi Technology Guangzhou Co ltd
Original Assignee
Pairi Technology Guangzhou 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 Pairi Technology Guangzhou Co ltd filed Critical Pairi Technology Guangzhou Co ltd
Priority to CN202110606085.8A priority Critical patent/CN113326151A/en
Publication of CN113326151A publication Critical patent/CN113326151A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/606Protecting data by securing the transmission between two devices or processes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Multi Processors (AREA)

Abstract

The application relates to the technical field of interprocess communication, and discloses an interprocess communication method, a device, equipment, a system and a storage medium, wherein the method is applied to a sending end and comprises the following steps: sending an interprocess communication request to an Rsocket library, wherein the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request; and carrying out data communication with a receiving end through the shared memory channel. The invention enables the sending end and the receiving end to communicate through the shared memory channel, thereby not needing to copy data through sbuf of the Rsocket library, avoiding the cost of twice copying and the delay cost caused by PCIE communication, and being beneficial to improving the communication performance between processes.

Description

Inter-process communication method, device, equipment, system and storage medium
Technical Field
The present application relates to the field of inter-process communication technologies, and in particular, to an inter-process communication method, apparatus, device, system, and storage medium.
Background
As computer technology has developed, applications have become more sophisticated and functional, and often need to communicate with other applications in the local host in addition to applications on the remote host.
Sockets allow applications on a network to communicate between two different hosts and also support interprocess communication within the same host. When interprocess communication needs to be carried out in the same host, a sender designates the IP address of the socket as any IP address in the host, a receiver needs to bind a port number, and the sender can communicate with the receiver in the mode of the IP address and the port number.
The Rsocket library (RDMA socket API, RDMA socket application Call interface) is a protocol that provides a socket interface over RDMA networks, is part of the library of librdmac provided by the linux-RDMA group, and is also part of the OFED library. The main work of Rsockets is to implement semantic adaptation of all socket calls over the interface Verbs provided by RDMA in order to use the RDMA network.
When the Rsocket library is used for inter-process communication in the same host, the communication process is as shown in FIG. 1, socket applications of a sending end and a receiving end transmit socket requests to the Rsocket library, the Rsocket library converts the socket requests into corresponding RDMA resource requests and transmits the RDMA resource requests to an OFED kernel library through the OFED library, the OFED kernel library processes the RDMA resource requests transmitted from the Rsocket library, the RDMA resource requests are constructed into RDMA hardware resource requests, and the RDMA hardware resource requests are transmitted to the RDMA network card. After the RDMA network card acquires the RDMA hardware resource request, distributing corresponding RDMA hardware resources to an OFED kernel library in the network card; the OFED kernel library further processes the RDMA hardware resources into RDMA resources and transmits the RDMA resources back to the OFED library; the OFED library transmits the RDMA resources to the Rsocket library; and the Rsocket library converts the corresponding RDMA resources into socket resources and returns the socket resources to socket applications of the sending end and the receiving end. Then, the socket application at the sending end transmits a sending cache address to the Rsocket library, the Rsocket library copies data from the sending cache to sbuf of the Rsocket library after receiving the sending cache address, the RDMA network card accesses the data of the sbuf and sends the data to the RDMA network card at the receiving end, the RDMA network card at the receiving end copies the data to rbuf of the Rsocket library, and the Rsocket library copies the data from the rbuf to a receiving cache of the socket application at the receiving end.
In the communication process, the sending-end socket application needs to copy data from a sending cache of the sending-end socket application to sbuf of the Rsocket library, so that the network card can send the data from the sbuf to rbuf of the Rsocket library of the receiving end, and copy the data from the rbuf to a receiving cache of the receiving-end socket application, so that the sending and the receiving both have one copy, the copy cost is totally twice in one transmission process, and the data reaches the rbuf of the Rsocket library of the receiving-end socket application after being forwarded by the RDMA network card, so that delay cost caused by PCIE communication exists. When a large amount of data is transmitted, copy overhead and PCIE delay overhead may significantly affect transmission performance.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, a device, a system, and a storage medium for inter-process communication, which enable a sending end and a receiving end to communicate through the shared memory channel, so that data copy is not required through sbuf of an Rsocket library, thereby avoiding twice copy overhead and delay overhead caused by PCIE communication, and being beneficial to improving inter-process communication performance.
In order to achieve the purpose, the invention adopts the following technical scheme:
the first aspect of the present invention provides an inter-process communication method, which is applied to a sending end, and the method includes:
sending an interprocess communication request to an Rsocket library, wherein the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request;
and carrying out data communication with a receiving end through the shared memory channel.
According to a manner in which the first aspect of the present invention can be realized, the performing data communication with a receiving end through the shared memory channel includes:
determining the length of data to be transmitted;
and when the length is greater than or equal to a preset length threshold value, acquiring a physical address of a sending cache from a memory processing module and copying the physical address into the shared memory channel, and acquiring the physical address of the sending cache by a receiving end according to the shared memory channel and copying the physical address into a shared memory area created by the memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of a corresponding receiving end socket application.
According to an implementation manner of the first aspect of the present invention, when the number of physical addresses of the sending cache stored in the shared memory channel reaches a number threshold corresponding to the receiving cache length of the receiving end, the receiving end copies the physical addresses in the shared memory channel to the shared memory region together.
According to an implementable aspect of the first aspect of the present invention, the performing data communication with a receiving end through the shared memory channel further includes:
when the length is smaller than a preset length threshold value, copying the data to be sent from a sending cache of a sending end socket application to the shared memory channel, and reading the data to be sent by the receiving end according to the address of the data to be sent in the shared memory channel.
According to a manner that can be implemented in the first aspect of the present invention, the establishing, by a Helper process, a shared memory channel between a sender socket application and a receiver socket application includes:
the Rsocket library sends a first connection request to a Helper process, and establishes a first shared memory channel according to a first shared memory secret key fed back by the Helper process, wherein the first shared memory channel is a shared memory channel of the sending end socket application and the Helper process, and the first connection request comprises a port number to be connected by the sending end socket application;
the Rsocket library sends a second connection request to a Helper process, and establishes a second shared memory channel according to a second shared memory key fed back by the Helper process, wherein the second shared memory channel is a shared memory channel between the receiving end socket application and the Helper process, and the second connection request comprises a port number to be connected by the receiving end socket application;
the Rsocket library receives a connection key sent by the Helper process, and the Helper process sends the connection key when the port number to be connected by the sending-end socket application is matched with the port number to be connected by the receiving-end socket application;
and the Rsocket library establishes a shared memory channel between the sending end socket application and the receiving end socket application according to the connection key.
According to an implementation manner of the first aspect of the present invention, the first connection request further includes an IP address and a connection type of a sending-side socket application, and the Helper process feeds back the first shared memory key when the IP address of the sending-side socket application matches a preset local IP address and the connection type is a sending connection type.
According to an implementation manner of the first aspect of the present invention, the second connection request further includes a connection type, and the Helper process feeds back the second shared memory key when the connection type is the receive connection type.
According to an enabling aspect of the first aspect of the invention, the method further comprises:
the Rsocket library sends a request for creating a shared memory area to the memory processing module after receiving the interprocess communication request, and the memory processing module creates the shared memory area according to the request for creating the shared memory area.
The second aspect of the present invention provides an inter-process communication method, which is applied to a receiving end, and the method includes:
the method comprises the steps that data communication is carried out between a sending end socket application and a receiving end socket application through a shared memory channel, the shared memory channel between the sending end socket application and the receiving end socket application is established through a Helper process when an Rsocket library receives an interprocess communication request sent by the sending end.
According to a manner in which the second aspect of the present invention can be realized, the performing data communication with a sending end through a shared memory channel between a sending end socket application and a receiving end socket application includes:
acquiring a physical address of a sending cache according to a shared memory channel between a sending end socket application and a receiving end socket application and copying the physical address of the sending cache into a shared memory area created by a memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of the corresponding receiving end socket application;
and the physical address is acquired from the memory processing module and copied to the shared memory channel by the sending end when the length of the data to be sent is greater than or equal to a preset length threshold.
According to an implementation manner of the second aspect of the present invention, when the number of physical addresses of the sending buffer stored in the shared memory channel reaches a number threshold corresponding to the receiving buffer length of the receiving end, the receiving end copies the physical addresses in the shared memory channel to the shared memory region together.
According to a manner in which the second aspect of the present invention can be realized, the performing data communication with a sending end through a shared memory channel between a sending end socket application and a receiving end socket application further includes:
when the length is smaller than a preset length threshold, the receiving end reads the data to be sent according to the address of the data to be sent in the shared memory channel, wherein when the length is smaller than the preset length threshold, the sending end copies the data to be sent from a sending cache of a sending end socket application to the shared memory channel:
according to a manner that can be implemented in the second aspect of the present invention, the establishment of the shared memory channel between the sending-end socket application and the receiving-end socket application by the Rsocket through the Helper process when receiving the inter-process communication request sent by the sending end includes:
the Rsocket library sends a first connection request to a Helper process, and establishes a first shared memory channel according to a first shared memory secret key fed back by the Helper process, wherein the first shared memory channel is a shared memory channel of the sending end socket application and the Helper process, and the first connection request comprises a port number to be connected by the sending end socket application;
the Rsocket library sends a second connection request to a Helper process, and establishes a second shared memory channel according to a second shared memory key fed back by the Helper process, wherein the second shared memory channel is a shared memory channel between the receiving end socket application and the Helper process, and the second connection request comprises a port number to be connected by the receiving end socket application;
the Rsocket library receives a connection key sent by the Helper process, and the Helper process sends the connection key when the port number to be connected by the sending-end socket application is matched with the port number to be connected by the receiving-end socket application;
and the Rsocket library establishes a shared memory channel between the sending end socket application and the receiving end socket application according to the connection key.
According to an implementation manner of the second aspect of the present invention, the first connection request further includes an IP address and a connection type of a sending-side socket application, and the Helper process feeds back the first shared memory key when the IP address of the sending-side socket application matches a preset local IP address and the connection type is a sending connection type.
According to an implementation manner of the second aspect of the present invention, the second connection request further includes a connection type, and the Helper process feeds back the second shared memory key when the connection type is the receive connection type.
According to an implementable manner of the second aspect of the invention, the method further comprises:
the Rsocket library sends a request for creating a shared memory area to the memory processing module after receiving the interprocess communication request, and the memory processing module creates the shared memory area according to the request for creating the shared memory area.
The third aspect of the present invention provides an interprocess communication apparatus based on an Rsocket library, where the apparatus is applied to a transmitting end, and the apparatus includes:
the system comprises a sending module, a receiving module and a processing module, wherein the sending module is used for sending an interprocess communication request to an Rsocket library, and the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request;
and the first communication module is used for carrying out data communication with a receiving end through the shared memory channel.
According to one implementable aspect of the third aspect of the present invention, the first communication module comprises:
the determining unit is used for determining the length of the data needing to be sent;
the first copying unit is configured to, when the length is greater than or equal to a preset length threshold, obtain a physical address of a sending cache from a memory processing module and copy the physical address into the shared memory channel, so that a receiving end obtains the physical address of the sending cache according to the shared memory channel and copies the physical address into a shared memory region created by the memory processing module, and the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of a corresponding receiving-end socket application.
According to an implementable manner of the third aspect of the present invention, the first communication module further includes a second copy unit, where the second copy unit is configured to copy, when the length is smaller than a preset length threshold, the data to be sent from a sending cache of a sending-end socket application to the shared memory channel, so that the receiving end reads, according to the data to be sent, the data to be sent at an address of the shared memory channel.
A fourth aspect of the present invention provides an interprocess communication apparatus based on an Rsocket library, which is applied to a receiving end, and includes:
and the second communication module is used for carrying out data communication with the sending end through a shared memory channel between the sending end socket application and the receiving end socket application, and the shared memory channel between the sending end socket application and the receiving end socket application is established by a Helper process when an Rsocket library receives an interprocess communication request sent by the sending end.
According to an implementable manner of the fourth aspect of the present invention, the second communication module comprises:
and the third copying unit is used for acquiring a physical address of a sending cache according to a shared memory channel between the sending-end socket application and the receiving-end socket application and copying the physical address into a shared memory area created by the memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and the receiving cache of the corresponding receiving-end socket application, and the physical address is acquired from the memory processing module and copied into the shared memory channel when the length of data to be sent by a sending end is greater than or equal to a preset length threshold value.
According to an implementation manner of the fourth aspect of the present invention, the second communication module further includes a reading unit, where the reading unit is configured to read, when the length is smaller than a preset length threshold, the data to be sent according to the address of the data to be sent in the shared memory channel, where the sending end copies the data to be sent from a sending cache of a sending end socket application to the shared memory channel when the length is smaller than the preset length threshold.
A fifth aspect of the present invention provides an inter-process communication device based on an Rsocket library, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the inter-process communication method executed by the transmitting end as described above when executing the computer program.
A sixth aspect of the present invention provides an inter-process communication device based on an Rsocket library, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the inter-process communication method executed by a receiving end as described above when executing the computer program.
A seventh aspect of the present invention provides an interprocess communication system based on an Rsocket library, the system comprising an interprocess communication apparatus as described above and an interprocess communication apparatus as described above;
or the like, or, alternatively,
the system comprises an interprocess communication device as described above and an interprocess communication device as described above.
An eighth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed, implements an inter-process communication method as recited in any one of the above.
According to the method and the device, the shared memory channel between the socket application of the sending end and the socket application of the receiving end is established by the Rsocket library through the Helper process according to the interprocess communication request, so that the sending end and the receiving end communicate through the shared memory channel, data copying is not needed through sbuf of the Rsocket library, the two-time copying cost and the delay cost caused by PCIE communication are avoided, and the improvement of interprocess communication performance is facilitated.
Drawings
FIG. 1 is a flow diagram of a preferred embodiment of an interprocess communication method provided by the present invention;
FIG. 2 is a flow chart diagram of a preferred embodiment of an interprocess communication method provided by the present invention;
FIG. 3 is a block diagram of a preferred embodiment of an interprocess communication device provided by the present invention;
FIG. 4 is a block diagram of a preferred embodiment of an interprocess communication device provided by the present invention.
Reference numerals:
the device comprises a sending module 1, a first communication module 2, a determining unit 20, a first copying unit 21, a second copying unit 22, a second communication module 3, a third copying unit 30 and a reading unit 31.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It is to be noted that the following communication method of the present invention is used for inter-process communication within the same host.
In the following embodiment of the invention, the Rsocket library establishes the shared memory channel between the sending end socket application and the receiving end socket application through the Helper process according to the interprocess communication request, so that the sending end and the receiving end communicate through the shared memory channel, data copying is not required through sbuf of the Rsocket library, the twice copying cost and the delay cost caused by PCIE communication are avoided, and the improvement of the interprocess communication performance is facilitated.
Wherein the socket application and the OFED library are installed in the user space, and the Rsocket library is part of the OFED library and thus also installed in the user space.
Fig. 1 is a flowchart illustrating an inter-process communication method according to a preferred embodiment of the present invention.
As shown in fig. 1, the method is applied to a transmitting end, and the method includes:
s1 sends an interprocess communication request to an Rsocket library, and the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request.
S2 performs data communication with a receiving end through the shared memory channel.
According to the method and the device, the shared memory channel between the socket application of the sending end and the socket application of the receiving end is established by the Rsocket library through the Helper process according to the interprocess communication request, so that the sending end and the receiving end communicate through the shared memory channel, data copying is not needed through sbuf of the Rsocket library, the two-time copying cost and the delay cost caused by PCIE communication are avoided, and the improvement of interprocess communication performance is facilitated.
Wherein, the data communication with the receiving end through the shared memory channel includes:
determining the length of data to be transmitted;
and when the length is greater than or equal to a preset length threshold value, acquiring a physical address of a sending cache from a memory processing module and copying the physical address into the shared memory channel, and acquiring the physical address of the sending cache by a receiving end according to the shared memory channel and copying the physical address into a shared memory area created by the memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of a corresponding receiving end socket application.
During specific execution, a zero-copy sending function can be added in the Rsocket library, a function of calling the zero-copy sending function is added in the rsend function, and the zero-copy sending function can copy the physical address of the sending cache to the shared memory channel. And adding a zero-copy receiving function in the Rsocket library, adding a function of calling the zero-copy receiving function in the rrecv function, wherein the zero-copy receiving function can acquire the physical address of the sending cache from the shared memory channel and send a request for establishing memory mapping to the character equipment of the memory processing module, so that the memory processing module can perform memory mapping on the sending cache physical address and the receiving cache of the corresponding receiving end socket application according to the request.
In one embodiment, the receiving end may perform an operation of copying the physical address in the shared memory channel to the shared memory area when the physical address is copied in the shared memory channel. In another preferred embodiment, when the number of physical addresses of the sending cache stored in the shared memory channel reaches a number threshold corresponding to the receiving cache length of the receiving end, the receiving end copies the physical addresses in the shared memory channel to the shared memory area together, so that the memory processing module can process a plurality of memory maps at one time.
Further, the method further comprises:
when the length is smaller than a preset length threshold value, copying the data to be sent from a sending cache of a sending end socket application to the shared memory channel, and reading the data to be sent by the receiving end according to the address of the data to be sent in the shared memory channel.
During specific execution, a shared memory sending function can be added in the Rsocket library, and a function of calling the shared memory sending function is added in the rsend function of the Rsocket library; and adding a shared memory receiving function in the Rsocket library, adding a function of calling the shared memory function in the rrecv function of the Rsocket library, wherein the shared memory receiving function is used for taking the data to be sent.
Preferably, the preset length threshold is 32 KB.
Further, a compare and swap (CAS) technology of the Linux system is adopted to copy the data to be transmitted from the transmission cache of the transmitting-side socket application to the shared memory channel.
Wherein, the establishing of the shared memory channel between the sending end socket application and the receiving end socket application through the Helper process includes:
the Rsocket library sends a first connection request to a Helper process, and establishes a first shared memory channel according to a first shared memory secret key fed back by the Helper process, wherein the first shared memory channel is a shared memory channel of the sending end socket application and the Helper process, and the first connection request comprises a port number to be connected by the sending end socket application;
the Rsocket library sends a second connection request to a Helper process, and establishes a second shared memory channel according to a second shared memory key fed back by the Helper process, wherein the second shared memory channel is a shared memory channel between the receiving end socket application and the Helper process, and the second connection request comprises a port number to be connected by the receiving end socket application;
the Rsocket library receives a connection key sent by the Helper process, and the Helper process sends the connection key when the port number to be connected by the sending-end socket application is matched with the port number to be connected by the receiving-end socket application;
and the Rsocket library establishes a shared memory channel between the sending end socket application and the receiving end socket application according to the connection key.
When the above steps are specifically executed, in order to adapt to the Helper process, the correlation function in the Rsocket library needs to be modified: adding a function of connecting a sending end with a Helper function in an Rsocket library, and adding a function of calling the sending end to connect the Helper function in an rconnect function of the Rsocket library; adding a receiving terminal connection Helper function in an Rsocket library, and adding a function of calling the receiving terminal connection Helper function in a raccept function of the Rsocket library; adding a shared memory function in an Rsocket library, and adding and calling functions for establishing the shared memory function in an rconnect function and a raccept function of the Rsocket library; adding a shared memory connection establishment function in the Rsocket library, and adding a function for calling the shared memory connection establishment function in an rconnect function and a raccept function of the Rsocket library.
Therefore, the Rsocket library sends the first connection request to the Helper process by connecting the Helper function to the sending end, sends the second connection request to the Helper process by connecting the Helper function to the receiving end, establishes the first shared memory channel and the second shared memory channel by the established shared memory function, and establishes the shared memory channel between the socket application of the sending end and the socket application of the receiving end by the shared memory connection establishing function.
Further, the first connection request further includes an IP address and a connection type of the sending end socket application, and the Helper process feeds back the first shared memory key when the IP address of the sending end socket application matches a preset local IP address and the connection type is the sending connection type.
Further, the second connection request further includes a connection type, and the Helper process feeds back the second shared memory key when the connection type is the received connection type.
Wherein the method further comprises:
the Rsocket library sends a request for creating a shared memory area to the memory processing module after receiving the interprocess communication request, and the memory processing module creates the shared memory area according to the request for creating the shared memory area.
During specific execution, a character device shared memory function can be added in the Rsocket library, and a function of calling the character device shared memory function is added in an rconnect function and a raccept function of the Rsocket library.
The shared memory function of the character device is used for sending the request for establishing the shared memory area to the memory processing module, so that the memory processing module establishes the shared memory area according to the request.
Preferably, the shared memory space of the shared memory channel is a shared sending buffer of 1MB, a shared receiving buffer of 1MB, and a pointer storage space of 4KB, and the pointer storage space is used for storing a queue head pointer of the shared sending buffer, a queue tail pointer of the shared sending buffer, a queue head pointer of the shared receiving buffer, and a queue tail pointer of the shared receiving buffer.
Further, the shared memory space of the shared memory area is a memory area of 2 MB.
The second aspect of the present invention provides an interprocess communication method, which is applied in a receiving end.
Fig. 2 is a flowchart illustrating an inter-process communication method according to a preferred embodiment of the present invention. As shown in fig. 2, the method of the second aspect of the present invention comprises:
s1 carries out data communication with the sending end through the shared memory channel between the sending end socket application and the receiving end socket application, and the shared memory channel between the sending end socket application and the receiving end socket application is established by the Helper process when the Rsocket library receives the interprocess communication request sent by the sending end.
The data communication with the sending end through the shared memory channel between the sending end socket application and the receiving end socket application comprises the following steps:
acquiring a physical address of a sending cache according to a shared memory channel between a sending end socket application and a receiving end socket application and copying the physical address of the sending cache into a shared memory area created by a memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of the corresponding receiving end socket application;
and the physical address is acquired from the memory processing module and copied to the shared memory channel by the sending end when the length of the data to be sent is greater than or equal to a preset length threshold.
The communication method is used for interprocess communication in the same host.
In one embodiment, the receiving end may perform an operation of copying the physical address in the shared memory channel to the shared memory area when the physical address is copied in the shared memory channel. In another preferred embodiment, when the number of physical addresses of the sending cache stored in the shared memory channel reaches a number threshold corresponding to the receiving cache length of the receiving end, the receiving end copies the physical addresses in the shared memory channel to the shared memory area together, so that the memory processing module can process a plurality of memory maps at one time.
Further, the method further comprises:
when the length is smaller than a preset length threshold, the receiving end reads the data to be sent according to the address of the data to be sent in the shared memory channel, wherein when the length is smaller than the preset length threshold, the sending end copies the data to be sent from a sending cache of a sending end socket application to the shared memory channel.
The method for establishing the shared memory channel between the sending end socket application and the receiving end socket application through the Helper process when the Rsocket library receives the interprocess communication request sent by the sending end comprises the following steps:
the Rsocket library sends a first connection request to a Helper process, and establishes a first shared memory channel according to a first shared memory secret key fed back by the Helper process, wherein the first shared memory channel is a shared memory channel of the sending end socket application and the Helper process, and the first connection request comprises a port number to be connected by the sending end socket application;
the Rsocket library sends a second connection request to a Helper process, and establishes a second shared memory channel according to a second shared memory key fed back by the Helper process, wherein the second shared memory channel is a shared memory channel between the receiving end socket application and the Helper process, and the second connection request comprises a port number to be connected by the receiving end socket application;
the Rsocket library receives a connection key sent by the Helper process, and the Helper process sends the connection key when the port number to be connected by the sending-end socket application is matched with the port number to be connected by the receiving-end socket application;
and the Rsocket library establishes a shared memory channel between the sending end socket application and the receiving end socket application according to the connection key.
Further, the first connection request further includes an IP address and a connection type of the sending end socket application, and the Helper process feeds back the first shared memory key when the IP address of the sending end socket application matches a preset local IP address and the connection type is the sending connection type.
Further, the second connection request further includes a connection type, and the Helper process feeds back the second shared memory key when the connection type is the received connection type.
Wherein the method further comprises:
the Rsocket library sends a request for creating a shared memory area to the memory processing module after receiving the interprocess communication request, and the memory processing module creates the shared memory area according to the request for creating the shared memory area.
Wherein the preset length threshold is 32 KB.
Preferably, the shared memory space of the shared memory channel is a shared sending buffer of 1MB, a shared receiving buffer of 1MB, and a pointer storage space of 4KB, and the pointer storage space is used for storing a queue head pointer of the shared sending buffer, a queue tail pointer of the shared sending buffer, a queue head pointer of the shared receiving buffer, and a queue tail pointer of the shared receiving buffer.
Further, the shared memory space of the shared memory area is a memory area of 2 MB.
For the convenience of understanding the present invention, a preferred specific implementation manner corresponding to a specific process of performing communication between the sending end and the receiving end through the shared memory channel is described below by taking the preset length threshold as 32KB as an example. The method according to the above embodiment of the present invention may also be implemented in other specific implementations.
The preferred specific execution program is:
1.1, a sending end socket application calls a send function of a Linux system, an Rsocket library is used for intercepting the send function, an rsend function of the Rsocket library is used for replacing the send function, and if the sending cache length of the socket application is smaller than 32KB, 1.2 is converted; if the sending buffer length of the socket application is greater than or equal to 32KB, 1.3 is converted.
1.2 the rsend function of the Rsocket library calls a shared memory sending function, and the specific method comprises the following steps:
1.2.1, a shared memory sending function of a sending end reads a queue head pointer and a queue tail pointer of a shared receiving cache, judges whether the shared receiving cache is full or not, and judges whether a value obtained by adding 1 to the queue tail pointer and then obtaining a remainder value of 256 is equal to the queue head pointer or not, if the value is equal to the value indicating that the shared receiving cache is full, 1.2.1 steps are circulated until 5 seconds are overtime, if the value is overtime, the 'cache is full, sending is failed', and if the shared receiving cache is not full, 1.2.2 is turned;
1.2.2 increasing a queue tail pointer by using an __ sync _ match _ and _ swap function provided by a Linux system, wherein each increase of the queue tail pointer by 1 represents that a shared receiving cache occupies a 4KB memory, judging whether the increase is successful, if so, turning to 1.2.3, and if not, turning to 1.2.2 steps;
1.2.3 the shared memory sending function at the sending end copies data from the sending cache of the socket application to the shared memory, the write address in the shared memory is the address of the shared receiving cache plus the address of the queue tail pointer multiplied by 4KB, if the data length of the sending cache of the socket application at the sending end exceeds 3.8KB, the copy length is equal to 3.8 KB;
if the data length of the sending buffer of the sending end socket application is less than or equal to 3.8KB, the copy length is equal to the data length;
1.2.4 shared memory send function at sender uses __ atomic _ store _ n function to write 001 in the last 8 bytes of 4KB region of write address of shared memory described in 1.2.3;
1.2.5 subtracting the copy length from the data length in the sending buffer of the sending end socket application;
1.2.6 whether the data length of the sending buffer of the sending end socket application is 0, if the data length is 0 to 1.5, if the data length is not 0, the data length is 1.2.1;
1.3 the rsend function of the Rsocket library calls a zero-copy sending function, and the specific method is as follows:
1.3.1, a zero-copy sending function of a sending end reads a queue head pointer and a queue tail pointer of a shared receiving buffer, judges whether the receiving buffer is full or not, and judges whether a value obtained by adding 1 to the queue tail pointer and then obtaining a remainder of 256 is equal to the queue head pointer or not, if the value is equal to the value indicating that the shared receiving buffer is full, 1.3.1 steps are circulated until 5 seconds are overtime, if the value is overtime, the buffer is full, the sending is failed, and if the shared receiving buffer is not full, 1.3.2 is turned;
1.3.2 the zero copy sending function of the sending end calls the memory processing request function, and the specific method of the memory processing request function is as follows:
1.3.2.1 the memory processing request function sends a memory processing request to a system call processing module of the memory processing module, wherein the memory processing request comprises a virtual address and a length of a sending cache of a sending end socket application;
1.3.2.2 the system call processing module of the memory processing module receives the memory processing request, calls the get _ user _ page function of the Linux system to obtain the physical page and page number of the sending cache, and uses the array to store the physical page address.
1.3.2.3 the system call processing module copies data of the array storing the physical page address to a physical address array of a user space by using a copy _ to _ user function of the Linux system;
1.3.3 zero copy sending function adds a queue tail pointer by using __ sync _ match _ and _ swap function provided by a Linux system; when the queue tail pointer is increased by 1, the shared receiving buffer is occupied by a 4KB memory, whether the queue tail pointer is increased successfully or not is judged, and if the queue tail pointer is increased successfully, the queue tail pointer is changed to 1.3.4; if not successful, turning to step 1.3.3;
1.3.4 the zero copy sending function takes out the physical address from the physical address array, writes the physical address into the shared receiving buffer, and the write-in address in the shared receiving buffer is the address obtained by adding the queue tail pointer to the shared receiving buffer address and multiplying the 4 KB;
1.3.5 zero copy send function writes 101 in the last 8 bytes of the 4KB region of the write address of shared memory described in 1.3.4 using the __ atomic _ store _ n function;
1.3.6 the zero copy sending function judges whether the physical address array is empty, if so, the operation is changed to 1.5; if not, turning to 1.3.3;
1.4 the receiving end socket application calls a recv function of the Linux system, uses an Rsocket library to intercept the recv function, and adopts a rrecv function of the Rsocket library to replace the recv function; the rrecv function calls a shared memory receiving function, and the specific method is as follows:
1.4.1 shared memory receiving function reads a queue head pointer and a queue tail pointer of a shared receiving buffer, judges whether the shared receiving buffer is empty or not, and judges whether the queue head pointer is equal to the queue tail pointer or not, if the queue head pointer is equal to the queue tail pointer, the shared receiving buffer does not have data, the loop 1.4.1 step knows that 5 seconds are overtime, if the overtime, the buffer is empty, no new data arrives, and if the shared receiving buffer is not empty, the loop 1.4.2 is turned to.
1.4.2 the shared memory receiving function at the receiving end reads the last 8 bytes of the 4KB region of the shared memory receiving buffer pointed by the shared memory receiving buffer queue head pointer, and the address of the read 4KB region is the address obtained by adding the shared memory receiving buffer address to the address obtained by multiplying the queue head pointer by 4 KB. Using __ atomic _ load _ n function to ensure the correctness of CPU instruction, if the last 8 bytes is 001, turning to 1.4.3, if the last 8 bytes is 101, turning to 1.4.7;
1.4.3 the shared memory receiving function of the receiving end copies the shared memory message pointed by the shared receiving buffer queue head pointer to the receiving buffer of the receiving end socket application, and the message address is the address obtained by adding the queue head pointer to the shared receiving buffer address and multiplying the shared receiving buffer address by 4 KB;
1.4.4 the copy length of the shared memory receive function is the smaller of the length of the receive buffer and 3.8 KB;
1.4.5 the shared memory receiving function sets the content of a 4KB region starting from the message address to be 0;
1.4.6 shared memory receiving function increases queue head pointer of receiving buffer;
1.4.7 subtracting the copy length from the receiving buffer length of the receiving end socket application;
1.4.8 if the receiving buffer length of the receiving end socket application is 0, turning to 1.5, if not 0, turning to 1.4.1;
1.4.7 the shared memory receiving function calls a zero-copy receiving function;
1.4.8 storing the message of the shared memory pointed by the shared receiving buffer queue head pointer into the physical address array by the zero-copy receiving function, wherein the message address is the address obtained by adding the shared receiving buffer address and the queue head pointer multiplied by 4KB, and the length of the read message is fixed to 64 bytes;
1.4.9 subtracting 4KB from the receiving buffer length of the receiving end socket application;
1.4.10 if the receiving buffer length of the receiving end socket application is 0, turning to 1.4.11, if not 0, turning to 1.4.1;
1.4.11 the zero copy receiving function sends the request of establishing memory mapping to the character device of the memory processing module, and copies the physical address array to the shared memory area of the character device;
1.4.12 the character device of the memory processing module obtains the physical address in the physical address array through the character device shared memory area;
1.4.13 the character device of the memory processing module uses the remap _ pfn _ range function of Linux system to remap the physical address of the physical address array and the receiving buffer of the receiving end socket application;
1.5 end of
The embodiment of the third aspect of the invention provides an interprocess communication device based on an Rsocket library, which is applied to a sending end.
Fig. 3 is a schematic structural diagram of a preferred embodiment of the inter-process communication apparatus based on an Rsocket library according to the present invention, where the apparatus is capable of implementing all the processes of the inter-process communication method described in any of the above embodiments executed by the sending end.
As shown in fig. 3, the apparatus includes:
the system comprises a sending module 1, a receiving module and a sending module, wherein the sending module 1 is used for sending an interprocess communication request to an Rsocket library, and the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request;
and the first communication module 2 is used for carrying out data communication with a receiving end through the shared memory channel.
Wherein the first communication module comprises:
a determining unit 20, configured to determine a length of data to be transmitted;
the first copying unit 21 is configured to, when the length is greater than or equal to a preset length threshold, obtain a physical address of a sending cache from a memory processing module and copy the physical address to the shared memory channel, so that a receiving end obtains the physical address of the sending cache according to the shared memory channel and copies the physical address to a shared memory area created by the memory processing module, and the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of a corresponding receiving-end socket application.
Further, the first communication module 2 further includes a second copying unit 22, where the second copying unit 22 is configured to copy, when the length is smaller than a preset length threshold, the data to be sent from a sending cache of a sending-end socket application to the shared memory channel, so that the receiving end reads the data to be sent according to an address of the data to be sent in the shared memory channel.
The functions and implementation manners of the modules of the above embodiment of the apparatus of the present invention are the same as those of the above embodiment of the inter-process communication method executed by the sending end, and specific analysis may refer to the above embodiment of the inter-process communication method executed by the sending end, and are not described herein again to avoid repetition.
Fig. 4 is a schematic structural diagram of a preferred embodiment of the inter-process communication apparatus based on the Rsocket library according to the present invention, where the apparatus is capable of implementing all the processes of the inter-process communication method described in any of the embodiments executed by the receiving end.
As shown in fig. 4, the apparatus includes:
and the second communication module 3 is configured to perform data communication with the sending end through a shared memory channel between a sending-end socket application and a receiving-end socket application, where the shared memory channel between the sending-end socket application and the receiving-end socket application is established by a Helper process when an inter-process communication request sent by the sending end is received by an Rsocket library.
Wherein the second communication module 3 comprises:
a third copying unit 30, configured to obtain a physical address of a sending cache according to a shared memory channel between a sending-end socket application and a receiving-end socket application, and copy the physical address to a shared memory area created by a memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of the corresponding receiving-end socket application, where the physical address is obtained from the memory processing module and copied to the shared memory channel by the sending end when a length of data to be sent is greater than or equal to a preset length threshold.
Further, the second communication module 3 further includes a reading unit 31, where the reading unit 31 is configured to read, according to the address of the data to be sent in the shared memory channel when the length is smaller than a preset length threshold, the data to be sent, where the sending end copies the data to be sent from a sending cache of a sending end socket application to the shared memory channel when the length is smaller than the preset length threshold.
The functions and implementation manners of the modules of the above embodiment of the apparatus of the present invention are the same as those of the above embodiment of the inter-process communication method executed by the receiving end, and the specific analysis may refer to the above embodiment of the inter-process communication method executed by the receiving end, and are not described herein again to avoid repetition.
A fifth aspect of the present invention provides an inter-process communication device based on an Rsocket library, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the inter-process communication method executed by the transmitting end as described above when executing the computer program.
A sixth aspect of the present invention provides an inter-process communication device based on an Rsocket library, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the inter-process communication method executed by a receiving end as described above when executing the computer program.
A seventh aspect of the present invention provides an interprocess communication system based on an Rsocket library, the system comprising an interprocess communication apparatus as described above and an interprocess communication apparatus as described above;
or the like, or, alternatively,
the system comprises an interprocess communication device as described above and an interprocess communication device as described above.
An eighth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed, implements an inter-process communication method as recited in any one of the above.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc., and the processor is a control center of the inter-process communication device based on the Rsocket library, and various interfaces and lines are used for connecting various parts of the whole inter-process communication device based on the Rsocket library.
The memory may be configured to store the computer program and/or the module, and the processor may implement various functions of the inter-process communication apparatus based on the Rsocket library by executing or executing the computer program and/or the module stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein, the modules/units integrated by the inter-process communication device based on the Rsocket library can be stored in a computer readable storage medium if the modules/units are realized in the form of software functional units and sold or used as independent products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
The foregoing is a preferred embodiment of the present application, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations are also regarded as the protection scope of the present application.

Claims (26)

1. An inter-process communication method, applied to a transmitting end, the method comprising:
sending an interprocess communication request to an Rsocket library, wherein the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request;
and carrying out data communication with a receiving end through the shared memory channel.
2. The inter-process communication method according to claim 1, wherein the performing data communication with a receiving end through the shared memory channel includes:
determining the length of data to be transmitted;
and when the length is greater than or equal to a preset length threshold value, acquiring a physical address of a sending cache from a memory processing module and copying the physical address into the shared memory channel, and acquiring the physical address of the sending cache by a receiving end according to the shared memory channel and copying the physical address into a shared memory area created by the memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of a corresponding receiving end socket application.
3. The inter-process communication method according to claim 2, wherein the physical addresses in the shared memory channel are copied to the shared memory region by the receiving end only when the number of the physical addresses of the sending buffer stored in the shared memory channel reaches a number threshold corresponding to a receiving buffer length of the receiving end.
4. The inter-process communication method according to claim 2, wherein the data communication with a receiving end through the shared memory channel further comprises:
when the length is smaller than a preset length threshold value, copying the data to be sent from a sending cache of a sending end socket application to the shared memory channel, and reading the data to be sent by the receiving end according to the address of the data to be sent in the shared memory channel.
5. The inter-process communication method according to claim 1, wherein the establishing, by the Helper process, a shared memory channel between the sender-side socket application and the receiver-side socket application includes:
the Rsocket library sends a first connection request to a Helper process, and establishes a first shared memory channel according to a first shared memory secret key fed back by the Helper process, wherein the first shared memory channel is a shared memory channel of the sending end socket application and the Helper process, and the first connection request comprises a port number to be connected by the sending end socket application;
the Rsocket library sends a second connection request to a Helper process, and establishes a second shared memory channel according to a second shared memory key fed back by the Helper process, wherein the second shared memory channel is a shared memory channel between the receiving end socket application and the Helper process, and the second connection request comprises a port number to be connected by the receiving end socket application;
the Rsocket library receives a connection key sent by the Helper process, and the Helper process sends the connection key when the port number to be connected by the sending-end socket application is matched with the port number to be connected by the receiving-end socket application;
and the Rsocket library establishes a shared memory channel between the sending end socket application and the receiving end socket application according to the connection key.
6. The inter-process communication method according to claim 5, wherein the first connection request further includes an IP address and a connection type of a sending-side socket application, and the Helper process feeds back the first shared memory key when the IP address of the sending-side socket application matches a preset native IP address and the connection type is a sending connection type.
7. The inter-process communication method according to claim 5, wherein the second connection request further includes a connection type, and the Helper process feeds back the second shared memory key when the connection type is a receive connection type.
8. The inter-process communication method of claim 2, further comprising:
the Rsocket library sends a request for creating a shared memory area to the memory processing module after receiving the interprocess communication request, and the memory processing module creates the shared memory area according to the request for creating the shared memory area.
9. An inter-process communication method, applied to a receiving end, the method comprising:
the method comprises the steps that data communication is carried out between a sending end socket application and a receiving end socket application through a shared memory channel, the shared memory channel between the sending end socket application and the receiving end socket application is established through a Helper process when an Rsocket library receives an interprocess communication request sent by the sending end.
10. The inter-process communication method according to claim 9, wherein the performing data communication with the sender through a shared memory channel between the sender socket application and the receiver socket application comprises:
acquiring a physical address of a sending cache according to a shared memory channel between a sending end socket application and a receiving end socket application and copying the physical address of the sending cache into a shared memory area created by a memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of the corresponding receiving end socket application;
and the physical address is acquired from the memory processing module and copied to the shared memory channel by the sending end when the length of the data to be sent is greater than or equal to a preset length threshold.
11. The inter-process communication method according to claim 10, wherein the physical addresses in the shared memory channel are copied to the shared memory area by the receiving end only when the number of the physical addresses of the sending buffer stored in the shared memory channel reaches a number threshold corresponding to a receiving buffer length of the receiving end.
12. The inter-process communication method according to claim 10, wherein the data communication with the sender is performed through a shared memory channel between the sender socket application and the receiver socket application, and further comprising:
when the length is smaller than a preset length threshold, the receiving end reads the data to be sent according to the address of the data to be sent in the shared memory channel, wherein when the length is smaller than the preset length threshold, the sending end copies the data to be sent from a sending cache of a sending end socket application to the shared memory channel.
13. The inter-process communication method according to claim 9, wherein the shared memory channel between the sending-end socket application and the receiving-end socket application is established by a Helper process when an Rsocket library receives an inter-process communication request sent by the sending end, and the method includes:
the Rsocket library sends a first connection request to a Helper process, and establishes a first shared memory channel according to a first shared memory secret key fed back by the Helper process, wherein the first shared memory channel is a shared memory channel of the sending end socket application and the Helper process, and the first connection request comprises a port number to be connected by the sending end socket application;
the Rsocket library sends a second connection request to a Helper process, and establishes a second shared memory channel according to a second shared memory key fed back by the Helper process, wherein the second shared memory channel is a shared memory channel between the receiving end socket application and the Helper process, and the second connection request comprises a port number to be connected by the receiving end socket application;
the Rsocket library receives a connection key sent by the Helper process, and the Helper process sends the connection key when the port number to be connected by the sending-end socket application is matched with the port number to be connected by the receiving-end socket application;
and the Rsocket library establishes a shared memory channel between the sending end socket application and the receiving end socket application according to the connection key.
14. The inter-process communication method according to claim 13, wherein the first connection request further includes an IP address and a connection type of a sending-side socket application, and the Helper process feeds back the first shared memory key when the IP address of the sending-side socket application matches a preset native IP address and the connection type is a sending connection type.
15. The inter-process communication method of claim 13, wherein the second connection request further comprises a connection type, and wherein the Helper process feeds back the second shared memory key when the connection type is a receive connection type.
16. The inter-process communication method of claim 10, further comprising:
the Rsocket library sends a request for creating a shared memory area to the memory processing module after receiving the interprocess communication request, and the memory processing module creates the shared memory area according to the request for creating the shared memory area.
17. Interprocess communication device based on Rsocket library, which is characterized in that the device is applied to a sending end, and the device comprises:
the system comprises a sending module, a receiving module and a processing module, wherein the sending module is used for sending an interprocess communication request to an Rsocket library, and the Rsocket library establishes a shared memory channel between a sending end socket application and a receiving end socket application through a Helper process according to the interprocess communication request;
and the first communication module is used for carrying out data communication with a receiving end through the shared memory channel.
18. The interprocess communication apparatus according to claim 17, wherein said first communication module comprises:
the determining unit is used for determining the length of the data needing to be sent;
the first copying unit is configured to, when the length is greater than or equal to a preset length threshold, obtain a physical address of a sending cache from a memory processing module and copy the physical address into the shared memory channel, so that a receiving end obtains the physical address of the sending cache according to the shared memory channel and copies the physical address into a shared memory region created by the memory processing module, and the memory processing module performs memory mapping on the physical address of the sending cache and a receiving cache of a corresponding receiving-end socket application.
19. The inter-process communication device according to claim 18, wherein the first communication module further includes a second copy unit, and the second copy unit is configured to copy, when the length is smaller than a preset length threshold, the data to be sent from a sending cache of a sending-end socket application to the shared memory channel, so that the receiving end reads the data to be sent at an address of the shared memory channel according to the data to be sent.
20. Interprocess communication device based on Rsocket library, the device is applied to the receiving terminal, the device includes:
and the second communication module is used for carrying out data communication with the sending end through a shared memory channel between the sending end socket application and the receiving end socket application, and the shared memory channel between the sending end socket application and the receiving end socket application is established by a Helper process when an Rsocket library receives an interprocess communication request sent by the sending end.
21. The interprocess communication apparatus according to claim 20, wherein said second communication module comprises:
and the third copying unit is used for acquiring a physical address of a sending cache according to a shared memory channel between the sending-end socket application and the receiving-end socket application and copying the physical address into a shared memory area created by the memory processing module, so that the memory processing module performs memory mapping on the physical address of the sending cache and the receiving cache of the corresponding receiving-end socket application, and the physical address is acquired from the memory processing module and copied into the shared memory channel when the length of data to be sent by a sending end is greater than or equal to a preset length threshold value.
22. The inter-process communication device according to claim 21, wherein the second communication module further includes a reading unit, and the reading unit is configured to read the data to be sent at the address of the shared memory channel according to the data to be sent when the length is smaller than a preset length threshold, where the sending end copies the data to be sent from a sending cache of a sending end socket application to the shared memory channel when the length is smaller than the preset length threshold.
23. An inter-process communication device based on an Rsocket library, comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the inter-process communication method according to any one of claims 1 to 8 when executing the computer program.
24. An inter-process communication device based on an Rsocket library, comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the inter-process communication method according to any one of claims 9 to 16 when executing the computer program.
25. An inter-process communication system based on a Rsocket library, characterized in that the system comprises an inter-process communication device according to claim 9 and an inter-process communication device according to claim 17;
or the like, or, alternatively,
the system comprising an interprocess communication device according to claim 23 and an interprocess communication device according to claim 24.
26. A computer-readable storage medium, in which a computer program is stored which, when executed, implements the inter-process communication method according to any one of claims 1 to 16.
CN202110606085.8A 2021-05-31 2021-05-31 Inter-process communication method, device, equipment, system and storage medium Withdrawn CN113326151A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110606085.8A CN113326151A (en) 2021-05-31 2021-05-31 Inter-process communication method, device, equipment, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110606085.8A CN113326151A (en) 2021-05-31 2021-05-31 Inter-process communication method, device, equipment, system and storage medium

Publications (1)

Publication Number Publication Date
CN113326151A true CN113326151A (en) 2021-08-31

Family

ID=77422818

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110606085.8A Withdrawn CN113326151A (en) 2021-05-31 2021-05-31 Inter-process communication method, device, equipment, system and storage medium

Country Status (1)

Country Link
CN (1) CN113326151A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117692416A (en) * 2024-02-04 2024-03-12 苏州元脑智能科技有限公司 Network message processing method, device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117692416A (en) * 2024-02-04 2024-03-12 苏州元脑智能科技有限公司 Network message processing method, device, computer equipment and storage medium
CN117692416B (en) * 2024-02-04 2024-05-03 苏州元脑智能科技有限公司 Network message processing method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107678835B (en) Data transmission method and system
US20220245005A1 (en) Methods, devices and computer storage media for inter-mini program platform discovery
CN113064846A (en) Zero-copy data transmission method based on Rsockets protocol
CN115374046B (en) Multiprocessor data interaction method, device, equipment and storage medium
CN114265800A (en) Interrupt message processing method and device, electronic equipment and readable storage medium
CN114244790A (en) PCIe device and host device communication method, system and device
CN109478171B (en) Improving throughput in openfabics environment
CN113326151A (en) Inter-process communication method, device, equipment, system and storage medium
CN115422106A (en) Interrupt request processing method and device
CN113076281B (en) Method, system, equipment and medium for communication of Ceph kernel client
CN113098955B (en) Data transmission method, device and equipment and computer readable storage medium
WO2019236862A1 (en) Systems and methods for transport layer processing of server message block protocol messages
CN112422485B (en) Communication method and device of transmission control protocol
CN116016570A (en) Message processing method, device and system
US20200341653A1 (en) Method, network adapter and computer program product for processing data
CN116070239A (en) File encryption and decryption methods, devices, equipment and storage medium
WO2022151475A1 (en) Message buffering method, memory allocator, and message forwarding system
CN112822299B (en) RDMA (remote direct memory Access) -based data transmission method and device and electronic equipment
CN110659143B (en) Communication method and device between containers and electronic equipment
CN112637106B (en) Method and device for terminal to access website
CN108667951B (en) Virtual MAC address mapping method and device, storage medium and relay equipment
CN111580987A (en) Remote procedure calling method and device, storage medium and terminal equipment
CN113596029B (en) Data packet transmission method and device of functional mobile phone and functional mobile phone
CN111459867B (en) Method, device, converter and storage medium for converting USB (Universal Serial bus) into SMI (SMI)
CN111615150B (en) 5G data transmission method, device, equipment and storage medium based on PCIe interface

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20210831

WW01 Invention patent application withdrawn after publication