CN107656827A - A kind of inter-process communication methods and system - Google Patents
A kind of inter-process communication methods and system Download PDFInfo
- Publication number
- CN107656827A CN107656827A CN201710889866.6A CN201710889866A CN107656827A CN 107656827 A CN107656827 A CN 107656827A CN 201710889866 A CN201710889866 A CN 201710889866A CN 107656827 A CN107656827 A CN 107656827A
- Authority
- CN
- China
- Prior art keywords
- message
- communication information
- response message
- pending
- queue
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
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/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
- Telephonic Communication Services (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a kind of inter-process communication methods and system, this method includes:First process sends communication information to the second process;After sending the communication information, first process continues with the pending message in message queue, and the message queue includes the message that first process need to be handled;During the pending message during first process continues with the message queue, if first process receives the response message to the communication information that second process is sent, respective handling is carried out to the response message.After the first process sends communication information to the second process in the present invention, first process continues directly to handle next pending message, respective handling is carried out to the response message if the response message of second process is received during remaining pending message is handled, therefore the present invention does not have to lose time to wait, the operating efficiency of process can be improved, and then improves the operating efficiency of software.
Description
Technical field
The present invention relates to field of computer technology, more specifically to a kind of inter-process communication methods, further relates to one kind
Interprocess communication system.
Background technology
In software is stored, it will usually different functions is realized using different processes, each process includes one
It message queue, may need to interact information to coordinate to complete work between different processes, therefore just generate between process
Communication.The several ways such as process communication generally use pipeline, signal, shared drive, socket or message queue, wherein, for
For message queue, existing inter-process communication methods are:Process is handled the message in message queue by message queue successively, when
When handling some message, it may be desirable to send communication information to other process, send and then wait that other side's is anti-after communication information
Feedback, just may proceed to handle next message, namely wait the time to be feedback can not handle other when receiving the feedback of other side
Information, this period are wasted, and cause the operating efficiency of the process relatively low so that the work of the storage software corresponding to the process
Make less efficient.
In summary, how a kind of method that can improve software work efficiency is provided, be current those skilled in the art urgently
The problem of to be solved.
The content of the invention
It is an object of the invention to provide a kind of inter-process communication methods and system, can improve software work efficiency.
To achieve these goals, the present invention provides following technical scheme:
A kind of inter-process communication methods, including:
First process sends communication information to the second process;
After sending the communication information, first process continues with the pending message in message queue, institute
State message queue and include the message that first process need to be handled;
During the pending message during first process continues with the message queue, if described first enters
Journey receives the response message to the communication information that second process is sent, then carries out corresponding position to the response message
Reason.
Preferably, respective handling is carried out to the response message, including:
First process calls the readjustment processing function pre-set to handle the response message.
Preferably, when first process receives the response to the communication information of the second process transmission
After message, in addition to:
First process judges itself whether handling any pending message in the message queue, if so,
The readjustment processing function processing response called and pre-set will be performed after the completion of the pending Message Processing by then waiting
The step of message, if it is not, then performing the readjustment that the calling is pre-set handles the step of function is to handle the response message.
Preferably, after first process has often handled the pending message in a message queue, in addition to:
First process judges whether the pending message in the message queue is disposed, if so, then sending place
Manage the prompting completed.
A kind of interprocess communication system, including:
First process, is used for:Communication information is sent to the second process;After sending the communication information, continue with
Pending message in message queue, the message queue include the message that first process need to be handled;Continuing with
During stating the pending message in message queue, if receiving answering the communication information for the second process transmission
Message is answered, then respective handling is carried out to the response message;
Second process, is used for:Receive the communication information that first process is sent;Corresponding position is carried out to the communication information
The response message of the communication information is sent after reason to first process.
Preferably, first process includes:
Processing unit, it is used for:The readjustment processing function pre-set is called to handle the response message.
Preferably, first process also includes:
Judging unit, it is used for:When first process receive that second process sends to the communication information
After the response message, judge whether first process is handling any pending message in the message queue, if
It is that then waiting after the completion of the pending Message Processing, will control the processing unit to perform the readjustment for calling and pre-setting
The step of function handles the response message is handled, if it is not, then controlling the processing unit to perform what the calling was pre-set
The step of readjustment processing function is to handle the response message.
Preferably, in addition to:
Suggestion device, it is used for:After first process has often handled the pending message in a message queue, sentence
Whether the pending message in the disconnected message queue is disposed, if so, then sending the prompting that processing is completed.
The invention provides a kind of inter-process communication methods, this method includes:First process sends to the second process and communicated
Message;After sending the communication information, first process continues with the pending message in message queue, described to disappear
Breath queue includes the message that first process need to be handled;Wait to locate in first process continues with the message queue
During managing message, if first process receives the response to the communication information that second process is sent and disappeared
Breath, then respective handling is carried out to the response message.After the first process sends communication information to the second process in the present invention, first
Process continues directly to handle next pending message, if receiving described second during remaining pending message is handled
The response message of process then to the response message carry out respective handling, therefore the present invention do not have to lose time to wait, can improve into
The operating efficiency of journey, and then improve the operating efficiency of software.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
The embodiment of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis
The accompanying drawing of offer obtains other accompanying drawings.
Fig. 1 is a kind of flow chart of inter-process communication methods provided in an embodiment of the present invention;
Fig. 2 is a kind of structural representation of interprocess communication system provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
Referring to Fig. 1, it illustrates a kind of flow chart of inter-process communication methods provided in an embodiment of the present invention, can wrap
Include:
S11:First process sends communication information to the second process.
When the first process needs to interact with the second process, then communication information is sent to the second process.For one
For software, when the software needs to complete a certain function, it may be necessary to several processes, in these processes, as long as in the presence of
Need the situation to other process transmission communication information, then this process for sending communication information is just used as the embodiment of the present invention
In the first process, and the process for receiving above-mentioned communication information is just corresponding as the second process in the embodiment of the present invention.
S12:After sending communication information, the first process continues with the pending message in message queue, message team
The message that row need to be handled comprising the first process.
Each process has corresponded to a message queue, and the message in the message queue is that the process needs to be processed disappear
Breath.Specific in the embodiment of the present invention, when the first process is in some message in handling its corresponding message queue, Ke Nengxu
To be interacted with the second process, now the first process will send communication information to the second process, sent above-mentioned communication and disappeared
After breath, the first process will continue to handle next pending message in its corresponding message queue.
S13:During the pending message during the first process continues with message queue, if the first process receives
The response message to communication information that second process is sent, then respective handling is carried out to response message.
During the pending message during the first process continues with its corresponding message queue, the second process may
Corresponding processing has been done to above-mentioned communication information, then sent result to the first process by response message, the
After one process receives the response message, the result of the second process in response message is done accordingly to the response message
Processing.
After the first process sends communication information to the second process in the embodiment of the present invention, the first process is continued directly under processing
One pending message, should to this if the response message of the second process is received during remaining pending message is handled
Answer message and carry out respective handling, therefore the present invention does not have to lose time to wait, and can improve the operating efficiency of process, and then improve soft
The operating efficiency of part.
A kind of inter-process communication methods provided in an embodiment of the present invention, respective handling is carried out to response message, can be included:
First process calls the readjustment processing function processing response message pre-set.
After the first process receives the above-mentioned response message of the second process transmission, it can call at the readjustment pre-set
Reason function is handled accordingly, wherein, readjustment processing function can be configured according to actual conditions.For example, when first
, it is necessary to by could handle message a well with interacting for the second process when process handles message a, now the first process is to second
Process sends communication information, and after transmission, the first process can be according to corresponding to the communication information that this sends sets one at readjustment
Function is managed, when the first process can call the correspondence after the response message to the communication information of the second process transmission is received
Readjustment processing function, pass through the readjustment and handle function and complete processing to message a.So this method causes the first process to exist
The processing that after communication information the time need not be spent to wait the second process is have sent, need to only be adjusted after the second process sends response message
Untreated complete message before being continued with readjustment processing function, improve the operating efficiency of the first process.
A kind of inter-process communication methods provided in an embodiment of the present invention, when the first process receives pair of the second process transmission
After the response message of communication information, it can also include:
First process judges itself whether handling any pending message in message queue, will if so, then waiting
After the completion of the pending Message Processing, the step of calling the readjustment processing function processing response message pre-set is performed, if it is not,
Then performing calls the readjustment pre-set to handle the step of function is to handle response message.
Continued with after sending communication information to the second process due to the first process pending in its corresponding message queue
Message, so when the first process receive the second process transmission response message when, the first process may be handled in addition
Some message, now the first process then first corresponding position can will be done to response message again after the completion of the Message Processing handled
Reason, but if now the first process has just handled some message, then directly can be handled the response message.The party
Method can ensure that the first process is not interrupted halfway when handling each message, avoid may therefore caused by failure, make the
One process works obtain more smooth.Certainly, in the specific implementation, can have processing mode for greater flexibility, as worked as the first process just
The priority of message b in its corresponding message queue is handled is lower, then the first process can also be temporarily ceased to message b
Processing, the above-mentioned response message of priority treatment, handled and be further continued for after above-mentioned response message completing the processing to message b.
A kind of inter-process communication methods provided in an embodiment of the present invention, the first process have often been handled in a message queue
After pending message, it can also include:
First process judges whether the pending message in message queue is disposed, if so, then sending what processing was completed
Prompting.
After the message that the first process has been handled in its corresponding message queue, judge to wait to locate in the message queue
Whether the message of reason is all disposed, if be all disposed, the prompting that processing is completed can be sent, due to for some work(
Multiple processes may be needed to complete for energy, relevant staff can know the substantially progress of the function by the prompting.
The embodiment of the present invention additionally provides a kind of interprocess communication system, as shown in Fig. 2 can include:
First process 11, is used for:Communication information is sent to the second process;After sending communication information, continue with and disappear
The pending message in queue is ceased, message queue includes the message that the first process need to be handled;In message queue is continued with
During pending message, if receiving the response message to communication information of the second process transmission, response message is entered
Row respective handling;
Second process 12, is used for:Receive the communication information of the first process transmission;It is backward that respective handling is carried out to communication information
First process sends the response message of communication information.
Interprocess communication device provided in an embodiment of the present invention, the first process can include:
Processing unit, it is used for:Call the readjustment processing function processing response message pre-set.
Interprocess communication device provided in an embodiment of the present invention, the first process can also include:
Judging unit, it is used for:When the first process receive the transmission of the second process to the response message of communication information after, sentence
Whether disconnected first process is handling any pending message in message queue, if so, then waiting at the pending message
After the completion of reason, control process unit performs the step of calling the readjustment processing function processing response message pre-set, if it is not, then
Control process unit, which performs, calls the readjustment pre-set to handle the step of function is to handle response message.
Interprocess communication device provided in an embodiment of the present invention, can also include:
Suggestion device, it is used for:After first process has often handled the pending message in a message queue, message team is judged
Whether the pending message in row is disposed, if so, then sending the prompting that processing is completed.
The explanation of relevant portion refers to implementation of the present invention in a kind of interprocess communication device provided in an embodiment of the present invention
A kind of detailed description for inter-process communication methods corresponding part that example provides, will not be repeated here.In addition, on disclosed by the invention
Part consistent with corresponding to technical scheme realization principle in the prior art in technical scheme and unspecified is stated, so as not to it is excessive superfluous
State.
The foregoing description of the disclosed embodiments, those skilled in the art are enable to realize or using the present invention.To this
A variety of modifications of a little embodiments will be apparent for a person skilled in the art, and generic principles defined herein can
Without departing from the spirit or scope of the present invention, to realize in other embodiments.Therefore, the present invention will not be limited
The embodiments shown herein is formed on, and is to fit to consistent with principles disclosed herein and features of novelty most wide
Scope.
Claims (8)
- A kind of 1. inter-process communication methods, it is characterised in that including:First process sends communication information to the second process;After sending the communication information, first process continues with the pending message in message queue, described to disappear Breath queue includes the message that first process need to be handled;During the pending message during first process continues with the message queue, if first process connects The response message to the communication information that second process is sent is received, then respective handling is carried out to the response message.
- 2. according to the method for claim 1, it is characterised in that respective handling is carried out to the response message, including:First process calls the readjustment processing function pre-set to handle the response message.
- 3. according to the method for claim 2, it is characterised in that sent when first process receives second process The response message to the communication information after, in addition to:First process judges itself whether handling any pending message in the message queue, if so, then etc. Treat that the readjustment processing function processing response message called and pre-set will be performed after the completion of the pending Message Processing The step of, if it is not, then performing the readjustment that the calling is pre-set handles the step of function is to handle the response message.
- 4. according to the method described in claim any one of 1-3, it is characterised in that first process has often been handled described in one After pending message in message queue, in addition to:First process judges whether the pending message in the message queue is disposed, and has been handled if so, then sending Into prompting.
- A kind of 5. interprocess communication system, it is characterised in that including:First process, is used for:Communication information is sent to the second process;After sending the communication information, message is continued with Pending message in queue, the message queue include the message that first process need to be handled;Continuing with described disappear During ceasing the pending message in queue, disappear if receiving the response to the communication information that second process is sent Breath, then respective handling is carried out to the response message;Second process, is used for:Receive the communication information that first process is sent;Corresponding position is carried out to the communication information The response message of the communication information is sent after reason to first process.
- 6. system according to claim 5, it is characterised in that first process includes:Processing unit, it is used for:The readjustment processing function pre-set is called to handle the response message.
- 7. system according to claim 6, it is characterised in that first process also includes:Judging unit, it is used for:When first process receive that second process sends to described in the communication information After response message, judge whether first process is handling any pending message in the message queue, if so, then Waiting after the completion of the pending Message Processing, will control the processing unit to perform the readjustment processing letter for calling and pre-setting Number handles the step of response message, if it is not, then controlling the processing unit to perform at the readjustment for calling and pre-setting Manage the step of function handles the response message.
- 8. according to the system described in claim any one of 5-7, it is characterised in that also include:Suggestion device, it is used for:After first process has often handled the pending message in a message queue, institute is judged Whether the pending message stated in message queue is disposed, if so, then sending the prompting that processing is completed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710889866.6A CN107656827A (en) | 2017-09-27 | 2017-09-27 | A kind of inter-process communication methods and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710889866.6A CN107656827A (en) | 2017-09-27 | 2017-09-27 | A kind of inter-process communication methods and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107656827A true CN107656827A (en) | 2018-02-02 |
Family
ID=61115982
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710889866.6A Pending CN107656827A (en) | 2017-09-27 | 2017-09-27 | A kind of inter-process communication methods and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107656827A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000056997A (en) * | 1998-08-10 | 2000-02-25 | Nec Software Ltd | Asynchronous notice device and its method between server/client in distributed object environment |
CN101674326A (en) * | 2009-09-21 | 2010-03-17 | 中兴通讯股份有限公司 | Method for realizing interprocess synchronization communication and agent unit |
CN104679598A (en) * | 2013-12-27 | 2015-06-03 | 卡巴斯基实验室封闭式股份公司 | System and method for selecting a synchronous or asynchronous interprocess communication mechanism |
-
2017
- 2017-09-27 CN CN201710889866.6A patent/CN107656827A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000056997A (en) * | 1998-08-10 | 2000-02-25 | Nec Software Ltd | Asynchronous notice device and its method between server/client in distributed object environment |
CN101674326A (en) * | 2009-09-21 | 2010-03-17 | 中兴通讯股份有限公司 | Method for realizing interprocess synchronization communication and agent unit |
CN104679598A (en) * | 2013-12-27 | 2015-06-03 | 卡巴斯基实验室封闭式股份公司 | System and method for selecting a synchronous or asynchronous interprocess communication mechanism |
Non-Patent Citations (1)
Title |
---|
刘鹏远: "异步消息机制原理挖掘与应用范畴分析", 《计算机系统应用》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105656808B (en) | Message processing method and its system | |
CN106161480A (en) | SMS platform service scheduling method based on gateway resource pond | |
CN106909467A (en) | A kind of distributed transaction processing method based on micro services framework | |
EP1058444A3 (en) | Dynamically allocating server resources to competing classes of work based upon achievement of service goals | |
JP2005518693A5 (en) | ||
CN105471722B (en) | Message treatment method and device | |
CN104602199B (en) | PTT realization method and systems in a kind of public network colony dispatching | |
US9392034B2 (en) | Systems and methods of distributed silo signaling | |
EP4027749A1 (en) | Methods and apparatuses for call termination | |
CN107861897A (en) | One kind is interrupted and poll triggering method, system, equipment and computer-readable storage medium | |
CN101311902A (en) | State machine system associating with multi-instance and its realization method | |
CN107656827A (en) | A kind of inter-process communication methods and system | |
CN105024904A (en) | Message sending processing method | |
CN210271039U (en) | Hospital outpatient service number calling system | |
CN103856639B (en) | Callback reservation cancellation method, related equipment and system | |
CN108735278A (en) | A kind of transmission method of instruction suitable for rehabilitation equipment and application | |
CN104010058B (en) | Automatic calling method and device | |
EP2381666B1 (en) | Method, system and apparatus for handling a call received at a mobile communication device | |
WO2003028351A3 (en) | Method and system for controlling services during call establishment | |
JPH0454797A (en) | Outgoing incoming service separation system | |
CN101383878B (en) | Queuing method for coordinating connection attempt to server | |
CN105162634B (en) | The processing method of OAM protocol packages is received and dispatched in same thread | |
CN114852807B (en) | Robot ladder calling method and related equipment | |
CN107770620A (en) | Request information response method, system and readable storage medium | |
CN113741403B (en) | Vehicle diagnosis method, diagnosis apparatus, and computer-readable storage medium |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180202 |
|
RJ01 | Rejection of invention patent application after publication |