CN109144741A - The method, apparatus and electronic equipment of interprocess communication - Google Patents

The method, apparatus and electronic equipment of interprocess communication Download PDF

Info

Publication number
CN109144741A
CN109144741A CN201710445871.8A CN201710445871A CN109144741A CN 109144741 A CN109144741 A CN 109144741A CN 201710445871 A CN201710445871 A CN 201710445871A CN 109144741 A CN109144741 A CN 109144741A
Authority
CN
China
Prior art keywords
subprocess
host process
mode
communication
waiting task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710445871.8A
Other languages
Chinese (zh)
Inventor
陈方晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Guangdong Shenma Search Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Shenma Search Technology Co Ltd filed Critical Guangdong Shenma Search Technology Co Ltd
Priority to CN201710445871.8A priority Critical patent/CN109144741A/en
Publication of CN109144741A publication Critical patent/CN109144741A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the present invention provides the method, apparatus and electronic equipment of a kind of interprocess communication, the described method includes: host process is according to configuration file, create corresponding each subprocess, wherein, including the number of subprocess, the host process communication mode between each subprocess and the corresponding business logic processing mode of each subprocess respectively in the configuration file;The host process realizes the communication between each subprocess according to the communication mode between each subprocess.The method provides the universal method of a set of interprocess communication, so that business logic processing mode is no longer coupled with the communication between process, realizing only need to modify configuration file the access of subprocess can be realized, no longer need to the complicated multi-process programming of concern, also more business scenarios are able to achieve, and reduce the expense of system.

Description

The method, apparatus and electronic equipment of interprocess communication
Technical field
The present invention relates to fields of communication technology, set in particular to the method, apparatus and electronics of a kind of interprocess communication It is standby.
Background technique
Process, in simple terms an exactly program being currently running, all systems occupied in the program including this operation System resource, such as CPU (register), IO, memory, Internet resources etc..Many scenes in routine work are according to one process Treatment effeciency can be extremely low, for example, the scenes such as queue consumption, Email, log processing, short message.Therefore multi-process is generallyd use To handle the business in above-mentioned scene.Currently, the method for multiprocess communication is coupled with business logic processing code level mostly, Under this mode, for different business logic codes, the method that requires to design a set of interprocess communication exclusively for it.
Summary of the invention
In view of this, the method, apparatus for being designed to provide a kind of interprocess communication and electronics of the embodiment of the present invention are set It is standby, to solve the above problems.
To achieve the goals above, technical solution used in the embodiment of the present invention is as follows: in a first aspect, the embodiment of the present invention Provide a kind of method of interprocess communication, which comprises host process according to configuration file, create corresponding each height into Journey, wherein number, the host process communication between each subprocess respectively in the configuration file including subprocess Mode and the corresponding business logic processing mode of each subprocess;The host process is according between each subprocess Communication mode, realize and each subprocess between communication.
Second aspect, the embodiment of the invention provides a kind of device of interprocess communication, described device includes: creation mould Block, for creating corresponding each subprocess according to configuration file, wherein number in the configuration file including subprocess, The host process communication mode between each subprocess and the corresponding business logic processing side of each subprocess respectively Formula;Communication module is realized logical between each subprocess for basis and the communication mode between each subprocess Letter.
The third aspect, the embodiment of the invention provides a kind of electronic equipment, the electronic equipment includes memory and processing Device, the memory are couple to the processor, the memory store instruction, when executed by the processor So that the processor executes following operation: host process creates corresponding each subprocess, wherein described according to configuration file Including the number of subprocess, the host process communication mode between each subprocess and each respectively in configuration file The corresponding business logic processing mode of the subprocess;The host process according to the communication mode between each subprocess, Realize the communication between each subprocess.
Compared with prior art, the method, apparatus and electronic equipment of a kind of interprocess communication provided in an embodiment of the present invention, By host process according to configuration file, corresponding each subprocess is created, wherein include the number of subprocess in the configuration file Mesh, the host process communication mode between each subprocess and the corresponding service logic of each subprocess respectively Processing mode, and according to the communication mode between each subprocess, realize the communication between each subprocess, we Case provides the universal method of a set of interprocess communication, so that business logic processing mode is no longer coupled with the communication between process, Realizing only need to modify configuration file the access of subprocess can be realized, and no longer need to the complicated multi-process programming of concern, also can be real Now more business scenarios, and reduce the expense of system.
To enable the above objects, features and advantages of the present invention to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate Appended attached drawing, is described in detail below.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached Figure is briefly described, it should be understood that the following drawings illustrates only certain embodiments of the present invention, therefore is not construed as pair The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this A little attached drawings obtain other relevant attached drawings.
Fig. 1 is the structural block diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Fig. 2 is a kind of schematic diagram of multi-process manager provided in an embodiment of the present invention.
Fig. 3 is a kind of flow chart of the method for interprocess communication that first embodiment of the invention provides.
Fig. 4 is that a kind of host process that first embodiment of the invention provides is shown with subprocess by the principle that pipe method communicates It is intended to.
Fig. 5 is the original that a kind of host process that first embodiment of the invention provides is communicated with subprocess by message queue mode Manage schematic diagram.
Fig. 6 is a kind of flow chart of the method for interprocess communication that second embodiment of the invention provides.
Fig. 7 is a kind of structural block diagram of the device for interprocess communication that third embodiment of the invention provides.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present invention, technical solution in the embodiment of the present invention carries out clear, complete Ground description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Usually exist The component of the embodiment of the present invention described and illustrated in attached drawing can be arranged and be designed with a variety of different configurations herein.Cause This, is not intended to limit claimed invention to the detailed description of the embodiment of the present invention provided in the accompanying drawings below Range, but it is merely representative of selected embodiment of the invention.Based on the embodiment of the present invention, those skilled in the art are not doing Every other embodiment obtained under the premise of creative work out, shall fall within the protection scope of the present invention.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile of the invention In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
The method of interprocess communication provided in an embodiment of the present invention can be run in electronic equipment 100 shown in FIG. 1.Institute Stating electronic equipment 100 can be user terminal or server.Further, the server can be network server, number According to library server etc..The user terminal can be PC (personal computer, PC), tablet computer, intelligent hand Machine, personal digital assistant (personal digital assistant, PDA), mobile unit, wearable device etc..
As shown in Figure 1, being the block diagram of electronic equipment 100.The electronic equipment 100 includes memory 101, processing Device 102 and network module 103.
Memory 101 can be used for storing software program and module, such as the side of the interprocess communication in the embodiment of the present invention Method and the corresponding program instruction/module of device, processor 102 by the software program that is stored in memory 101 of operation and Module, thereby executing various function application and data processing, the i.e. method of interprocess communication in the realization embodiment of the present invention. Memory 101 may include high speed random access memory, may also include nonvolatile memory, as one or more magnetic storage fills It sets, flash memory or other non-volatile solid state memories.Further, the software program and module in above-mentioned memory 101 It may also include that operating system 121 and service module 122.Wherein operating system 121, may be, for example, LINUX, UNIX, WINDOWS may include various for management system task (such as memory management, storage equipment control, power management etc.) Component software and/or driving, and can mutually be communicated with various hardware or component software, to provide the operation of other software component Environment.Service module 122 operates on the basis of operating system 121, and is come from by the network service of operating system 121 monitoring The request of network completes corresponding data processing according to request, and returns to processing result to client.That is, service mould Block 122 is used to provide network service to client.
Network module 103 is for receiving and transmitting network signal.Above-mentioned network signal may include wireless signal or have Line signal.
It is appreciated that structure shown in FIG. 1 is only to illustrate, the electronic equipment 100 may also include more than shown in Fig. 1 Perhaps less component or with the configuration different from shown in Fig. 1.Each component shown in Fig. 1 can use hardware, software Or combinations thereof realize.
Referring to Fig. 2, Fig. 2 shows a kind of schematic diagrames of multi-process manager of the embodiment of the present invention.The embodiment of the present invention The method and device of the interprocess communication of offer can be run in the multi-process manager.As shown in Fig. 2, the multi-process management The entry program of device is responsible for receiving configuration file and executes order.It wherein, include number, the host process of subprocess in configuration file Communication mode between each subprocess and the corresponding business logic processing mode of each subprocess respectively.The entry program will The configuration file and execution order are sent to host process, and host process parses the execution order, if execution order is initiation command, Host process creates corresponding each subprocess according to configuration file.After each subprocess creation, when entry program receives When waiting task, send host process for waiting task, host process according to the communication mode between each subprocess, Realize the communication between each subprocess, subprocess adjusts back corresponding business logic processing mode and handles waiting task.
The access of the interprocess communication realized under this mode, subprocess is very simple, it is only necessary to modify configuration file i.e. Can, the complicated multi-process programming of concern is no longer needed to, and be also able to achieve more business scenarios, further due to service logic Processing mode is not coupled with multi-process management, therefore can reduce the expense of system.
It is retouched in more detail below in conjunction with method and device of the attached drawing to the interprocess communication in the embodiment of the present invention It states.
Fig. 3 shows a kind of flow chart of the method for interprocess communication of first embodiment of the invention offer, please refers to figure 3, the method for the interprocess communication is run in above-mentioned electronic equipment, this method comprises:
Step S210, host process create corresponding each subprocess, wherein in the configuration file according to configuration file Number, the host process including the subprocess communication mode between each subprocess and each subprocess respectively Corresponding business logic processing mode.
There are many kinds of the sources of the configuration file, for example, it may be being received by entry program and actively issuing host process; It can also be obtained from entry program with host process periodic polling entry program;Can also the configuration file be pre-stored in In some storage region, read from the storage region by host process.Certainly, it is not limited to aforesaid way, any master into The embodiment of the available configuration file of journey, shall fall within the protection scope of the present invention.
The quantity of the subprocess that the number for the subprocess for including in configuration file can create according to actual needs determines. For example, if currently three subprocess is needed to handle three waiting tasks, the number of the subprocess in configuration file at this time It can be set to 3.
Certainly, the ratio subprocess actually required more one that the number of configuration file sub-process also can be set A bit, so that host process is created that the subprocess of some redundancies, facilitates subsequent use according to the configuration file.
Communication mode between host process and subprocess includes but is not limited to: pipe method, message queue mode, common memory At least one of mode and aspect.It is of course also possible to obstructed between host process and subprocess being arranged in configuration file Letter.
For example, if indicating logical between host process and subprocess in configuration file with field communication modes Communication modes=1 can be set in letter mode, indicates that the communication mode between host process and subprocess is pipeline side Formula;Communication modes=2 is set, indicates that the communication mode between host process and subprocess is message queue mode;If Communication modes=3 is set, indicates that the communication mode between host process and subprocess is common memory mode;Setting Communication modes=4 indicates that the communication mode between host process and subprocess is aspect;Setting Communication modes=0, indicate host process between subprocess between do not communicate.By reading word in the configuration file Section communication modes determines the communication mode between host process and subprocess.
Further, if host process creates multiple subprocess, the communication mode between host process and each subprocess can With identical, for example, the communication mode and host process of host process and subprocess 1 and the communication mode of subprocess 2 can be pipeline Mode.
Certainly, the communication mode between host process and each subprocess can also be different.For example, host process host process and son into The communication mode of journey 1 is pipe method, and the communication mode of host process and subprocess 2 is then message queue mode.
The corresponding business logic processing mode of each subprocess in configuration file can be the API provided by business side (Application Programming Interface, application programming interface), subprocess can be by adjusting back by business The API that just provides handles waiting task.
It is different there are many host process is also possible to according to the embodiment that configuration file creates corresponding each subprocess Platform can have the embodiment of different creation subprocess, and different programming languages also has the implementation of different creation subprocess Mode.Any host process belongs to protection model of the invention according to the embodiment that configuration file creates corresponding each subprocess It encloses.
As a kind of specific embodiment, host process can call fork function to create subprocess.According to configuration text The number of part sub-process, the parameter of fork function is arranged, successively come determine creation subprocess number.
As another specific embodiment, if host process creates the mistake of corresponding each subprocess according to configuration file Journey is write using PHP programming language, then host process can call pcntl_fork () function to create subprocess, specifically Implementation details are not described herein again.
A specific example is named step S210 to be described in detail.
Assuming that configuration file includes:
(1) number of subprocess: 3.
(2) communication mode of host process and subprocess 1 are as follows: mode 1;The communication mode of host process and subprocess 2 are as follows: mode 2;The communication mode of host process and subprocess 3 are as follows: mode 3.
(3) the corresponding business logic processing mode of subprocess 1 are as follows: business logic processing mode 1;The corresponding industry of subprocess 2 Business logical process mode are as follows: business logic processing mode 2;The corresponding business logic processing mode of subprocess 3 are as follows: at service logic Reason mode 3.
After host process receives the configuration file, create corresponding 3 subprocess, and be arranged its respectively with 3 subprocess Between the corresponding business logic processing mode of communication mode and each subprocess.
Step S220, host process are realized and each subprocess according to the communication mode between each subprocess Between communication.
As an implementation, host process receives waiting task, respectively basis and the communication party between each subprocess The waiting task is sent each subprocess by formula, so that each subprocess receives described to be processed It is engaged in and the corresponding business logic processing mode of each subprocess is called to be handled.
Continue to be illustrated with above-mentioned example, if host process reception waiting task 1, waiting task 2 and to be processed Business 3.Waiting task 1 is sent to subprocess 1 and handles host process by pass-through mode 1 respectively, and pass-through mode 2 is by waiting task 2 It is sent to the processing of subprocess 2, waiting task 3 is sent to subprocess 3 and handled by pass-through mode 3.Subprocess 1 adjusts back corresponding industry Logical process mode 1 of being engaged in handles waiting task 1, and subprocess 2 adjusts back corresponding business logic processing mode 2 and handles to be processed Business 2, subprocess 3 adjusts back corresponding business logic processing mode 3 and handles waiting task 3, when each subprocess is disposed, Whole process terminates.
Step S220 is illustrated with two kinds of specific embodiments below.
As a kind of specific embodiment, if the communication mode of the host process and the subprocess is pipe method, The corresponding data of the waiting task are written into pipeline for host process, and subprocess reads described to be processed from the pipeline It is engaged in corresponding data, and the corresponding business logic processing mode of the subprocess is called to handle the corresponding number of the waiting task According to.
Wherein, the corresponding data of the waiting task may is that the number order for including in waiting task, and executing should Business datum needed for waiting task, parameter or metadata etc..
It calls pipe () function to create a pipeline in kernel referring to Fig. 4, host process can first pass through, works as host process When receiving waiting task, toward the corresponding data of the tail portion of pipeline write-in waiting task, head of the subprogram from the pipeline Portion reads the corresponding data of the waiting task, and call the corresponding business logic processing mode of the subprocess handle it is described to The corresponding data of processing task.If in the process, subprocess exits extremely, then the subprocess can be hung up by host process.
As another specific embodiment, if the communication mode of the host process and the subprocess is message queue The corresponding message of the waiting task is written into message queue for mode, the host process so that the subprocess successively from The corresponding message of the waiting task is read in the message queue, and calls the corresponding business logic processing of the subprocess Mode handles the message read, until the corresponding message of all waiting tasks in the message queue is all handled It finishes.
Wherein, the corresponding message of the waiting task may is that is parsed and generated by waiting task some disappears Breath, the corresponding message of each waiting task can have a specific type of message, and subprocess is according to the waiting task pair of reading The type of message and content answered call the corresponding business logic processing mode of subprocess to handle.
Referring to Fig. 5, host process can call msgget function to create a message queue in kernel in advance.When it is main into When journey receives waiting task, the corresponding message of 3 waiting tasks is generated according to the waiting task.Host process is called The corresponding message of 3 waiting tasks is written into the message queue for msgsnd function, it is assumed that the sequence of write-in is message 3, disappears Cease 2, message 1.
Subprocess can be corresponding by calling msgrcv function successively to read 3 waiting tasks from the message queue Message, the sequence of reading may is that message 3, message 2, message 1.
Certainly, the sequence for reading the corresponding message of waiting task can not also be according to the sequence of write-in, can be according to finger Fixed sequence is read out, for example, according to: message 1, message 2, the sequence of message 3 are read;Can also be according to: message 1 disappears The sequence of 3, message 2 is ceased to read.
The corresponding message of subprocess one waiting task of every reading, calls its corresponding business logic processing mode to carry out Processing.After this 3 message in message queue are all disposed, subprocess terminates.If in the process, subprocess moves back extremely Out, then the subprocess can be hung up by host process.
Further, described if not communicated between the host process and the subprocess as another specific embodiment Method further include: the subprocess calls corresponding business logic processing mode to handle the waiting task.
Specifically, if host process is configured between host process and subprocess not communicate from what is read in configuration file, when When receiving waiting task, host process only need to send subprocess for waiting task, be called by subprocess corresponding Business logic processing mode has handled waiting task.If waiting task is multiple, subprocess recursive call correspondence Business logic processing mode handle multiple waiting tasks respectively.
As a kind of specific embodiment, host process and subprocess in the present embodiment be all made of PHP programming language into Journey programming can further save memory, and reduce the expense of system since its bottom layer realization code is C language.
The method of interprocess communication provided in an embodiment of the present invention creates corresponding by host process according to configuration file Each subprocess, wherein in the configuration file including the number of subprocess, the host process respectively with each subprocess Between communication mode and the corresponding business logic processing mode of each subprocess, and according between each subprocess Communication mode, realize the communication between each subprocess, present solution provides the universal method of a set of interprocess communication, So that business logic processing mode is no longer coupled with the communication between process, realize need to only modify configuration file can be realized son into The access of journey no longer needs to the complicated multi-process programming of concern, is also able to achieve more business scenarios, and reduce opening for system Pin.
Fig. 6 shows a kind of flow chart of the method for interprocess communication of second embodiment of the invention offer, please refers to figure 6, the method for the interprocess communication is run in above-mentioned electronic equipment, this method comprises:
Step S310, the acquired exectorial type of host process judgement.
It obtains there are many exectorial modes, for example, host process periodically can ask whether to hold to entry program Line command, if so, then actively getting the execution order from entry program;External transmission can also be received by entry program Execution order when, active transmission is to host process.Host process is by parsing the execution order, to determine the operation of next step.
Wherein, exectorial type includes but is not limited to cease and desist order, cease and desist order and reset command.
If the execution order executes step S320 to cease and desist order;If the execution order is reset command, step is executed Rapid S330;If the execution order executes step S340 to cease and desist order.
Step S320, the host process exit, and each subprocess has executed currently pending task backed off after random.
After each subprocess has executed currently pending task backed off after random, entire EP (end of program).
Step S330, the host process execute described in cease and desist order after corresponding operation, it is corresponding to execute the initiation command Operation.
Specifically, being that host process exits first, each subprocess has executed currently if execution order is reset command Waiting task backed off after random.After each subprocess has executed currently pending task backed off after random, in order to which the host process can be resided From the background, using host process as finger daemon, host process creates corresponding each subprocess according to configuration file, and according to it is each Communication mode between a subprocess realizes the communication between each subprocess.
Step S340, host process create corresponding each subprocess, wherein in the configuration file according to configuration file Number, the host process including the subprocess communication mode between each subprocess and each subprocess respectively Corresponding business logic processing mode.
Step S350, the host process are realized and each son according to the communication mode between each subprocess Communication between process.
After it is initiation command that host process, which parses the execution order, using host process as finger daemon, B simultaneously executes step S340 to step S350.Wherein, the step S210 in the embodiment of step S340 to step S350 and a upper embodiment is extremely walked The embodiment of rapid S220 is identical, and details are not described herein again.
The method of interprocess communication provided in an embodiment of the present invention creates corresponding by host process according to configuration file Each subprocess, wherein in the configuration file including the number of subprocess, the host process respectively with each subprocess Between communication mode and the corresponding business logic processing mode of each subprocess, and according between each subprocess Communication mode, realize the communication between each subprocess, present solution provides the universal method of a set of interprocess communication, So that business logic processing mode is no longer coupled with the communication between process, realize need to only modify configuration file can be realized son into The access of journey no longer needs to the complicated multi-process programming of concern, is also able to achieve more business scenarios, and reduce opening for system Pin.
Referring to Fig. 7, being the functional module signal of the device 400 for the interprocess communication that third embodiment of the invention provides Figure.The device 400 of the interprocess communication includes creation module 410, communication module 420.
Creation module 410, for creating corresponding each subprocess, wherein in the configuration file according to configuration file The communication mode between each subprocess and each subprocess are corresponding respectively for number, host process including subprocess Business logic processing mode.
Communication module 420 is realized and each subprocess for basis and the communication mode between each subprocess Between communication.
As an implementation, described device further includes receiving module 430, the receiving module 430 for receive to Processing task;The communication module 420 will be described specifically for basis respectively and the communication mode between each subprocess Waiting task is sent to each subprocess, so that each subprocess receives the waiting task and calls each The corresponding business logic processing mode of a subprocess is handled.
As an implementation, the communication mode include: pipe method, message queue mode, common memory mode, And at least one of aspect.
As an implementation, described logical if the communication mode of the host process and the subprocess is pipe method Module 420 is believed, specifically for the corresponding data of the waiting task are written into pipeline, so that the subprocess is from described The corresponding data of the waiting task are read in pipeline, and the corresponding business logic processing mode of the subprocess is called to handle The corresponding data of the waiting task.
As an implementation, if the communication mode of the host process and the subprocess is message queue mode, institute Communication module 420 is stated, specifically for the corresponding message of the waiting task is written into message queue, so that the subprocess The corresponding message of the waiting task is successively read from the message queue, and the corresponding business of the subprocess is called to patrol Volume processing mode handles the message read, until the corresponding message of all waiting tasks in the message queue is complete Portion is disposed.
As an implementation, if not communicating between the host process and the subprocess, described device includes processing mould Block 440 calls corresponding business logic processing mode to handle the waiting task for the subprocess.
As an implementation, described device further includes obtaining module 450, executes order for obtaining;The creation Module 410, specifically for the acquired exectorial type of host process judgement;If the execution order is to start to order It enables, the host process creates corresponding each subprocess according to configuration file.
As an implementation, described device further includes exiting module 460, acquired in judging in the host process Exectorial type after, if execution order is ceases and desist order, the host process is exited, and each subprocess is held Currently pending task backed off after random is gone.
As an implementation, described device further includes restarting module 470, acquired in judging in the host process Exectorial type after, if execution order is reset command, the host process execute described in cease and desist order correspondence Operation after, execute the corresponding operation of the initiation command.
Above each module can be by software code realization, at this point, above-mentioned each module can be stored in depositing for electronic equipment In reservoir 101.Above each module can equally be realized by hardware such as IC chip.
Fourth embodiment of the invention provides a kind of electronic equipment, and the electronic equipment includes memory and processor, institute State memory and be couple to the processor, the memory store instruction, when executed by the processor so that The processor executes following operation:
Host process creates corresponding each subprocess according to configuration file, wherein includes subprocess in the configuration file Number, the host process communication mode between each subprocess and the corresponding business of each subprocess respectively Logical process mode;
The host process is realized logical between each subprocess according to the communication mode between each subprocess Letter.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
The technical effect of the device of interprocess communication provided by the embodiment of the present invention, realization principle and generation and aforementioned Embodiment of the method is identical, and to briefly describe, Installation practice part does not refer to place, can refer to corresponding in preceding method embodiment Content.
In several embodiments provided herein, it should be understood that disclosed device and method can also pass through Other modes are realized.The apparatus embodiments described above are merely exemplary, for example, flow chart and block diagram in attached drawing Show the device of multiple embodiments according to the present invention, the architectural framework in the cards of method and computer program product, Function and operation.In this regard, each box in flowchart or block diagram can represent the one of a module, section or code Part, a part of the module, section or code, which includes that one or more is for implementing the specified logical function, to be held Row instruction.It should also be noted that function marked in the box can also be to be different from some implementations as replacement The sequence marked in attached drawing occurs.For example, two continuous boxes can actually be basically executed in parallel, they are sometimes It can execute in the opposite order, this depends on the function involved.It is also noted that every in block diagram and or flow chart The combination of box in a box and block diagram and or flow chart can use the dedicated base for executing defined function or movement It realizes, or can realize using a combination of dedicated hardware and computer instructions in the system of hardware.
In addition, each functional module in each embodiment of the present invention can integrate one independent portion of formation together Point, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function module It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention. And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access The various media that can store program code such as memory (RAM, Random Access Memory), magnetic or disk.It needs It is noted that herein, such as first and the relational terms of third or the like be used merely to an entity or operation It is distinguished with another entity or operation, without necessarily requiring or implying between these entities or operation, there are any this Actual relationship or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to nonexcludability It include so that the process, method, article or equipment for including a series of elements not only includes those elements, but also to wrap Include other elements that are not explicitly listed, or further include for this process, method, article or equipment intrinsic want Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want There is also other identical elements in the process, method, article or equipment of element.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.It should also be noted that similar label and letter exist Similar terms are indicated in following attached drawing, therefore, once being defined in a certain Xiang Yi attached drawing, are then not required in subsequent attached drawing It is further defined and explained.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.

Claims (19)

1. a kind of method of interprocess communication, which is characterized in that the described method includes:
Host process creates corresponding each subprocess according to configuration file, wherein includes the number of subprocess in the configuration file Mesh, the host process communication mode between each subprocess and the corresponding service logic of each subprocess respectively Processing mode;
The host process realizes the communication between each subprocess according to the communication mode between each subprocess.
2. the method according to claim 1, wherein the method also includes: the host process receives to be processed Task;The host process realizes the communication between each subprocess according to the communication mode between each subprocess, Include: respectively according to and the communication mode between each subprocess, by the waiting task be sent to it is each it is described son into Journey, so that each subprocess receives the waiting task and calls at the corresponding service logic of each subprocess Reason mode is handled.
3. according to the method described in claim 2, it is characterized in that, the communication mode includes: pipe method, message queue side At least one of formula, common memory mode and aspect.
4. according to the method described in claim 3, it is characterized in that, if the host process and the communication mode of the subprocess are Pipe method, the basis respectively and the communication mode between each subprocess, send the waiting task to each The subprocess, so that each subprocess receives the pending data and uses the corresponding place of each subprocess Reason mode is handled, comprising:
The corresponding data of the waiting task are written into pipeline for the host process, so that the subprocess is from the pipeline Read the corresponding data of the waiting task, and call the corresponding business logic processing mode of the subprocess handle it is described to The corresponding data of processing task.
5. according to the method described in claim 3, it is characterized in that, if the host process and the communication mode of the subprocess are Message queue mode, the basis respectively and the communication mode between each subprocess, send the waiting task to Each subprocess, so that each subprocess is received the pending data and corresponded to using each subprocess Processing mode handled, comprising:
The corresponding message of the waiting task is written into message queue for the host process, so that the subprocess is successively from institute It states and reads the corresponding message of the waiting task in message queue, and call the corresponding business logic processing side of the subprocess The message that reads of formula processing, until the corresponding message of all waiting tasks in the message queue has all been handled Finish.
6. according to the method described in claim 2, it is characterized in that, if not communicated between the host process and the subprocess, institute State method further include:
The subprocess calls corresponding business logic processing mode to handle the waiting task.
7. the method according to claim 1, wherein the method also includes: acquisition execute order;The master into Journey creates corresponding each subprocess according to configuration file, comprising:
The acquired exectorial type of the host process judgement;
If the execution order is initiation command, the host process creates corresponding each subprocess according to configuration file.
8. the method according to the description of claim 7 is characterized in that the exectorial class acquired in host process judgement After type, the method also includes:
If the execution order is ceases and desist order, the host process is exited, and each subprocess has executed currently pending Business backed off after random.
9. according to the method described in claim 8, it is characterized in that, the exectorial class acquired in host process judgement After type, the method also includes:
If the execution order is reset command, after corresponding operation of ceasing and desisting order described in the host process execution, described in execution The corresponding operation of initiation command.
10. a kind of device of interprocess communication, which is characterized in that described device includes:
Creation module, for creating corresponding each subprocess according to configuration file, wherein include son in the configuration file The number of process, the host process communication mode between each subprocess and the corresponding business of each subprocess respectively Logical process mode;
Communication module is realized logical between each subprocess for basis and the communication mode between each subprocess Letter.
11. device according to claim 10, which is characterized in that described device further includes receiving module, the reception mould Block is for receiving waiting task;The communication module, specifically for basis respectively and the communication party between each subprocess The waiting task is sent each subprocess by formula, so that each subprocess receives described to be processed It is engaged in and the corresponding business logic processing mode of each subprocess is called to be handled.
12. device according to claim 11, which is characterized in that the communication mode includes: pipe method, message queue At least one of mode, common memory mode and aspect.
13. device according to claim 12, which is characterized in that if the communication mode of the host process and the subprocess For pipe method, the communication module, specifically for the corresponding data of the waiting task are written into pipeline, so that institute It states subprocess and reads the corresponding data of the waiting task from the pipeline, and the corresponding business of the subprocess is called to patrol It collects processing mode and handles the corresponding data of the waiting task.
14. device according to claim 12, which is characterized in that if the communication mode of the host process and the subprocess For message queue mode, the communication module, specifically for the corresponding message of the waiting task is written into message queue, So that the subprocess successively reads the corresponding message of the waiting task from the message queue, and call the son into The corresponding business logic processing mode of journey handles the message read, until all described to be processed in the message queue Corresponding message of being engaged in all is disposed.
15. device according to claim 11, which is characterized in that if not communicated between the host process and the subprocess, Described device includes processing module, calls corresponding business logic processing mode to handle described to be processed for the subprocess Business.
16. device according to claim 10, which is characterized in that described device further includes obtaining module, is held for obtaining Line command;The creation module, specifically for the acquired exectorial type of host process judgement;If described execute life Enabling is initiation command, and the host process creates corresponding each subprocess according to configuration file.
17. device according to claim 16, which is characterized in that described device further includes exiting module, for described After the acquired exectorial type of host process judgement, if execution order is ceases and desist order, the host process is exited, Each subprocess has executed currently pending task backed off after random.
18. device according to claim 17, which is characterized in that described device further includes restarting module, for described After the acquired exectorial type of host process judgement, if execution order is reset command, the host process is executed After the corresponding operation of ceasing and desisting order, the corresponding operation of the initiation command is executed.
19. a kind of electronic equipment, the electronic equipment includes memory and processor, and the memory is couple to the processing Device, the memory store instruction, when executed by the processor so that the processor executes following operation:
Host process creates corresponding each subprocess according to configuration file, wherein includes the number of subprocess in the configuration file Mesh, the host process communication mode between each subprocess and the corresponding service logic of each subprocess respectively Processing mode;
The host process realizes the communication between each subprocess according to the communication mode between each subprocess.
CN201710445871.8A 2017-06-13 2017-06-13 The method, apparatus and electronic equipment of interprocess communication Pending CN109144741A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710445871.8A CN109144741A (en) 2017-06-13 2017-06-13 The method, apparatus and electronic equipment of interprocess communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710445871.8A CN109144741A (en) 2017-06-13 2017-06-13 The method, apparatus and electronic equipment of interprocess communication

Publications (1)

Publication Number Publication Date
CN109144741A true CN109144741A (en) 2019-01-04

Family

ID=64829865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710445871.8A Pending CN109144741A (en) 2017-06-13 2017-06-13 The method, apparatus and electronic equipment of interprocess communication

Country Status (1)

Country Link
CN (1) CN109144741A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221928A (en) * 2019-06-11 2019-09-10 Oppo广东移动通信有限公司 Information recording method, device, terminal and storage medium
CN111124685A (en) * 2019-12-26 2020-05-08 神州数码医疗科技股份有限公司 Big data processing method and device, electronic equipment and storage medium
CN111209110A (en) * 2019-12-31 2020-05-29 浙江明度智控科技有限公司 Task scheduling management method, system and storage medium for realizing load balance
CN111400081A (en) * 2020-03-24 2020-07-10 恒生电子股份有限公司 Process guarding method and device, electronic equipment and computer storage medium
CN112346906A (en) * 2019-08-08 2021-02-09 丰鸟航空科技有限公司 Unmanned aerial vehicle daemon processing method, device, equipment and storage medium
CN113326139A (en) * 2021-06-28 2021-08-31 上海商汤科技开发有限公司 Task processing method, device, equipment and storage medium
CN113391909A (en) * 2021-06-28 2021-09-14 上海商汤科技开发有限公司 Process creation method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631664A (en) * 2013-12-09 2014-03-12 北京奇虎科技有限公司 Inter-process communication method and device
CN104317605A (en) * 2014-11-18 2015-01-28 东方网力科技股份有限公司 Assembly operation method and device
CN104796862A (en) * 2014-01-22 2015-07-22 歌乐株式会社 Connection device, program, and connection method
CN105337755A (en) * 2014-08-08 2016-02-17 阿里巴巴集团控股有限公司 Master-slave architecture server, service processing method thereof and service processing system thereof
CN105426231A (en) * 2014-09-04 2016-03-23 腾讯科技(深圳)有限公司 Multi-processing apparatus and multi-processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631664A (en) * 2013-12-09 2014-03-12 北京奇虎科技有限公司 Inter-process communication method and device
CN104796862A (en) * 2014-01-22 2015-07-22 歌乐株式会社 Connection device, program, and connection method
CN105337755A (en) * 2014-08-08 2016-02-17 阿里巴巴集团控股有限公司 Master-slave architecture server, service processing method thereof and service processing system thereof
CN105426231A (en) * 2014-09-04 2016-03-23 腾讯科技(深圳)有限公司 Multi-processing apparatus and multi-processing method
CN104317605A (en) * 2014-11-18 2015-01-28 东方网力科技股份有限公司 Assembly operation method and device

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221928A (en) * 2019-06-11 2019-09-10 Oppo广东移动通信有限公司 Information recording method, device, terminal and storage medium
CN110221928B (en) * 2019-06-11 2021-06-04 Oppo广东移动通信有限公司 Information recording method, information recording apparatus, terminal, and storage medium
CN112346906A (en) * 2019-08-08 2021-02-09 丰鸟航空科技有限公司 Unmanned aerial vehicle daemon processing method, device, equipment and storage medium
CN111124685A (en) * 2019-12-26 2020-05-08 神州数码医疗科技股份有限公司 Big data processing method and device, electronic equipment and storage medium
CN111209110A (en) * 2019-12-31 2020-05-29 浙江明度智控科技有限公司 Task scheduling management method, system and storage medium for realizing load balance
CN111209110B (en) * 2019-12-31 2023-10-10 明度智云(浙江)科技有限公司 Task scheduling management method, system and storage medium for realizing load balancing
CN111400081A (en) * 2020-03-24 2020-07-10 恒生电子股份有限公司 Process guarding method and device, electronic equipment and computer storage medium
CN113326139A (en) * 2021-06-28 2021-08-31 上海商汤科技开发有限公司 Task processing method, device, equipment and storage medium
CN113391909A (en) * 2021-06-28 2021-09-14 上海商汤科技开发有限公司 Process creation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109144741A (en) The method, apparatus and electronic equipment of interprocess communication
CN107885762B (en) Intelligent big data system, method and equipment for providing intelligent big data service
US10521393B2 (en) Remote direct memory access (RDMA) high performance producer-consumer message processing
US10157089B2 (en) Event queue management for embedded systems
US10693816B2 (en) Communication methods and systems, electronic devices, and computer clusters
CN107479990A (en) Distributed software service system
EP4113299A2 (en) Task processing method and device, and electronic device
US20070005530A1 (en) Selecting grid executors via a neural network
CN102541661A (en) Wait on address synchronization interface
CN112181619A (en) Scheduling method, device, equipment and medium for batch service
CN111752822A (en) Containerization pressure measurement scheduling method, computer equipment and readable storage medium
US7539992B2 (en) Scheduling method, program product for use in such method, and task scheduling apparatus
CN109561134B (en) Electronic device, distributed cluster service distribution method and storage medium
CN113190427B (en) Method and device for monitoring blocking, electronic equipment and storage medium
US10061676B2 (en) Remotely located timing method and device for a processing unit in an information processing system
CN116089477B (en) Distributed training method and system
CN110515749B (en) Method, device, server and storage medium for queue scheduling of information transmission
EP4394673A1 (en) Method and apparatus for controlling item inventory, and device and medium
WO2023071643A1 (en) Method and apparatus for processing task, electronic device, and medium
CN115981871A (en) GPU resource scheduling method, device, equipment and storage medium
CN109933444A (en) A kind of instant communication method between applying of lodging
CN114697398B (en) Data processing method, device, electronic equipment, storage medium and product
CN114168294B (en) Method and device for distributing compiling resources, electronic equipment and storage medium
US20200301608A1 (en) Controller event queues
CN113079152A (en) Data transmission method, device and 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
TA01 Transfer of patent application right

Effective date of registration: 20200529

Address after: 310051 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Alibaba (China) Co.,Ltd.

Address before: 510000 Guangdong city of Guangzhou province Whampoa Tianhe District Road No. 163 Xiping Yun Lu Yun Ping square B radio tower 13 layer self unit 01 (only for office use)

Applicant before: GUANGZHOU SHENMA MOBILE INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20190104

RJ01 Rejection of invention patent application after publication