CN110928700A - Multi-process communication method and device - Google Patents
Multi-process communication method and device Download PDFInfo
- Publication number
- CN110928700A CN110928700A CN201811100206.6A CN201811100206A CN110928700A CN 110928700 A CN110928700 A CN 110928700A CN 201811100206 A CN201811100206 A CN 201811100206A CN 110928700 A CN110928700 A CN 110928700A
- Authority
- CN
- China
- Prior art keywords
- message
- control bus
- header information
- processes
- added
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/544—Buffers; Shared memory; Pipes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/542—Event management; Broadcasting; Multicasting; Notifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
- Multi Processors (AREA)
Abstract
The invention provides a multi-process communication method and a device, wherein the method comprises the following steps: a control bus receives a message sent by a process; the control bus adds header information to a message sent by a process, wherein the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, and the IDs are used for uniquely identifying the processes; the control bus sends out the message added with the header information. In the above scheme, the header information is added to the message, and the header information carries the identification ID, so that whether the receiver needs to process the received message can be informed, and the order and the efficiency of multi-process communication can be improved.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a multi-process communication method and a multi-process communication device.
Background
Inter-process communication refers to the propagation or exchange of information between different processes, and common inter-process communication methods include: pipeline, message queue, semaphore, shared memory, socket.
Wherein, the pipeline divide into: the method comprises a nameless pipeline and a named pipeline, wherein the nameless pipeline can only be used for communication between processes with affinity, the named pipeline can exchange data between unrelated processes, but the named pipeline can only bear a plain byte stream, and the data of the pipeline is cleared when the data is read out. The message queue can complete a plurality of inter-process message transmission works, but the efficiency is low and the real-time performance is poor. Semaphores are used for interprocess synchronization, and if data needs to be transferred between processes, a shared memory needs to be combined. Shared memory means that two or more processes share a given memory area, which is fast and efficient because the processes directly access the memory, and then need to be synchronized because multiple processes can operate a block of memory at the same time. Socket is an inter-process communication mode of a surface phase network, and can not only realize inter-process communication in the same local computer but also realize communication of processes on different hosts.
The most direct multi-process message communication method is to establish one-to-one communication between two processes needing communication, which wastes resources and is not beneficial to unified management. The common multi-process message communication is realized by using socket, but the message transmission speed is low, and the real-time performance is not good.
An effective solution is not provided at present for how to efficiently perform multi-process message communication in real time.
Disclosure of Invention
The embodiment of the invention provides a multi-process communication method and device, which aim to achieve the aim of efficiently carrying out multi-process communication in real time.
The embodiment of the invention provides a multi-process communication method, which comprises the following steps:
a control bus receives a message sent by a process;
the control bus adds header information to a message sent by a process, wherein the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, and the IDs are used for uniquely identifying the processes;
and the control bus sends out the message added with the header information.
In one embodiment, after the control bus sends out the message added with the header information, the method further comprises:
the control bus determines whether the message requires a reply;
setting a specific memory location on the control bus under the condition that the message needs to be replied;
and storing the message through the specific memory location.
In one embodiment, after the control bus sends out the message added with the header information, the method further comprises:
the process receives the message added with the header information;
the process extracts the ID of the process receiving the message in the header information;
comparing the ID of the process receiving the message with the ID of the process;
if so, the message with the added header information is processed.
In one embodiment, after comparing the ID of the process receiving the message with the ID of itself, the method further comprises:
determining whether the ID of the process receiving the message identifies the message as a broadcast message;
in case that it is determined to be a broadcast message, the message to which the header information is added is processed.
In one embodiment, the control bus comprises: the system comprises a first control bus and a second control bus, wherein the first control bus is used for a server side to actively send control messages to all processes and receive messages replied by the processes; and the second control bus is used for actively sending messages to the server and other processes by the processes.
The embodiment of the present invention further provides a multiprocess communication apparatus, located in a control bus, including:
the receiving module is used for receiving messages sent by the process;
the system comprises an adding module, a processing module and a processing module, wherein the adding module is used for adding header information to a message sent by a process, the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, and the IDs are used for uniquely identifying the process;
and the sending module is used for sending the message added with the header information.
In one embodiment, the multi-process communication apparatus may further include:
the determining module is used for determining whether the message needs to be replied or not by the control bus after the control bus sends out the message added with the header information;
the setting module is used for setting a specific memory position on the control bus under the condition that the message needs to be replied;
and the storage module is used for storing the message through the specific memory location.
In one embodiment, the multi-process communication apparatus may further include: the process receives the message added with the header information; the process extracts the ID of the process receiving the message in the header information; comparing the ID of the process receiving the message with the ID of the process; if so, the message with the added header information is processed.
In one embodiment, the multi-process communication apparatus may further include: after comparing the ID of the process receiving the message with the ID of the process, determining whether the ID of the process receiving the message identifies the message as a broadcast message; in case that it is determined to be a broadcast message, the message to which the header information is added is processed.
In one embodiment, the control bus comprises: the system comprises a first control bus and a second control bus, wherein the first control bus is used for a server side to actively send control messages to all processes and receive messages replied by the processes; and the second control bus is used for actively sending messages to the server and other processes by the processes.
In the embodiment of the invention, a control bus receives a message sent by a process, the control bus adds header information to the message sent by the process, wherein the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, the ID is used for uniquely identifying the process, and the control bus sends the message added with the header information. That is, by adding header information to the message and carrying the identification ID in the header information, it can be informed whether the receiving party needs to process the received message, so as to improve the order and efficiency of multi-process communication.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a block diagram of a multi-process messaging system according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of multi-process message communication according to an embodiment of the invention;
FIG. 3 is a flowchart of a method for multi-process communication registration according to an embodiment of the present invention;
fig. 4 is a flowchart of a communication registration method according to an embodiment of the present invention;
FIG. 5 is a block diagram of a multi-process messaging device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the following embodiments and accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
To better illustrate the present application, the following explanations of several terms involved are as follows:
1) IPCMessage: the method is a message communication mechanism realized by a share memory;
2) client: each process for mapping the shared memory is called a client;
3) ClientInterface: providing a method for operating a Client;
4) ringbuffer: and the messages are sequentially arranged backwards from the initial position of the buffer, and when the buffer is full, the messages return to the initial position for continuous storage.
Considering that the existing multi-process message communication is realized by using socket, the message transmission is influenced by network conditions, the speed is slow, and the requirements cannot be met for some use scenes with high real-time requirements. Therefore, in the embodiment, by utilizing the advantages of high speed and high efficiency of shared memory and combining the requirement that the messages among the multiple processes can be flexibly and quickly transmitted, an efficient multi-process message communication mechanism is provided, so that the efficiency is improved, the resources can be saved, and the technical effects of improving the message transmission speed and the message transmission flexibility among the multiple processes are achieved.
As shown in fig. 1, in this example, a multiprocess messaging system is provided, which may include: a shared memory 10, the shared memory 10 being divided into a first control bus 101 and a second control bus 102, wherein:
the first control bus 101 is used for the server 103 to actively send control messages to all the processes 104 and receive messages replied by the processes;
the second control bus 102 is used for processes to actively send messages to the server and other processes.
For messages requiring immediate results, a specific memory location may be set for storing to increase response time. For example, the first control bus may be provided with a specific memory location for storing messages requiring immediate results to be returned.
On one bus, messages which only need to be received by the opposite Client and do not need to be replied (for example, when a plurality of messages are sent simultaneously) are sequentially arranged in a ring buffer mode, and the time for reserving the messages is related to the size of the shared memory. For example, the first control bus may be provided with a ringbuffer mode, wherein messages of the server are sequentially arranged according to the ringbuffer mode under the condition that the process does not need to reply to the messages.
Similarly, the second control bus may be provided in the form of the first control bus. That is, the second control bus may be provided with a ringbuffer mode, in which messages of processes at the transmitting end are sequentially arranged according to the ringbuffer mode under the condition that the processes at the receiving end do not need to reply to the messages.
For a control bus, a server end and a client end are controlled, the server end is used for managing a registered client list, and a client interface is distributed to each client. The client end is used for realizing a client interface and registering the client by matching with the server. Specifically, the first control bus includes a server side control module and a process side control module, wherein the server side control module is configured to manage a registered process list and allocate a process access interface to each process, and the process side control module is configured to implement the process access interface. Similarly, the second control bus may include a server side control module and a process side control module, where the server side control module is configured to manage a registered process list and allocate a process access interface to each process, and the process side control module is configured to implement the process access interface.
Based on the above multiprocess communication system, in this example, a multiprocess communication method is further provided, as shown in fig. 2, the method may include the following steps:
step 201: a control bus receives a message sent by a process;
step 202: the method comprises the steps that a control bus adds header information to a message sent by a process, wherein the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, and the IDs are used for uniquely identifying the processes;
step 203: the control bus sends out the message added with the header information.
After the control bus sends out the message added with the header information in step 203, the control bus can determine whether the message needs to be replied; setting a specific memory location on a control bus under the condition that the message needs to be replied; and storing the message through the specific memory location.
After the control bus sends out the message added with the header information, the process can receive the message added with the header information; the process extracts the ID of the process receiving the message in the header information; comparing the ID of the process receiving the message with the ID of the process; if so, the message with the added header information is processed. That is, for the recipient process, it can be determined whether the received message itself needs to be processed by the process ID in the header information, and if so, it is processed, and if not, it is discarded.
In practical implementation, not only the message that needs to be processed by itself is indicated in the header information, but also the message that indicates that the message is a broadcast message is indicated in the header information, which is also needed to be processed by the process of the receiving party. That is, after comparing the ID of the process receiving the message with the ID of itself, it may be determined whether the ID of the process receiving the message identifies the message as a broadcast message; in case that it is determined to be a broadcast message, the message to which the header information is added is processed.
The control bus can be divided into a first control bus and a second control bus, wherein the first control bus is used for the server side to actively send control messages to all processes and receive messages replied by the processes; and the second control bus is used for actively sending messages to the server and other processes by the processes. Specifically, one shared memory can be divided into two parts which are respectively used as two buses, one bus is used for the server to actively send control messages to all clients and clients to reply messages, and the other bus is used for the clients to actively send messages to the server and other clients, so that the simultaneous bidirectional communication of the server and the clients is realized, and the real-time performance of control is guaranteed.
Because the communication among the multiple processes is realized by accessing the server and the processes to the same communication system, the problem of communication registration is involved, and each process can be registered in time. In this example, a registration method based on server-side priority start and a registration method based on process priority start are proposed, and the following two registration methods are described as follows:
1) as shown in fig. 3, the registration method based on server-side preferential initiation may include the following steps:
step 301: after the server is started, a shared memory is established;
step 302: the server side broadcasts a query message to the process and waits for the process to reply, wherein after the process is started, the shared memory is mapped and a registration message is broadcasted;
step 303: the server receives the registration message;
step 304: and the server side responds to the registration information, registers the progress and replies a confirmation message.
Specifically, after the server broadcasts a query message to the process and waits for the process to reply, whether the query message needs the process to reply or not can be determined through a control bus created by the shared memory; and in the case that the reply is determined to be needed, storing the query message in a specific memory location.
After a server broadcasts a query message to a process and waits for the process to reply, whether the query message needs the process to reply or not can be determined through a control bus established by the shared memory; and under the condition that the reply is determined not to be needed, sequentially arranging the query messages in a ringbuffer mode.
That is, different processing is used for messages that need to be replied to and messages that do not need to be replied to.
The step 302, where the server broadcasts the query message to the process and waits for a reply from the process, may include: the server adds header information in the query message, wherein the header information is used for indicating that the message is a broadcast message; and the server side sends out the query message added with the header information.
2) The registration method based on the preferential initiation of the process, as shown in fig. 4, may include the following steps:
step 401: after the process is started, a shared memory is established;
step 402: the process actively broadcasts a registration message and waits for receiving a server message, wherein after the server is started, the shared memory is mapped and a query message is broadcast;
step 403: the process receives the query message;
step 404: and the process responds to the inquiry message and broadcasts a registration message, wherein the server side responds to the registration message to register the proceeding process.
Specifically, after a process broadcasts a registration message and waits for receiving a server message, whether the registration message needs to be replied or not can be determined through a control bus established by a shared memory; in the event that a reply is determined to be required, the registration message is stored at a particular memory location.
After a process broadcasts a registration message and waits for receiving a server message, whether the registration message needs a process reply or not can be determined through a control bus established by the shared memory; and under the condition that the reply is determined not to be needed, sequentially arranging the registration messages in a ringbuffer mode.
The process of step 402 broadcasts the registration message and waits for receiving the server message, which may include: adding header information in the registration message, wherein the header information is used for indicating that the registration message is a broadcast message; and sending out the query message added with the header information.
The multi-process communication method is described below with reference to a specific embodiment, however, it should be noted that the specific embodiment is only for better describing the present application and is not to be construed as a limitation of the present application.
In this example, the IPCMessage is considered as a control bus, and each client on the bus can communicate with any client, and can also broadcast to all clients. The IPCMessage allocates a unique id to each client, and assigns the id of a process for sending and receiving the message to the message adding header information, and can also assign the broadcast id to send the message to all processes.
One process sends a message and informs other processes through a semaphore, the other processes receive the message and compare whether the message is the same as the id of the other processes, if the id is the same or the id is broadcast, the message is processed, and otherwise, the message is ignored.
Wherein, the IPCMessage may include: the server end and the client end are controlled, the server end is used for managing a registered client list, and a client interface is distributed to each client. The client end is used for realizing a client interface and registering the client by matching with the server.
Firstly, a shared memory is divided into two parts which are respectively used as two buses, one bus is used for a server to actively send control messages to all clients and client reply messages, and the other bus is used for the client to actively send messages to the server and other clients, so that the simultaneous two-way communication of the server and the clients is realized, and the real-time performance of control is guaranteed.
On one bus, messages which only need to be received by the opposite Client and do not need to be replied (for example, when a plurality of messages are sent simultaneously) are sequentially arranged in a ring buffer mode, and the time for reserving the messages is related to the size of the shared memory. For messages requiring immediate results, a specific memory location may be set for storage to increase response time.
The negotiation process of the server and the client is as follows:
1) if the server side is started first, a shared memory is created, a client message is broadcasted and inquired and the client is waited to reply, after the client is started, the shared memory is mapped, a client message is broadcasted and registered, and the server registers the client and replies a confirmation message.
2) If the client end is started first, a shared memory is created, client information is broadcasted and registered, the server end information is waited to be received, the shared memory is mapped after the server end is started, the client information is broadcasted and inquired, the client information is broadcasted and registered after the client receives the client information, and the server registers the client and replies confirmation information.
3) If a new client is added, the client actively broadcasts a registration client message, and the server registers the client and replies a confirmation message.
In the above example, the bus and the shared memory are combined, so that the communication efficiency and the communication flexibility of the multi-process message are improved. Specifically, full-duplex communication between the client and the server is realized through the two buses, real-time performance of control of adding a new client and the like is guaranteed, the problem that messages on one bus are frequent is solved through the ringbuffer, and the response speed is improved by storing the messages needing to be replied in time at the fixed position of one bus.
Based on the same inventive concept, the embodiment of the present invention further provides a multi-process communication apparatus, as described in the following embodiments. Because the problem solving principle of the multi-process communication device is similar to that of the multi-process communication method, the implementation of the multi-process communication device can refer to the implementation of the multi-process communication method, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated. Fig. 5 is a block diagram of a multi-process communication device according to an embodiment of the present invention, which is located in a control bus, and as shown in fig. 5, the multi-process communication device may include: the following describes the configuration of the receiving module 501, the adding module 502, and the transmitting module 503.
A receiving module 501, configured to receive a message sent by a process;
an adding module 502, configured to add header information to a message sent by a process, where the header information is used to indicate an ID of the process sending the message and an ID of the process receiving the message, where the IDs are used to uniquely identify the processes;
a sending module 503, configured to send the message to which the header information is added.
In one embodiment, the multi-process communication apparatus may further include: the determining module is used for determining whether the message needs to be replied or not by the control bus after the control bus sends out the message added with the header information; the setting module is used for setting a specific memory position on the control bus under the condition that the message needs to be replied; and the storage module is used for storing the message through the specific memory location.
In one embodiment, the multi-process communication apparatus may further include: the process receives the message added with the header information; the process extracts the ID of the process receiving the message in the header information; comparing the ID of the process receiving the message with the ID of the process; if so, the message with the added header information is processed.
In one embodiment, the multi-process communication apparatus may further include: after comparing the ID of the process receiving the message with the ID of the process, determining whether the ID of the process receiving the message identifies the message as a broadcast message; in case that it is determined to be a broadcast message, the message to which the header information is added is processed.
In one embodiment, the control bus may include: the system comprises a first control bus and a second control bus, wherein the first control bus is used for a server side to actively send control messages to all processes and receive messages replied by the processes; and the second control bus is used for actively sending messages to the server and other processes by the processes.
In another embodiment, a software is provided, which is used to execute the technical solutions described in the above embodiments and preferred embodiments.
In another embodiment, a storage medium is provided, in which the software is stored, and the storage medium includes but is not limited to: optical disks, floppy disks, hard disks, erasable memory, etc.
From the above description, it can be seen that the embodiments of the present invention achieve the following technical effects: the method comprises the steps that a control bus receives a message sent by a process, the control bus adds header information to the message sent by the process, wherein the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, the IDs are used for uniquely identifying the process, and the control bus sends the message added with the header information. That is, by adding header information to the message and carrying the identification ID in the header information, it can be informed whether the receiving party needs to process the received message, so as to improve the order and efficiency of multi-process communication.
Although the present application provides method steps as described in an embodiment or flowchart, additional or fewer steps may be included based on conventional or non-inventive efforts. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual apparatus or client product executes, it may execute sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures.
The apparatuses or modules illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. The functionality of the modules may be implemented in the same one or more software and/or hardware implementations of the present application. Of course, a module that implements a certain function may be implemented by a plurality of sub-modules or sub-units in combination.
The methods, apparatus or modules described herein may be implemented in computer readable program code to a controller implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, Application Specific Integrated Circuits (ASICs), programmable logic controllers and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may therefore be considered as a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
Some of the modules in the apparatus described herein may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary hardware. Based on such understanding, the technical solutions of the present application may be embodied in the form of software products or in the implementation process of data migration, which essentially or partially contributes to the prior art. The computer software product may be stored in a storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, mobile terminal, server, or network device, etc.) to perform the methods described in the various embodiments or portions of the embodiments of the present application.
The embodiments in the present specification are described in a progressive manner, and the same or similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. All or portions of the present application are operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, mobile communication terminals, multiprocessor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
While the present application has been described with examples, those of ordinary skill in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit of the application, and it is intended that the appended claims encompass such variations and permutations without departing from the spirit of the application.
Claims (10)
1. A multiprocess communication method, comprising:
a control bus receives a message sent by a process;
the control bus adds header information to a message sent by a process, wherein the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, and the IDs are used for uniquely identifying the processes;
and the control bus sends out the message added with the header information.
2. The method of claim 1, wherein after the control bus sends out the message with the header information added, the method further comprises:
the control bus determines whether the message requires a reply;
setting a specific memory location on the control bus under the condition that the message needs to be replied;
and storing the message through the specific memory location.
3. The method of claim 1, wherein after the control bus sends out the message with the header information added, the method further comprises:
the process receives the message added with the header information;
the process extracts the ID of the process receiving the message in the header information;
comparing the ID of the process receiving the message with the ID of the process;
if so, the message with the added header information is processed.
4. The method of claim 3, wherein after comparing the ID of the process receiving the message with the ID of itself, the method further comprises:
determining whether the ID of the process receiving the message identifies the message as a broadcast message;
in case that it is determined to be a broadcast message, the message to which the header information is added is processed.
5. The method of claim 1, wherein the control bus comprises: the system comprises a first control bus and a second control bus, wherein the first control bus is used for a server side to actively send control messages to all processes and receive messages replied by the processes; and the second control bus is used for actively sending messages to the server and other processes by the processes.
6. A multiprocess communication apparatus, located in a control bus, comprising:
the receiving module is used for receiving messages sent by the process;
the system comprises an adding module, a processing module and a processing module, wherein the adding module is used for adding header information to a message sent by a process, the header information is used for indicating an ID of the process sending the message and an ID of the process receiving the message, and the IDs are used for uniquely identifying the process;
and the sending module is used for sending the message added with the header information.
7. The apparatus of claim 6, further comprising:
the determining module is used for determining whether the message needs to be replied or not by the control bus after the control bus sends out the message added with the header information;
the setting module is used for setting a specific memory position on the control bus under the condition that the message needs to be replied;
and the storage module is used for storing the message through the specific memory location.
8. The apparatus of claim 6, further comprising: the process receives the message added with the header information; the process extracts the ID of the process receiving the message in the header information; comparing the ID of the process receiving the message with the ID of the process; if so, the message with the added header information is processed.
9. The apparatus of claim 8, further comprising: after comparing the ID of the process receiving the message with the ID of the process, determining whether the ID of the process receiving the message identifies the message as a broadcast message; in case that it is determined to be a broadcast message, the message to which the header information is added is processed.
10. The apparatus of claim 6, wherein the control bus comprises: the system comprises a first control bus and a second control bus, wherein the first control bus is used for a server side to actively send control messages to all processes and receive messages replied by the processes; and the second control bus is used for actively sending messages to the server and other processes by the processes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811100206.6A CN110928700B (en) | 2018-09-20 | 2018-09-20 | Multi-process communication method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811100206.6A CN110928700B (en) | 2018-09-20 | 2018-09-20 | Multi-process communication method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110928700A true CN110928700A (en) | 2020-03-27 |
CN110928700B CN110928700B (en) | 2023-04-07 |
Family
ID=69856247
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811100206.6A Active CN110928700B (en) | 2018-09-20 | 2018-09-20 | Multi-process communication method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110928700B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114003413A (en) * | 2021-12-30 | 2022-02-01 | 深圳佑驾创新科技有限公司 | IPC data communication method, device, equipment and medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0695993A2 (en) * | 1994-07-27 | 1996-02-07 | International Business Machines Corporation | System and method for interprocess communication |
US20040237089A1 (en) * | 2003-05-20 | 2004-11-25 | Teh Jin Teik | Separation of data and instruction for improving system performance in a multiple process environment |
CN101174225A (en) * | 2006-11-02 | 2008-05-07 | 华为技术有限公司 | Device and method for implementing message communication |
CN102355429A (en) * | 2011-08-12 | 2012-02-15 | 北京思创银联科技股份有限公司 | Pipeline-based inter-process message communication method |
CN103455380A (en) * | 2012-06-05 | 2013-12-18 | 上海斐讯数据通信技术有限公司 | Multi-process communication system and establishment and communication method thereof |
CN103970593A (en) * | 2013-01-30 | 2014-08-06 | 云联(北京)信息技术有限公司 | Multi-process interaction method and system |
CN104317661A (en) * | 2014-11-04 | 2015-01-28 | 上海斐讯数据通信技术有限公司 | Intersystem communication method and device of dual embedded systems |
CN104346229A (en) * | 2014-11-14 | 2015-02-11 | 国家电网公司 | Processing method for optimization of inter-process communication of embedded operating system |
CN107391276A (en) * | 2017-07-05 | 2017-11-24 | 腾讯科技(深圳)有限公司 | Distributed monitor method, interception control device and system |
-
2018
- 2018-09-20 CN CN201811100206.6A patent/CN110928700B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0695993A2 (en) * | 1994-07-27 | 1996-02-07 | International Business Machines Corporation | System and method for interprocess communication |
US20040237089A1 (en) * | 2003-05-20 | 2004-11-25 | Teh Jin Teik | Separation of data and instruction for improving system performance in a multiple process environment |
CN101174225A (en) * | 2006-11-02 | 2008-05-07 | 华为技术有限公司 | Device and method for implementing message communication |
CN102355429A (en) * | 2011-08-12 | 2012-02-15 | 北京思创银联科技股份有限公司 | Pipeline-based inter-process message communication method |
CN103455380A (en) * | 2012-06-05 | 2013-12-18 | 上海斐讯数据通信技术有限公司 | Multi-process communication system and establishment and communication method thereof |
CN103970593A (en) * | 2013-01-30 | 2014-08-06 | 云联(北京)信息技术有限公司 | Multi-process interaction method and system |
CN104317661A (en) * | 2014-11-04 | 2015-01-28 | 上海斐讯数据通信技术有限公司 | Intersystem communication method and device of dual embedded systems |
CN104346229A (en) * | 2014-11-14 | 2015-02-11 | 国家电网公司 | Processing method for optimization of inter-process communication of embedded operating system |
CN107391276A (en) * | 2017-07-05 | 2017-11-24 | 腾讯科技(深圳)有限公司 | Distributed monitor method, interception control device and system |
Non-Patent Citations (1)
Title |
---|
陈涛 等: "基于Linux的多线程池并发Web服务器设计" * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114003413A (en) * | 2021-12-30 | 2022-02-01 | 深圳佑驾创新科技有限公司 | IPC data communication method, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN110928700B (en) | 2023-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10826979B2 (en) | Apparatus and method for logically grouping client nodes in an IoT environment using client identifiers | |
US8898191B2 (en) | Method for providing connections for application processes to a database server | |
US9424027B2 (en) | Message management system for information transfer within a multitasking system | |
CN105630731A (en) | Network card data processing method and device in multi-CPU (Central Processing Unit) environment | |
JP2008033952A (en) | Most eligible server in common work queue environment | |
US11201836B2 (en) | Method and device for managing stateful application on server | |
US9323591B2 (en) | Listening for externally initiated requests | |
JP2002223214A (en) | Method and apparatus for communication between computer systems using sliding transmission window for ordered message in cluster computer environment | |
CN105373563B (en) | Database switching method and device | |
CN110928700B (en) | Multi-process communication method and device | |
CN103827830A (en) | System and method for preventing single-point bottleneck in a transactional middleware machine environment | |
CN110928703B (en) | Multi-process communication registration method and device | |
CN110928702B (en) | Multi-process message communication system | |
CN112822299A (en) | RDMA (remote direct memory Access) -based data transmission method and device and electronic equipment | |
CN110928701A (en) | Communication registration method and device | |
CN112134938B (en) | Message processing method, device, terminal and computer readable storage medium | |
CN114528114B (en) | Data processing method, device and equipment | |
US11797342B2 (en) | Method and supporting node for supporting process scheduling in a cloud system | |
CN112328417A (en) | Embedded multi-program communication method and system | |
CN117076409B (en) | File sharing method, device, system, electronic equipment and storage medium | |
CN113783830B (en) | Method and apparatus for data communication | |
US9588924B2 (en) | Hybrid request/response and polling messaging model | |
WO2012071860A1 (en) | Synchronization communication method between single-boards of a multiple dwelling unit and multiple dwelling unit thereof | |
CN114116258B (en) | Queue manager hot standby method, system, terminal and storage medium | |
CN108108243B (en) | Resource sharing system and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |