WO2015090250A1 - Inter-process communication method and device - Google Patents

Inter-process communication method and device Download PDF

Info

Publication number
WO2015090250A1
WO2015090250A1 PCT/CN2015/073166 CN2015073166W WO2015090250A1 WO 2015090250 A1 WO2015090250 A1 WO 2015090250A1 CN 2015073166 W CN2015073166 W CN 2015073166W WO 2015090250 A1 WO2015090250 A1 WO 2015090250A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
local
target
channel
data
Prior art date
Application number
PCT/CN2015/073166
Other languages
French (fr)
Chinese (zh)
Inventor
徐翠屏
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2015090250A1 publication Critical patent/WO2015090250A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/23Reliability checks, e.g. acknowledgments or fault reporting

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and apparatus for inter-process communication.
  • Inter-process communication problems are often encountered during the development of network services. Inter-process communication is divided into process communication within the machine and process communication across machines. For process communication in the machine, it is generally used: pipeline, shared memory, message queue, Unix Socket (an operating system socket) and IPC (Inter-Process Communication). For process communication across machines, TCP (Transmission Control Protocol) / UDP (User Datagram Protocol) Socket (Socket) is generally used.
  • TCP Transmission Control Protocol
  • UDP User Datagram Protocol
  • Socket Socket
  • Embodiments of the present invention provide a method and apparatus for inter-process communication, which are used to improve development efficiency and reduce errors.
  • a method of interprocess communication including:
  • the target channel between the local node and the target node is a remote proxy channel between a local proxy node of the local node and a target proxy node of the target node. And transmitting, by the local proxy node of the local node, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using the remote proxy channel.
  • a device for interprocess communication including:
  • a channel determining unit configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node;
  • a data writing unit configured to write the to-be-sent data into a local shared storage space corresponding to the target channel determined by the channel determining unit;
  • a sending unit configured to: if the target node is a remote node, the target channel between the local node and the target node is a local proxy node of the local node and a target proxy node of the target node And a remote proxy channel, by which the to-be-sent data in the local shared storage space is sent to a target proxy node of the target node by a local proxy node of the local node.
  • the embodiment of the present invention has the following advantages: the channel management scheme is adopted, and the cross-machine communication is realized through the proxy node, and the process that does not need to care about the communication is running on the same host or different hosts, so the developer does not need to Understand the mechanics and details of machine core cross-machine communication, so you can improve development efficiency and reduce errors.
  • FIG. 1 is a schematic flowchart of a method according to an embodiment of the present invention.
  • FIG. 2 is a schematic structural diagram of a system according to an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of a method according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a method according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a method according to an embodiment of the present invention.
  • FIG. 6 is a schematic flowchart of a method according to an embodiment of the present invention.
  • FIG. 7 is a schematic flowchart of a method according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural view of an apparatus according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural view of an apparatus according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
  • FIG. 13 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
  • Figure 14 is a schematic structural view of an apparatus according to an embodiment of the present invention.
  • FIG. 15 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • the embodiment of the invention provides a method for inter-process communication, as shown in FIG. 1 , including the following steps.
  • Step 102 Write the to-be-sent data into the local shared storage space corresponding to the target channel.
  • the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs the transmission control at the sending end of the data, as follows: the data to be sent is written into the local shared storage space corresponding to the determined target channel. Previously, it also included:
  • the transmission of data will continue. Once the state of the target channel changes to the pause state, this will indicate that the transmission speed exceeds the limit of the receiver and the transmission needs to be stopped.
  • the state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
  • the target node is a remote node
  • the target channel between the local node and the target node is a remote end between a local proxy node of the local node and a target proxy node of the target node.
  • a proxy channel by using the remote proxy channel, to send the to-be-sent data in the local shared storage space to a target proxy node of the target node by using a local proxy node of the local node.
  • this embodiment may further include:
  • the target channel is a local channel between the local node and the target node, and the data to be sent written in the local shared storage space passes through the local Channel reception.
  • the channel management scheme is adopted, and the cross-machine communication is realized through the proxy node. You don't need to care about whether the communication process is running on the same host or a different host, so developers don't need to understand the mechanism and details of the machine core's communication between machines, so it can improve development efficiency and reduce errors.
  • the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent.
  • the device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a solution used by the receiving end of the data, and performs flow control at the receiving end of the data, as follows:
  • the foregoing method further includes:
  • the proxy node receives data from the remote proxy node through the local proxy node and determining whether the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, to the remote end
  • the proxy node sends a pause indication message instructing the remote proxy node to suspend sending data to the home proxy node.
  • the local threshold is determined according to the storage space corresponding to the local target channel, and is used to prevent overflow.
  • the embodiment of the present invention further provides an implementation scheme for how to resume data transmission after the target channel is suspended (ie, after the data transmission is suspended) after the traffic control is performed, as follows:
  • the foregoing method further includes:
  • a recovery indication is sent to the remote proxy node, indicating that the remote proxy node continues to write data to the target channel.
  • the local target channel if it is not in the pause state, it should currently be in the process of sending data. If the local target channel is in the pause state, then there should be no data communication at present. In this case, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel, in fact, if the target It is also possible that the data amount of the channel is smaller than the total data capacity setting ratio of the target channel, which is not limited by the embodiment of the present invention.
  • the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the target proxy node, and the specific scheme is as follows: before determining the target channel according to the target node of the data to be sent, Also includes:
  • a local proxy node creates the local node and establishes a target channel between the local proxy node and the target proxy node, and allocates a local shared storage space for the target channel; or the local proxy node receives the target proxy node
  • the embodiment of the present invention further provides a technical solution for how to synchronize information of channels across devices, and uses proxy nodes to complete synchronization of channel information, as follows: before sending the data to be sent to the target proxy node through the local proxy node, Also includes:
  • Reading a configuration file determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP connection between the local proxy node and the target proxy node by using the internet protocol address and a port number; Transmitting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
  • the embodiment of the present invention further provides a scheme for channel deletion, which is specifically as follows: the foregoing method further includes:
  • the channel between the local node and the remote node is closed, and the channel between the local node and the remote node is not used by other processes, and the local node and the remote node are destroyed.
  • the channel between the end nodes is destroyed.
  • the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel.
  • the process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
  • the embodiment of the invention adopts a middleware scheme based on shared memory for inter-process communication. Developers can use it to easily exchange data between processes without worrying about whether the processes that need to exchange data are running on the same host or on different hosts. When processes are on the same host, data is transferred through shared memory; for processes on different hosts, the middleware transfers data to the remote host via the agent/agent via TCP/IP.
  • Host1 and host2 are two host devices; host1 contains two data sending and receiving points (peer), peer 1 and peer2, which belong to their respective processes; host2 contains two data sending and receiving points (peer), peer3 and The peer 4s are respectively in the process of the present invention; each of the hosts may include a plurality of processes, and each of the processes may include a plurality of peers.
  • FIG. 2 is only a schematic diagram and should not be construed as limiting the embodiments of the present invention.
  • the process in which the Agent is executing is a proxy service, which can be called a proxy node. The following sections describe the parts shown in Figure 2 in detail as follows:
  • the middleware is a client development package provided by the developer.
  • the development package is used to create a specific peer to receive and send messages.
  • Channel It is actually a shared memory.
  • the middleware creates a channel with the same name and binds to the peer. Each channel has a unique id, so there are multiple channel collections with the same channel name.
  • the peer receives data through this channel; when sending data, the middleware first finds the channel bound to the target peer and writes the data to the target channe.
  • the channel is divided into a local channel and a remote channel proxy.
  • the remote proxy channels shown in Figure 2 are: host2_channel4_proxy and host2_channel3_proxy in host1; host1_channel1_proxy and host1_channel2_proxy in host2.
  • Channel index actually a piece of shared memory. Store all The shared memory key (keyword) corresponding to the channel.
  • the peer's recv function (a function for receiving data from a connected datagram or streaming socket) is called each time. Receive a complete message.
  • the middleware mainly consists of two components:
  • the embodiment of the present invention is an inter-process communication middleware based on shared memory, and the data structure of the channel, the channel index, and the message in the shared memory is as follows:
  • the message is the basic unit of middleware data transmission.
  • the message will be reported as a data packet during the transmission process.
  • the maximum length of the data packet is 8K bytes.
  • the receiver will assemble these fragments into a complete message.
  • Table 3 The structure of the packet is shown in Table 3 below:
  • Channel creation The creation process of the channel is divided into a local channel actively created by the middleware client and a remote proxy channel created by the proxy service agent receiving the channel information transmitted from the peer end.
  • the process of the local channel actively created by the middleware client is as shown in FIG. 3, including:
  • Bind access channel index obtain the channel shm key and channel sem key corresponding to the peer
  • channel shm key and the channel sem key are keywords for identifying channel shm and channel sem respectively;
  • channel shm is a channel for receiving data, channel sem It is the channel used for searching.
  • This step initializes the storage space corresponding to the channel. As shown in Figure 2, channel1 to channel 4.
  • the proxy service agent receives the process of the remote proxy channel created by the channel information transmitted by the peer end, as shown in FIG. 4, including:
  • the agent receives the channel information sent by the peer end.
  • it may be channel information sent by the peer agent.
  • 402 Determine whether the channel corresponding to the received channel information exists, if yes, the process may end; otherwise, enter 403;
  • host2_channel4_proxy, host2_channel3_proxy, host1_channel1_proxy, and host1_channel2_proxy shown in Figure 2 are channels corresponding to the remote proxy peer.
  • Bind access channel index to obtain the channel shm key and channel sem key corresponding to the peer
  • the channel is created, the channel information is maintained in the memory, and the corresponding channel shared memory is created.
  • Cross-machine channel synchronization In this embodiment, it can be deployed as a front-end agent (agent) and a back-end agent.
  • the front-end agent needs to read remotehost.xml (the information of the remote host) to obtain all back-end agent information, including IP. (Internet Protocol Address) and Port (port) information, and actively establish a TCP connection with these backend agents for communication.
  • Host1 and host2 perform channel synchronization.
  • the specific process is shown in Figure 5. It includes:
  • 501A Read the configuration file to obtain the channel index configuration information that has been included in the Agent IP and the port.
  • the configuration file of the agent needs to include the following information:
  • channel corresponds to the maximum size of shared memory.
  • 503A Read remotehost.xml to obtain IP information of all peer Agents and ports;
  • 505A Obtain all new non-Agent created channels from the channel indx and send them to the peer agent.
  • 501B to 506B shown in FIG. 5 are steps completely corresponding to the above-described steps 501A to 506A, and will not be described again.
  • 603 Take the target channel from the channel list
  • 605 Determine whether the channel corresponding to the above shm is a local channel; if yes, enter 606, otherwise enter 607;
  • the local channel receives the data.
  • the remote proxy channel receives the data.
  • the proxy agent sends the data received by the remote proxy channel to the peer proxy agent.
  • the channel manager cyclically detects and reads whether there is data receiving in the channel created by the process, and refreshes the timestamp attribute (timestamp) of the channel every time, if there is data reception, To the user.
  • the local process can also obtain the channel created by other processes through the channel index, and periodically check whether the channel timestamp attribute (timestamp) is updated to determine whether the channel has been closed. If it is closed, the channel memory information will be destroyed. Refer specifically to the description of channel destruction in the subsequent embodiments.
  • multiple channels may be obtained through the target channel name, and one message channel is acquired each time as a target channel. This mechanism is also well-balanced.
  • the peer invokes the send method of the peer
  • 703 Determine whether the target channel is in a suspended state, if yes, suspend data transmission; if not, enter 704;
  • Agent 1 reads the remote channel sham data and sends it to the peer agent (Agent2).
  • the step is performed periodically: periodically determining that the channel state is paused and there is no data in the channel, the channel state is restored to normal.
  • the method of returning to the normal manner may be to send an indication message to the peer agent, indicating that the channel status is restored to normal.
  • Channel destruction in this embodiment the channel destruction rules are as follows:
  • the created peer is closed, and the corresponding channel memory information will be destroyed.
  • the channel may be used by multiple processes at the same time. Only all processes destroy the channel memory information, and the shared memory corresponding to the channel will be deleted from the system.
  • the present invention is a middleware solution for inter-process communication based on shared memory.
  • An embodiment of the present invention further provides an apparatus for inter-process communication, as shown in FIG. 8, including:
  • a channel determining unit 801 configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node;
  • a data writing unit 802 configured to write the to-be-sent data into a local shared storage space corresponding to the target channel determined by the channel determining unit;
  • a sending unit 804 configured to: if the target node is a remote node, the target channel between the local node and the target node is a local proxy node of the local node and a target proxy of the target node a remote proxy channel between the nodes, using the remote proxy channel
  • the local proxy node passing the local node transmits the to-be-sent data in the local shared storage space to a target proxy node of the target node.
  • the method may further include: a local channel unit 803, configured to: if the target node is another local node, the target channel is a local channel between the local node and the target node, Then, the data to be sent written in the local shared storage space is received through the local channel.
  • a local channel unit 803 configured to: if the target node is another local node, the target channel is a local channel between the local node and the target node, Then, the data to be sent written in the local shared storage space is received through the local channel.
  • the channel management scheme is adopted to implement cross-machine communication through the proxy node, and it is not necessary to care whether the communication process runs on the same host or different hosts, so the developer does not need to understand the mechanism and details of the inter-machine communication between the machine cores. This can improve development efficiency and reduce errors.
  • the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent.
  • the device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a receiving end of the data, and performs flow control at the receiving end of the data, as follows:
  • the foregoing apparatus further includes:
  • the receiving unit 901 is configured to receive data from the remote proxy node by using the local proxy node;
  • a threshold determining unit 902 configured to determine whether the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node;
  • the sending unit 804 is further configured to: after the threshold determining unit 902 determines that the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node, then to the remote proxy node. Sending a pause indication message instructing the remote proxy node to suspend sending data to the home agent node.
  • the received data does not reach the local threshold of the target channel, then the data can continue to be received.
  • the above threshold is in accordance with the above local target
  • the local storage space corresponding to the track is determined to prevent overflow.
  • the embodiment of the present invention further provides an implementation scheme of how to resume data transmission after the target channel is suspended (ie, after the data transmission is suspended), as follows: As shown in FIG. 10, the foregoing apparatus further includes:
  • a first determining unit 1001 configured to determine whether a channel between the local proxy node and the remote proxy node is in a suspended state, and whether there is data
  • the sending unit 804 is further configured to: if the first determining unit 1001 determines that the channel between the local proxy node and the remote proxy node is in a suspended state and has no data, send a recovery indication to the remote proxy node. Instructing the remote proxy node to continue transmitting data to the home agent node.
  • the local target channel if it is not in the pause state, it should currently be in the process of sending data. If the local target channel is in the pause state, then there should be no data communication at present. In this case, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel, in fact, if the target It is also possible that the data amount of the channel is smaller than the total data capacity setting ratio of the target channel, which is not limited by the embodiment of the present invention.
  • the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs transmission control at a data sending end, as follows: as shown in FIG. 11, the foregoing apparatus further includes:
  • the second determining unit 1101 is configured to determine whether the target channel is in a suspended state before writing the to-be-sent data into the local shared storage space corresponding to the target channel;
  • the data writing unit 802 is further configured to: if the second determining unit 1101 determines that the target channel is not in a suspended state, write the to-be-sent data into the shared storage space corresponding to the determined target channel, otherwise stop the foregoing The shared memory space corresponding to the target channel writes data until the target channel returns to the non-suspended state.
  • the target channel if the target channel is not in the pause state, then the data will be sent. If the status of the target channel changes to a paused state, this will indicate that the transmission speed exceeds the receiver's limit and needs to stop sending.
  • the state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
  • the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the peer proxy node.
  • a node creation scheme including a local node creation and a channel creation scheme according to the indication of the peer proxy node.
  • the node management unit 1201 is configured to create the local node and establish the local proxy before determining a target channel between the local node and the target node according to a target node to which the data to be sent of the local node is to be sent. a target channel between the node and the target proxy node, the local shared storage space is allocated to the target channel; or the channel information sent by the target proxy node is received, and if the channel information is not stored locally, the Target channel and monitor the target channel for data reception.
  • the embodiment of the present invention further provides a technical solution for how to synchronize the information of the channel across the device, and uses the proxy node to complete the synchronization of the channel information, as follows: As shown in FIG. 13, the foregoing apparatus further includes:
  • a synchronization management unit 1301 configured to send, by using the remote proxy channel, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using a local proxy node of the local node, Reading a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP connection between the local proxy node and the target proxy node by using the internet protocol address and a port number; Transmitting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
  • the embodiment of the present invention further provides a channel deletion scheme, which is specifically as follows: the synchronization management unit 1301 is further configured to: if the local node is closed, shut down the local node and the remote node. A channel between end nodes, and a channel between the local node and the remote node is not used by other processes, and the channel between the local node and the remote node is destroyed.
  • the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel.
  • the process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
  • the embodiment of the present invention further provides an apparatus for inter-process communication, as shown in FIG. 14, comprising: a receiver 1401, a transmitter 1402, a processor 1403, and a memory 1404;
  • the processor 1403 is configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node, and write the to-be-sent data into the target channel.
  • a target node to which the data to be sent of the local node is to be sent
  • a target channel between the local node and the target node is a target proxy node of the local node and a target proxy node of the target node
  • a remote proxy channel by which the to-be-sent data in the local shared storage space is sent to a target proxy node of the target node by a local proxy node of the local node.
  • the processor 1403 may be further configured to: if the target node is another local node, the target channel is a local channel between the local node and the target node, and then write the local shared storage space. The data to be transmitted within is received through the local channel.
  • the channel management scheme is adopted to implement cross-machine communication through the proxy node, and it is not necessary to care whether the communication process runs on the same host or different hosts, so the developer does not need to understand the mechanism and details of the inter-machine communication between the machine cores. This can improve development efficiency and reduce errors.
  • the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs transmission control at a transmitting end of the data, as follows: the processor 1403 is further configured to write the to-be-sent data into the target. Before the channel corresponds to the local shared storage space, determine the location Whether the target channel is in a pause state; if the target channel is in a pause state, stopping writing data to the local shared storage space corresponding to the target channel until the target channel returns to a non-suspended state.
  • the transmission of data will continue. Once the state of the target channel changes to the pause state, this will indicate that the transmission speed exceeds the limit of the receiver and the transmission needs to be stopped.
  • the state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
  • the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent.
  • the device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a receiving end of the data, and performs flow control at the receiving end of the data, as follows: the processor 1403 is further configured to receive data from the remote proxy node through the local proxy node, and determine the received data. Whether the data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, sending a pause indication message to the remote proxy node, instructing the remote proxy node to suspend to the The local proxy node sends the data.
  • the received data does not reach the threshold of the local target channel, the data can continue to be received.
  • the above threshold is determined according to the storage space corresponding to the local target channel described above, and is used to prevent overflow.
  • the embodiment of the present invention further provides an implementation scheme of how to resume data transmission after the target channel is suspended (that is, after the data transmission is suspended) after the traffic control is performed, as follows: the processor 1403 is further configured to: if the local When the channel between the proxy node and the remote proxy node is in a suspended state and there is no data, a recovery indication is sent to the remote proxy node, indicating that the remote proxy node continues to send data to the local proxy node.
  • the local target channel if it is not in the pause state, it should currently be in the process of sending data. If the above local target channel is in the pause state, then it should be If there is no data communication, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel. In fact, if the data volume of the target channel is smaller than the total data capacity setting of the target channel. The ratio is also possible, and the embodiment of the invention does not limit this uniquely.
  • the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the peer proxy node.
  • the processor 1403 is further configured to be based on the local node. Before the target node to which the to-be-sent data is to be sent determines the target channel between the local node and the target node, create the local node, and establish a target between the local proxy node and the target proxy node Channel, the local shared storage space is allocated to the target channel; or, receiving channel information sent by the target proxy node, if the channel information is not stored locally, creating the target channel, and monitoring whether the target channel has Data reception.
  • the embodiment of the present invention further provides a technical solution for how to synchronize the information of the channel across the device, and uses the proxy node to complete the synchronization of the channel information.
  • the processor 1403 is further configured to use the remote proxy channel to pass the Before the local proxy node of the local node sends the to-be-sent data in the local shared storage space to the target proxy node of the target node, the configuration file is read, and the Internet Protocol address and port number of the target proxy node are determined.
  • the channel information is sent to the target proxy node, so that the target proxy node establishes the target channel according to the channel information.
  • the embodiment of the present invention further provides a channel deletion scheme, which is specifically as follows: the processor 1403 is further configured to: if the local node is closed, close a channel between the local node and the remote node, and the The channel between the local node and the remote node is not used by other processes, and the channel between the local node and the remote node is destroyed.
  • the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel.
  • the process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
  • the embodiment of the present invention further provides a terminal.
  • a terminal As shown in FIG. 15 , for the convenience of description, only parts related to the embodiment of the present invention are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present invention.
  • the terminal may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, and the terminal is a mobile phone as an example:
  • FIG. 15 is a block diagram showing a partial structure of a mobile phone related to a terminal provided by an embodiment of the present invention.
  • the mobile phone includes: a radio frequency (RF) circuit 1510 , a memory 1520 , an input unit 1530 , a display unit 1540 , a sensor 1550 , an audio circuit 1560 , a wireless fidelity (WiFi) module 1570 , and a processor 1580 .
  • RF radio frequency
  • the RF circuit 1510 can be used for receiving and transmitting signals during the transmission or reception of information or during a call. Specifically, after receiving the downlink information of the base station, the processing is processed by the processor 1580. In addition, the data designed for the uplink is sent to the base station.
  • RF circuit 1510 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • RF circuitry 1510 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • E-mail Short Messaging Service
  • the memory 1520 can be used to store software programs and modules, and the processor 1580 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1520.
  • the memory 1520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the mobile phone (such as audio data, phone book, etc.).
  • memory 1520 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 1530 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function controls of the handset.
  • the input unit 1530 may include a touch panel 1531 and other input devices 1532.
  • the touch panel 1531 also referred to as a touch screen, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 1531 or near the touch panel 1531. Operation), and drive the corresponding connecting device according to a preset program.
  • the touch panel 1531 may include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 1580 is provided and can receive commands from the processor 1580 and execute them.
  • the touch panel 1531 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 1530 may also include other input devices 1532.
  • other input devices 1532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 1540 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone.
  • the display unit 1540 can include a display panel 1541.
  • the display panel 1541 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 1531 may cover the display panel 1541. After the touch panel 1531 detects a touch operation on or near the touch panel 1531, the touch panel 1531 transmits to the processor 1580 to determine the type of the touch event, and then the processor 1580 according to the touch event. The type provides a corresponding visual output on display panel 1541.
  • touch panel 1531 and the display panel 1541 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 15, in some embodiments, the touch panel 1531 and the display panel 1541 may be integrated. Realize the input and output functions of the phone.
  • the handset may also include at least one type of sensor 1550, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1541 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1541 and/or when the mobile phone moves to the ear. Or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • the mobile phone can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the mobile phone can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
  • the gesture of the mobile phone such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration
  • vibration recognition related functions such as pedometer, tapping
  • the mobile phone can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
  • An audio circuit 1560, a speaker 1561, and a microphone 1562 can provide an audio interface between the user and the handset.
  • the audio circuit 1560 can transmit the converted electrical data of the received audio data to the speaker 1561, and convert it into a sound signal output by the speaker 1561.
  • the microphone 1562 converts the collected sound signal into an electrical signal, and the audio circuit 1560. After receiving, it is converted into audio data, and then processed by the audio data output processor 1580, sent to, for example, another mobile phone via the RF circuit 1510, or outputted to the memory 1520 for further processing.
  • WiFi is a short-range wireless transmission technology.
  • the mobile phone through the WiFi module 1570 can help users to send and receive e-mail, browse the web and access streaming media, etc. It provides users with wireless broadband Internet access.
  • FIG. 15 shows the WiFi module 1570, it can be understood that it does not belong to the essential configuration of the mobile phone, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 1580 is a control center for the handset that connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 1520, and invoking data stored in the memory 1520, The phone's various functions and processing data, so that the overall monitoring of the phone.
  • the processor 1580 may include one or more processing units; preferably, the processor 1580 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1580.
  • the handset also includes a power source 1590 (such as a battery) that supplies power to the various components.
  • a power source 1590 such as a battery
  • the power source can be logically coupled to the processor 1580 via a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the mobile phone may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
  • the processor 1580 included in the terminal further has the following functions:
  • the target node Determining, by the target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node; and writing the to-be-sent data into a local shared storage space corresponding to the target channel;
  • the target node is a remote node, and the target channel between the local node and the target node is a remote proxy channel between a local proxy node of the local node and a target proxy node of the target node, And transmitting, by the local proxy node of the local node, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using the remote proxy channel.
  • the processor 1580 also And if the target node is another local node, the target channel is a local channel between the local node and the target node, and the data to be sent in the local shared storage space is written. Local channel reception.
  • the channel management scheme is adopted to implement cross-machine communication through the proxy node, and it is not necessary to care whether the communication process runs on the same host or different hosts, so the developer does not need to understand the mechanism and details of the inter-machine communication between the machine cores. This can improve development efficiency and reduce errors.
  • the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs transmission control at the transmitting end of the data, as follows: the processor 1580 is further configured to write the to-be-sent data into the target. Before the local shared storage space corresponding to the channel, determining whether the target channel is in a suspended state, if yes, stopping writing data to the local shared storage space corresponding to the target channel until the target channel returns to a non-suspended state.
  • the transmission of data will continue. Once the state of the target channel changes to the pause state, this will indicate that the transmission speed exceeds the limit of the receiver and the transmission needs to be stopped.
  • the state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
  • the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent.
  • the device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a solution used by the receiving end of the data, and performs flow control at the receiving end of the data, as follows: the processor 1580 is further configured to receive data from the remote proxy node through the local proxy node, and determine the received data. Whether the data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, sending a pause indication message to the remote proxy node, instructing the remote proxy node to suspend to the The local proxy node sends the data.
  • the threshold of the target channel can continue to receive data.
  • the above threshold is determined according to the storage space corresponding to the local target channel described above, and is used to prevent overflow.
  • the embodiment of the present invention further provides an implementation scheme of how to resume data transmission after the target channel is suspended (ie, after the data transmission is suspended) after the traffic control is performed, as follows: the processor 1580 is further configured to be used if the local When the channel between the proxy node and the remote proxy node is in a suspended state and there is no data, a recovery indication is sent to the remote proxy node, indicating that the remote proxy node continues to send data to the local proxy node.
  • the local target channel if it is not in the pause state, it should currently be in the process of sending data. If the local target channel is in the pause state, then there should be no data communication at present. In this case, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel, in fact, if the target It is also possible that the data amount of the channel is smaller than the total data capacity setting ratio of the target channel, which is not limited by the embodiment of the present invention.
  • the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the peer proxy node, and the specific scheme is as follows: the processor 1580 is further configured to be based on the local node. Before the target node to which the to-be-sent data is to be sent determines the target channel between the local node and the target node, create the local node, and establish a target between the local proxy node and the target proxy node Channel, the local shared storage space is allocated to the target channel; or, receiving channel information sent by the target proxy node, if the channel information is not stored locally, creating the target channel, and monitoring whether the target channel has Data reception.
  • the processor 1580 is further configured to be based on the local node. Before the target node to which the to-be-sent data is to be sent determines the target channel between the local node and the target node, create the local node, and establish a target between the local proxy node and the target proxy node Channel, the local shared
  • the embodiment of the present invention further provides a technical solution for how to synchronize the information of the channel across the device, and uses the proxy node to complete the synchronization of the channel information.
  • the processor 1580 is further configured to use the remote proxy channel to pass the a local proxy node of the local node sends the to-be-sent data in the local shared storage space to a target proxy node of the target node And reading a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP between the local proxy node and the target proxy node by using the internet protocol address and the port number And connecting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
  • the embodiment of the present invention further provides a channel deletion scheme, which is specifically as follows: the processor 1580 is further configured to: if the local node is closed, close a channel between the local node and the remote node, and the The channel between the local node and the remote node is not used by other processes, and the channel between the local node and the remote node is destroyed.
  • the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel.
  • the process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
  • the included units are only divided according to functional logic, but are not limited to the foregoing division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional units It is also for convenience of distinguishing from each other and is not intended to limit the scope of protection of the present invention.
  • the storage medium may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

Disclosed are an inter-process communication method and device. The method comprises: according to a target node to which data to be sent of a local node is to be sent, a target channel between the local node and the target node is determined; the data to be sent is written into a local shared storage space corresponding to the target channel; if the target node is a remote node, the target channel between the local node and the target node is a remote proxy channel between a local proxy node of the local node and a target proxy node of the target node, and the remote proxy channel is used to send the data to be sent in the local shared storage space to the target proxy node of the target node via the local proxy node of the local node. In the present solution, it is of no concern whether a communication process is running on a same host or a different host. Development efficiency is therefore increased, and errors are reduced.

Description

一种进程间通讯的方法及装置Method and device for inter-process communication 技术领域Technical field
本发明涉及计算机技术领域,特别涉及一种进程间通讯的方法、及装置。The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for inter-process communication.
背景技术Background technique
网络服务开发过程中经常会碰到进程间通讯问题。进程间通讯又分为机器内的进程通讯和跨机器的进程通讯。对于机器内的进程通讯一般采用:管道、共享内存、消息队列、Unix Socket(一种操作系统的套接字)以及IPC(Inter-Process Communication,进程间通信)等技术。对于跨机器的进程通讯一般采用TCP(Transmission Control Protocol,传输控制协议)/UDP(User Datagram Protocol,用户数据包协议)Socket(套接字)方式。Inter-process communication problems are often encountered during the development of network services. Inter-process communication is divided into process communication within the machine and process communication across machines. For process communication in the machine, it is generally used: pipeline, shared memory, message queue, Unix Socket (an operating system socket) and IPC (Inter-Process Communication). For process communication across machines, TCP (Transmission Control Protocol) / UDP (User Datagram Protocol) Socket (Socket) is generally used.
网络服务开发如果同时需要在机器内和跨机器作进程间通讯,就需要针对具体场景选择合适的IPC机制,并且对于机器内和跨机器进程间通讯分别封装和开发提供给上层应用使用。开发人员需要很了解机器内和跨机器进程间通讯机制和细节。这样应用开发效率比较低,也容易出错。If network service development needs to communicate between processes in the machine and across machines, it is necessary to select the appropriate IPC mechanism for the specific scenario, and provide the upper layer application for the inter-machine and cross-machine process communication and encapsulation and development. Developers need to be well aware of the communication mechanisms and details between in-machine and cross-machine processes. This kind of application development is relatively inefficient and error-prone.
发明内容Summary of the invention
本发明实施例提供了一种进程间通讯的方法、及装置,用于提高开发效率,减少出错。Embodiments of the present invention provide a method and apparatus for inter-process communication, which are used to improve development efficiency and reduce errors.
一种进程间通讯的方法,包括:A method of interprocess communication, including:
根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道; Determining a target channel between the local node and the target node according to a target node to which the to-be-sent data of the local node is to be sent;
将所述待发送数据写入所述目标通道对应的本地共享存储空间内;Writing the to-be-sent data into a local shared storage space corresponding to the target channel;
若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。If the target node is a remote node, the target channel between the local node and the target node is a remote proxy channel between a local proxy node of the local node and a target proxy node of the target node. And transmitting, by the local proxy node of the local node, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using the remote proxy channel.
一种装置,用于进程间通讯,包括:A device for interprocess communication, including:
通道确定单元,用于根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道;a channel determining unit, configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node;
数据写入单元,用于将所述待发送数据写入所述通道确定单元确定的所述目标通道对应的本地共享存储空间内;a data writing unit, configured to write the to-be-sent data into a local shared storage space corresponding to the target channel determined by the channel determining unit;
发送单元,用于若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的所述目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。a sending unit, configured to: if the target node is a remote node, the target channel between the local node and the target node is a local proxy node of the local node and a target proxy node of the target node And a remote proxy channel, by which the to-be-sent data in the local shared storage space is sent to a target proxy node of the target node by a local proxy node of the local node.
从以上技术方案可以看出,本发明实施例具有以下优点:采用通道管理的方案,通过代理节点实现跨机通讯,不需要关心通讯的进程是运行于同一主机还是不同主机,因此开发人员不需要了解机器内核跨机器间通信的机制和细节,因此可以提高开发效率,并减少出错。It can be seen from the above technical solutions that the embodiment of the present invention has the following advantages: the channel management scheme is adopted, and the cross-machine communication is realized through the proxy node, and the process that does not need to care about the communication is running on the same host or different hosts, so the developer does not need to Understand the mechanics and details of machine core cross-machine communication, so you can improve development efficiency and reduce errors.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造 性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention, One of ordinary skill in the art would not pay for creation Other drawings can also be obtained from these drawings on the premise of sexual labor.
图1为本发明实施例方法流程示意图;1 is a schematic flowchart of a method according to an embodiment of the present invention;
图2为本发明实施例系统架构示意图;2 is a schematic structural diagram of a system according to an embodiment of the present invention;
图3为本发明实施例方法流程示意图;3 is a schematic flowchart of a method according to an embodiment of the present invention;
图4为本发明实施例方法流程示意图;4 is a schematic flowchart of a method according to an embodiment of the present invention;
图5为本发明实施例方法流程示意图;FIG. 5 is a schematic flowchart of a method according to an embodiment of the present invention;
图6为本发明实施例方法流程示意图;6 is a schematic flowchart of a method according to an embodiment of the present invention;
图7为本发明实施例方法流程示意图;7 is a schematic flowchart of a method according to an embodiment of the present invention;
图8为本发明实施例装置结构示意图;8 is a schematic structural view of an apparatus according to an embodiment of the present invention;
图9为本发明实施例装置结构示意图;9 is a schematic structural diagram of an apparatus according to an embodiment of the present invention;
图10为本发明实施例装置结构示意图;10 is a schematic structural diagram of an apparatus according to an embodiment of the present invention;
图11为本发明实施例装置结构示意图;11 is a schematic structural view of an apparatus according to an embodiment of the present invention;
图12为本发明实施例装置结构示意图;12 is a schematic structural diagram of an apparatus according to an embodiment of the present invention;
图13为本发明实施例装置结构示意图;13 is a schematic structural diagram of an apparatus according to an embodiment of the present invention;
图14为本发明实施例装置结构示意图;Figure 14 is a schematic structural view of an apparatus according to an embodiment of the present invention;
图15为本发明实施例终端结构示意图。FIG. 15 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The present invention will be further described in detail with reference to the accompanying drawings, in which FIG. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例提供了一种进程间通讯的方法,如图1所示,包括以下步骤。 The embodiment of the invention provides a method for inter-process communication, as shown in FIG. 1 , including the following steps.
101:根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道。101: Determine, according to a target node to which the to-be-sent data of the local node is to be sent, a target channel between the local node and the target node.
102:将上述待发送数据写入上述目标通道对应的本地共享存储空间内。Step 102: Write the to-be-sent data into the local shared storage space corresponding to the target channel.
进一步地,本发明实施例还提供了进行流量控制的方案,该方案在数据的发送端进行发送控制,具体如下:在将上述待发送数据写入确定的上述目标通道对应的本地共享存储空间内之前,还包括:Further, the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs the transmission control at the sending end of the data, as follows: the data to be sent is written into the local shared storage space corresponding to the determined target channel. Previously, it also included:
确定目标通道是否为暂停状态,若不是暂停状态,则将上述待发送数据写入确定的上述目标通道对应的本地共享存储空间内,否则停止向上述目标通道对应的本地共享存储空间写入数据,直到上述目标通道恢复为非暂停状态。Determining whether the target channel is in a pause state, if not in the pause state, writing the to-be-sent data to the determined local shared storage space corresponding to the target channel, and otherwise stopping writing data to the local shared storage space corresponding to the target channel, Until the above target channel returns to the non-suspended state.
在本实施例中,如果目标通道不是暂停状态,那么数据的发送将会持续,一旦目标通道的状态变为暂停状态,这将表示发送速度超过了接收方的限度,需要停止发送。目标通道的状态由接收端指定,在后续实施例中将给出更详细的说明。In this embodiment, if the target channel is not in the pause state, the transmission of data will continue. Once the state of the target channel changes to the pause state, this will indicate that the transmission speed exceeds the limit of the receiver and the transmission needs to be stopped. The state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
103:若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。103: If the target node is a remote node, the target channel between the local node and the target node is a remote end between a local proxy node of the local node and a target proxy node of the target node. And a proxy channel, by using the remote proxy channel, to send the to-be-sent data in the local shared storage space to a target proxy node of the target node by using a local proxy node of the local node.
另外,本实施例还可以包括:In addition, this embodiment may further include:
若所述目标节点为另一本地节点,则所述目标通道为所述本地节点与所述目标节点之间的本地通道,则写入所述本地共享存储空间内的待发送数据通过所述本地通道接收。If the target node is another local node, the target channel is a local channel between the local node and the target node, and the data to be sent written in the local shared storage space passes through the local Channel reception.
以上实施例,采用通道管理的方案,通过代理节点实现跨机通讯, 不需要关心通讯的进程是运行于同一主机还是不同主机,因此开发人员不需要了解机器内核跨机器间通信的机制和细节,因此可以提高开发效率,并减少出错。In the above embodiment, the channel management scheme is adopted, and the cross-machine communication is realized through the proxy node. You don't need to care about whether the communication process is running on the same host or a different host, so developers don't need to understand the mechanism and details of the machine core's communication between machines, so it can improve development efficiency and reduce errors.
进一步地,本发明实施例中所称的本地是指上述待发送数据的源端的设备本地,本领域技术人员可以理解的是该设备也可以作为数据的接收端使用,本发明实施例还提供了该设备作为数据的接收端使用的方案,并且在数据的接收端进行流量控制,具体如下:上述方法,还包括:Further, the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent. The device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a solution used by the receiving end of the data, and performs flow control at the receiving end of the data, as follows: The foregoing method further includes:
通过本地代理节点接收来自远端代理节点的数据,并确定接收到的数据是否已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值,若是,则向所述远端代理节点发送暂停指示消息,指示所述远端代理节点暂停向所述本地代理节点发送数据。Receiving data from the remote proxy node through the local proxy node and determining whether the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, to the remote end The proxy node sends a pause indication message instructing the remote proxy node to suspend sending data to the home proxy node.
本领域技术人员可以理解的是,如果接收到的数据没有达到目标通道的本地阈值,则可以继续接收数据。上述本地阈值是按照上述本地的目标通道所对应的存储空间来确定的,用于防止溢出。Those skilled in the art will appreciate that if the received data does not reach the local threshold of the target channel, then the data can continue to be received. The local threshold is determined according to the storage space corresponding to the local target channel, and is used to prevent overflow.
进一步地,本发明实施例还提供了进行流量控制以后,目标通道被暂停以后(即暂停数据传输以后)如何恢复数据传输的实现方案,具体如下:上述方法,还包括:Further, the embodiment of the present invention further provides an implementation scheme for how to resume data transmission after the target channel is suspended (ie, after the data transmission is suspended) after the traffic control is performed, as follows: The foregoing method further includes:
若上述本地的目标通道为暂停状态,并且没有数据,则向远端代理节点发送恢复指示,指示上述远端代理节点继续向上述目标通道写入数据。If the local target channel is in a suspended state and there is no data, a recovery indication is sent to the remote proxy node, indicating that the remote proxy node continues to write data to the target channel.
可以理解的是,如果本地的目标通道不是暂停状态,当前应该处于数据的发送过程中。如果上述本地的目标通道为暂停状态,那么当前应该是没有进行数据通讯的,此时需要确定在何种情况下恢复通讯,本实施例给出了目标通道中没有数据的情况,实际上如果目标通道的数据量小于目标通道的数据总容量设定比例也是可以的,本发明实施例对此不作唯一性限定。 It can be understood that if the local target channel is not in the pause state, it should currently be in the process of sending data. If the local target channel is in the pause state, then there should be no data communication at present. In this case, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel, in fact, if the target It is also possible that the data amount of the channel is smaller than the total data capacity setting ratio of the target channel, which is not limited by the embodiment of the present invention.
进一步地,本发明实施例还提供了节点的创建方案,包含本地节点的创建以及依据目标代理节点的指示进行通道创建的方案,具体方案如下:在根据待发送数据的目标节点确定目标通道之前,还包括:Further, the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the target proxy node, and the specific scheme is as follows: before determining the target channel according to the target node of the data to be sent, Also includes:
本地代理节点创建所述本地节点,并建立所述本地代理节点与所述目标代理节点之间的目标通道,为所述目标通道分配本地共享存储空间;或者,本地代理节点接收所述目标代理节点发送的通道信息,若本地未存储所述通道信息,则创建所述目标通道,并监听所述目标通道是否有数据接收。a local proxy node creates the local node and establishes a target channel between the local proxy node and the target proxy node, and allocates a local shared storage space for the target channel; or the local proxy node receives the target proxy node The channel information that is sent, if the channel information is not stored locally, the target channel is created, and the target channel is monitored for data reception.
进一步地,本发明实施例还提供了跨设备的通道的信息如何同步的技术方案,采用代理节点完成通道信息的同步,具体如下:在通过本地代理节点向目标代理节点发送上述待发送数据之前,还包括:Further, the embodiment of the present invention further provides a technical solution for how to synchronize information of channels across devices, and uses proxy nodes to complete synchronization of channel information, as follows: before sending the data to be sent to the target proxy node through the local proxy node, Also includes:
读取配置文件,确定所述目标代理节点的互联网协议地址以及端口号,并通过所述互联网协议地址以及端口号建立所述本地代理节点与所述目标代理节点之间的传输控制协议TCP连接;通过所述TCP连接将所述本地代理节点创建的关于所述目标通道的通道信息发送给目标代理节点,以便所述目标代理节点根据所述通道信息建立所述目标通道。Reading a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP connection between the local proxy node and the target proxy node by using the internet protocol address and a port number; Transmitting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
进一步地,本发明实施例还提供了,通道删除的方案,具体如下:上述方法,还包括:Further, the embodiment of the present invention further provides a scheme for channel deletion, which is specifically as follows: the foregoing method further includes:
若本地节点关闭,则关闭所述本地节点与远端节点之间的通道,且所述本地节点与所述远端节点之间的通道没有被其他进程所使用,则销毁所述本地节点与远端节点之间的通道。If the local node is closed, the channel between the local node and the remote node is closed, and the channel between the local node and the remote node is not used by other processes, and the local node and the remote node are destroyed. The channel between the end nodes.
可以理解的是,销毁通道的目的在于释放不需要的存储空间,具体操作可以是将通道对应的存储空间内的信息进行销毁。销毁的过程可以是将该存储空间,例如内存释放使之能够被再次使用,并不一定需要进行存储空间进行初始化操作。 It can be understood that the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel. The process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
以下实施例就本发明实施例的几个重要方面进行分别举例说明。The following embodiments respectively illustrate several important aspects of the embodiments of the present invention.
本发明实施例采用的是基于共享内存的进程间通讯的中间件方案。开发人员可以使用它方便地实现进程间的数据交换,而不用关心需要交换数据的进程是运行在同一主机还是在不同的主机。当进程处于同一主机时,数据通过共享内存传输;而对于不同主机上的进程,该中间件会将数据由代理服务(Agent)通过TCP/IP传输到远程主机。The embodiment of the invention adopts a middleware scheme based on shared memory for inter-process communication. Developers can use it to easily exchange data between processes without worrying about whether the processes that need to exchange data are running on the same host or on different hosts. When processes are on the same host, data is transferred through shared memory; for processes on different hosts, the middleware transfers data to the remote host via the agent/agent via TCP/IP.
一、该中间件方案如图2所示,包含如下几个部分:First, the middleware scheme shown in Figure 2 contains the following parts:
host1和host2是两个主机设备;在host1中包含了两个数据收发点(peer),peer 1和peer2,分别属于各自的进程;在host2中包含了两个数据收发点(peer),peer3和peer4,分别属于各自的进程;每个主机可以包含的进程可以有很多,每个进程包含的peer也可以有很多,图2仅作为一个示意,不应理解为对本发明实施例的限定。Agent所在的进程执行的是代理服务,可以称为代理节点。以下分别对图2所示的各部分进行详细介绍如下:Host1 and host2 are two host devices; host1 contains two data sending and receiving points (peer), peer 1 and peer2, which belong to their respective processes; host2 contains two data sending and receiving points (peer), peer3 and The peer 4s are respectively in the process of the present invention; each of the hosts may include a plurality of processes, and each of the processes may include a plurality of peers. FIG. 2 is only a schematic diagram and should not be construed as limiting the embodiments of the present invention. The process in which the Agent is executing is a proxy service, which can be called a proxy node. The following sections describe the parts shown in Figure 2 in detail as follows:
数据收发点(peer):中间件为开发人员提供的客户端开发包,使用该开发包创建具体peer用来接收和发送消息。Data peer: The middleware is a client development package provided by the developer. The development package is used to create a specific peer to receive and send messages.
通道(channel):实际上是一块共享内存。当创建一个peer时,中间件创建一个同名的channel与这个peer绑定。每个channel都有一个唯一的id,所以存在多个channel名称相同的channel集合。peer通过这个channel接收数据;发送数据时,中间件会先找到与目标peer绑定的channel,并将数据写入到这个目标channe中。通道分为本地通道(local channel)和远端代理通道(remote channel proxy)。在图2所示远端代理通道有:在host1中的host2_channel4_proxy、host2_channel3_proxy;在host2中的有host1_channel1_proxy、host1_channel2_proxy。Channel: It is actually a shared memory. When creating a peer, the middleware creates a channel with the same name and binds to the peer. Each channel has a unique id, so there are multiple channel collections with the same channel name. The peer receives data through this channel; when sending data, the middleware first finds the channel bound to the target peer and writes the data to the target channe. The channel is divided into a local channel and a remote channel proxy. The remote proxy channels shown in Figure 2 are: host2_channel4_proxy and host2_channel3_proxy in host1; host1_channel1_proxy and host1_channel2_proxy in host2.
通道索引(channel index):实际上是一块共享内存。存储着所有 channel对应的共享内存key(关键字)。Channel index: actually a piece of shared memory. Store all The shared memory key (keyword) corresponding to the channel.
消息(message):每次调用peer的send函数发送的数据视为一条消息,peer的recv函数(用于已连接的数据报或流式套接口进行数据的接收的函数)每次被调用,会接收一条完整的消息。Message: Each time the data sent by the peer's send function is treated as a message, the peer's recv function (a function for receiving data from a connected datagram or streaming socket) is called each time. Receive a complete message.
中间件主要包括2个组件:The middleware mainly consists of two components:
(1)为开发人员提供的客户端开发包。(1) A client development kit for developers.
(2)进行跨机器进程间通讯的代理服务Agent。(2) A proxy service agent that performs communication between processes across machines.
二、重要数据结构Second, the important data structure
本发明实施例是基于共享内存的进程间通讯中间件,通道、通道索引、消息在共享内存中的数据结构如下:The embodiment of the present invention is an inter-process communication middleware based on shared memory, and the data structure of the channel, the channel index, and the message in the shared memory is as follows:
(1)通道(channel),如下表1所示(1) Channel, as shown in Table 1 below
表1Table 1
Figure PCTCN2015073166-appb-000001
Figure PCTCN2015073166-appb-000001
Figure PCTCN2015073166-appb-000002
Figure PCTCN2015073166-appb-000002
(2)通道索引(channel index),如下表2所示:(2) Channel index, as shown in Table 2 below:
表2Table 2
Figure PCTCN2015073166-appb-000003
Figure PCTCN2015073166-appb-000003
(3)消息(message):(3) Message (message):
消息是中间件数据传输的基本单位,消息在传输的过程中会被打报成数据包,数据包的最大长度是8K字节,当消息的长度超过8K字节时,它会被分片,即分成多个数据包传输,接收端会将这些分片组装成一条完整的消息。数据包的结构如下表3所示:The message is the basic unit of middleware data transmission. The message will be reported as a data packet during the transmission process. The maximum length of the data packet is 8K bytes. When the length of the message exceeds 8K bytes, it will be fragmented. That is, divided into multiple packet transmissions, the receiver will assemble these fragments into a complete message. The structure of the packet is shown in Table 3 below:
表3table 3
Figure PCTCN2015073166-appb-000004
Figure PCTCN2015073166-appb-000004
Figure PCTCN2015073166-appb-000005
Figure PCTCN2015073166-appb-000005
三、重要流程介绍Third, the introduction of important processes
(1)channel创建:channel的创建流程分为中间件客户端主动创建的本地通道和代理服务Agent接收对端传过来的channel信息创建的远端代理通道。(1) Channel creation: The creation process of the channel is divided into a local channel actively created by the middleware client and a remote proxy channel created by the proxy service agent receiving the channel information transmitted from the peer end.
其中,中间件客户端主动创建的本地通道的流程如图3所示,包括:The process of the local channel actively created by the middleware client is as shown in FIG. 3, including:
301:创建一个本地peer;301: Create a local peer;
302:绑定访问channel index,获取peer对应的channel shm key和channel sem key;302: Bind access channel index, obtain the channel shm key and channel sem key corresponding to the peer;
上述channel index存储的信息以及用途在前面实施例中已有介绍,channel shm key和channel sem key分别是用于标识channel shm以及channel sem的关键字;channel shm是用来接收数据的通道,channel sem是用来搜索用的通道。The information and usage of the above channel index are described in the previous embodiment. The channel shm key and the channel sem key are keywords for identifying channel shm and channel sem respectively; channel shm is a channel for receiving data, channel sem It is the channel used for searching.
303:创建并绑定channel shm key和channel sem key;303: Create and bind a channel shm key and a channel sem key;
304:初始化channel shm;304: Initialize channel shm;
本步骤是将通道对应的存储空间进行初始化。如图2所示的channel1~channel 4。This step initializes the storage space corresponding to the channel. As shown in Figure 2, channel1 to channel 4.
305:将channel加入到channel管理器中,并监听该channel是否有数据接收。305: Add the channel to the channel manager and listen to the channel for data reception.
代理服务Agent接收对端传过来的channel信息创建的远端代理通道的流程,如图4所示,包括: The proxy service agent receives the process of the remote proxy channel created by the channel information transmitted by the peer end, as shown in FIG. 4, including:
401:Agent接收对端发送的channel信息;401: The agent receives the channel information sent by the peer end.
具体可以是对端的Agent发送的channel信息。Specifically, it may be channel information sent by the peer agent.
402:判断接收到的channel信息对应的channel是否存在,如果存在可以结束流程,否则,进入403;402: Determine whether the channel corresponding to the received channel information exists, if yes, the process may end; otherwise, enter 403;
403:创建一个远端代理peer;403: Create a remote proxy peer;
例如,图2所示的host2_channel4_proxy、host2_channel3_proxy;host1_channel1_proxy、host1_channel2_proxy均为远端代理peer对应的channel;For example, host2_channel4_proxy, host2_channel3_proxy, host1_channel1_proxy, and host1_channel2_proxy shown in Figure 2 are channels corresponding to the remote proxy peer.
404:绑定访问channel index获取peer对应的channel shm key和channel sem key;404: Bind access channel index to obtain the channel shm key and channel sem key corresponding to the peer;
405:创建并绑定channel shm key和channel sem key;405: Create and bind channel shm key and channel sem key;
406:初始化channel shm;406: Initialize channel shm;
407:将channel加入到channel管理器中,并监听该channel是否有数据接收。407: Add the channel to the channel manager and listen to the channel for data reception.
本实施例中,创建channel,会在内存中维护channel信息并且创建对应的channel共享内存。In this embodiment, the channel is created, the channel information is maintained in the memory, and the corresponding channel shared memory is created.
(2)跨机器channel同步:在本实施例中可以部署为前端Agent(代理)和后端Agent,前端Agent需要读取remotehost.xml(远端主机的信息)获取所有后端Agent信息,包括IP(互联网协议地址)和Port(端口)信息,并且主动和这些后端Agent建立TCP连接进行通讯。host1和host2进行channel同步,具体流程如图5所示,包括:(2) Cross-machine channel synchronization: In this embodiment, it can be deployed as a front-end agent (agent) and a back-end agent. The front-end agent needs to read remotehost.xml (the information of the remote host) to obtain all back-end agent information, including IP. (Internet Protocol Address) and Port (port) information, and actively establish a TCP connection with these backend agents for communication. Host1 and host2 perform channel synchronization. The specific process is shown in Figure 5. It includes:
501A:读取配置文件,获取Agent IP和Port已经包括的channel index配置信息;501A: Read the configuration file to obtain the channel index configuration information that has been included in the Agent IP and the port.
在本实施例中,Agent的配置文件需要包含以下信息:In this embodiment, the configuration file of the agent needs to include the following information:
1、Agent IP和Port; 1, Agent IP and Port;
2、channel index的共享内存key、信号量key;2, channel index shared memory key, semaphore key;
3、可管理的channel的最大个数;3. The maximum number of manageable channels;
4、channel对应共享内存最大尺寸。4, channel corresponds to the maximum size of shared memory.
502A:初始化channel index shm;502A: Initialize channel index shm;
503A:读取remotehost.xml获取所有对端Agent IP和port信息;503A: Read remotehost.xml to obtain IP information of all peer Agents and ports;
504A:创建和对端Agent的TCP连接;504A: Create a TCP connection with the peer agent;
505A:定时从channel indx获取所有新的非Agent创建的channel,并发送给对端Agent;505A: Obtain all new non-Agent created channels from the channel indx and send them to the peer agent.
506A:接收对端Agent发送的新的channel信息,并建立相应的远端channel代理。506A: Receive new channel information sent by the peer agent, and establish a corresponding remote channel proxy.
在图5所示的501B~506B是与上述步骤501A~506A完全对应的步骤,再次不再一一赘述。501B to 506B shown in FIG. 5 are steps completely corresponding to the above-described steps 501A to 506A, and will not be described again.
(3)、消息传输,如图6所示,包括如下步骤:(3), message transmission, as shown in Figure 6, including the following steps:
601:调用peer的send方法;601: Call the send method of the peer;
602:根据目标peer名称到channel管理器找到对应的目标channel列表;602: Find a corresponding target channel list according to the target peer name to the channel manager;
603:从channel列表中取出目标channel;603: Take the target channel from the channel list;
604:将数据写入到上述channel对应的shm中;604: Write data to the shm corresponding to the above channel;
605:确定上述shm对应的channel是否是本地channel;如果是,进入606,否则进入607;605: Determine whether the channel corresponding to the above shm is a local channel; if yes, enter 606, otherwise enter 607;
606:本地channel接收数据。606: The local channel receives the data.
607:远端代理channel接收数据;607: The remote proxy channel receives the data.
608:代理Agent将远端代理channel接收到的数据发送到对端代理Agent。608: The proxy agent sends the data received by the remote proxy channel to the peer proxy agent.
在本实施例中有以下两点需要说明如下: In the present embodiment, the following two points need to be explained as follows:
1.在本实施例的中间件中有channel管理器会循环检测和读取本进程创建的channel中是否有数据接收,并且每次都会刷新channel的时间戳属性(timestamp),如果有数据接收返回给用户。同时本地进程也可以通过channel index获取其他进程创建的channel,并且会定时检查这些channel时间戳属性(timestamp)是否有更新来判断channel是否已经关闭,如果已经关闭就会将该channel内存信息进行销毁。具体参考后续实施例中关于channel销毁的说明。1. In the middleware of this embodiment, the channel manager cyclically detects and reads whether there is data receiving in the channel created by the process, and refreshes the timestamp attribute (timestamp) of the channel every time, if there is data reception, To the user. At the same time, the local process can also obtain the channel created by other processes through the channel index, and periodically check whether the channel timestamp attribute (timestamp) is updated to determine whether the channel has been closed. If it is closed, the channel memory information will be destroyed. Refer specifically to the description of channel destruction in the subsequent embodiments.
2.在本实施例中,通过目标channel名称可能会获取到多个channel(channel id不同),会按顺序每次获取一个作为目标channel进行消息通讯,这种机制也很好做到负载均衡。2. In this embodiment, multiple channels (channel ids) may be obtained through the target channel name, and one message channel is acquired each time as a target channel. This mechanism is also well-balanced.
(4)流量控制,具体流程如图7所示,包括如下步骤:(4) Flow control, the specific process is shown in Figure 7, including the following steps:
701:peer调用peer的send方法;701: The peer invokes the send method of the peer;
702:从channel shm存储的channel状态信息中获取channel状态;702: Obtain a channel state from the channel state information stored in the channel shm.
703:判断目标channel是否为暂停状态,如果是,则暂停数据发送;如果否,进入704;703: Determine whether the target channel is in a suspended state, if yes, suspend data transmission; if not, enter 704;
704:将数据写入到对应的目标channel shm中;704: Write data to the corresponding target channel shm;
705:将数据写入共享内存;705: Write data to the shared memory;
706:Agent 1读取远端channel sham数据并发送到对端Agent(Agent2)706: Agent 1 reads the remote channel sham data and sends it to the peer agent (Agent2).
707:接收对端Agent发送的数据;707: Receive data sent by the peer agent.
708:获取channel数据状态;708: Obtain channel data status.
709:判断channel数据是否达到阈值;如果是,进入710,否则进入712;709: Determine whether the channel data reaches the threshold; if yes, enter 710, otherwise enter 712;
710:发送暂停接收指示给对端Agent;710: Send a suspension receiving indication to the peer agent;
711:接收对端channel暂停请求并设置channel状态为暂停;并将设 置channel状态为暂停;711: Receive the peer channel pause request and set the channel state to pause; Set the channel state to pause;
712:将数据写入到相应channel shm中。712: Write data to the corresponding channel shm.
713:如果channel状态为暂停,则定时执行本步骤:定时判断channel状态为暂停并且channel中没有数据,则将channel状态恢复正常。恢复正常的方式,可以是向对端Agent发送指示消息,指示将该channel状态恢复正常。713: If the channel state is paused, the step is performed periodically: periodically determining that the channel state is paused and there is no data in the channel, the channel state is restored to normal. The method of returning to the normal manner may be to send an indication message to the peer agent, indicating that the channel status is restored to normal.
(5)channel销毁,在本实施例中channel销毁规则如下:(5) Channel destruction, in this embodiment the channel destruction rules are as follows:
1、创建的Peer关闭,对应的channel内存信息将被销毁。1. The created peer is closed, and the corresponding channel memory information will be destroyed.
2、接收到对端Agent的连接关闭请求,将由该Agent传递过来并且建立的channel内存信息全部销毁。2. After receiving the connection close request of the peer agent, the channel memory information that is transmitted by the agent and established is completely destroyed.
3、channel同一时刻可能会被多个进程在使用,只有所有进程都销毁该channel内存信息,该channel对应的共享内存在会被真正从系统删除。3. The channel may be used by multiple processes at the same time. Only all processes destroy the channel memory information, and the shared memory corresponding to the channel will be deleted from the system.
本发明是一个基于共享内存的进程间通讯的中间件方案。提供开发包和跨机器通讯Agent。只需要创建具体Peer和channel就可以和目标Peer和channel通讯。不用关心需要通讯的进程是运行在同一主机还是在不同的主机。The present invention is a middleware solution for inter-process communication based on shared memory. Provide development kits and cross-machine communication agents. You only need to create specific Peer and channel to communicate with the target Peer and channel. Don't worry if the process that needs communication is running on the same host or on a different host.
本发明实施例还提供了一种装置,用于进程间通讯,如图8所示,包括:An embodiment of the present invention further provides an apparatus for inter-process communication, as shown in FIG. 8, including:
通道确定单元801,用于根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道;a channel determining unit 801, configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node;
数据写入单元802,用于将所述待发送数据写入所述通道确定单元确定的所述目标通道对应的本地共享存储空间内;a data writing unit 802, configured to write the to-be-sent data into a local shared storage space corresponding to the target channel determined by the channel determining unit;
发送单元804,用于若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的所述目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通 过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。a sending unit 804, configured to: if the target node is a remote node, the target channel between the local node and the target node is a local proxy node of the local node and a target proxy of the target node a remote proxy channel between the nodes, using the remote proxy channel The local proxy node passing the local node transmits the to-be-sent data in the local shared storage space to a target proxy node of the target node.
在本发明实施例中,还可以包括:本地通道单元803,用于若所述目标节点为另一本地节点,则所述目标通道为所述本地节点与所述目标节点之间的本地通道,则写入所述本地共享存储空间内的待发送数据通过所述本地通道接收。In the embodiment of the present invention, the method may further include: a local channel unit 803, configured to: if the target node is another local node, the target channel is a local channel between the local node and the target node, Then, the data to be sent written in the local shared storage space is received through the local channel.
以上实施例,采用通道管理的方案,通过代理节点实现跨机通讯,不需要关心通讯的进程是运行于同一主机还是不同主机,因此开发人员不需要了解机器内核跨机器间通信的机制和细节,因此可以提高开发效率,并减少出错。In the above embodiment, the channel management scheme is adopted to implement cross-machine communication through the proxy node, and it is not necessary to care whether the communication process runs on the same host or different hosts, so the developer does not need to understand the mechanism and details of the inter-machine communication between the machine cores. This can improve development efficiency and reduce errors.
进一步地,本发明实施例中所称的本地是指上述待发送数据的源端的设备本地,本领域技术人员可以理解的是该设备也可以作为数据的接收端使用,本发明实施例还提供了该设备作为数据的接收端使用的方案,并且在数据的接收端进行流量控制,具体如下:如图9所示,上述装置,还包括:Further, the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent. The device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a receiving end of the data, and performs flow control at the receiving end of the data, as follows: As shown in FIG. 9, the foregoing apparatus further includes:
接收单元901,用于通过本地代理节点接收来自远端代理节点的数据;The receiving unit 901 is configured to receive data from the remote proxy node by using the local proxy node;
阈值确定单元902,用于确定接收到的数据是否已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值;a threshold determining unit 902, configured to determine whether the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node;
上述发送单元804,还用于在上述阈值确定单元902确定接收到的数据已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值后,则向所述远端代理节点发送暂停指示消息,指示所述远端代理节点暂停向所述本地代理节点发送数据。The sending unit 804 is further configured to: after the threshold determining unit 902 determines that the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node, then to the remote proxy node. Sending a pause indication message instructing the remote proxy node to suspend sending data to the home agent node.
本领域技术人员可以理解的是,如果接收到的数据没有达到目标通道的本地阈值,则可以继续接收数据。上述阈值是按照上述本地的目标通 道所对应的本地存储空间来确定的,用于防止溢出。Those skilled in the art will appreciate that if the received data does not reach the local threshold of the target channel, then the data can continue to be received. The above threshold is in accordance with the above local target The local storage space corresponding to the track is determined to prevent overflow.
进一步地,本发明实施例还提供了进行流量控制以后,目标通道被暂停以后(即暂停数据传输以后)如何恢复数据传输的实现方案,具体如下:如图10所示,上述装置,还包括:Further, the embodiment of the present invention further provides an implementation scheme of how to resume data transmission after the target channel is suspended (ie, after the data transmission is suspended), as follows: As shown in FIG. 10, the foregoing apparatus further includes:
第一确定单元1001,用于确定所述本地代理节点与所述远端代理节点之间的通道是否为暂停状态,是否有数据;a first determining unit 1001, configured to determine whether a channel between the local proxy node and the remote proxy node is in a suspended state, and whether there is data;
上述发送单元804,还用于若上述第一确定单元1001确定所述本地代理节点与所述远端代理节点之间的通道为暂停状态并且没有数据,则向所述远端代理节点发送恢复指示,指示所述远端代理节点继续向所述本地代理节点发送数据。The sending unit 804 is further configured to: if the first determining unit 1001 determines that the channel between the local proxy node and the remote proxy node is in a suspended state and has no data, send a recovery indication to the remote proxy node. Instructing the remote proxy node to continue transmitting data to the home agent node.
可以理解的是,如果本地的目标通道不是暂停状态,当前应该处于数据的发送过程中。如果上述本地的目标通道为暂停状态,那么当前应该是没有进行数据通讯的,此时需要确定在何种情况下恢复通讯,本实施例给出了目标通道中没有数据的情况,实际上如果目标通道的数据量小于目标通道的数据总容量设定比例也是可以的,本发明实施例对此不作唯一性限定。It can be understood that if the local target channel is not in the pause state, it should currently be in the process of sending data. If the local target channel is in the pause state, then there should be no data communication at present. In this case, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel, in fact, if the target It is also possible that the data amount of the channel is smaller than the total data capacity setting ratio of the target channel, which is not limited by the embodiment of the present invention.
进一步地,本发明实施例还提供了进行流量控制的方案,该方案在数据的发送端进行发送控制,具体如下:如图11所示,上述装置,还包括:Further, the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs transmission control at a data sending end, as follows: as shown in FIG. 11, the foregoing apparatus further includes:
第二确定单元1101,用于在将所述待发送数据写入所述目标通道对应的本地共享存储空间内之前,确定所述目标通道是否为暂停状态;The second determining unit 1101 is configured to determine whether the target channel is in a suspended state before writing the to-be-sent data into the local shared storage space corresponding to the target channel;
上述数据写入单元802,还用于若上述第二确定单元1101确定所述目标通道不是暂停状态,则将上述待发送数据写入确定的上述目标通道对应的共享存储空间内,否则停止向上述目标通道对应的共享存储空间写入数据,直到上述目标通道恢复为非暂停状态。The data writing unit 802 is further configured to: if the second determining unit 1101 determines that the target channel is not in a suspended state, write the to-be-sent data into the shared storage space corresponding to the determined target channel, otherwise stop the foregoing The shared memory space corresponding to the target channel writes data until the target channel returns to the non-suspended state.
在本实施例中,如果目标通道不是暂停状态,那么数据的发送将会 持续,一旦目标通道的状态变为暂停状态,这将表示发送速度超过了接收方的限度,需要停止发送。目标通道的状态由接收端指定,在后续实施例中将给出更详细的说明。In this embodiment, if the target channel is not in the pause state, then the data will be sent. If the status of the target channel changes to a paused state, this will indicate that the transmission speed exceeds the receiver's limit and needs to stop sending. The state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
进一步地,本发明实施例还提供了节点的创建方案,包含本地节点的创建以及依据对端代理节点的指示进行通道创建的方案,具体方案如下:如图12所示,上述装置,还包括:Further, the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the peer proxy node. The specific solution is as follows: As shown in FIG. 12, the foregoing apparatus further includes:
节点管理单元1201,用于在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,创建所述本地节点,并建立所述本地代理节点与所述目标代理节点之间的目标通道,为所述目标通道分配本地共享存储空间;或者,接收所述目标代理节点发送的通道信息,若本地未存储所述通道信息,则创建所述目标通道,并监听所述目标通道是否有数据接收。The node management unit 1201 is configured to create the local node and establish the local proxy before determining a target channel between the local node and the target node according to a target node to which the data to be sent of the local node is to be sent. a target channel between the node and the target proxy node, the local shared storage space is allocated to the target channel; or the channel information sent by the target proxy node is received, and if the channel information is not stored locally, the Target channel and monitor the target channel for data reception.
进一步地,本发明实施例还提供了跨设备的通道的信息如何同步的技术方案,采用代理节点完成通道信息的同步,具体如下:如图13所示,上述装置,还包括:Further, the embodiment of the present invention further provides a technical solution for how to synchronize the information of the channel across the device, and uses the proxy node to complete the synchronization of the channel information, as follows: As shown in FIG. 13, the foregoing apparatus further includes:
同步管理单元1301,用于在利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点之前,读取配置文件,确定所述目标代理节点的互联网协议地址以及端口号,并通过所述互联网协议地址以及端口号建立所述本地代理节点与所述目标代理节点之间的传输控制协议TCP连接;通过所述TCP连接将所述本地代理节点创建的关于所述目标通道的通道信息发送给目标代理节点,以便所述目标代理节点根据所述通道信息建立所述目标通道。a synchronization management unit 1301, configured to send, by using the remote proxy channel, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using a local proxy node of the local node, Reading a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP connection between the local proxy node and the target proxy node by using the internet protocol address and a port number; Transmitting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
可选地,本发明实施例还提供了,通道删除的方案,具体如下:上述同步管理单元1301,还用于若本地节点关闭,则关闭所述本地节点与远 端节点之间的通道,且所述本地节点与所述远端节点之间的通道没有被其他进程所使用,则销毁所述本地节点与远端节点之间的通道。Optionally, the embodiment of the present invention further provides a channel deletion scheme, which is specifically as follows: the synchronization management unit 1301 is further configured to: if the local node is closed, shut down the local node and the remote node. A channel between end nodes, and a channel between the local node and the remote node is not used by other processes, and the channel between the local node and the remote node is destroyed.
可以理解的是,销毁通道的目的在于释放不需要的存储空间,具体操作可以是将通道对应的存储空间内的信息进行销毁。销毁的过程可以是将该存储空间,例如内存释放使之能够被再次使用,并不一定需要进行存储空间进行初始化操作。It can be understood that the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel. The process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
本发明实施例还提供了一种装置,用于进程间通讯,如图14所示,包括:接收器1401、发射器1402、处理器1403以及存储器1404;The embodiment of the present invention further provides an apparatus for inter-process communication, as shown in FIG. 14, comprising: a receiver 1401, a transmitter 1402, a processor 1403, and a memory 1404;
其中,处理器1403,用于根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道;将所述待发送数据写入所述目标通道对应的本地共享存储空间内;若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。另外,处理器1403还可以用于若所述目标节点为另一本地节点,则所述目标通道为所述本地节点与所述目标节点之间的本地通道,则写入所述本地共享存储空间内的待发送数据通过所述本地通道接收。The processor 1403 is configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node, and write the to-be-sent data into the target channel. Within the local shared storage space; if the target node is a remote node, the target channel between the local node and the target node is a local proxy node of the local node and a target proxy node of the target node And a remote proxy channel, by which the to-be-sent data in the local shared storage space is sent to a target proxy node of the target node by a local proxy node of the local node. In addition, the processor 1403 may be further configured to: if the target node is another local node, the target channel is a local channel between the local node and the target node, and then write the local shared storage space. The data to be transmitted within is received through the local channel.
以上实施例,采用通道管理的方案,通过代理节点实现跨机通讯,不需要关心通讯的进程是运行于同一主机还是不同主机,因此开发人员不需要了解机器内核跨机器间通信的机制和细节,因此可以提高开发效率,并减少出错。In the above embodiment, the channel management scheme is adopted to implement cross-machine communication through the proxy node, and it is not necessary to care whether the communication process runs on the same host or different hosts, so the developer does not need to understand the mechanism and details of the inter-machine communication between the machine cores. This can improve development efficiency and reduce errors.
进一步地,本发明实施例还提供了进行流量控制的方案,该方案在数据的发送端进行发送控制,具体如下:上述处理器1403,还用于在将所述待发送数据写入所述目标通道对应的本地共享存储空间内之前,确定所 述目标通道是否为暂停状态;若所述目标通道是暂停状态,则停止向所述目标通道对应的本地共享存储空间写入数据,直到所述目标通道恢复为非暂停状态。Further, the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs transmission control at a transmitting end of the data, as follows: the processor 1403 is further configured to write the to-be-sent data into the target. Before the channel corresponds to the local shared storage space, determine the location Whether the target channel is in a pause state; if the target channel is in a pause state, stopping writing data to the local shared storage space corresponding to the target channel until the target channel returns to a non-suspended state.
在本实施例中,如果目标通道不是暂停状态,那么数据的发送将会持续,一旦目标通道的状态变为暂停状态,这将表示发送速度超过了接收方的限度,需要停止发送。目标通道的状态由接收端指定,在后续实施例中将给出更详细的说明。In this embodiment, if the target channel is not in the pause state, the transmission of data will continue. Once the state of the target channel changes to the pause state, this will indicate that the transmission speed exceeds the limit of the receiver and the transmission needs to be stopped. The state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
进一步地,本发明实施例中所称的本地是指上述待发送数据的源端的设备本地,本领域技术人员可以理解的是该设备也可以作为数据的接收端使用,本发明实施例还提供了该设备作为数据的接收端使用的方案,并且在数据的接收端进行流量控制,具体如下:上述处理器1403,还用于通过本地代理节点接收来自远端代理节点的数据,并确定接收到的数据是否已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值,若是,则向所述远端代理节点发送暂停指示消息,指示所述远端代理节点暂停向所述本地代理节点发送数据。Further, the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent. The device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a receiving end of the data, and performs flow control at the receiving end of the data, as follows: the processor 1403 is further configured to receive data from the remote proxy node through the local proxy node, and determine the received data. Whether the data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, sending a pause indication message to the remote proxy node, instructing the remote proxy node to suspend to the The local proxy node sends the data.
本领域技术人员可以理解的是,如果接收到的数据没有达到本地的目标通道的阈值,则可以继续接收数据。上述阈值是按照上述本地的目标通道所对应的存储空间来确定的,用于防止溢出。It will be understood by those skilled in the art that if the received data does not reach the threshold of the local target channel, the data can continue to be received. The above threshold is determined according to the storage space corresponding to the local target channel described above, and is used to prevent overflow.
进一步地,本发明实施例还提供了进行流量控制以后,目标通道被暂停以后(即暂停数据传输以后)如何恢复数据传输的实现方案,具体如下:上述处理器1403,还用于若所述本地代理节点与所述远端代理节点之间的通道为暂停状态并且没有数据,则向所述远端代理节点发送恢复指示,指示所述远端代理节点继续向所述本地代理节点发送数据。Further, the embodiment of the present invention further provides an implementation scheme of how to resume data transmission after the target channel is suspended (that is, after the data transmission is suspended) after the traffic control is performed, as follows: the processor 1403 is further configured to: if the local When the channel between the proxy node and the remote proxy node is in a suspended state and there is no data, a recovery indication is sent to the remote proxy node, indicating that the remote proxy node continues to send data to the local proxy node.
可以理解的是,如果本地的目标通道不是暂停状态,当前应该处于数据的发送过程中。如果上述本地的目标通道为暂停状态,那么当前应该 是没有进行数据通讯的,此时需要确定在何种情况下恢复通讯,本实施例给出了目标通道中没有数据的情况,实际上如果目标通道的数据量小于目标通道的数据总容量设定比例也是可以的,本发明实施例对此不作唯一性限定。It can be understood that if the local target channel is not in the pause state, it should currently be in the process of sending data. If the above local target channel is in the pause state, then it should be If there is no data communication, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel. In fact, if the data volume of the target channel is smaller than the total data capacity setting of the target channel. The ratio is also possible, and the embodiment of the invention does not limit this uniquely.
进一步地,本发明实施例还提供了节点的创建方案,包含本地节点的创建以及依据对端代理节点的指示进行通道创建的方案,具体方案如下:上述处理器1403,还用于在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,创建所述本地节点,并建立所述本地代理节点与所述目标代理节点之间的目标通道,为所述目标通道分配本地共享存储空间;或者,接收所述目标代理节点发送的通道信息,若本地未存储所述通道信息,则创建所述目标通道,并监听所述目标通道是否有数据接收。Further, the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the peer proxy node. The specific solution is as follows: the processor 1403 is further configured to be based on the local node. Before the target node to which the to-be-sent data is to be sent determines the target channel between the local node and the target node, create the local node, and establish a target between the local proxy node and the target proxy node Channel, the local shared storage space is allocated to the target channel; or, receiving channel information sent by the target proxy node, if the channel information is not stored locally, creating the target channel, and monitoring whether the target channel has Data reception.
进一步地,本发明实施例还提供了跨设备的通道的信息如何同步的技术方案,采用代理节点完成通道信息的同步,上述处理器1403,还用于在利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点之前,读取配置文件,确定所述目标代理节点的互联网协议地址以及端口号,并通过所述互联网协议地址以及端口号建立所述本地代理节点与所述目标代理节点之间的传输控制协议TCP连接;通过所述TCP连接将所述本地代理节点创建的关于所述目标通道的通道信息发送给目标代理节点,以便所述目标代理节点根据所述通道信息建立所述目标通道。Further, the embodiment of the present invention further provides a technical solution for how to synchronize the information of the channel across the device, and uses the proxy node to complete the synchronization of the channel information. The processor 1403 is further configured to use the remote proxy channel to pass the Before the local proxy node of the local node sends the to-be-sent data in the local shared storage space to the target proxy node of the target node, the configuration file is read, and the Internet Protocol address and port number of the target proxy node are determined. And establishing, by the internet protocol address and the port number, a transmission control protocol TCP connection between the local proxy node and the target proxy node; and the target channel created by the local proxy node by using the TCP connection The channel information is sent to the target proxy node, so that the target proxy node establishes the target channel according to the channel information.
进一步地,本发明实施例还提供了,通道删除的方案,具体如下:上述处理器1403,还用于若本地节点关闭,则关闭所述本地节点与远端节点之间的通道,且所述本地节点与所述远端节点之间的通道没有被其他进程所使用,则销毁所述本地节点与远端节点之间的通道。 Further, the embodiment of the present invention further provides a channel deletion scheme, which is specifically as follows: the processor 1403 is further configured to: if the local node is closed, close a channel between the local node and the remote node, and the The channel between the local node and the remote node is not used by other processes, and the channel between the local node and the remote node is destroyed.
可以理解的是,销毁通道的目的在于释放不需要的存储空间,具体操作可以是将通道对应的存储空间内的信息进行销毁。销毁的过程可以是将该存储空间,例如内存释放使之能够被再次使用,并不一定需要进行存储空间进行初始化操作。It can be understood that the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel. The process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
本发明实施例还提供了一种终端,如图15所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该终端可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑等任意终端设备,以终端为手机为例:The embodiment of the present invention further provides a terminal. As shown in FIG. 15 , for the convenience of description, only parts related to the embodiment of the present invention are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present invention. The terminal may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, and the terminal is a mobile phone as an example:
图15示出的是与本发明实施例提供的终端相关的手机的部分结构的框图。参考图15,手机包括:射频(Radio Frequency,RF)电路1510、存储器1520、输入单元1530、显示单元1540、传感器1550、音频电路1560、无线保真(wireless fidelity,WiFi)模块1570、处理器1580、以及电源1590等部件。本领域技术人员可以理解,图15中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 15 is a block diagram showing a partial structure of a mobile phone related to a terminal provided by an embodiment of the present invention. Referring to FIG. 15 , the mobile phone includes: a radio frequency (RF) circuit 1510 , a memory 1520 , an input unit 1530 , a display unit 1540 , a sensor 1550 , an audio circuit 1560 , a wireless fidelity (WiFi) module 1570 , and a processor 1580 . And power supply 1590 and other components. It will be understood by those skilled in the art that the structure of the handset shown in FIG. 15 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different components may be arranged.
下面结合图15对手机的各个构成部件进行具体的介绍:The following describes the components of the mobile phone in detail with reference to FIG. 15:
RF电路1510可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器1580处理;另外,将设计上行的数据发送给基站。通常,RF电路1510包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路1510还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System ofMobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division  Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 1510 can be used for receiving and transmitting signals during the transmission or reception of information or during a call. Specifically, after receiving the downlink information of the base station, the processing is processed by the processor 1580. In addition, the data designed for the uplink is sent to the base station. Generally, RF circuit 1510 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 1510 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), and the like.
存储器1520可用于存储软件程序以及模块,处理器1580通过运行存储在存储器1520的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1520可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器1520可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 1520 can be used to store software programs and modules, and the processor 1580 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1520. The memory 1520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the mobile phone (such as audio data, phone book, etc.). Moreover, memory 1520 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元1530可用于接收输入的数字或字符信息,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入单元1530可包括触控面板1531以及其他输入设备1532。触控面板1531,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1531上或在触控面板1531附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板1531可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1580,并能接收处理器1580发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1531。除了触控面板1531,输入单元1530还可以包括其他输入设备1532。具体地,其他输入设备1532可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。 The input unit 1530 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function controls of the handset. Specifically, the input unit 1530 may include a touch panel 1531 and other input devices 1532. The touch panel 1531, also referred to as a touch screen, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 1531 or near the touch panel 1531. Operation), and drive the corresponding connecting device according to a preset program. Optionally, the touch panel 1531 may include two parts: a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 1580 is provided and can receive commands from the processor 1580 and execute them. In addition, the touch panel 1531 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1531, the input unit 1530 may also include other input devices 1532. Specifically, other input devices 1532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
显示单元1540可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1540可包括显示面板1541,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板1541。进一步的,触控面板1531可覆盖显示面板1541,当触控面板1531检测到在其上或附近的触摸操作后,传送给处理器1580以确定触摸事件的类型,随后处理器1580根据触摸事件的类型在显示面板1541上提供相应的视觉输出。虽然在图15中,触控面板1531与显示面板1541是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1531与显示面板1541集成而实现手机的输入和输出功能。The display unit 1540 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone. The display unit 1540 can include a display panel 1541. Alternatively, the display panel 1541 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. Further, the touch panel 1531 may cover the display panel 1541. After the touch panel 1531 detects a touch operation on or near the touch panel 1531, the touch panel 1531 transmits to the processor 1580 to determine the type of the touch event, and then the processor 1580 according to the touch event. The type provides a corresponding visual output on display panel 1541. Although the touch panel 1531 and the display panel 1541 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 15, in some embodiments, the touch panel 1531 and the display panel 1541 may be integrated. Realize the input and output functions of the phone.
手机还可包括至少一种传感器1550,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1541的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1541和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The handset may also include at least one type of sensor 1550, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1541 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1541 and/or when the mobile phone moves to the ear. Or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the mobile phone can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
音频电路1560、扬声器1561,传声器1562可提供用户与手机之间的音频接口。音频电路1560可将接收到的音频数据转换后的电信号,传输到扬声器1561,由扬声器1561转换为声音信号输出;另一方面,传声器1562将收集的声音信号转换为电信号,由音频电路1560接收后转换为音频数据,再将音频数据输出处理器1580处理后,经RF电路1510以发送给比如另一手机,或者将音频数据输出至存储器1520以便进一步处理。 An audio circuit 1560, a speaker 1561, and a microphone 1562 can provide an audio interface between the user and the handset. The audio circuit 1560 can transmit the converted electrical data of the received audio data to the speaker 1561, and convert it into a sound signal output by the speaker 1561. On the other hand, the microphone 1562 converts the collected sound signal into an electrical signal, and the audio circuit 1560. After receiving, it is converted into audio data, and then processed by the audio data output processor 1580, sent to, for example, another mobile phone via the RF circuit 1510, or outputted to the memory 1520 for further processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块1570可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图15示出了WiFi模块1570,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-range wireless transmission technology. The mobile phone through the WiFi module 1570 can help users to send and receive e-mail, browse the web and access streaming media, etc. It provides users with wireless broadband Internet access. Although FIG. 15 shows the WiFi module 1570, it can be understood that it does not belong to the essential configuration of the mobile phone, and may be omitted as needed within the scope of not changing the essence of the invention.
处理器1580是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1520内的软件程序和/或模块,以及调用存储在存储器1520内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器1580可包括一个或多个处理单元;优选的,处理器1580可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器1580中。The processor 1580 is a control center for the handset that connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 1520, and invoking data stored in the memory 1520, The phone's various functions and processing data, so that the overall monitoring of the phone. Optionally, the processor 1580 may include one or more processing units; preferably, the processor 1580 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1580.
手机还包括给各个部件供电的电源1590(比如电池),优选的,电源可以通过电源管理系统与处理器1580逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The handset also includes a power source 1590 (such as a battery) that supplies power to the various components. Preferably, the power source can be logically coupled to the processor 1580 via a power management system to manage functions such as charging, discharging, and power management through the power management system.
尽管未示出,手机还可以包括摄像头、蓝牙模块等,在此不再赘述。Although not shown, the mobile phone may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
在本发明实施例中,该终端所包括的处理器1580还具有以下功能:In the embodiment of the present invention, the processor 1580 included in the terminal further has the following functions:
根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道;将所述待发送数据写入所述目标通道对应的本地共享存储空间内;若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。在本实施例中,处理器1580还 用于若所述目标节点为另一本地节点,则所述目标通道为所述本地节点与所述目标节点之间的本地通道,则写入所述本地共享存储空间内的待发送数据通过所述本地通道接收。Determining, by the target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node; and writing the to-be-sent data into a local shared storage space corresponding to the target channel; The target node is a remote node, and the target channel between the local node and the target node is a remote proxy channel between a local proxy node of the local node and a target proxy node of the target node, And transmitting, by the local proxy node of the local node, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using the remote proxy channel. In this embodiment, the processor 1580 also And if the target node is another local node, the target channel is a local channel between the local node and the target node, and the data to be sent in the local shared storage space is written. Local channel reception.
以上实施例,采用通道管理的方案,通过代理节点实现跨机通讯,不需要关心通讯的进程是运行于同一主机还是不同主机,因此开发人员不需要了解机器内核跨机器间通信的机制和细节,因此可以提高开发效率,并减少出错。In the above embodiment, the channel management scheme is adopted to implement cross-machine communication through the proxy node, and it is not necessary to care whether the communication process runs on the same host or different hosts, so the developer does not need to understand the mechanism and details of the inter-machine communication between the machine cores. This can improve development efficiency and reduce errors.
进一步地,本发明实施例还提供了进行流量控制的方案,该方案在数据的发送端进行发送控制,具体如下:上述处理器1580,还用于在将所述待发送数据写入所述目标通道对应的本地共享存储空间内之前,确定所述目标通道是否为暂停状态,若是,则停止向所述目标通道对应的本地共享存储空间写入数据,直到所述目标通道恢复为非暂停状态。Further, the embodiment of the present invention further provides a scheme for performing flow control, where the scheme performs transmission control at the transmitting end of the data, as follows: the processor 1580 is further configured to write the to-be-sent data into the target. Before the local shared storage space corresponding to the channel, determining whether the target channel is in a suspended state, if yes, stopping writing data to the local shared storage space corresponding to the target channel until the target channel returns to a non-suspended state.
在本实施例中,如果目标通道不是暂停状态,那么数据的发送将会持续,一旦目标通道的状态变为暂停状态,这将表示发送速度超过了接收方的限度,需要停止发送。目标通道的状态由接收端指定,在后续实施例中将给出更详细的说明。In this embodiment, if the target channel is not in the pause state, the transmission of data will continue. Once the state of the target channel changes to the pause state, this will indicate that the transmission speed exceeds the limit of the receiver and the transmission needs to be stopped. The state of the target channel is specified by the receiving end, and a more detailed description will be given in the subsequent embodiments.
进一步地,本发明实施例中所称的本地是指上述待发送数据的源端的设备本地,本领域技术人员可以理解的是该设备也可以作为数据的接收端使用,本发明实施例还提供了该设备作为数据的接收端使用的方案,并且在数据的接收端进行流量控制,具体如下:上述处理器1580,还用于通过本地代理节点接收来自远端代理节点的数据,并确定接收到的数据是否已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值,若是,则向所述远端代理节点发送暂停指示消息,指示所述远端代理节点暂停向所述本地代理节点发送数据。Further, the local device in the embodiment of the present invention refers to the device at the source end of the data to be sent. The device can also be used as the receiving end of the data, and the embodiment of the present invention further provides The device is used as a solution used by the receiving end of the data, and performs flow control at the receiving end of the data, as follows: the processor 1580 is further configured to receive data from the remote proxy node through the local proxy node, and determine the received data. Whether the data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, sending a pause indication message to the remote proxy node, instructing the remote proxy node to suspend to the The local proxy node sends the data.
本领域技术人员可以理解的是,如果接收到的数据没有达到本地的 目标通道的阈值,则可以继续接收数据。上述阈值是按照上述本地的目标通道所对应的存储空间来确定的,用于防止溢出。Those skilled in the art can understand that if the received data does not reach the local The threshold of the target channel can continue to receive data. The above threshold is determined according to the storage space corresponding to the local target channel described above, and is used to prevent overflow.
进一步地,本发明实施例还提供了进行流量控制以后,目标通道被暂停以后(即暂停数据传输以后)如何恢复数据传输的实现方案,具体如下:上述处理器1580,还用于若所述本地代理节点与所述远端代理节点之间的通道为暂停状态并且没有数据,则向所述远端代理节点发送恢复指示,指示所述远端代理节点继续向所述本地代理节点发送数据。Further, the embodiment of the present invention further provides an implementation scheme of how to resume data transmission after the target channel is suspended (ie, after the data transmission is suspended) after the traffic control is performed, as follows: the processor 1580 is further configured to be used if the local When the channel between the proxy node and the remote proxy node is in a suspended state and there is no data, a recovery indication is sent to the remote proxy node, indicating that the remote proxy node continues to send data to the local proxy node.
可以理解的是,如果本地的目标通道不是暂停状态,当前应该处于数据的发送过程中。如果上述本地的目标通道为暂停状态,那么当前应该是没有进行数据通讯的,此时需要确定在何种情况下恢复通讯,本实施例给出了目标通道中没有数据的情况,实际上如果目标通道的数据量小于目标通道的数据总容量设定比例也是可以的,本发明实施例对此不作唯一性限定。It can be understood that if the local target channel is not in the pause state, it should currently be in the process of sending data. If the local target channel is in the pause state, then there should be no data communication at present. In this case, it is necessary to determine under what circumstances to resume communication. In this embodiment, there is no data in the target channel, in fact, if the target It is also possible that the data amount of the channel is smaller than the total data capacity setting ratio of the target channel, which is not limited by the embodiment of the present invention.
进一步地,本发明实施例还提供了节点的创建方案,包含本地节点的创建以及依据对端代理节点的指示进行通道创建的方案,具体方案如下:上述处理器1580,还用于在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,创建所述本地节点,并建立所述本地代理节点与所述目标代理节点之间的目标通道,为所述目标通道分配本地共享存储空间;或者,接收所述目标代理节点发送的通道信息,若本地未存储所述通道信息,则创建所述目标通道,并监听所述目标通道是否有数据接收。Further, the embodiment of the present invention further provides a node creation scheme, including a local node creation and a channel creation scheme according to the indication of the peer proxy node, and the specific scheme is as follows: the processor 1580 is further configured to be based on the local node. Before the target node to which the to-be-sent data is to be sent determines the target channel between the local node and the target node, create the local node, and establish a target between the local proxy node and the target proxy node Channel, the local shared storage space is allocated to the target channel; or, receiving channel information sent by the target proxy node, if the channel information is not stored locally, creating the target channel, and monitoring whether the target channel has Data reception.
进一步地,本发明实施例还提供了跨设备的通道的信息如何同步的技术方案,采用代理节点完成通道信息的同步,上述处理器1580,还用于在利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点之 前,读取配置文件,确定所述目标代理节点的互联网协议地址以及端口号,并通过所述互联网协议地址以及端口号建立所述本地代理节点与所述目标代理节点之间的传输控制协议TCP连接;通过所述TCP连接将所述本地代理节点创建的关于所述目标通道的通道信息发送给目标代理节点,以便所述目标代理节点根据所述通道信息建立所述目标通道。Further, the embodiment of the present invention further provides a technical solution for how to synchronize the information of the channel across the device, and uses the proxy node to complete the synchronization of the channel information. The processor 1580 is further configured to use the remote proxy channel to pass the a local proxy node of the local node sends the to-be-sent data in the local shared storage space to a target proxy node of the target node And reading a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP between the local proxy node and the target proxy node by using the internet protocol address and the port number And connecting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
进一步地,本发明实施例还提供了,通道删除的方案,具体如下:上述处理器1580,还用于若本地节点关闭,则关闭所述本地节点与远端节点之间的通道,且所述本地节点与所述远端节点之间的通道没有被其他进程所使用,则销毁所述本地节点与远端节点之间的通道。Further, the embodiment of the present invention further provides a channel deletion scheme, which is specifically as follows: the processor 1580 is further configured to: if the local node is closed, close a channel between the local node and the remote node, and the The channel between the local node and the remote node is not used by other processes, and the channel between the local node and the remote node is destroyed.
可以理解的是,销毁通道的目的在于释放不需要的存储空间,具体操作可以是将通道对应的存储空间内的信息进行销毁。销毁的过程可以是将该存储空间,例如内存释放使之能够被再次使用,并不一定需要进行存储空间进行初始化操作。It can be understood that the purpose of destroying the channel is to release the unnecessary storage space, and the specific operation may be to destroy the information in the storage space corresponding to the channel. The process of destruction may be to release the storage space, such as memory, so that it can be used again, and does not necessarily need to perform storage space initialization.
值得注意的是,上述装置实施例中,所包括的各个单元只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。It should be noted that, in the foregoing device embodiments, the included units are only divided according to functional logic, but are not limited to the foregoing division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional units It is also for convenience of distinguishing from each other and is not intended to limit the scope of protection of the present invention.
另外,本领域普通技术人员可以理解实现上述各方法实施例中的全部或部分步骤是可以通过程序来指令相关的硬件完成,相应的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。In addition, those skilled in the art can understand that all or part of the steps in implementing the foregoing method embodiments may be performed by a program to instruct related hardware, and the corresponding program may be stored in a computer readable storage medium. The storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
以上仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明实施例揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求的保护范围为准。 The above is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the embodiments of the present invention. All should be covered by the scope of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims (18)

  1. 一种进程间通讯的方法,其特征在于,包括:A method for inter-process communication, characterized in that it comprises:
    根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道;Determining a target channel between the local node and the target node according to a target node to which the to-be-sent data of the local node is to be sent;
    将所述待发送数据写入所述目标通道对应的本地共享存储空间内;Writing the to-be-sent data into a local shared storage space corresponding to the target channel;
    若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。If the target node is a remote node, the target channel between the local node and the target node is a remote proxy channel between a local proxy node of the local node and a target proxy node of the target node. And transmitting, by the local proxy node of the local node, the to-be-sent data in the local shared storage space to a target proxy node of the target node by using the remote proxy channel.
  2. 根据权利要求1所述方法,其特征在于,还包括:The method of claim 1 further comprising:
    通过本地代理节点接收来自远端代理节点的数据,并确定接收到的数据是否已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值,若是,则向所述远端代理节点发送暂停指示消息,指示所述远端代理节点暂停向所述本地代理节点发送数据。Receiving data from the remote proxy node through the local proxy node and determining whether the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node, and if so, to the remote end The proxy node sends a pause indication message instructing the remote proxy node to suspend sending data to the home proxy node.
  3. 根据权利要求2所述方法,其特征在于,还包括:The method of claim 2, further comprising:
    若所述本地代理节点与远端代理节点之间的通道为暂停状态并且没有数据,则向所述远端代理节点发送恢复指示,指示所述远端代理节点继续向所述本地代理节点发送数据。And if the channel between the local proxy node and the remote proxy node is in a suspended state and has no data, sending a recovery indication to the remote proxy node, indicating that the remote proxy node continues to send data to the local proxy node .
  4. 根据权利要求1所述方法,其特征在于,在将所述待发送数据写入所述目标通道对应的本地共享存储空间内之前,还包括:The method of claim 1, further comprising: before the data to be sent is written into the local shared storage space corresponding to the target channel,
    确定所述目标通道是否为暂停状态,若是,则停止向所述目标通道对应的本地共享存储空间写入数据,直到所述目标通道恢复为非暂停状态。Determining whether the target channel is in a suspended state, and if so, stopping writing data to the local shared storage space corresponding to the target channel until the target channel returns to a non-suspended state.
  5. 根据权利要求1所述方法,其特征在于,在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,还包括:The method according to claim 1, wherein before determining the target channel between the local node and the target node according to the target node to which the data to be transmitted of the local node is to be sent, the method further includes:
    本地代理节点创建所述本地节点,并建立所述本地代理节点与所述目标代理节点之间的目标通道,为所述目标通道分配本地共享存储空间;或 者,本地代理节点接收所述目标代理节点发送的通道信息,若本地未存储所述通道信息,则创建所述目标通道,并监听所述目标通道是否有数据接收。a local proxy node creates the local node and establishes a target channel between the local proxy node and the target proxy node, and allocates a local shared storage space for the target channel; or The local proxy node receives the channel information sent by the target proxy node. If the channel information is not stored locally, the target channel is created, and the target channel is monitored for data reception.
  6. 根据权利要求1至5任意一项所述方法,其特征在于,在利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点之前,还包括:The method according to any one of claims 1 to 5, wherein the data to be transmitted in the local shared storage space is sent to the local proxy node of the local node by using the remote proxy channel to Before the target proxy node of the target node, the method further includes:
    读取配置文件,确定所述目标代理节点的互联网协议地址以及端口号,并通过所述互联网协议地址以及端口号建立所述本地代理节点与所述目标代理节点之间的传输控制协议TCP连接;通过所述TCP连接将所述本地代理节点创建的关于所述目标通道的通道信息发送给目标代理节点,以便所述目标代理节点根据所述通道信息建立所述目标通道。Reading a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing a transmission control protocol TCP connection between the local proxy node and the target proxy node by using the internet protocol address and a port number; Transmitting, by the TCP connection, channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
  7. 根据权利要求6所述方法,其特征在于,还包括:The method of claim 6 further comprising:
    若本地节点关闭,则关闭所述本地节点与远端节点之间的通道,且所述本地节点与所述远端节点之间的通道没有被其他进程所使用,则销毁所述本地节点与远端节点之间的通道。If the local node is closed, the channel between the local node and the remote node is closed, and the channel between the local node and the remote node is not used by other processes, and the local node and the remote node are destroyed. The channel between the end nodes.
  8. 根据权利要求1所述的方法,其特征在于,还包括:The method of claim 1 further comprising:
    若所述目标节点为另一本地节点,则所述目标通道为所述本地节点与所述目标节点之间的本地通道,则写入所述本地共享存储空间内的待发送数据通过所述本地通道接收。If the target node is another local node, the target channel is a local channel between the local node and the target node, and the data to be sent written in the local shared storage space passes through the local Channel reception.
  9. 根据权利要求8所述的方法,其特征在于,在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,还包括:The method according to claim 8, wherein before determining the target channel between the local node and the target node according to the target node to which the data to be transmitted of the local node is to be sent, the method further includes:
    本地代理节点创建所述本地节点,并建立所述本地节点与所述目标节点之间的目标通道,为所述目标通道分配本地共享存储空间。The local proxy node creates the local node and establishes a target channel between the local node and the target node, and allocates a local shared storage space for the target channel.
  10. 一种装置,用于进程间通讯,其特征在于,包括:A device for inter-process communication, characterized in that it comprises:
    通道确定单元,用于根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道;a channel determining unit, configured to determine, according to a target node to which the data to be sent of the local node is to be sent, a target channel between the local node and the target node;
    数据写入单元,用于将所述待发送数据写入所述通道确定单元确定的所述目标通道对应的本地共享存储空间内; a data writing unit, configured to write the to-be-sent data into a local shared storage space corresponding to the target channel determined by the channel determining unit;
    发送单元,用于若所述目标节点为远端节点,则所述本地节点与所述目标节点之间的所述目标通道为所述本地节点的本地代理节点与所述目标节点的目标代理节点之间的远端代理通道,利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点。a sending unit, configured to: if the target node is a remote node, the target channel between the local node and the target node is a local proxy node of the local node and a target proxy node of the target node And a remote proxy channel, by which the to-be-sent data in the local shared storage space is sent to a target proxy node of the target node by a local proxy node of the local node.
  11. 根据权利要求10所述装置,其特征在于,还包括:The device according to claim 10, further comprising:
    接收单元,用于通过本地代理节点接收来自远端代理节点的数据;a receiving unit, configured to receive data from the remote proxy node by using the local proxy node;
    阈值确定单元,用于确定接收到的数据是否已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值;a threshold determining unit, configured to determine whether the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node;
    所述发送单元,还用于在接收到的数据已经达到所述本地代理节点与所述远端代理节点之间的通道的本地阈值后,则向所述远端代理节点发送暂停指示消息,指示所述远端代理节点暂停向所述本地代理节点发送数据。The sending unit is further configured to: after the received data has reached a local threshold of a channel between the local proxy node and the remote proxy node, send a pause indication message to the remote proxy node, indicating The remote proxy node suspends sending data to the local proxy node.
  12. 根据权利要求11所述装置,其特征在于,还包括:The device according to claim 11, further comprising:
    第一确定单元,用于确定所述本地代理节点与远端代理节点之间的通道是否为暂停状态,是否有数据;a first determining unit, configured to determine whether a channel between the local proxy node and the remote proxy node is in a suspended state, and whether there is data;
    所述发送单元,还用于若所述本地代理节点与所述远端代理节点之间的通道为暂停状态并且没有数据,则向所述远端代理节点发送恢复指示,指示所述远端代理节点继续向所述本地代理节点发送数据。The sending unit is further configured to: if the channel between the local proxy node and the remote proxy node is in a suspended state and has no data, send a recovery indication to the remote proxy node, indicating the remote proxy The node continues to send data to the home agent node.
  13. 根据权利要求10所述装置,其特征在于,The device according to claim 10, characterized in that
    第二确定单元,用于在将所述待发送数据写入所述目标通道对应的本地共享存储空间内之前,确定所述目标通道是否为暂停状态;a second determining unit, configured to determine whether the target channel is in a suspended state before writing the to-be-sent data into a local shared storage space corresponding to the target channel;
    所述数据写入单元,还用于若所述目标通道是暂停状态,则停止向所述目标通道对应的本地共享存储空间写入数据,直到所述目标通道恢复为非暂停状态。The data writing unit is further configured to stop writing data to the local shared storage space corresponding to the target channel if the target channel is in a suspended state, until the target channel returns to a non-suspended state.
  14. 根据权利要求10所述装置,其特征在于,还包括:The device according to claim 10, further comprising:
    节点管理单元,用于在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,创建所述本地节点,并建立所述本地代理节点与所述目标代理节点之间的目标通道,为所述目标通道分配本地共享存储空间;或者,接收所述目标代理节点发 送的通道信息,若本地未存储所述通道信息,则创建所述目标通道,并监听所述目标通道是否有数据接收。a node management unit, configured to create the local node and establish the local proxy node before determining a target channel between the local node and the target node according to a target node to which the to-be-sent data of the local node is to be sent a target channel between the target proxy node and a local shared storage space; or receiving the target proxy node The channel information sent, if the channel information is not stored locally, the target channel is created, and the target channel is monitored for data reception.
  15. 根据权利要求10至14任意一项所述装置,其特征在于,还包括:The device according to any one of claims 10 to 14, further comprising:
    同步管理单元,用于在利用所述远端代理通道通过所述本地节点的本地代理节点将所述本地共享存储空间内的所述待发送数据发送至所述目标节点的目标代理节点之前,读取配置文件,确定所述目标代理节点的互联网协议地址以及端口号,并通过所述互联网协议地址以及端口号建立所述本地代理节点与所述目标代理节点之间的传输控制协议TCP连接;通过所述TCP连接将所述本地代理节点创建的关于所述目标通道的通道信息发送给目标代理节点,以便所述目标代理节点根据所述通道信息建立所述目标通道。a synchronization management unit, configured to read the to-be-sent data in the local shared storage space to the target proxy node of the target node by using the remote proxy channel by the local proxy node of the local node Taking a configuration file, determining an internet protocol address and a port number of the target proxy node, and establishing, by using the internet protocol address and the port number, a transmission control protocol TCP connection between the local proxy node and the target proxy node; The TCP connection sends channel information about the target channel created by the local proxy node to a target proxy node, so that the target proxy node establishes the target channel according to the channel information.
  16. 根据权利要求15所述装置,其特征在于,The device of claim 15 wherein:
    所述同步管理单元,还用于若本地节点关闭,则关闭所述本地节点与远端节点之间的通道,且所述本地节点与所述远端节点之间的通道没有被其他进程所使用,则销毁所述本地节点与远端节点之间的通道。The synchronization management unit is further configured to: if the local node is closed, close a channel between the local node and the remote node, and the channel between the local node and the remote node is not used by another process. , destroying the channel between the local node and the remote node.
  17. 根据权利要求10所述的装置,其特征在于,还包括:The device according to claim 10, further comprising:
    本地通道单元,用于若所述目标节点为另一本地节点,则所述目标通道为所述本地节点与所述目标节点之间的本地通道,则写入所述本地共享存储空间内的待发送数据通过所述本地通道接收。a local channel unit, configured to: if the target node is another local node, the target channel is a local channel between the local node and the target node, and then write to the local shared storage space Transmit data is received through the local channel.
  18. 根据权利要求17所述的装置,其特征在于,还包括:The device according to claim 17, further comprising:
    节点管理单元,用于在根据本地节点的待发送数据所要发送至的目标节点确定所述本地节点与所述目标节点之间的目标通道之前,创建所述本地节点,并建立所述本地节点与所述目标节点之间的目标通道,为所述目标通道分配本地共享存储空间。 a node management unit, configured to create the local node and establish the local node before determining a target channel between the local node and the target node according to a target node to which the data to be sent of the local node is to be sent A target channel between the target nodes, the local shared storage space is allocated to the target channel.
PCT/CN2015/073166 2013-12-16 2015-02-16 Inter-process communication method and device WO2015090250A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310690566.7A CN104133728B (en) 2013-12-16 2013-12-16 Method and device for communication between processes
CN201310690566.7 2013-12-16

Publications (1)

Publication Number Publication Date
WO2015090250A1 true WO2015090250A1 (en) 2015-06-25

Family

ID=51806413

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/073166 WO2015090250A1 (en) 2013-12-16 2015-02-16 Inter-process communication method and device

Country Status (3)

Country Link
CN (1) CN104133728B (en)
TW (1) TWI528182B (en)
WO (1) WO2015090250A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766199A (en) * 2018-12-29 2019-05-17 歌尔股份有限公司 Node communication method and device in a kind of robot operating system

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104133728B (en) * 2013-12-16 2015-07-22 腾讯科技(深圳)有限公司 Method and device for communication between processes
CN106598756B (en) * 2016-12-13 2020-06-16 重庆川仪自动化股份有限公司 Data interaction method between different application programs
DE102017201966A1 (en) * 2017-02-08 2018-08-09 Robert Bosch Gmbh Control device for a motor vehicle and corresponding motor vehicle
CN107608632B (en) * 2017-09-21 2021-02-02 苏州浪潮智能科技有限公司 Communication method, device and system of distributed storage cluster
CN107682460B (en) * 2017-11-21 2021-01-12 苏州浪潮智能科技有限公司 Distributed storage cluster data communication method and system
CN108667903B (en) * 2018-04-03 2019-11-12 新华三技术有限公司 Data transmission method for uplink, device and storage medium
CN111901490A (en) * 2019-05-06 2020-11-06 鸿富锦精密电子(郑州)有限公司 Resource sharing method, device, computer device and storage medium
TWI791316B (en) 2021-11-05 2023-02-01 財團法人工業技術研究院 Method and system for implementing inter-process communications
CN115883654A (en) * 2022-11-29 2023-03-31 深圳市汇川技术股份有限公司 Process communication method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7095828B1 (en) * 2000-08-11 2006-08-22 Unisys Corporation Distributed network applications platform architecture
CN1842064A (en) * 2005-03-29 2006-10-04 腾讯科技(深圳)有限公司 Data transmission method and system in instant communication
CN1859327A (en) * 2006-02-09 2006-11-08 华为技术有限公司 Method, device and system for transfer news
CN104133728A (en) * 2013-12-16 2014-11-05 腾讯科技(深圳)有限公司 Method and device for communication between processes

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100547995C (en) * 2004-06-30 2009-10-07 联想(北京)有限公司 The data transmission method of equipment room in a kind of network
CN101938484B (en) * 2010-09-09 2013-05-15 奇智软件(北京)有限公司 Distributed flow control method and system
US9996403B2 (en) * 2011-09-30 2018-06-12 Oracle International Corporation System and method for providing message queues for multinode applications in a middleware machine environment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7095828B1 (en) * 2000-08-11 2006-08-22 Unisys Corporation Distributed network applications platform architecture
CN1842064A (en) * 2005-03-29 2006-10-04 腾讯科技(深圳)有限公司 Data transmission method and system in instant communication
CN1859327A (en) * 2006-02-09 2006-11-08 华为技术有限公司 Method, device and system for transfer news
CN104133728A (en) * 2013-12-16 2014-11-05 腾讯科技(深圳)有限公司 Method and device for communication between processes

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766199A (en) * 2018-12-29 2019-05-17 歌尔股份有限公司 Node communication method and device in a kind of robot operating system
CN109766199B (en) * 2018-12-29 2024-01-30 歌尔股份有限公司 Node communication method and device in robot operating system

Also Published As

Publication number Publication date
TW201525698A (en) 2015-07-01
CN104133728B (en) 2015-07-22
TWI528182B (en) 2016-04-01
CN104133728A (en) 2014-11-05

Similar Documents

Publication Publication Date Title
WO2015090250A1 (en) Inter-process communication method and device
WO2018170833A1 (en) Uplink data transmission method, terminal, network side device and system
WO2016150331A1 (en) Method and device for operating game client
WO2018049887A1 (en) Data transmission processing method and terminal device
WO2018195924A1 (en) Network connection configuration method and related product
EP3179693B1 (en) Method, apparatus, storage medium and computer program product for establishing a data connection
WO2018049912A1 (en) Data transmission method and related devices
CN107800585B (en) Network communication method and device, and message pushing method and device
WO2018049971A1 (en) Hotspot network switching method and terminals
WO2018049921A1 (en) Data transmission processing method and related device
WO2019019182A1 (en) Data transmission method and related product
WO2018049970A1 (en) Hotspot network switching method and terminal
WO2018188278A1 (en) Memory resource allocation method and terminal device
WO2019028814A1 (en) Measurement reporting control method and related product
WO2018201411A1 (en) Scheduling request transmission control method and related product
WO2015062234A1 (en) Mobile terminal resource processing method, device and apparatus
WO2018049969A1 (en) Hotspot establishment method and related device
WO2018170835A1 (en) Uplink data transmission method, terminal, network side device and system
WO2015062400A1 (en) Method for managing video channel allocation, related device, and communications system
WO2018049968A1 (en) Hotspot establishment method and terminals
WO2019028866A1 (en) Data transmission method and related product
WO2018126407A1 (en) Data transmission method and device
WO2017166093A1 (en) Front-end system
WO2018049896A1 (en) Data transmission method and device
WO2019028876A1 (en) Data transmission method and related product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15729740

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 25.10.16)

122 Ep: pct application non-entry in european phase

Ref document number: 15729740

Country of ref document: EP

Kind code of ref document: A1