CN110399229A - Communication means, device, system, medium and terminal between process - Google Patents
Communication means, device, system, medium and terminal between process Download PDFInfo
- Publication number
- CN110399229A CN110399229A CN201810380885.0A CN201810380885A CN110399229A CN 110399229 A CN110399229 A CN 110399229A CN 201810380885 A CN201810380885 A CN 201810380885A CN 110399229 A CN110399229 A CN 110399229A
- Authority
- CN
- China
- Prior art keywords
- section key
- message content
- shared section
- publishing side
- address
- 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
- 238000000034 method Methods 0.000 title claims abstract description 877
- 230000008569 process Effects 0.000 title claims abstract description 812
- 238000004891 communication Methods 0.000 title claims abstract description 121
- 230000005540 biological transmission Effects 0.000 claims abstract description 33
- 238000003860 storage Methods 0.000 claims description 58
- 239000004744 fabric Substances 0.000 claims description 10
- 238000012217 deletion Methods 0.000 claims description 8
- 230000037430 deletion Effects 0.000 claims description 8
- 230000001360 synchronised effect Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 5
- 230000002452 interceptive effect Effects 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 4
- 238000004590 computer program Methods 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 230000001815 facial effect Effects 0.000 description 3
- 230000002093 peripheral effect Effects 0.000 description 3
- 238000012935 Averaging Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 230000007812 deficiency Effects 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000012856 packing Methods 0.000 description 2
- 241001269238 Data Species 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 235000015170 shellfish Nutrition 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000026676 system process Effects 0.000 description 1
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
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the invention discloses communication means, device, medium, system and the terminals between a kind of process, wherein, this method comprises: receiving the socket connection request that subscription end process is sent, socket is established with the subscription end process according to the socket connection request and is connect;The target message content issued will be needed to be written to shared section key, and obtain address of the target message content in the shared section key;The address is transmitted to the subscription end process by the socket, so that the subscription end process reads the target message content according to the address from the shared section key, the resource overhead of operating system can be reduced, and reduce the propagation delay time of message content, the handling capacity for improving message content transmission, realizes the synchronization of message content.
Description
Technical field
The present invention relates to the communication means, logical between a kind of process between field of computer technology more particularly to a kind of process
Communication system, a kind of computer storage medium and a kind of terminal between T unit, a kind of process.
Background technique
Process is the basic unit that operating system carries out Resource Distribution and Schedule, and each process is owned by oneself independent money
Source needs to be communicated between process to make can mutually to access resource and co-ordination between process.Interprocess communication
(Interprocess Communications, IPC), which refers to, propagates between different processes or exchanges message.Practice discovery, mesh
There are message contents, and synchronization can not be realized between process for preceding inter-process communications schemes, needs to carry out frequency to operating system nucleus
Numerous access and the problems such as occupy a large amount of process resources, influence communication delay and handling capacity, therefore, how preferably to realize into
Communication becomes an important research topic between journey.
Summary of the invention
The technical problem to be solved by the embodiment of the invention is that communication means, device, Jie between providing a kind of process
Matter, system and terminal, can reduce the resource overhead of operating system, and reduce the propagation delay time of message content, improve message content
The handling capacity of transmission realizes the synchronization of message content.
On the one hand, the embodiment of the invention provides the communication means between a kind of process, this method comprises:
The socket connection request that subscription end process is sent is received, the socket connection request carries publishing side process
The mark of mark and the subscription end process;The mark of the publishing side process is by the subscription end process from the publishing side
It is obtained in the broadcast message that process is sent, or obtained from center process;
Socket is established with the subscription end process according to the socket connection request to connect;
The target message content issued will be needed to be written to shared section key, and obtain the target message content described
Address in shared section key;
The address is transmitted to the subscription end process by the socket, so that the subscription end process is according to institute
It states address and reads the target message content from the shared section key.
On the one hand, the embodiment of the invention provides the communication means between a kind of process, this method comprises:
Socket connection request is sent to publishing side process, foundation is connect with the socket of the publishing side process;It is described
Socket connection request carries the mark of the publishing side process and the mark of subscription end process;The mark of the publishing side process
It is to be obtained from the broadcast message that the publishing side process is sent, or it is obtained from center process;
The address that the publishing side process is sent by the socket is received, the address is that the publishing side process will
The target message content for needing the to issue target message content acquired after being written to shared section key is described shared interior
Deposit the address in area;
The target message content is read from the shared drive according to the address.
On the one hand, the embodiment of the invention provides the communication device between a kind of process, which includes:
Connection unit is asked for receiving the socket connection request of subscription end process transmission according to socket connection
It asks and establishes socket with the subscription end process and connect;The socket connection request carries the mark of publishing side process and described
The mark of subscription end process;The mark of the publishing side process is to be sent by the subscription end process from the publishing side process
It is obtained in broadcast message, or obtained from center process.
Writing unit, the target message content for that will need to issue is written to shared section key, and obtains the target
Address of the message content in the shared section key.
Transmission unit, for the address to be transmitted to the subscription end process by the socket, so that described order
It reads end process and reads the target message content from the shared section key according to the address.
On the one hand, the embodiment of the invention provides the communication device between a kind of process, which includes:
Connection unit establishes the set with the publishing side process for sending socket connection request to publishing side process
Connect word connection;The socket connection request carries the mark of the publishing side process and the mark of subscription end process;The hair
The mark of cloth end process is to obtain from the broadcast message that the publishing side process is sent, or obtained from center process
's.
Receiving unit, the address sent for receiving the publishing side process by the socket, the address is institute
Stating publishing side process will be in the target message that the target message content issued be needed acquired after being written to shared section key
Hold the address in the shared section key.
Reading unit, for reading the target message content from the shared drive according to the address.
On the one hand, the embodiment of the invention provides the communication system between a kind of process, which includes publishing side process, orders
Read end process and shared section key:
The publishing side process, the socket connection request sent for receiving the subscription end process, the socket
Connection request carries the mark of publishing side process and the mark of the subscription end process;The mark of the publishing side process is by institute
State what subscription end process was obtained from the broadcast message that the publishing side process is sent, or obtained from center process;Root
Socket is established with the subscription end process according to the socket connection request to connect;The target message content issued will be needed to write
Enter to shared section key, and obtains address of the target message content in the shared section key;The address is passed through
The socket is transmitted to the subscription end process.
The subscription end process, for publishing side process send socket connection request, establish with the publishing side into
The socket of journey connects;The address that the publishing side process is sent by the socket is received, according to the address from described
The target message content is read in shared drive.
The shared section key, for storing the target message content of the publishing side process write-in.
On the one hand, the embodiment of the invention provides a kind of computer storage mediums, which is characterized in that the computer storage
Media storage has one or one or more first instruction, and described one or one or more first instruction are suitable for by processor load simultaneously
Execute following method:
The socket connection request that subscription end process is sent is received, the socket connection request carries publishing side process
The mark of mark and the subscription end process;The mark of the publishing side process is by the subscription end process from the publishing side
It is obtained in the broadcast message that process is sent, or obtained from center process;
Socket is established with the subscription end process according to the socket connection request to connect;
The target message content issued will be needed to be written to shared section key, and obtain the target message content described
Address in shared section key;
The address is transmitted to the subscription end process by the socket so that at least one described subscription end into
Journey reads the target message content according to the address from the shared section key.
Alternatively, the computer storage medium be stored with one or one or more second instruction, described one or one with
Upper second instruction is suitable for being loaded by processor and executing following method:
Socket connection request is sent to publishing side process, foundation is connect with the socket of the publishing side process;It is described
Socket connection request carries the mark of the publishing side process and the mark of subscription end process;The mark of the publishing side process
It is to be obtained from the broadcast message that the publishing side process is sent by the subscription end process, or obtained from center process
's;
The address that the publishing side process is sent by the socket is received, the address is that the publishing side process will
The target message content for needing the to issue target message content acquired after being written to shared section key is described shared interior
Deposit the address in area;
The target message content is read from the shared drive according to the address.
On the one hand, the embodiment of the invention provides a kind of terminal, which includes: processor, is adapted for carrying out one or one
Above instructions;And computer storage medium, the computer storage medium are stored with one or one or more first finger
Enable, described one or one or more first instruction be suitable for loaded by processor and execute following method:
The socket connection request that subscription end process is sent is received, the socket connection request carries publishing side process
The mark of mark and the subscription end process;The mark of the publishing side process is by the subscription end process from the publishing side
It is obtained in the broadcast message that process is sent, or obtained from center process;
Socket is established with the subscription end process according to the socket connection request to connect;
The target message content issued will be needed to be written to shared section key, and obtain the target message content described
Address in shared section key;
The address is transmitted to the subscription end process by the socket so that at least one described subscription end into
Journey reads the target message content according to the address from the shared section key.
Alternatively, the computer storage medium be stored with one or one or more second instruction, described one or one with
Upper second instruction is suitable for being loaded by processor and executing following method:
Socket connection request is sent to publishing side process, foundation is connect with the socket of the publishing side process;It is described
Socket connection request carries the mark of the publishing side process and the mark of subscription end process;The mark of the publishing side process
It is to be obtained from the broadcast message that the publishing side process is sent by the subscription end process, or obtained from center process
's;
The address that the publishing side process is sent by the socket is received, the address is that the publishing side process will
The target message content for needing the to issue target message content acquired after being written to shared section key is described shared interior
Deposit the address in area;
The target message content is read from the shared drive according to the address.
In the embodiment of the present invention, publishing side process is established socket with subscription end process and is connect, the target that needs are issued
Message content is written to shared section key, and is sent to the target message content in the address of shared section key by socket
Subscription end process can be according to the address that publishing side process is sent from altogether when subscription end process needs to read the message content
It enjoys and reads the message content in memory field.As it can be seen that the embodiment of the present invention only needs to carry out message content in shared section key
Copy, without continually being copied in kernel and buffer area, reduces the copy number of message content, can reduce operation
The resource overhead of system, and the propagation delay time of message content is reduced, improve the handling capacity of message content transmission.And pass through socket
Message content is sent to subscription end process in the address of shared section key in real time, so that subscription end process can obtain in real time
The message content of publishing side process write-in is got, it can be achieved that the message content between subscription end process and publishing side process is synchronous.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the configuration diagram of the communication system between a kind of process provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of the communication means between a kind of process provided in an embodiment of the present invention;
Fig. 3 is the flow diagram of the communication means between another process provided in an embodiment of the present invention;
Fig. 4 is the flow diagram of the communication means between another process provided in an embodiment of the present invention;
Fig. 5 is the flow diagram of the communication means between another process provided in an embodiment of the present invention;
Fig. 6 is a kind of schematic diagram of shared section key provided in an embodiment of the present invention;
Fig. 7 is the flow diagram of the communication means between another process provided in an embodiment of the present invention;
Fig. 8 is the structural schematic diagram of the communication device between a kind of process provided in an embodiment of the present invention;
Fig. 9 is the structural schematic diagram of the communication device between another process provided in an embodiment of the present invention;
Figure 10 is a kind of structural schematic diagram of terminal provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Process is the primary operation activity of the program in computer;In other words, process is the entity of program, is to transport
The example of capable program;Such as: it is currently running instant messaging application program in terminal, has been opened then can view in the terminal
The process of the instant messaging application program moved and be currently running.Terminal can run multiple application programs simultaneously, therefore in terminal
The process of multiple application programs can be existed simultaneously;In some scenarios, there are communication requirement, examples between multiple processes in terminal
Such as: in terminal simultaneously operation have camera shooting process and face recognition process, then, in human bioequivalence scene, need image into
It is communicated between journey and face recognition process, provides the facial image taken by camera shooting process, obtained by face recognition process
The facial image is obtained to carry out recognition of face processing.In the embodiment of the present invention, publishing side process refers to be mentioned by giving out information
For the process of service, subscription end process refers to the process for subscribing to messaging service;In above-mentioned recognition of face scene, camera shooting process is made
For publishing side process, face recognition process is as subscription end process.Currently, the communication means between process is specifically included that based on set
Connect the inter-process communication methods, the inter-process communication methods based on message queue and the interprocess communication based on shared section key of word
Method below will briefly introduce several method:
(1) based on the inter-process communication methods of socket: the main advantage of the method is to may be implemented and network socket
Word interface is compatible with substantially, does not need to be concerned about other side's process and itself be in same computer between two processes communicated
In, or in the same network environment, and it is capable of providing unified software module communication interface.But there is also following deficiencies:
Firstly, socket communication is one-to-one, communication of the Yao Shixian M to N, then needs M × N to socket, occupy a large amount of system moneys
Source;Secondly, the inter-process communication methods based on socket need publishing side process to copy into message content to buffer area, then from
Buffer area copies into message content in kernel, subscription end process need message content from kernel by message content copy into
Then buffer area is copied out from buffer area by the message content, continually copy message content and do not only take up processor resource, also tight
Ghost image rings message transmission delay and message throughput of transmissions.
(2) based on the inter-process communication methods of message queue: compared to the inter-process communication methods based on socket, based on disappearing
Character stream communication may be implemented in the inter-process communication methods of breath queue, is able to maintain message boundaries.But lead between realization process
There is still a need for continually copied message content between buffer area-kernel-buffer area during letter.In addition, though disappearing
It ceases queue and supports multi-to-multi interprocess communication, but multiple subscription end processes actually need to fight for message content, i.e., one subscription
After end process reads certain message content, which cannot be read by other subscription end processes, therefore be not appropriate for disappearing
Cease the mode of content publication.
(3) based on the inter-process communication methods of shared section key: by providing an addressable shared drive of multi-process
Area is to realize the interprocess communication of multi-to-multi.The copy number that message content can be reduced, reduces the propagation delay time of message content.But
Based on the inter-process communication methods of shared section key, there is also deficiencies, essentially consist in shortage synchronization mechanism, i.e. publishing side process lacks
Weary effective ways notice subscription end process has new message content to be written to shared section key.
To sum up, the inter-process communication methods based on socket and the inter-process communication methods based on message queue have preferably
Synchronization mechanism, but message content needs continually copied in buffer area-kernel-buffer area, increase operating system
Resource overhead, and cause the propagation delay time of message content larger, reduce the handling capacity of message content transmission;And it is based on shared drive
In the inter-process communication methods in area although message content does not need to copy into kernel and buffer area, but is a lack of synchronization mechanism.
As it can be seen that various inter-process communication methods of above-mentioned single mode or there are the resource overhead of operating system is larger, message content
Propagation delay time it is higher, the problems such as message content throughput of transmissions is lower or there are problems that lacking synchronization mechanism.These are asked
The main reason for topic generates is caused by the variation of application scenarios.The interprocess communication of early stage more considers one-to-one logical
Believe (i.e. a publishing side process is to a subscription end process) demand, the message content of interaction is simply single between process;Therefore on
The inter-process communication methods for stating single mode are more suitable in the simple communication scene that early stage this complexity is low, handling capacity is low.
But with the promotion of software systems complexity, in the case where being isolated in the form of process between software module, produce it is more more
Complicated communication requirement requires the more more complicated message contents of interaction such as in One-to-one communication scene, or requires to realize
Many-many communication etc.;For example, robot system scene has multiple high-definition cameras, each high-definition camera shooting
Image data can be by multiple software modules pair such as recognition of face, human bioequivalence, gesture identification, gesture recognition, object identification
Acquired in the process answered;Each high-definition camera is a publishing side process, and the corresponding process of each software module is then
One subscription end process;The many-many communication of realization high-throughput is required under the robot system scene.Above-mentioned single mode
Various inter-process communications schemes can not be adapted to the communication scenes of this complexity, cannot achieve the communication field of high-throughput
Scape.
Based on this, the embodiment of the present invention provides the communication plan between a kind of process, specifically: it needs to send out in publishing side process
When cloth message content, publishing side process is established socket with subscription end process and is connect, and the target message content issued will be needed to write
Enter to shared section key, and by socket by the target message content the address of shared section key be sent to subscription end into
Journey can be according to the address that publishing side process is sent from shared section key when subscription end process needs to read the message content
Middle reading message content.As it can be seen that the embodiment of the present invention is flexibly compatible with the inter-process communication techniques of a variety of mainstreams, in shared
It deposits and realizes interprocess communication with the advantage of socket.Firstly, the storage of message content is carried out using shared section key, in this way,
Message content only needs to be copied in shared section key, without being copied in kernel and buffer area, reduces and disappears
The copy number for ceasing content, can reduce the resource overhead of operating system, and reduce the propagation delay time of message content;Secondly, publication
Socket connection is established between end process and subscription end process, publishing side process can pass through socket after the content that gives out information
Message content is shared to subscription end process in the address of shared section key in real time by word, in this way, subscription end process can be real-time
Ground gets the message content of publishing side process write-in, to realize in the message between subscription end process and publishing side process
Hold and synchronizes.In conclusion the embodiment of the present invention solves the problems of the inter-process communication methods of single mode, effectively subtract
The resource overhead for having lacked operating system promotes the propagation delay time and transmission throughput of message content, solves disappearing between process
Stationary problem is ceased, the communication scenes that complexity is high, handling capacity is high are more suitable for.
In the embodiment of the present invention, publishing side process refers to that the process for the content that gives out information, subscription end process refer to that reading disappears
Cease the process of content.Publishing side process and subscription end process be it is opposite, i.e., in some scenarios, same process both can be used as
Publishing side process gives out information content, can also be used as the message content that subscription end process reads the publication of other processes;Citing comes
It says, under the scene that recognition of face carries out terminal booting, firstly, camera shooting process publication image data (i.e. message content), face
Identification process reads the image data of camera shooting process publication, and carries out recognition of face according to image data, obtains recognition result;In
In this case, camera shooting process is as publishing side process, face recognition process is as subscription end process;Secondly, face recognition process
Recognition result is issued, booting process reads the recognition result and controlling terminal boots up.In the case, face recognition process
As publishing side process, the process that is switched on is as subscription end process.As it can be seen that face recognition process is both used as and orders in above-mentioned scene
End process is read, and as publishing side process.It should be noted that the same subscription end process can be ordered in the embodiment of the present invention
The message content that multiple publishing side processes are issued is read, the message content that the same publishing side process is issued can be ordered by multiple
End is read to subscribe to.
Based on foregoing description, the embodiment of the present invention provides the communication system between a kind of process, which can be set
It is placed in the operating system of terminal, terminal herein includes at least memory, display or processor.Referring to Figure 1, the communication
System includes at least one publishing side process and at least one subscription end process.Fig. 1 is for two, publishing side process therein
Including publishing side process P1 and publishing side process P2, subscription end process therein includes subscription end process S1 and subscription end process
S2.It, can be by calling the task manager of terminal to check the publishing side having been turned on after each process is activated in an operating system
Process and subscription end process.
The communication system further includes shared section key 10.Shared section key refers in the computer system of multiprocessor,
The large capacity memory that can be accessed by different central processing units.The memory space of shared section key 10 shown in FIG. 1 can be from
It is distributed in the memory of terminal, the capacity (i.e. the amount of storage size of memory space) of shared section key can be by terminal according to handling up
The automatic setting of amount, can also be by user's manual setting.Shared section key 10 is equivalent to publishing side process and subscription end process carries out
The intermediate medium of interactive information;Specifically: in the message that publishing side process P1 or/and publishing side process P2 can issue needs
Appearance is written to shared section key 10, and subscription end process S1 or/and subscription end process S2 can read hair from shared section key 10
The message content of cloth end process write-in.
In one embodiment, communication system shown in FIG. 1 can be applied to One-to-one communication scene;The pair of one
Communication scenes refer to the scene communicated between a publishing side process and a subscription end process.Between one-to-one process
In communication scenes, below by taking the communication between publishing side process P1 and subscription end process S1 as an example, the work of the communication system is former
Reason generally comprises: the issuing process of message content and the reading process of message content.As shown in Fig. 2, the publication of the message content
Process includes:
S11, publishing side process initialization.
Publishing side process P1 initialization includes: the socket connection request of publishing side process P1 processing subscription end process S1,
Shared section key is opened with trial.It gives out information content in order to not influence publishing side process P1, it can be by publishing side process P1's
Independent thread handles the socket connection request of subscription end process S1, i.e., independent thread builds according to socket connection request
It is vertical to be connect with the socket of subscription end process S1, and opening operation is executed to the shared section key, if it is shared interior successfully to open this
Area is deposited, then the message content to be written such as, if opening failure, creates shared section key.
S12, publishing side process issue target message content.
It is that the target message content assignment is empty that publishing side process P1 publication target message content, which includes: in shared section key,
Between, if being allocated successfully, message content is written in the shared section key, and obtain the address of the message content, passes through socket
Address of the message content in shared drive is sent to subscription end process S1.
S13, publishing side process exit.
Publishing side process P1 can exit shared section key after target message content is written, and exit shared section key packet
It includes: detecting whether to need to remove shared section key, specifically, publishing side process P1 detection is currently with the presence or absence of other process (packets
Include publishing side process or subscription end process) it has opened and has not exited shared section key;If it exists, show there is process to be used altogether
Memory field is enjoyed, then does not remove all message contents that shared section key is stored;If it does not exist, show to make currently without process
With shared section key, then all message contents that shared section key is stored can be removed, it is empty with the storage for discharging shared section key
Between.
As shown in figure 3, the reading process of message content includes:
S21, subscription end process initialization.
Subscription end process S1 initialization, which includes: subscription end process S1, sends socket connection request to publishing side process P1,
It is connect with establishing with the socket of publishing side process P1.Establishing socket attended operation can be by the center process of communication system
It realizes, can also be realized by the concatenate rule of local socket path, web socket port, the present invention is unlimited to this
It is fixed.
For example, if subscription end process starts before publishing side process in communication system, publishing side process can
It is broadcast the message with being sent by local socket path to each subscription end process, which includes publishing side process P1
Mark and publishing side process P1 service description information, service description information for describe publishing side process P1 be capable of providing it is assorted
The message content of sample.Subscription end process S1 according to the broadcast message that publishing side process is issued judge whether to subscribe to the publishing side into
The message content of journey P1 publication, however, it is determined that subscribe to, then send socket connection request, socket connection to publishing side process P1
Request carries the mark of publishing side process P1 and the mark of subscription end process S1, and publishing side process P1 is asked according to socket connection
It asks foundation to establish socket with subscription end process S1 to connect.
S22, subscription end process read target message content.
After socket connection is established, subscription end process S1 can receive the ground that publishing side process is sent by socket
Shared section key is opened, and the target message content is read in shared section key according to address in location.Further, it is possible to by target
Message content calls registered call back function in subscription end process S1 as parameter, alternatively, can also will be in the target message
Call back function is called as parameter in the address of appearance, so that subscription end process S1 can realize corresponding function according to call back function.
S23, subscription end process exit.
Shared section key can be exited after reading target message content, and detects whether to need to remove shared section key,
Specifically, subscription end process S1 detection has currently been opened with the presence or absence of other processes (including publishing side process or subscription end process)
And the shared section key is not exited, and if it exists, show currently have process that shared section key is used, then do not remove shared drive
All message contents that area is stored;If it does not exist, show then remove in shared currently without process using shared section key
All message contents that area is stored are deposited, to discharge the memory space of shared section key.
In above-mentioned one-to-one interprocess communication scene, publishing side process only needs message content being written to shared drive
Area does not need kernel and buffer area that message content is copied to operating system, reduces message in the issuing process of message content
The copy number of content, can reduce the resource overhead of operating system, and reduce the propagation delay time of message content, improve message content
The handling capacity of transmission.Message content is sent to subscription end process in the address of shared section key in real time by socket, with
Just subscription end process can get the message content of publishing side process write-in, it can be achieved that subscription end process and publishing side in real time
Message content between process is synchronous.
In another embodiment, communication system shown in FIG. 1 can be applied to many-many communication scene;It is described multipair
More communication scenes refer to the scene communicated between multiple publishing side processes and multiple subscription end processes.In multipair multi-process
Between in communication scenes, below by taking publishing side process P1, publishing side process P2 and subscription end process S1, subscription end process S2 as an example,
The working principle of the communication system equally includes: the issuing process of message content and the reading process of message content.
During news release, publishing side process P1 establishes the set with subscription end process S1, subscription end process S2 respectively
Connect word connection;Publishing side process P1 can execute opening operation to shared section key, if successfully opening the shared section key, and work as
Before need to issue target message content D, publishing side process P1 can be distributed in shared section key for the target message content D and be stored
Space;If being allocated successfully, show that the shared section key has storage resource, target message content D is written in shared
It deposits in area, and the target message content D is sent to subscription end process S1, subscription by socket in the address of shared section key
End process S2.Equally, publishing side process P2 foundation is connect with the socket of subscription end process S1, subscription end process S2, publishing side
Process P2 can execute opening operation to shared section key, if successfully opening the shared section key, and currently need to issue target
Message content E, publishing side process P2 can distribute memory space in shared section key for the target message content E;If distribution is lost
It loses, then deletes the existing message content of the shared section key, such as delete the accessed least message content of number or delete and build
Earliest message content between immediately;The target message content E is being obtained after shared section key distributes memory space, by the target
Message content E is written in shared section key, and the target message content E is sent out in the address of shared section key by socket
It send to subscription end process S1, subscription end process S2.
In message reading process, subscription end process S1 can send to publishing side process P1, publishing side process P2 and be socketed
Word connection request is connect with establishing subscription end process S1 with the socket of publishing side process P1, publishing side process P2, and receives hair
The address that cloth end process P1 and publishing side process P2 are sent by socket;Subscription end process S1 can open shared section key,
And message content D is read from shared section key in the address sent according to publishing side process P1, and is sent according to publishing side process P2
Address from shared section key read message content E.Equally, subscription end process S2 can to publishing side process P1, publishing side into
Journey P2 sends socket connection request, to establish the socket of subscription end process S2 and publishing side process P1, publishing side process P2
Connection, and the address that publishing side process P1 and publishing side process P2 are sent by socket is received, subscription end process S2 is opened altogether
Message content D is read from shared section key in the address enjoying memory field, and being sent according to publishing side process P1, and according to publishing side into
Message content E is read from shared section key in the address that journey P2 is sent.If opening failure, show that there is no can be read shared section key
Message content, then abandon read message content.
In above-mentioned multi-to-multi interprocess communication scene, it is shared that each publishing side process will need the message content issued to be written to
Memory field, and message content is transmitted in the address of shared section key by each subscription end process by socket, each subscription end into
Journey reads message content from shared section key according to address;This way it is not necessary to which message content is carried out frequency in kernel and buffer area
Numerous copy reduces the copy number of message content, can reduce the resource overhead of operating system, and reduces the transmission of message content
Time delay improves the handling capacity of message content transmission.Also, by socket in real time by message content on the ground of shared section key
Location is sent to subscription end process, can so that subscription end process can get the message content of publishing side process write-in in real time
Realize that the message content between subscription end process and publishing side process is synchronous.
The description of embodiment based on the communication system between above-mentioned process, the embodiment of the present invention are provided between a kind of process
Communication means refers to Fig. 4, and the communication means between the process can be applied to the communication system between process shown in FIG. 1;This implementation
In example, publishing side process is expressed as P1, and subscription end process is expressed as S1;Communication means between the process may include following steps
S101-S105。
S101, subscription end process send socket connection request to publishing side process.
S102, publishing side process are established according to socket connection request and are connect with the socket of subscription end process.
In step S101~S102, in order to make publishing side process P1 and subscription end process S1 can be with interactive information, Ke Yijian
Vertical cloth end process P1 establishes socket with subscription end process S1 and connect;Specifically, by way of broadcast message or can pass through
The mode of center coordination realizes that publishing side process is established socket with subscription end process and connect.
In one embodiment, if being realized by way of broadcast message, publishing side process P1 is built with subscription end process S1
Vertical socket connection, then step S101~S102 includes step S31~S34:
S31, publishing side process P1 send broadcast message, which includes the mark and publishing side of publishing side process P1
Which type of message the service description information of process P1, service description information are capable of providing in for describing publishing side process P1
Hold.
S32, subscription end process S1 by the broadcast message of publishing side process P1 judge whether to need to subscribe to the publishing side into
The message content of journey P1 publication.
S33, if it is determined that need to subscribe to the publishing side process P1 publication message content, then to publishing side process P1 send cover
Word connection request is connect, which carries the mark of publishing side process P1 and the mark of subscription end process S1.
S34, publishing side process P1 are established according to the socket connection request and are established socket company with subscription end process S1
It connects.
In step S31~S34, after publishing side process and subscription end process all start, publishing side process P1 can be wide
Message is broadcast, subscription end process S1 can determine that publishing side process P1 can be provided according to the service description information in broadcast message
Which type of message content, the service description information may include type of message, such as image class, text class or video class;It can also wrap
Include message subject, such as facial image, face video.Further, it is determined the need for subscribing to hair according to service description information
The message content of cloth end process P1 publication, however, it is determined that need to subscribe to, then sent to publishing side process P1 and carry publishing side process P1
Mark and subscription end process S1 mark socket connection request, publishing side process P1 builds according to the socket connection request
It is vertical to establish socket with subscription end process S1 and connect.
In another embodiment, if realizing that publishing side process and subscription end process are established by center coordination mode
Socket connection, then step S101~S102 includes step S41~S42:
S41, publishing side process P1 can be by the mark of publishing side process P1 and the service description informations of publishing side process P1
It is sent to center process;The mark of subscription end process S1 and subscription demand can be sent to center process by subscription end process S1;
Center process can be matched according to the content received, such as: center process finds the message that publishing side process P1 is provided
Content is just met for the subscription demand of subscription end S1, then, the mark of subscription end process S1 can be sent to by center process
Cloth end process P1, while the mark of publishing side process P1 is sent to subscription end process S1.
S42, publishing side process P1 or subscription end process S1 are between the two according to establishing from center process mark obtained
Socket connection.
S103, publishing side process will need the target message content issued to be written to shared section key, and obtain the target
Address of the message content in the shared section key.
Publishing side process P1 can will need the target message content issued to be written to shared section key;The writing process can
It include: that 1. publishing side process P1 detection needs whether the data volume for the target message content issued is greater than present count magnitude;Herein
Present count magnitude can be set according to actual needs;2. the target for demonstrating the need for publication disappears if more than present count magnitude
The data volume for ceasing content is larger, then the target message content that can be issued to the needs carries out packing processing, after packing is handled
Target message content be written to the shared section key;3. demonstrating the need for the target of publication if being less than or equal to present count magnitude
The data volume of message content is smaller, then target message content directly can be written to the shared section key.In the target message
After content is written to shared section key, publishing side process P1 obtains the target message content in the address of the shared section key.
The address is transmitted to the subscription end process by the socket by S104, publishing side process.
In order to realize subscription end process S1 and subscribe to the message synchronization between publishing side process P1, publishing side process P1 can be with
Target message content is transmitted to subscription end process S1 by socket in the address of shared section key;So, subscription end into
Journey S1 receives the information that publishing side process P1 is transmitted by socket, can timely learning publishing side process P1 issued it is new
Message content.
S105, subscription end process read the message content according to the address from shared section key.
Subscription end process S1 receives the target message content of publishing side process P1 transmission in shared section key by socket
In address;It, can be according to the ground when subscription end process S1 needs to read the target message content of publishing side process P1 publication
The target message content is read from shared section key 10 in location.In a kind of embodiment, if shared section key storage be through
It is packaged treated target message content, then the reading process of subscription end process S1 can include: 1. according to address out of shared
It deposits to read in area and is packaged treated target message content;2. handling being packaged that treated target message content carrying out unpacking
The target message content needed to subscription end process S1.In another embodiment, if shared section key storage be without
It is packaged treated target message content, subscription end process S1 can directly read institute according to the address from the shared section key
The target message content needed.
In the embodiment of the present invention, publishing side process is established socket with subscription end process and is connect, the target that needs are issued
Message content is written to shared section key, and is sent to the target message content in the address of shared section key by socket
Subscription end process can be according to the address that publishing side process is sent from altogether when subscription end process needs to read the message content
It enjoys and reads the message content in memory field.As it can be seen that the embodiment of the present invention only needs to carry out message content in shared section key
Copy, without continually being copied in kernel and buffer area, reduces the copy number of message content, can reduce operation
The resource overhead of system, and the propagation delay time of message content is reduced, improve the handling capacity of message content transmission.And pass through socket
Message content is sent to subscription end process in the address of shared section key in real time, so that subscription end process can obtain in real time
The message content of publishing side process write-in is got, it can be achieved that the message content between subscription end process and publishing side process is synchronous.
The description of embodiment based on the communication means between the communication system and process between above-mentioned process, the embodiment of the present invention
Communication means between another process is provided, refers to Fig. 5, the communication means between the process can be applied to process shown in FIG. 1
Between communication system, in the present embodiment, publishing side process is expressed as P1, and subscription end process is expressed as S1;Communication between the process
Method includes the following steps S201-S208:
S201, publishing side process are established socket with subscription end process and are connect, and specific implementation process can be found in real shown in Fig. 4
Apply step S101~S102 in example.
In order to make publishing side process P1 and subscription end process S1 that can establish cloth end process P1 with interactive information and subscribe to
End process S1 establishes socket connection.Specifically, can be by way of broadcast message or by way of the coordination of center
Realize that publishing side process is established socket with subscription end process and connect.
S202, publishing side process judge whether the shared section key has storage resource, if having, show shared drive
Area has the ability of storage target message content, is transferred to execution step S203 if not having and shows that shared section key does not have
Store the ability of target message content.
It includes step S51~S54 that publishing side process, which judges whether the shared section key has storage resource:
S51, opening operation is executed to the shared section key.
If S52, successfully opening the shared section key, detect whether the shared section key can be the target message content
Distribute memory space.
If S53, shared section key can be the target message content assignment memory space, confirm that the shared section key has
Standby storage resource.
If S54, opening the shared section key not successfully, the newly-built shared section key for having storage resource.
In step S51~S54, shared section key has storage resource and refers to: successfully opening shared section key, and this is total
Enjoying memory field to be can be target message content assignment memory space;Shared section key does not have storage resource and refers to: having not been able to
Shared section key is opened in success, or can successfully open shared section key, but the shared section key has not been able to as the target message
Content assignment memory space.Wherein, if having built up shared section key, publishing side process P1 can successfully open shared drive
Failure is opened if not setting up shared section key in area;Therefore, if opening successfully, it can detecte the shared section key and whether can
For the target message content assignment memory space;If opening failure, the shared section key for having storage resource can be created.If
The residual memory space capacity of the shared section key is greater than or equal to the data volume (i.e. length) of the target message content, then issues
End process P1 determines that shared section key can be the target message content assignment memory space, otherwise, it determines cannot be the target
Message content distributes memory space.
If S203, having storage resource, which is increased pre- fixed step size by publishing side process, and is obtained this and disappeared
The state of queue lock is ceased, which includes idle state or occupied state.
If shared section key has storage resource, show that the residual memory space capacity of the shared section key is greater than or equal to
The data volume of the target message content, shared section key have the ability of storage target message content, can write in shared section key
Enter the target message content.In the embodiment of the present invention, shared section key uses message queue stores messages content, the shared drive
It is locked including the first reference count and message queue;Being used to indicate for first reference count successfully opens and does not exit shared section key
Publishing side process and subscription end process quantity;That is, showing not deposit if the value of the first reference count is initial value
It is successfully opened in process and does not exit shared section key, it is shared using this to also indicate that there is no publishing side processes and subscription end process
Memory field;If the value of the first reference count is not initial value, the first reference count, which is used to indicate, successfully to be opened and does not exit altogether
The publishing side process of memory field and the quantity of subscription end process are enjoyed, also indicates that use there are publishing side process and subscription end process and be somebody's turn to do
Shared section key.Herein, initial value can be set according to actual needs, and for example, 0,1 etc..It is write by the target message
When entering to shared section key, which is increased pre- fixed step size by publishing side process P1, and pre- fixed step size can also basis
Actual needs is set, and for example, 1,2 etc..With initial value for 0, for pre- fixed step size is 1;Shared section key is not any
Process is opened, and the first reference count of shared section key is initial value;When publishing side process P1 opens shared section key, by first
Reference count adds 1, then the value that the first reference calculates becomes 1.
For the ease of carrying out orderly management to message queue, the same time, which can be set, only allows a process to message team
Column carry out edit operation, and edit operation herein includes: write operation, newly-increased nodal operation or deletion of node operation etc.;This setting
It can be realized by message queue lock.Message queue locks the permission for being locked in the edit operation of shared section key, that is,
It says, if some publishing side process obtains and occupies the message queue lock of the shared section key 10, message queue lock, which is in, at this time is accounted for
With state, then the publishing side process can get the edit operation permission in the shared section key 10, it can be to shared section key
Message content is written;Other publishing side processes cannot carry out edit operation to shared section key at this time;Only in the message team
After column lock is released, the message queue being released is locked in idle state, other publishing side processes could be by obtaining and occupying
The message queue is locked to obtain the edit operation permission in the shared section key 10.Shared section key can also include message queue
Head node, for recording the state of the message content in message queue;Herein, the state of message content includes having message content
State and do not have message content state;Wherein, have message content state and refer to and had been written into message in the message queue
Hold;Do not have message content state and refer in the message queue and message content is not written.Further, if the state of the message content
To have message content state, then message queue head node can be also used for the operation information of each message content of record write-in
(number being such as read).Further, which may include at least one information node, and information node draws including second
With counting, the data structure for storing message content and configuration information.Chained list (such as circular linked list or two-way can be used
Circular linked list) or the data structures such as array establish the message queue of shared section key, according to chained list (such as circular linked list or double
To circular linked list) mode establish the message queue of shared section key, then configuration information includes chained list configuration information;According to number
The mode of group establishes message queue, then configuration information includes array configuration information.Wherein, the second reference count is used to indicate currently
In the quantity for the subscription end process for reading the message content in the information node, array configuration information and chained list configuration information can be with
Outlet and the entrance of message queue are recorded, the message content that information node includes refers to the message content of publishing side process write-in.
For establishing the message queue of shared section key by the way of chained list;In the sometime shared section key
State is as shown in fig. 6, the shared section key 10 includes information node 1, information node 2 and information node 3;Wherein, information node 1
In the second reference count value be 0, show there is currently no subscription end process read information node 1 in message content A, disappear
The value for ceasing the second reference count in node 2 is 1, shows that there is currently a subscription end processes to read disappearing in information node 2
Content B is ceased, the value of the second reference count in information node 3 is 2, shows that there is currently 2 subscription end processes to read message section
Message content C in point 3.The value of first reference count of shared section key 10 be 5, show current one co-exist in 5 processes at
Function is opened and does not exit shared section key 10.By the second reference count of above-mentioned each information node it is found that current one co-exists in
Three subscription end processes are reading message content, after only having subscription end process to open shared section key, can just read altogether
The message content in memory field is enjoyed, therefore, is opened there is currently 3 subscription end processes and does not exit shared section key, Jin Erke
Know, opened there is currently 2 publishing side processes and does not exit shared section key.
In step S202, if shared section key does not have storage resource, further shared section key cannot disappear for the target
Content assignment memory space is ceased, shows that the residual memory space capacity of shared section key is less than the data volume of target message content,
In a kind of feasible embodiment, space release operation can also be carried out, to the shared section key so as to which the target disappears
Breath content is written to the shared section key.The process for carrying out space release operation to the shared section key may comprise steps of
S61~S62:
S61, the earliest information node of settling time in the message queue is obtained.
If the value of the second reference count of S62, the settling time earliest information node is initial value, when deleting this and establishing
Between earliest information node.
In step S61~S62, when the shared section key cannot be the target message content assignment memory space, hair
Cloth end process P1 can discharge settling time earliest information node;Specifically, it is earliest to obtain settling time in the message queue
Information node show not deposit currently if the value of the second reference count of the settling time earliest information node is initial value
The settling time earliest information node is being read in subscription end process, the settling time earliest information node can be deleted,
After deleting the settling time earliest information node, if cannot deposit in shared section key or for the target message content assignment
Space is stored up, then earliest information node of available next settling time, circulation executes step S61~S62 to delete message
Node, until in shared section key can be the target message content assignment memory space when terminate.If the settling time is earliest
The value of second reference count of information node is not initial value, shows that there is currently subscription end processes to read the settling time most
Early information node, then publishing side process P1 can abandon that message is written to shared section key, or wait can this when establishing
Between the value of the second reference count of earliest information node when being initial value, delete the settling time earliest information node.
Wherein, the value of the second reference count is that initial value is used to indicate that there is currently no subscription processes to read the information node
In message content, initial value can be zero, is also possible to other values.
For example, when the shared section key cannot be the target message content assignment memory space, as shown in fig. 6,
The settling time got earliest information node is information node 1 (since message queue is First Input First Output, message
Tail node 1 in queue is the node in earliest inbound message queue, i.e., information node 1 is settling time earliest message section
Point).Second reference count of information node 1 is 0, i.e., the second application count of information node is initial value, can be by message section
Point 1 is deleted, if after information node 1 is deleted, publishing side process P1 still can not be the target message content assignment memory space,
The available next information node (i.e. information node 2) established earliest of publishing side process P1, due to the second of information node 2
Reference count is not initial value, then abandons that message content is written to shared section key.
If S204, the message queue lock are in idle condition, publishing side process obtains message queue lock to be somebody's turn to do
The write operation permission of shared section key.
If message queue lock is in idle condition, shows to write currently without publishing side process P1 into shared section key and disappear
Content is ceased, message content can be written in publishing side process P1 into shared section key, in order to avoid publishing side process P1 is being written
During message content, message content is also written in other publishing side processes into shared section key, and shared section key is caused to be deposited
There is out-of-order problem in the message content of storage, and the available message queue lock of publishing side process P1 is to obtain the shared drive
Write operation permission makes message queue lock in occupied state.
The target message content is written in the message queue of the shared section key by S205, publishing side process.
When obtaining the write operation permission of the shared section key, publishing side process P1 the target message content can be written
Into the message queue of the shared section key, specifically, the target message content can be written to the entrance of the message queue
Place, or the message content is written to the region that message content is not written in the message queue and.
The target message content is written to the tool of the process in the message queue of the shared section key and can wrapped by publishing side process
Include step S71~S73:
S71, the entrance that the message queue is searched according to the data structure information.
S72, target message node is established in the inlet.
S73, the target message content is written in the target message node, and is arranged the second of the target message node
The value of reference count, the second reference count of the target message node, which is used to indicate, is currently reading in the target message node
Message content subscription end process quantity.
In step S71~S73, in order to agree with the rule for the first in, first out for transmitting message content in message queue, publication
The message content being newly written can be written to inlet by end process P1, specifically, publishing side process P1 can be according to the data
Structural information searches the entrance of the message queue, establishes target message node in the inlet, which is written
Into the target message node, and the value of the second reference count of the target message node is set, that is, the target message section is set
The initial value of second reference count of point, so that subsequent can be determined according to the value of the second reference count is currently just reading the target
The quantity of the subscription end process of the message content of information node.
S206, after the completion of write-in, publishing side process discharges message queue lock, and obtains the target message content at this
Address in shared section key.
In order to which other publishing side processes can obtain the write operation permission of shared section key or publishing side process P1 can be again
The secondary write operation permission for obtaining shared section key, publishing side process P1 can discharge the message after target message content is written
Queue lock is in idle condition message queue lock.In publishing side process P1 after target message content is written, in order in real time will
The target message content synchronization of write-in is to subscription end process S1, and the available target message content is in the shared section key
Address.
The address is transmitted to the subscription end process by the socket by S207, publishing side process.
It includes: that handle is written in the address that the address is transmitted to the subscription end process by the socket by publishing side process
Handle in the handle pond is transmitted to the subscription end process by the socket by pond.
Publishing side process P1 can the address conversion be handle, which is written in handle pond, pass through socket will
Handle in the handle pond is transmitted to subscription end process S1, specifically, the first address that the address is the target message content (or refers to
Needle), address offset amount is calculated according to the first address of the first address of the message content and shared section key, which is made
It for handle, is written in handle pond, the handle in the handle pond is transmitted to by subscription end process S1 by socket.
Following steps can also be performed in publishing side process: when exiting shared section key, by the first of the shared section key
Reference count reduces pre- fixed step size, if the value of the first reference count of shared section key is initial value, removes shared section key institute
All message contents of storage delete information node in the message queue.
Publishing side process P1 can exit shared section key after target message content is written to shared section key, and
First reference count of the shared section key is reduced into pre- fixed step size, if the value of the first reference count of shared section key is initial
Value shows to open there is currently no subscription end process and publishing side process and does not exit the shared section key, publishing side process P1
All message contents that the shared section key is stored can be removed or delete the information node in message queue, so as to it is subsequent can
Message content is written to the shared section key;If the value of the first reference count of shared section key is not initial value, show
It is opened there is currently subscription end process Huo and publishing side process and does not exit the shared section key, then do not remove shared section key
Message in, so that subscription end process can read the message content of shared section key.
S208, subscription end process read the message content according to the address from the shared section key.
It includes: by the socket that subscription end process S1, which receives the publishing side process by the address that the socket is sent,
Connection receives the handle in the handle pond of the subscription end process transmission, according to the handle acquiring address.Subscription end process S1 can
The address of target message content is calculated with the handle sent by publishing side process P1, specifically, according to the handle (address
Offset) plus the first address of shared section key the first address of the target message content is obtained, the first ground of the target message content
Location is the address of the target message content, so as to be read in the target message according to the first address of the target message content
Hold.
It has been observed that shared drive uses message queue stores messages content, which includes the first reference count;It should
Message queue includes at least one information node, which includes the second reference count and message content;According to the address
The process that the target message content is read from the shared drive includes step S81~S84:
S81, the shared section key is opened, and pre- fixed step size is increased to the first reference count of the shared section key.
After subscription end process S1 receives address, it is somebody's turn to do if subscription end process S1 determines that current needs or subsequent needs are read
Target message content can then show the demand of subscription end process S1, tool by the way that the first reference count of shared section key is arranged
Body, the shared section key can be opened, and pre- fixed step size is increased to the first reference count of the shared section key.
S82, target message node in the message queue is obtained according to the address.
S83, the second reference count of the target message node is increased into pre- fixed step size, is read from the target message node
The target message content.
When needing to read the target message content, the target message content is being read in subscription end process S1 in order to prevent
During, which is deleted the target message by other publishing side processes or subscription end process, subscription end
Second reference count of the target message node can be increased pre- fixed step size by process S1, and be read from the target message node
The target message content.
S84, after the completion of reading, the second reference count of the target message node is calculated and reduces pre- fixed step size.
Subscription end process S1 after having read the target message content, show this read operation complete, subscription end into
Second reference count of the target message node can be reduced pre- fixed step size by journey S1, so that subsequent issued end process can basis
The space of the value release shared section key of second reference count.
Following steps can also be performed in subscription end process: when exiting the shared section key, by the shared section key
First reference count reduces pre- fixed step size, if the value of the first reference count of the shared section key is initial value, it is shared to remove this
The information node in all message contents or deletion message queue that memory field is stored.
Subscription end process S1 is subscribed to after getting the target message content and when not needing to read other message contents again
End process S1 can exit the shared section key, and the first reference count of the shared section key is reduced pre- fixed step size, if
The value of first reference count of the shared section key is initial value, shows that there is currently no subscription end processes and publishing side process to beat
Open and do not exit the shared section key, subscription end process S1 can remove all message contents that the shared section key is stored or
The information node in message queue is deleted, message content can be written to the shared section key so as to subsequent;If shared drive
The value of first reference count in area is not initial value, show there is currently subscription end process or and publishing side process open and not
The shared section key is exited, then does not remove the message content of shared section key, so that subscription end process can read shared drive
The message content in area.
In the embodiment of the present invention, publishing side process is established socket with subscription end process and is connect, the target that needs are issued
Message content is written to shared section key, and is sent to the target message content in the address of shared section key by socket
Subscription end process can be according to the address that publishing side process is sent from altogether when subscription end process needs to read the message content
It enjoys and reads the message content in memory field.As it can be seen that the embodiment of the present invention only needs to carry out message content in shared section key
Copy, without continually being copied in kernel and buffer area, reduces the copy number of message content, can reduce operation
The resource overhead of system, and the propagation delay time of message content is reduced, improve the handling capacity of message content transmission.And pass through socket
Message content is sent to subscription end process in the address of shared section key in real time, so that subscription end process can obtain in real time
The message content of publishing side process write-in is got, it can be achieved that the message content between subscription end process and publishing side process is synchronous.
Communication means between process provided in an embodiment of the present invention is applicable to one-to-one, one-to-many or multi-to-multi process
Between communications applications scene.Fig. 7 is referred to, is illustrated by taking robot scene as an example, which includes intelligent robot terminal, should
Intelligent terminal includes one or more camera shooting application programs, such as includes high-definition camera application program and commonly images application program,
When start in an intelligent terminal and run high-definition camera application program and or when common camera shooting application program, in the intelligent terminal
Middle synchronous averaging and run high-definition camera process and or commonly image process.The intelligent terminal further includes various image application journeys
Sequence, including but not limited to: face recognition application program, gesture identification application program, human bioequivalence application program, gesture recognition are answered
With program, object identification application program etc.;When starting in an intelligent terminal and running these image recognition application programs, at this
Synchronous averaging is understood in intelligent terminal and runs corresponding process.With intelligent terminal starting face recognition application program to be paid
Scene, and starting human bioequivalence application program for carrying out the scene of personnel tracking;When face recognition application program and
After human bioequivalence application program is activated and runs, corresponding operation face recognition process and human bioequivalence process.The recognition of face
As subscription end process, high-definition camera process and common camera shooting process, should as publishing side process for process and human bioequivalence process
Inter-process communication methods include the following steps S301-S304:
The socket that S301, publishing side process are established between each subscription end process connects, and for details, reference can be made to steps
S101 and step S102.
In order to make publishing side process and subscription end process can with interactive information, can establish according to demand publishing side process with
Between each subscription end process socket connection, for example, face payment scene in, in order to improve identification accuracy and
The safety of payment is improved, face recognition process can subscribe to the high-definition image data of high-definition camera process publication to carry out face knowledge
Not;Face recognition process can be established in step S301 to connect with the socket of high-definition camera process.For another example: human body tracking scene
In, due to only needing to identify the basic sign of human body, such as height, figure information when carrying out human bioequivalence in this scene, because
This, the general image data that human bioequivalence process can subscribe to common camera shooting process publication carries out human bioequivalence, can in step S301
Human bioequivalence process is established to connect with the socket of common camera shooting process.High-definition image data herein refer to that pixel is higher than or waits
In the image data of presetted pixel threshold value;General image data refers to that pixel is lower than the image data of presetted pixel threshold value;This is pre-
If pixel threshold can be set according to actual needs.
The image data that S302, publishing side process will acquire is written to shared section key, and obtains the image data and exist
The address of the shared section key.
When high-definition camera process receives the instruction of shooting image, high-definition camera process can be shot the camera of terminal
High-definition image data be written to shared section key, and obtain the high-definition image data in the address of shared section key.Equally, general
The general image data that terminal is shot can be written to shared section key by logical camera shooting process, and obtain the general image data altogether
Enjoy the address of memory field.
The address is transmitted to each subscription end process by the socket by S303, publishing side process, and for details, reference can be made to steps
Rapid S104 and step S207.
For example, the address of high-definition image data can be transmitted to face by the socket and known by high-definition camera process
The address of general image data can be transmitted to human bioequivalence process by the socket by other process, common camera shooting process.
S304, each subscription end process read the message content according to the address from the shared section key.
After face recognition process receives the address of high-definition camera process transmission, high definition can be read from shared section key and taken the photograph
As the high-definition image data that process is issued, for example, intelligent terminal, when being paid by recognition of face, face recognition process can
To read the high-definition image data from shared section key according to the address received and carry out recognition of face, according to recognition of face
As a result subsequent delivery operation is executed.
After human bioequivalence process receives the address that common camera shooting process is sent, it can read from shared section key and commonly take the photograph
As the general image data that process is issued, for example, intelligence is eventually during public security department needs to investigate the case by human bioequivalence
Human bioequivalence process in end can read the general image data according to the address received and be carried out from shared section key
Human bioequivalence obtains recognition result, and recognition result is exported to carry out subsequent investigation tracking operation.
In the embodiment of the present invention, publishing side process is established socket with subscription end process and is connect, the target that needs are issued
Message content is written to shared section key, and is sent to the target message content in the address of shared section key by socket
Subscription end process can be according to the address that publishing side process is sent from altogether when subscription end process needs to read the message content
It enjoys and reads the message content in memory field.As it can be seen that the embodiment of the present invention only needs to carry out message content in shared section key
Copy, without continually being copied in kernel and buffer area, reduces the copy number of message content, can reduce operation
The resource overhead of system, and the propagation delay time of message content is reduced, improve the handling capacity of message content transmission.And pass through socket
Message content is sent to subscription end process in the address of shared section key in real time, so that subscription end process can obtain in real time
The message content of publishing side process write-in is got, it can be achieved that the message content between subscription end process and publishing side process is synchronous.
Based on the description of the communication means between above-mentioned process, the embodiment of the present invention provides the communication device between a kind of process,
Fig. 8 is referred to, the communication device between process is applied to the communication system between process, which includes publishing side process, subscription end
Process and shared section key, the communication device between process include:
Connection unit 801 is connected for receiving the socket connection request of subscription end process transmission according to the socket
Request is established socket with the subscription end process and is connect;The socket connection request carries mark and the institute of publishing side process
State the mark of subscription end process;The mark of the publishing side process is to be sent by the subscription end process from the publishing side process
Broadcast message in obtain, or it is from center process obtained.
Writing unit 802, the target message content for that will need to issue is written to shared section key, and obtains the mesh
Mark address of the message content in the shared section key.
Transmission unit 803, for the address to be transmitted to the subscription end process by the socket, so that described
At least one subscription end process reads the target message content according to the address from the shared section key.
Optionally, connection unit 801, the socket connection request sent specifically for receiving the subscription end process, institute
It states socket connection request and carries the mark of the publishing side process and the mark of the subscription end process;The publishing side process
Mark be to be obtained from the broadcast message that the publishing side process is sent by the subscription end process, or from center process
It is obtained;Socket is established with the subscription end process according to the socket connection request to connect.
Optionally, judging unit 804, for judging whether the shared section key has storage resource.
Optionally, writing unit 802, if having storage resource for the shared section key, by the target message
Content is written to the shared section key.
Optionally, judging unit 804 are specifically used for executing opening operation to the shared section key;If successfully opening institute
Shared section key is stated, detects whether the shared section key can be the target message content assignment memory space;If described
Shared section key can be the target message content assignment memory space, then confirms that the shared section key has storage money
Source;If opening the shared section key not successfully, the newly-built shared section key for having storage resource.
Optionally, writing unit 802 are specifically used for increasing by first reference count into pre- fixed step size, and described in acquisition
The state of message queue lock, the state includes idle state or occupied state;If the message queue lock is in idle condition,
Obtain the message queue lock then to obtain the write operation permission of the shared section key;The target message content is written to
In the message queue of the shared section key;After the completion of write-in, the message queue lock is discharged.
Optionally, writing unit 802, specifically for searching the entrance of the message queue according to the configuration information;In
Target message node is established in the inlet;The target message content is written in the target message node, and is arranged
Second reference count of the initial value of the second reference count of the target message node, the target message node is used to indicate
Currently reading the quantity of the subscription end process of the message content in the target message node.
Optionally, releasing unit 805, if cannot be stored for the shared section key for the target message content assignment
Space carries out space release operation to the shared section key.
Optionally, releasing unit 805, specifically for the information node that settling time in the acquisition message queue is earliest;
If the value of the second reference count of the settling time earliest information node is initial value, institute is deleted from the message queue
State settling time earliest information node.
Optionally, computing unit 806, for when exiting the shared section key, by the first of the shared section key
Reference count reduces pre- fixed step size.
Optionally, clearing cell 807, if the value of the first reference count for the shared section key is initial value, clearly
The information node in all message contents or the deletion message queue stored except the shared section key.
Optionally, transmission unit 803 are specifically used for address handle pond is written;It will be described by the socket
Handle in handle pond is transmitted to the subscription end process.
In the embodiment of the present invention, publishing side process is established socket with subscription end process and is connect, the target that needs are issued
Message content is written to shared section key, and is sent to the target message content in the address of shared section key by socket
Subscription end process can be according to the address that publishing side process is sent from altogether when subscription end process needs to read the message content
It enjoys and reads the message content in memory field.As it can be seen that the embodiment of the present invention only needs to carry out message content in shared section key
Copy, without continually being copied in kernel and buffer area, reduces the copy number of message content, can reduce operation
The resource overhead of system, and the propagation delay time of message content is reduced, improve the handling capacity of message content transmission.And pass through socket
Message content is sent to subscription end process in the address of shared section key in real time, so that subscription end process can obtain in real time
The message content of publishing side process write-in is got, it can be achieved that the message content between subscription end process and publishing side process is synchronous.
Based on the description of the communication means between above-mentioned process, the embodiment of the present invention provides the communication device between a kind of process,
Fig. 9 is referred to, the communication device between process is applied to the communication system between process, which includes publishing side process, subscription end
Process and shared section key, the communication device between process include:
Connection unit 901 is established and the publishing side process for sending socket connection request to publishing side process
Socket connection;The socket connection request carries the mark of the publishing side process and the mark of subscription end process;It is described
The mark of publishing side process be obtained from the broadcast message that the publishing side process is sent by the subscription end process, or
From center, process is obtained.
Receiving unit 902, the address sent for receiving the publishing side process by the socket, the address is
The target message that the publishing side process will need the target message content issued acquired after being written to shared section key
Address of the content in the shared section key.
Reading unit 903, for reading the target message content from the shared drive according to the address.
Optionally, receiving unit 902, specifically for receiving the sentence of the subscription end process transmission by the socket
Handle, the handle are by the publishing side process that address write-in handle pond is obtained;According to the handle acquiring institute
State address.
Optionally, the shared drive uses message queue stores messages content;The shared drive includes the first reference
It counts;The message queue includes target message node, and the target message node includes at least the second reference count, for depositing
The data structure and configuration information of the target message content are stored up, the configuration information includes that chained list configuration information or array are matched
Confidence breath.
Optionally, reading unit 903 are specifically used for executing opening operation to the shared section key;If successfully opening institute
Shared section key is stated, pre- fixed step size is increased to the first reference count of the shared section key;According to the acquisition of the address
Target message node in message queue;Second reference count of the target message node is increased into pre- fixed step size;From described
The target message content is read in target message node, after the completion of reading, by the second reference of the target message node
It counts and reduces pre- fixed step size.
Optionally, computing unit 904, for when exiting the shared section key, by the first of the shared section key
Reference count reduces pre- fixed step size.
Optionally, clearing cell 905, if the value of the first reference count for the shared section key is initial value, clearly
The information node in all message contents or the deletion message queue stored except the shared section key.
In the embodiment of the present invention, subscription end process is established socket with publishing side process and is connect, and it is logical to receive publishing process
The address for crossing socket transmission, reads target message content according to address, it is only necessary to which message content exists from shared section key
It is copied in shared section key, without continually being copied in kernel and buffer area, reduces copying for message content
Shellfish number, can reduce the resource overhead of operating system, and reduce the propagation delay time of message content, improve gulping down for message content transmission
The amount of spitting.And message content is sent in the address of shared section key in real time by subscription end process by socket, to subscribe to
End process can get the message content of publishing side process write-in in real time, it can be achieved that subscription end process and publishing side process it
Between message content it is synchronous.
Based on the description of the communication means between above-mentioned process, the embodiment of the present invention provides a kind of terminal, and referring to Figure 10, it should
Terminal can be smart phone, computer, server, smartwatch or Intelligent bracelet etc., and terminal includes the communication system between process,
The system includes publishing side process, subscription end process and shared section key, and referring to Figure 10, terminal includes: processor 101, defeated
Incoming interface 102, output interface 103 and computer storage medium 104.
The computer storage medium 104 can indicate storage device, including volatile computer storage medium
(volatile memory), such as random access computer storage medium (random-access memory, RAM);Computer
Storage medium also may include nonvolatile computer storage media (non-volatile memory), such as quick flashing computer
Storage medium (flash memory), hard disk (hard disk drive, HDD) or solid state hard disk (solid-state drive,
SSD);Computer storage medium 104 can also include the combination of the computer storage medium of mentioned kind.
The input interface 102 can be used for input and wait for the pending data handled to processor 101.In a reality
It applies in example, input interface 102 may include multiple independent interfaces, such as Ethernet interface, LCD (Liquid Crystal
Display, liquid crystal display) interface etc., it is each responsible for communication of the different peripheral equipments to 101 input data of processor.
The output interface 103 can be used for outputting data to other peripheral equipments being connected with terminal, can export outward
The processing result of processor 101.Output interface 103 can also include multiple independent interfaces, such as Ethernet interface, camera
Interface etc. is responsible for communication of the processor 101 to different peripheral equipment output datas.
In one embodiment, output interface 103 and input interface 102 can be universal input output (General
Purpose Input Output, GPIO) interface.
The processor 101 can be used for reading and executing computer instruction.In one embodiment, processor 701 may be used also
To further comprise hardware chip.Above-mentioned hardware chip can be specific integrated circuit (application-specific
Integrated circuit, ASIC), programmable logic device (programmable logic device, PLD) or its group
It closes.Above-mentioned PLD can be Complex Programmable Logic Devices (complex programmable logic device, CPLD), existing
Field programmable logic gate array (field-programmable gate array, FPGA), Universal Array Logic (generic
Array logic, GAL) or any combination thereof.
The computer storage medium 104 is also used to store one or more than one program instructions;The program instruction packet
Include the first instruction and/or the second instruction.In one embodiment, when the processor 101 can call the described first instruction
The communication means between process is able to carry out to provide the communication service between process, specifically, the processor 101 calls first to refer to
It enables and executes following steps:
The socket connection request that subscription end process is sent is received, the socket connection request carries publishing side process
The mark of mark and the subscription end process;The mark of the publishing side process is by the subscription end process from the publishing side
It is obtained in the broadcast message that process is sent, or obtained from center process;
Socket is established with the subscription end process according to the socket connection request to connect;The target that needs are issued
Message content is written to shared section key, and obtains address of the target message content in the shared section key;
The address is transmitted to the subscription end process by the socket, so that the subscription end process is according to institute
It states address and reads the target message content from the shared section key.
Optionally, the processor 101 can call first instruction, execute following steps:
The socket connection request that the subscription end process is sent is received, the socket connection request carries the publication
The mark of the mark of end process and the subscription end process;The mark of the publishing side process is by the subscription end process from institute
It states and is obtained in the broadcast message of publishing side process transmission, or is from center process obtained;
Socket is established with the subscription end process according to the socket connection request to connect.
Optionally, the processor 101 can call first instruction, execute following steps:
Judge whether the shared section key has storage resource;
If the shared section key has storage resource, the target message content is written to the shared drive
Area.
Optionally, the processor 101 can call first instruction, execute following steps:
Opening operation is executed to the shared section key;
If successfully opening the shared section key, detect whether the shared section key can be the target message content
Distribute memory space;
If the shared section key can be the target message content assignment memory space, the shared drive is confirmed
Area has storage resource;
If opening the shared section key not successfully, the newly-built shared section key for having storage resource.
Optionally, the shared section key uses message queue stores messages content;The shared drive draws including first
With counting and message queue lock;The processor 101 can call first instruction, execute following steps:
First reference count is increased into pre- fixed step size, and obtains the state of the message queue lock, the state packet
Include idle state or occupied state;
If the message queue lock is in idle condition, the message queue lock is obtained to obtain the shared section key
Write operation permission;
The target message content is written in the message queue of the shared section key;
After the completion of write-in, the message queue lock is discharged.
Optionally, the message queue includes at least one information node, and the information node includes at least the second reference
It counts, the data structure for storing message content and configuration information, the configuration information include chained list configuration information or number
Group configuration information;The processor 101 can call first instruction, execute following steps:
The entrance of the message queue is searched according to the configuration information;
Target message node is established in the inlet;
The target message content is written in the target message node, and is arranged the of the target message node
The initial value of two reference counts, the second reference count of the target message node, which is used to indicate, is currently reading the target
The quantity of the subscription end process of message content in information node.
Optionally, the processor 101 can call first instruction, execute following steps:
If the shared section key cannot be the target message content assignment memory space, to the shared section key into
The release operation of row space.
Optionally, the processor 101 can call first instruction, execute following steps:
Obtain the earliest information node of settling time in the message queue;
If the value of the second reference count of the settling time earliest information node is initial value, from the message queue
It is middle to delete settling time earliest information node.
Optionally, the processor 101 can call first instruction, execute following steps:
When exiting the shared section key, the first reference count of the shared section key is reduced into pre- fixed step size;
If the value of the first reference count of the shared section key is initial value, remove what the shared section key was stored
Information node in all message contents or the deletion message queue.
Optionally, the processor 101 can call first instruction, execute following steps:
Handle pond is written into the address;
The handle in the handle pond is transmitted to the subscription end process by the socket.
In another embodiment, it is able to carry out between process when the processor 101 can call the described second instruction
Communication means to provide the communication service between process, specifically, the processor 101 calls the second instruction execution to walk as follows
It is rapid:
Socket connection request is sent to publishing side process, foundation is connect with the socket of the publishing side process;It is described
Socket connection request carries the mark of the publishing side process and the mark of subscription end process;The mark of the publishing side process
It is to be obtained from the broadcast message that the publishing side process is sent by the subscription end process, or obtained from center process
's;
The address that the publishing side process is sent by the socket is received, the address is that the publishing side process will
The target message content for needing the to issue target message content acquired after being written to shared section key is described shared interior
Deposit the address in area;
The target message content is read from the shared drive according to the address.
Optionally, the processor 101 can call second instruction, execute following steps:
The handle of the subscription end process transmission is received by the socket, the handle is by the publishing side process
Address write-in handle pond is obtained;
According to address described in the handle acquiring.
Optionally, the processor 101 can call second instruction, execute following steps:
Opening operation is executed to the shared section key;
If successfully opening the shared section key, pre- fixed step size is increased to the first reference count of the shared section key;
The target message node in the message queue is obtained according to the address;
Second reference count of the target message node is increased into pre- fixed step size;
The target message content is read from the target message node, after the completion of reading, by the target message
Second reference count of node reduces pre- fixed step size.
Optionally, the processor 101 can call second instruction, execute following steps:
When exiting the shared section key, the first reference count of the shared section key is reduced into pre- fixed step size;
If the value of the first reference count of the shared section key is initial value, remove what the shared section key was stored
Information node in all message contents or the deletion message queue.
It should also be noted that, the corresponding function of terminal of the invention can both be realized by hardware design, can also lead to
Software design is crossed to realize, can also be realized by way of software and hardware combining, this is not restricted.
The embodiment of the present invention also provides a kind of computer program product, and the computer program product includes storing calculating
The computer storage medium of machine program, when run on a computer, the computer are executed as in above method embodiment
Any one of record is to some or all of inter-process communication methods step.In one embodiment, which produces
Product can be a software installation packet.
In the embodiment of the present invention, publishing side process is established socket with subscription end process and is connect, the target that needs are issued
Message content is written to shared section key, and is sent to the target message content in the address of shared section key by socket
Subscription end process can be according to the address that publishing side process is sent from altogether when subscription end process needs to read the message content
It enjoys and reads the message content in memory field.As it can be seen that the embodiment of the present invention only needs to carry out message content in shared section key
Copy, without continually being copied in kernel and buffer area, reduces the copy number of message content, can reduce operation
The resource overhead of system, and the propagation delay time of message content is reduced, improve the handling capacity of message content transmission.And pass through socket
Message content is sent to subscription end process in the address of shared section key in real time, so that subscription end process can obtain in real time
The message content of publishing side process write-in is got, it can be achieved that the message content between subscription end process and publishing side process is synchronous.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, above-mentioned program can be stored in a computer and take in storage medium,
The program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, above-mentioned storage medium can for magnetic disk,
CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..
Above disclosed is only section Example of the present invention, cannot limit the right model of the present invention with this certainly
It encloses, therefore equivalent changes made in accordance with the claims of the present invention, is still within the scope of the present invention.
Claims (15)
1. the communication means between a kind of process characterized by comprising
The socket connection request that subscription end process is sent is received, the socket connection request carries the mark of publishing side process
And the mark of the subscription end process;The mark of the publishing side process is by the subscription end process from the publishing side process
It is obtained in the broadcast message of transmission, or obtained from center process;
Socket is established with the subscription end process according to the socket connection request to connect;
The target message content issued will be needed to be written to shared section key, and obtain the target message content described shared
Address in memory field;
The address is transmitted to the subscription end process by the socket, so that the subscription end process is according to describedly
The target message content is read from the shared section key in location.
2. the method as described in claim 1, which is characterized in that described that the target message content issued will be needed to be written to shared
Before memory field, further includes:
Opening operation is executed to the shared section key;
If opening the shared section key not successfully, the newly-built shared section key for having storage resource;
If successfully opening the shared section key, detect whether the shared section key can be the target message content assignment
Memory space;
If the shared section key cannot be the target message content assignment memory space, the shared section key is carried out empty
Between discharge operation;If the shared section key can be the target message content assignment memory space, confirm described shared
Memory field has storage resource;
If the shared section key has storage resource, the target message content issued will be needed to be written to shared section key.
3. method according to claim 2, which is characterized in that the shared section key is using in message queue stores messages
Hold;The shared drive includes that the first reference count and message queue are locked;The message queue includes at least one information node,
The information node includes at least the second reference count, the data structure for storing message content and configuration information, described
Configuration information includes chained list configuration information or array configuration information;
It is described that the target message content issued will be needed to be written to shared section key, comprising:
First reference count is increased into pre- fixed step size, and obtains the state of the message queue lock, the state includes sky
Not busy state or occupied state;
If the message queue lock is in idle condition, the message queue lock is obtained to obtain writing for the shared section key
Operating right;
The entrance of the message queue is searched according to the configuration information;
Target message node is established in the inlet;
The target message content is written in the target message node, and is arranged the second of the target message node and draws
With the initial value of counting, the second reference count of the target message node, which is used to indicate, is currently reading the target message
The quantity of the subscription end process of message content in node;
After the completion of write-in, the message queue lock is discharged.
4. method as claimed in claim 3, which is characterized in that it is described that space release operation is carried out to the shared section key,
Include:
Obtain the earliest information node of settling time in the message queue;
If the value of the second reference count of the settling time earliest information node is initial value, deleted from the message queue
Except the information node that the settling time is earliest.
5. the method as claimed in claim 3 or 4, which is characterized in that further include:
When exiting the shared section key, the first reference count of the shared section key is reduced into pre- fixed step size;
If the value of the first reference count of the shared section key is initial value, that removes that the shared section key stored is all
Information node in message content or the deletion message queue.
6. method according to claim 1 or 2, which is characterized in that described to be transmitted to the address by the socket
The subscription end process, comprising:
Handle pond is written into the address;
The handle in the handle pond is transmitted to the subscription end process by the socket.
7. the communication means between a kind of process characterized by comprising
Socket connection request is sent to publishing side process to connect to establish with the socket of the publishing side process;The socket
Word connection request carries the mark of the publishing side process and the mark of subscription end process;The mark of the publishing side process be from
It is obtained in the broadcast message that the publishing side process is sent, or obtained from center process;
Receive the address that the publishing side process is sent by the socket, the address is the publishing side process by needs
The target message content of the publication target message content acquired after being written to shared section key is in the shared section key
In address;
The target message content is read from the shared drive according to the address.
8. the method for claim 7, which is characterized in that the reception publishing side process is sent out by the socket
The address sent, comprising:
Receive the handle of the subscription end process transmission by the socket, the handle is by the publishing side process by institute
It is obtained to state address write-in handle pond;
According to address described in the handle acquiring.
9. method as claimed in claim 7 or 8, which is characterized in that the shared drive is using in message queue stores messages
Hold;The shared drive includes the first reference count;The message queue includes target message node, the target message node
Including at least the second reference count, data structure and configuration information for storing the target message content, the configuration
Information includes chained list configuration information or array configuration information;
It is described to read the target message content from the shared drive according to the address, comprising:
Opening operation is executed to the shared section key;
If successfully opening the shared section key, pre- fixed step size is increased to the first reference count of the shared section key;
The target message node in the message queue is obtained according to the address;
Second reference count of the target message node is increased into pre- fixed step size;
The target message content is read from the target message node, after the completion of reading, by the target message node
The second reference count reduce pre- fixed step size.
10. method as claimed in claim 9, which is characterized in that further include:
When exiting the shared section key, the first reference count of the shared section key is reduced into pre- fixed step size;
If the value of the first reference count of the shared section key is initial value, that removes that the shared section key stored is all
Information node in message content or the deletion message queue.
11. the communication device between a kind of process characterized by comprising
Connection unit, for receive subscription end process transmission socket connection request, according to the socket connection request with
The subscription end process establishes socket connection;The socket connection request carries the mark and the subscription of publishing side process
The mark of end process;The mark of the publishing side process is the broadcast sent by the subscription end process from the publishing side process
It is obtained in message, or obtained from center process;
Writing unit, the target message content for that will need to issue is written to shared section key, and obtains the target message
Address of the content in the shared section key;
Transmission unit, for the address to be transmitted to the subscription end process by the socket, so that the subscription end
Process reads the target message content according to the address from the shared section key.
12. the communication device between a kind of process characterized by comprising
Connection unit establishes the socket with the publishing side process for sending socket connection request to publishing side process
Connection;The socket connection request carries the mark of the publishing side process and the mark of subscription end process;The publishing side
The mark of process is obtained from the broadcast message that the publishing side process is sent, or obtained from center process;
Receiving unit, the address sent for receiving the publishing side process by the socket, the address is the hair
Cloth end process exists the target message content for needing the target message content issued acquired after being written to shared section key
Address in the shared section key;
Reading unit, for reading the target message content from the shared drive according to the address.
13. the communication system between a kind of process, which is characterized in that including publishing side process, subscription end process and shared section key:
The publishing side process, the socket connection request sent for receiving the subscription end process, the socket connection
Request carries the mark of publishing side process and the mark of the subscription end process;The mark of the publishing side process is ordered by described
Read what end process was obtained from the broadcast message that the publishing side process is sent, or obtained from center process;According to institute
It states socket connection request and establishes socket with the subscription end process and connect;To need the target message content issued be written to
Shared section key, and obtain address of the target message content in the shared section key;The address is passed through described
Socket is transmitted to the subscription end process;
The subscription end process, for the publishing side process send socket connection request, establish with the publishing side into
The socket of journey connects;The address that the publishing side process is sent by the socket is received, according to the address from described
The target message content is read in shared drive;
The shared section key, for storing the target message content of the publishing side process write-in.
14. a kind of computer storage medium, which is characterized in that the computer storage medium be stored with one article or one or more
One instruction, described one or one or more first instruction be suitable for loaded by processor and executed such as any one of claim 1-6 institute
Communication means between the process stated;Alternatively, the computer storage medium is stored with one or one or more second instruction, it is described
One or one or more second instruction be suitable for as processor loads and executes the communication between the process as described in claim 7-10
Method.
15. a kind of terminal characterized by comprising
Processor is adapted for carrying out one or one or more instruction;And
Computer storage medium, the computer storage medium be stored with one or one or more first instruction, described one or
One or more first instruction is suitable for being loaded by processor and executing the communication party between process as claimed in any one of claims 1 to 6
Method;Alternatively, the computer storage medium be stored with one or one or more second instruction, described one or one or more second
Instruction is suitable for as processor loads and executes the communication means between the process as described in claim 7-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810380885.0A CN110399229A (en) | 2018-04-25 | 2018-04-25 | Communication means, device, system, medium and terminal between process |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810380885.0A CN110399229A (en) | 2018-04-25 | 2018-04-25 | Communication means, device, system, medium and terminal between process |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110399229A true CN110399229A (en) | 2019-11-01 |
Family
ID=68320282
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810380885.0A Pending CN110399229A (en) | 2018-04-25 | 2018-04-25 | Communication means, device, system, medium and terminal between process |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110399229A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111190748A (en) * | 2019-12-23 | 2020-05-22 | 腾讯科技(深圳)有限公司 | Data sharing method, device, equipment and storage medium |
CN111651286A (en) * | 2020-05-27 | 2020-09-11 | 泰康保险集团股份有限公司 | Data communication method, device, computing equipment and storage medium |
CN111756846A (en) * | 2020-06-24 | 2020-10-09 | 杭州安森智能信息技术有限公司 | Method for light-weight robot cross-process communication |
CN111858447A (en) * | 2020-07-13 | 2020-10-30 | 深圳市集贤科技有限公司 | Method for receiving data from serial port and processing data frame |
CN112416625A (en) * | 2020-11-30 | 2021-02-26 | 深信服科技股份有限公司 | Copy-free interprocess communication system and method |
CN112463400A (en) * | 2020-10-30 | 2021-03-09 | 中国电子科技集团公司第五十二研究所 | Real-time data distribution method and device based on shared memory |
CN112749027A (en) * | 2020-12-31 | 2021-05-04 | 深圳市迅雷网络技术有限公司 | Rendering inter-process communication method, electronic equipment and readable storage device |
CN113296967A (en) * | 2020-02-21 | 2021-08-24 | 西安诺瓦星云科技股份有限公司 | Process management method, device and system based on embedded operating system |
CN113590362A (en) * | 2021-08-10 | 2021-11-02 | 中孚信息股份有限公司 | Inter-process message processing method and device, electronic equipment and storage medium |
WO2021244155A1 (en) * | 2020-06-05 | 2021-12-09 | 华为技术有限公司 | Inter-process communication method and inter-process communication apparatus |
CN114003413A (en) * | 2021-12-30 | 2022-02-01 | 深圳佑驾创新科技有限公司 | IPC data communication method, device, equipment and medium |
CN114691051A (en) * | 2022-05-30 | 2022-07-01 | 恒生电子股份有限公司 | Data processing method and device |
CN113296967B (en) * | 2020-02-21 | 2024-06-04 | 西安诺瓦星云科技股份有限公司 | Process management method, device and system based on embedded operating system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5652885A (en) * | 1993-05-25 | 1997-07-29 | Storage Technology Corporation | Interprocess communications system and method utilizing shared memory for message transfer and datagram sockets for message control |
US20090119676A1 (en) * | 2006-09-27 | 2009-05-07 | Supalov Alexander V | Virtual heterogeneous channel for message passing |
CN101977195A (en) * | 2010-10-29 | 2011-02-16 | 西安交通大学 | Method for realizing virtual machine inter-domain communication protocol based on shared memory mechanism |
CN103514053A (en) * | 2013-09-22 | 2014-01-15 | 中国科学院信息工程研究所 | Shared-memory-based method for conducting communication among multiple processes |
US20140068165A1 (en) * | 2012-09-06 | 2014-03-06 | Accedian Networks Inc. | Splitting a real-time thread between the user and kernel space |
CN105893112A (en) * | 2016-03-29 | 2016-08-24 | 华为技术有限公司 | Data packet processing method and device under virtualization environment |
CN107733839A (en) * | 2016-08-11 | 2018-02-23 | 北京百度网讯科技有限公司 | Data transmission method and system |
-
2018
- 2018-04-25 CN CN201810380885.0A patent/CN110399229A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5652885A (en) * | 1993-05-25 | 1997-07-29 | Storage Technology Corporation | Interprocess communications system and method utilizing shared memory for message transfer and datagram sockets for message control |
US20090119676A1 (en) * | 2006-09-27 | 2009-05-07 | Supalov Alexander V | Virtual heterogeneous channel for message passing |
CN101977195A (en) * | 2010-10-29 | 2011-02-16 | 西安交通大学 | Method for realizing virtual machine inter-domain communication protocol based on shared memory mechanism |
US20140068165A1 (en) * | 2012-09-06 | 2014-03-06 | Accedian Networks Inc. | Splitting a real-time thread between the user and kernel space |
CN103514053A (en) * | 2013-09-22 | 2014-01-15 | 中国科学院信息工程研究所 | Shared-memory-based method for conducting communication among multiple processes |
CN105893112A (en) * | 2016-03-29 | 2016-08-24 | 华为技术有限公司 | Data packet processing method and device under virtualization environment |
CN107733839A (en) * | 2016-08-11 | 2018-02-23 | 北京百度网讯科技有限公司 | Data transmission method and system |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111190748B (en) * | 2019-12-23 | 2023-06-09 | 腾讯科技(深圳)有限公司 | Data sharing method, device, equipment and storage medium |
CN111190748A (en) * | 2019-12-23 | 2020-05-22 | 腾讯科技(深圳)有限公司 | Data sharing method, device, equipment and storage medium |
CN113296967B (en) * | 2020-02-21 | 2024-06-04 | 西安诺瓦星云科技股份有限公司 | Process management method, device and system based on embedded operating system |
CN113296967A (en) * | 2020-02-21 | 2021-08-24 | 西安诺瓦星云科技股份有限公司 | Process management method, device and system based on embedded operating system |
CN111651286A (en) * | 2020-05-27 | 2020-09-11 | 泰康保险集团股份有限公司 | Data communication method, device, computing equipment and storage medium |
WO2021244155A1 (en) * | 2020-06-05 | 2021-12-09 | 华为技术有限公司 | Inter-process communication method and inter-process communication apparatus |
CN111756846A (en) * | 2020-06-24 | 2020-10-09 | 杭州安森智能信息技术有限公司 | Method for light-weight robot cross-process communication |
CN111756846B (en) * | 2020-06-24 | 2023-09-29 | 杭州安森智能信息技术有限公司 | Cross-process communication method for lightweight robot |
CN111858447A (en) * | 2020-07-13 | 2020-10-30 | 深圳市集贤科技有限公司 | Method for receiving data from serial port and processing data frame |
CN112463400A (en) * | 2020-10-30 | 2021-03-09 | 中国电子科技集团公司第五十二研究所 | Real-time data distribution method and device based on shared memory |
CN112416625A (en) * | 2020-11-30 | 2021-02-26 | 深信服科技股份有限公司 | Copy-free interprocess communication system and method |
CN112416625B (en) * | 2020-11-30 | 2024-04-09 | 深信服科技股份有限公司 | Copy-free interprocess communication system and method |
CN112749027A (en) * | 2020-12-31 | 2021-05-04 | 深圳市迅雷网络技术有限公司 | Rendering inter-process communication method, electronic equipment and readable storage device |
CN113590362A (en) * | 2021-08-10 | 2021-11-02 | 中孚信息股份有限公司 | Inter-process message processing method and device, electronic equipment and storage medium |
CN114003413A (en) * | 2021-12-30 | 2022-02-01 | 深圳佑驾创新科技有限公司 | IPC data communication method, device, equipment and medium |
CN114691051A (en) * | 2022-05-30 | 2022-07-01 | 恒生电子股份有限公司 | Data processing method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110399229A (en) | Communication means, device, system, medium and terminal between process | |
CN106161537B (en) | Method, device and system for processing remote procedure call and electronic equipment | |
CN109597818A (en) | Data-updating method, device, storage medium and equipment | |
CN110535813A (en) | Kernel state protocol stack and User space protocol stack simultaneously deposit treating method and apparatus | |
US9535756B2 (en) | Latency-hiding context management for concurrent distributed tasks in a distributed system | |
US20110252426A1 (en) | Processing batch transactions | |
CN104333533B (en) | A kind of packet zero-copy acquisition methods for industrial control system network | |
CN107256180A (en) | Data processing method, device and terminal | |
US20090150556A1 (en) | Memory to storage communication for hybrid systems | |
CN108064377A (en) | A kind of management method and device of multisystem shared drive | |
US20210234785A1 (en) | Container network interface monitoring | |
CN110995678A (en) | Industrial control network-oriented efficient intrusion detection system | |
CN102971708B (en) | The low-power of multithread programs performs | |
CN110138662A (en) | Session entry processing method, device and multiple nucleus system in multiple nucleus system | |
CN109308170A (en) | A kind of data processing method and device | |
CN104866528B (en) | Multi-platform collecting method and system | |
CN106055078A (en) | Sensor processing method and device of mobile terminal and mobile terminal | |
CN105939308A (en) | Message processing method and device | |
CN109603154A (en) | Interface test method, client, Entrust Server and system | |
CN108632166A (en) | A kind of packet receiving L2 cache method and system based on DPDK | |
CN105579963B (en) | Task Processing Unit, electronic equipment and method | |
CN103312618A (en) | Flow management method based on combination of software and hardware | |
FR2710993A1 (en) | Interconnection method and system for message management in a parallel structured processor network | |
CN117194562A (en) | Data synchronization method and device, electronic equipment and computer readable medium | |
CN110134537A (en) | Session entry timeout treatment method, apparatus and multiple nucleus system in multiple nucleus system |
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 |