CN107992368A - Method for interchanging data and system between a kind of multi-process - Google Patents

Method for interchanging data and system between a kind of multi-process Download PDF

Info

Publication number
CN107992368A
CN107992368A CN201711132105.2A CN201711132105A CN107992368A CN 107992368 A CN107992368 A CN 107992368A CN 201711132105 A CN201711132105 A CN 201711132105A CN 107992368 A CN107992368 A CN 107992368A
Authority
CN
China
Prior art keywords
data
node space
space
node
write
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711132105.2A
Other languages
Chinese (zh)
Inventor
张冬明
靳国庆
包秀国
袁庆升
云晓春
刘洋
王万能
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Computing Technology of CAS
National Computer Network and Information Security Management Center
Original Assignee
Institute of Computing Technology of CAS
National Computer Network and Information Security Management Center
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Computing Technology of CAS, National Computer Network and Information Security Management Center filed Critical Institute of Computing Technology of CAS
Priority to CN201711132105.2A priority Critical patent/CN107992368A/en
Publication of CN107992368A publication Critical patent/CN107992368A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/543User-generated data transfer, e.g. clipboards, dynamic data exchange [DDE], object linking and embedding [OLE]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Abstract

The present invention relates to the method for interchanging data and system between a kind of multi-process, include the use of shared drive and domain name socket mixed architecture exchanges data, and shared drive is divided into N number of node space, data sharing is carried out, and the data in shared drive are synchronized using domain name socket.Since each process uses mutual exclusion lock access identities position before accessed node space, avoid rdma read and write the conflict between memory.The collocation of the flag and mutual exclusion lock of node space uses, so that mutual exclusion between data production process and multiple data consuming process, and can be accessed at the same time between multiple data consuming process with a piece of memory so that data consuming process will not cause because of locking and caused by hydraulic performance decline.

Description

Method for interchanging data and system between a kind of multi-process
Technical field
The present invention relates to information technology field, method for interchanging data and system between more particularly to a kind of multi-process.
Background technology
Data Interchange Technology between the multi-process being present invention is primarily concerned with point in host, is especially suitable between multi-process Big data exchanges.
Common Data Exchange includes the use of pipeline, message format communication, shared drive, socket communication (socket), domain name socket (domainsocket etc.).Data exchange amount between process can use the above when smaller Mode is completed, but when needing to exchange substantial amounts of data between process, these modes can be because processing data bandwidth be high, it is more to take Additional CPU time and the requirement that cannot meet real-time, while the sending action of domain name socket is by the traps of operating system Triggering, and the resource of traps is limited, also limit the treatable maximum bandwidth of which institute.
Shared drive is then that a part of region is marked off in the memory of operating system as two or more process in system The memory being used in conjunction with.This mode make between process data exchange need not be replicated, therefore be adapted to large-scale data Exchange.But the data exchange based on shared drive needs to carry out complicated data simultaneously operating, and the degree of coupling is high between causing process, Any one process goes wrong, other all processes will appear from blocking.Such as the side that data production process passes through shared drive Formula provides data to multiple data consuming process, if one of data consuming process goes wrong, cause cannot be in shared It is insufficient it will cause shared memory space to take data in depositing away in time, ultimately results in data production process and is also stopped, so that Whole processing system is caused to be stopped.
For avoid shared drive indivedual process failures in cause all processes deadlock situation, the present invention propose make Realize that the large-scale data in host between multi-process exchanges with shared drive with mode that socket combines.Specifically, to carry The data exchange efficiency of high socket, the synchronizing information of data is transmitted using domain name socket.Moreover, in domain name socket only Transmit the offset of shared drive, can in once transmitting synchronous multiple data slots, can be greatly decreased to operating system The use of traps resource, reduces demand of the interactive information to bandwidth, improves the efficiency of data exchange between multi-process.This method Not only the characteristics of having make use of shared drive data exchange bandwidth high, but also eliminated using domain name socket between process to internal storage access Coupling caused by deadlock.
The content of the invention
The defects of it is an object of the invention to overcome above-mentioned technology, there is provided a kind of based on shared drive and domain name socket Large-scale data exchange method and system between multi-process in host.
Specifically, the invention discloses the method for interchanging data between a kind of multi-process, including:
Data consuming process starting step, starts multiple data consuming process, and empty to operating system application shared drive Between;
Shared memory space partiting step, starts a data production process, the data production process and the data consumption Process defines Data Management Unit, and the form by the shared memory space according to the Data Management Unit using identical rule N number of node space is divided into, wherein N is positive integer;
First node space selecting step, chooses a certain node space as node space to be written;
Data write step, the data production process access the flag of the node space to be written, if the node to be written is empty Between flag be idle condition, then be set in write state, while the data production process is write to the node space to be written Enter data, by home position be idle condition after the completion of write-in, if the flag of the node space to be written is in read states, put The node space to be written is abandoned, chooses next node space as the node space to be written;
The data write step is called in synchrodata tuple forwarding step, repetition, the number which is produced According to writing successively in N number of node space, and num node space is often write just by domain name socket by synchrodata tuple The data consuming process is sent to, wherein num is the positive integer for being less than N more than 1;
Section point space selecting step, the data consuming process obtain enabled node by parsing the domain name socket Space, and according to the enabled node space, a certain node space is chosen as the node space that continues;
Data reading step, the data consuming process access the flag of the node space that continues, if this continues, node is empty Between flag for idle condition or in read states, then be set in read states, while the data consuming process reads and locates Data in the node space that continues are managed, by home position are idle condition after the completion of processing, the mark of node space if this continues Position is in write state, then abandons the node space that continues, and according to the enabled node space, selection next node space, which is used as, treats Read node space;
Repeat step, the data reading step is called in repetition, until all data consuming process complete the reading of data Take and handle.
Method for interchanging data between the multi-process, wherein the data write step further include, the data production process to this During node space write-in data to be written, if it is former to write direct new data cover with data for the node space to be written Some data.
Method for interchanging data between the multi-process, wherein the data production process access node sky to be written using mutual exclusion lock Between flag;And the data consuming process accesses the flag of the node space that continues using mutual exclusion lock.
The circulation of method for interchanging data between the multi-process, wherein the data production process is write in N number of node space successively Enter data and sent N number of nodal information to data consuming process by domain name socket.
The invention also discloses the data exchange system between a kind of multi-process, including:
Data consuming process starting module, for starting multiple data consuming process, and in sharing to operating system application Deposit space;
Shared memory space division module, for starting a data production process, the data production process and the data Consuming process defines Data Management Unit using identical rule, and by the shared memory space according to the Data Management Unit Form is divided into N number of node space, and wherein N is positive integer;
Module is chosen in first node space, for choosing a certain node space as node space to be written;
Data write. module, for making the data production process access the flag of the node space to be written, if this is to be written The flag of node space is idle condition, then is set in write state, while the data production process is to the node to be written Space writes data, by home position be idle condition after the completion of write-in, if the flag of the node space to be written is in reading shape State, then abandon the node space to be written, chooses next node space as the node space to be written;
Synchrodata tuple sending module, for repeating to call the Data write. module, which is produced Data write successively in N number of node space, and often write num node space just by domain name socket by synchrodata Tuple is sent to the data consuming process, and wherein num is the positive integer for being less than N more than 1;
Module is chosen in section point space, for making the data consuming process parse the domain name socket, obtains available section The space of points, and according to the enabled node space, a certain node space is chosen as the node space that continues;
Data read module, for making the data consuming process access the flag of the node space that continues, if this continues The flag of node space is then set in read states for idle condition or in read states, while the data consuming process is read Take and handle data in the node space that continues, by home position be idle condition after the completion of processing, the node space if this continues Flag be in write state, then abandon the node space that continues, according to the enabled node space, choose next node space As the node space that continues;
Replicated blocks, for repeating to call the data read module, until all data consuming process complete data Reading and processing.
Data exchange system between the multi-process, the wherein Data write. module further include, the data production process to this During node space write-in data to be written, if it is former to write direct new data cover with data for the node space to be written Some data.
Data exchange system between the multi-process, wherein the data production process access node sky to be written using mutual exclusion lock Between flag;And the data consuming process accesses the flag of the node space that continues using mutual exclusion lock.
The circulation of method for interchanging data between the multi-process, wherein the data production process is write in N number of node space successively Enter data and sent N number of nodal information to data consuming process by domain name socket.
Compared with prior art, the advantage of the invention is that:
First, data between multi-process are improved relative to directly using domain name socket to exchange data using shared drive The bandwidth of exchange.Shared drive is divided into N number of node space, improves the service efficiency of shared drive between multi-process.Secondly, Favorable expandability.Communicate due to the use of domain name socket so that large-scale data exchange can between multiple processes in order into Go and be not limited solely between two processes.Meanwhile data production process employs the strategy of directly covering legacy data, even in number In the case of cannot taking data away according to consuming process, data production process is appointed so can write data in the shared drive of annular Keep normal work.Data consuming process can obtain data after recovering normal and work on immediately.Finally, due to each process Mutual exclusion lock access identities position is all used before accessed node space, rdma read is avoided and writes the conflict between memory.Node The collocation of the flag and mutual exclusion lock in space uses, as long as being related to flag rewriting, will use mutual exclusion, first obtain, then discharges, So that mutual exclusion between data production process and multiple data consuming process, and can be accessed at the same time between multiple data consuming process With a piece of memory, though such design increase more data consuming process will not cause because locking and caused by under performance Drop.
Brief description of the drawings
Fig. 1 is data production process flow chart;
Fig. 2 is data consuming process flow
Fig. 3 is the implication tabular drawing of each of flag;
Fig. 4 is annular shared drive schematic diagram when applying for N number of isometric continuous shared memory space.
Embodiment
The invention discloses the method for interchanging data between a kind of multi-process, including:
Data consuming process starting step, starts multiple data consuming process, and empty to operating system application shared drive Between;
Shared memory space partiting step, starts a data production process, the data production process and the data consumption Process defines Data Management Unit, and the form by the shared memory space according to the Data Management Unit using identical rule N number of node space is divided into, wherein N is positive integer;
First node space selecting step, chooses a certain node space as node space to be written;
Data write step, the data production process access the flag of the node space to be written, if the node to be written is empty Between flag be idle condition, then be set in write state, while the data production process is write to the node space to be written Enter data, by home position be idle condition after the completion of write-in, if the flag of the node space to be written is in read states, put The node space to be written is abandoned, chooses next node space as the node space to be written;
The data write step is called in synchrodata tuple forwarding step, repetition, the number which is produced According to writing successively in N number of node space, and num node space is often write just by domain name socket by synchrodata tuple The data consuming process is sent to, wherein num is the positive integer for being less than N more than 1;
Section point space selecting step, the data consuming process obtain enabled node by parsing the domain name socket Space, and according to the enabled node space, a certain node space is chosen as the node space that continues;
Data reading step, the data consuming process access the flag of the node space that continues, if this continues, node is empty Between flag for idle condition or in read states, then be set in read states, while the data consuming process reads and locates Data in the node space that continues are managed, by home position are idle condition after the completion of processing, the mark of node space if this continues Position is in write state, then abandons the node space that continues, and according to the enabled node space, selection next node space, which is used as, treats Read node space;
Repeat step, the data reading step is called in repetition, until all data consuming process complete the reading of data Take and handle.
Method for interchanging data between the multi-process, wherein the data write step further include, the data production process to this During node space write-in data to be written, if it is former to write direct new data cover with data for the node space to be written Some data.
Method for interchanging data between the multi-process, wherein the data production process access node sky to be written using mutual exclusion lock Between flag;And the data consuming process accesses the flag of the node space that continues using mutual exclusion lock.
The circulation of method for interchanging data between the multi-process, wherein the data production process is write in N number of node space successively Enter data and sent N number of nodal information to data consuming process by domain name socket.
Specifically, the present invention is realized by following technical solution:
A. start multiple data consuming process first, be total to from one in multiple data consuming process to operating system application Memory headroom is enjoyed, all data consuming process begin preparing for receiving domain name socket after the completion of application.One number of subsequent start-up According to production process.
B. data production and consumption process defines the structure of Data Management Unit using identical rule, is wrapped in structure Array (memory headrooms of actual storage data) containing mutual exclusion lock, flag flag and actual storage data.The reality of array Size is Block (Block can be sized according to practical application request, such as 5MB, 100MB etc.).By shared memory space Form according to Data Management Unit is divided into the identical node space of N number of size, and N is positive integer.This N number of node space is from 0 Start to finish sequence number in order, the numbering of last node space is N-1.
C. data production process writes data into a node space.Before a node space is write data into, make The flag of the node space is accessed with mutual exclusion lock, if just in reading evidence, i.e., flag is displayed without data consuming process It is 0 to read flag, then being that the current node space of representative is in write state by home position writes data mode, discharges mutual exclusion Lock, then starts to write data into node space.The same mutual exclusion lock that obtains is by flag after data production process writes data It is set to idle condition and then discharges mutual exclusion lock.The data of generation are write in this N number of node space successively along these lines, Num node space is often write just by domain name socket by synchrodata tuple<num,index_1,index_2,…, index_num>Corresponding data consuming process is sent to, each node space for having been written into data is included in synchrodata tuple Numbering.Here num is super ginseng, can be sized according to the frequency of application data exchange, and num is just whole less than N more than 1 Number, while it is less than min (MTU/sizeof (int) -1, N), wherein MTU is the maximum biography that the domain name socket that system is set uses Byte number shared by size (being usually 1500 bytes) wherein sizeof (int) expression integers of defeated unit, uses sizeof (int) so that calculation is independently of different platforms.If data production process finds have data consuming process reading The node spaces of data then this node space of abort operation will be write, next node space is changed into, to avoid conflict. The circulation of data production process writes Data Concurrent successively in this N number of node space and send synchrodata tuple.Such strategy makes N number of node space to logically create an annular region as shown in Figure 4.If node space has been had been written into data Hold, then write direct the original content of new data cover.This N number of node space of such circulate operation.
D. after data consuming process receives domain name socket, the content in domain name socket is write to the buffering of oneself Area.The content of domain name socket is parsed, obtains the numbering of pending each node space.It is first before handling node space data The flag of the node space first is accessed using mutual exclusion lock, is shown if flag if data production process is currently written into data Abandon handling the content of the node space, directly handle the pending node space such as next.If flag is shown as empty It is not busy or in read states, then the data in the node space are read, and handle.Change flag using mutual exclusion lock after being disposed State and discharge mutual exclusion lock.
To allow features described above of the invention and effect to illustrate more clearly understandable, special embodiment below, and coordinate Bright book attached drawing is described in detail below.
Identical node space structure is defined at the same time in data production system A and data consumption system B, C:
Wherein, flag node datas read and write flag, are claimed as char types in example, each process uses reading and writing mark Know each 1, can at most support the data exchange between 4 processes, can be as needed, the data type of the field is changed, with branch Hold more multi-process;Pkt_len is used for recording the size of data of this node space actual storage, and pkt_data [MTU_size] is used Carry out actual storage valid data, pmutex is mutual exclusion lock.
It is now assumed that the scene of a data exchange, including a data production process A and two data consuming process are System B and C.
To the shared drive of operating system application sizeof (_ pkt_node) * N bytes, (N is node to data consumption system B The number in space), obtain the ID and initial address of shared drive.Other systems obtain memory ID and rise in the same way Beginning address.In each system, initial address is stored in (void*) shm, passes through sentence struct_pkt_node*node= (struct_pkt_node*) shm so that node+i can access the node space of serial number i.
The identical structure for being used for domain name socket and sending data is also defined in data production and consumption system:
Wherein pkt_num=NumOfpktPerTime represents that data production system A often writes full NumOfpktPerTime's Node space just sends a domain name socket.node_index
For storing the sequence number of each node space.Sending domain name socket in view of system A call operations system can make Into traps, excessively can frequently packet loss be caused to decline system performance if sending domain name socket, it is excessively slow to cause data again It is not in time for processing also and new data is just write by data production system A erasings, therefore, by testing repeatedly, it is proposed that will NumOfpktPerTime is arranged to 31.31 be not a value fixed all the time, can be adjusted according to actual conditions.To avoid counting According to few abnormal conditions, timeout mechanism can be introduced, after overtime, timely data volume is several at that time by sending to reach preset value According to.
Since data generation system A needs to send domain name socket to data consumption system B, C, therefore needed just in A Beginningization domain name socket simultaneously binds B, the domain name socket addresses of C.
As shown in Figure 1, after completing shared drive and the initialization of domain name socket, instantiation _ pktnode_msg in A systems Structure is msg.Data production system A determines whether that data need to provide and arrives data consumption system, if do not continued Treat, if then starting to write data into each node space.Need to lock before data write-in node space and access the space Flag, read flag according to Fig. 3 and judge the space whether B, C reading, and has system to show in meter reading unavailable, otherwise represent can With, at the same will be available whether reflect a Boolean type variable.According to Fig. 3 by corresponding flag positions if the space can use 1. then flag is unlocked.The code of this process is as follows:
Represent that this node space is unavailable if variable deal_or_not is false, abandon straight to current spatial Connect and next node space is operated.If true, then corresponding content is write in node space, and will actually write In the pkt_len of the size of data write-in node space structure entered.At the same time by the sequence number write-in msg's of this node space In node_index.And then secondary locking operates flag, as Fig. 3 by relevant position 1 and is set to 0.
pthread_mutex_lock(&((node+i)->pmutex));//lock
(node+i)->Flag&=~1;
(node+i)->Flag |=1<<1;
pthread_mutex_unlock(&((node+i)->pmutex));//unlock
If the node space number having been written into is equal to NumOfpktPerTime, structure msg is passed through into domain name set Word is connect to be sent in corresponding data consumption program.
The course of work of data consumption program B, C are as shown in Figure 2.
Similar with system A, B, C use a positive integer application shared drive identical with A, obtain shared drive ID and rise Beginning address (void*) shm.Initialize B, the domain name socket of C and the pointer for applying for a struct_pktnode_msg* type Msg, and itself and char arrays msg_buf are bound together, msg pointers easy to use directly access data.Use header file Recv functions in sys/socket.h receive domain name socket.If do not receive message to continue to wait, after receiving message Information write-in msg_buf buffering areas in domain name socket are realized that code is as follows:
Struct_pktnode_msg*msg=(struct_pktnode_msg*) msg_buf;
NumBytes=recv (sockfd, msg_buf, 1024,0);
Wherein numBytes is the size of data being an actually-received.
Msg- is successively read after receiving data>Node space sequence number in node_index arrays simultaneously is attempted to handle.Read Need to lock the flag for accessing the space before data in node space, read flag, according to Fig. 3 and judge whether the space has System is being write, and represents unavailable writing, and reflects whether representing available in reading or idle condition, while node space can use One Boolean type variable.According to Fig. 3 by corresponding flag positions 1 if the space can use, then flag is unlocked.This process Code it is as follows:
pthread_mutex_unlock(&((node+msg->node_index[i])->pmutex));
The processing to this node space is abandoned if deal_or_not is false, reads next node space Sequence number, deal_or_not are that the data that true is then read in node space are handled.Locked again after the completion of reading to flag into Row operation.So circulation receives message and handles.
It is below system embodiment corresponding with above method embodiment, this implementation system can be mutual with the above embodiment Coordinate and implement.The above-mentioned relevant technical details mentioned in mode of applying are still effective in this implementation system, in order to reduce repetition, this In repeat no more.Correspondingly, the relevant technical details mentioned in this implementation system are also applicable in the above embodiment.
The invention also discloses the data exchange system between a kind of multi-process, including:
Data consuming process starting module, for starting multiple data consuming process, and in sharing to operating system application Deposit space;
Shared memory space division module, for starting a data production process, the data production process and the data Consuming process defines Data Management Unit using identical rule, and by the shared memory space according to the Data Management Unit Form is divided into N number of node space, and wherein N is positive integer;
Module is chosen in first node space, for choosing a certain node space as node space to be written;
Data write. module, for making the data production process access the flag of the node space to be written, if this is to be written The flag of node space is idle condition, then is set in write state, while the data production process is to the node to be written Space writes data, by home position be idle condition after the completion of write-in, if the flag of the node space to be written is in reading shape State, then abandon the node space to be written, chooses next node space as the node space to be written;
Synchrodata tuple sending module, for repeating to call the Data write. module, which is produced Data write successively in N number of node space, and often write num node space just by domain name socket by synchrodata Tuple is sent to the data consuming process, and wherein num is the positive integer for being less than N more than 1;
Module is chosen in section point space, for making the data consuming process parse the domain name socket, obtains available section The space of points, and according to the enabled node space, a certain node space is chosen as the node space that continues;
Data read module, for making the data consuming process access the flag of the node space that continues, if this continues The flag of node space is then set in read states for idle condition or in read states, while the data consuming process is read Take and handle data in the node space that continues, by home position be idle condition after the completion of processing, the node space if this continues Flag be in write state, then abandon the node space that continues, according to the enabled node space, choose next node space As the node space that continues;
Replicated blocks, for repeating to call the data read module, until all data consuming process complete data Reading and processing.
Data exchange system between the multi-process, the wherein Data write. module further include, the data production process to this During node space write-in data to be written, if it is former to write direct new data cover with data for the node space to be written Some data.
Data exchange system between the multi-process, wherein the data production process access node sky to be written using mutual exclusion lock Between flag;And the data consuming process accesses the flag of the node space that continues using mutual exclusion lock.
The circulation of method for interchanging data between the multi-process, wherein the data production process is write in N number of node space successively Enter data and sent N number of nodal information to data consuming process by domain name socket.
Although the present invention is disclosed with above-described embodiment, specific embodiment only to explain the present invention, is not used to limit The present invention, any those skilled in the art of the present technique, without departing from the spirit and scope of the invention, can make the change and complete of some It is kind, therefore the scope of the present invention is subject to claims.

Claims (10)

  1. A kind of 1. method for interchanging data between multi-process, it is characterised in that including:
    Data consuming process starting step, starts multiple data consuming process, and to operating system application shared memory space;
    Shared memory space partiting step, starts a data production process, the data production process and the data consuming process Data Management Unit is defined using identical rule, and the shared memory space is divided according to the form of the Data Management Unit For N number of node space, wherein N is positive integer;
    First node space selecting step, chooses a certain node space as node space to be written;
    Data write step, the data production process access the flag of the node space to be written, if the node space to be written Flag is idle condition, then is set in write state, while the data production process writes number to the node space to be written According to by home position being idle condition after the completion of write-in, if the flag of the node space to be written is in read states, abandon this Node space to be written, chooses next node space as the node space to be written;
    Synchrodata tuple forwarding step, repetition call the data write step, by the data production process produce data according to In the secondary N number of node space of write-in, and often write num node space and just sent synchrodata tuple by domain name socket To the data consuming process, wherein num is the positive integer for being less than N more than 1;
    Section point space selecting step, the data consuming process obtain enabled node space by parsing the domain name socket, And according to the enabled node space, a certain node space is chosen as the node space that continues;
    Data reading step, the data consuming process access the flag of the node space that continues, the node space if this continues Flag is then set in read states, while the data consuming process reads and handles this for idle condition or in read states Continue data in node space, by home position is idle condition after the completion of processing, if this continues, the flag of node space is In write state, then the node space that continues is abandoned, according to the enabled node space, choose next node space as the section that continues The space of points;
    Repeat step, repetition call the data reading step, until all data consuming process complete data reading and Processing.
  2. 2. the method for interchanging data between multi-process as claimed in claim 1, it is characterised in that the data write step is also wrapped Include, when the data production process is to node space to be written write-in data, if the node space to be written with data, directly Connect and write the new original data of data cover.
  3. 3. the method for interchanging data between multi-process as claimed in claim 1 or 2, it is characterised in that the data production process makes The flag of the node space to be written is accessed with mutual exclusion lock;And the data consuming process accesses the node sky that continues using mutual exclusion lock Between flag.
  4. 4. the method for interchanging data between multi-process as claimed in claim 3, it is characterised in that the data production process circulation according to It is secondary that data are write in N number of node space and are sent N number of nodal information to data consuming process by domain name socket.
  5. 5. the method for interchanging data between multi-process as claimed in claim 1 or 2, it is characterised in that the data production process follows Ring writes data in N number of node space and is sent N number of nodal information to data consuming process by domain name socket successively.
  6. A kind of 6. data exchange system between multi-process, it is characterised in that including:
    Data consuming process starting module, for starting multiple data consuming process, and it is empty to operating system application shared drive Between;
    Shared memory space division module, for starting a data production process, the data production process and the data consumption Process defines Data Management Unit, and the form by the shared memory space according to the Data Management Unit using identical rule N number of node space is divided into, wherein N is positive integer;
    Module is chosen in first node space, for choosing a certain node space as node space to be written;
    Data write. module, for making the data production process access the flag of the node space to be written, if the node to be written The flag in space is idle condition, then is set in write state, while the data production process is to the node space to be written Write data, by home position be idle condition after the completion of write-in, if the flag of the node space to be written in read states, The node space to be written is abandoned, chooses next node space as the node space to be written;
    Synchrodata tuple sending module, for repeating to call the Data write. module, the number which is produced According to writing successively in N number of node space, and num node space is often write just by domain name socket by synchrodata tuple The data consuming process is sent to, wherein num is the positive integer for being less than N more than 1;
    Module is chosen in section point space, for making the data consuming process parse the domain name socket, obtains enabled node sky Between, and according to the enabled node space, a certain node space is chosen as the node space that continues;
    Data read module, for making the data consuming process access the flag of the node space that continues, the node if this continues The flag in space is then set in read states for idle condition or in read states, while the data consuming process is read simultaneously Data in the node space that continues are handled, by home position are idle condition after the completion of processing, the mark of node space if this continues It is in write state to know position, then abandons the node space that continues, and according to the enabled node space, chooses next node space conduct Continue node space;
    Replicated blocks, for repeating to call the data read module, until all data consuming process complete the reading of data Take and handle.
  7. 7. the data exchange system between multi-process as claimed in claim 6, it is characterised in that the Data write. module also wraps Include, when the data production process is to node space to be written write-in data, if the node space to be written with data, directly Connect and write the new original data of data cover.
  8. 8. the data exchange system between multi-process as claimed in claims 6 or 7, it is characterised in that the data production process makes The flag of the node space to be written is accessed with mutual exclusion lock;And the data consuming process accesses the node sky that continues using mutual exclusion lock Between flag.
  9. 9. the method for interchanging data between multi-process as claimed in claim 8, it is characterised in that the data production process circulation according to It is secondary that data are write in N number of node space and are sent N number of nodal information to data consuming process by domain name socket.
  10. 10. the data exchange system between multi-process as claimed in claim 7 or 8, it is characterised in that the data production process follows Ring writes data in N number of node space and is sent N number of nodal information to data consuming process by domain name socket successively.
CN201711132105.2A 2017-11-15 2017-11-15 Method for interchanging data and system between a kind of multi-process Pending CN107992368A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711132105.2A CN107992368A (en) 2017-11-15 2017-11-15 Method for interchanging data and system between a kind of multi-process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711132105.2A CN107992368A (en) 2017-11-15 2017-11-15 Method for interchanging data and system between a kind of multi-process

Publications (1)

Publication Number Publication Date
CN107992368A true CN107992368A (en) 2018-05-04

Family

ID=62030896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711132105.2A Pending CN107992368A (en) 2017-11-15 2017-11-15 Method for interchanging data and system between a kind of multi-process

Country Status (1)

Country Link
CN (1) CN107992368A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508241A (en) * 2018-11-20 2019-03-22 中国电子科技集团公司第五十四研究所 A kind of Data Exchange method
CN109857698A (en) * 2019-02-26 2019-06-07 重庆零壹空间航天科技有限公司 A kind of rocket flight data processing method, device
CN109947575A (en) * 2019-03-21 2019-06-28 恒生电子股份有限公司 Locking, method for releasing and the related system of Read-Write Locks
CN112631768A (en) * 2020-11-23 2021-04-09 北京思特奇信息技术股份有限公司 Resource sharing method and system based on asynchronous mechanism
CN113132065A (en) * 2019-12-30 2021-07-16 西安诺瓦星云科技股份有限公司 Data communication method, device and system, storage medium and video processing equipment
CN115113931A (en) * 2022-07-22 2022-09-27 瀚博半导体(上海)有限公司 Data processing system, method, artificial intelligence chip, electronic device and medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8271336B2 (en) * 1999-11-22 2012-09-18 Accenture Global Services Gmbh Increased visibility during order management in a network-based supply chain environment
CN103049245A (en) * 2012-10-25 2013-04-17 浪潮电子信息产业股份有限公司 Software performance optimization method based on central processing unit (CPU) multi-core platform
CN103218176A (en) * 2013-04-02 2013-07-24 中国科学院信息工程研究所 Data processing method and device
CN103414582A (en) * 2013-07-26 2013-11-27 北京星网锐捷网络技术有限公司 Method and device for synchronizing main process and standby process and network device
CN103455380A (en) * 2012-06-05 2013-12-18 上海斐讯数据通信技术有限公司 Multi-process communication system and establishment and communication method thereof
CN104503734A (en) * 2014-12-31 2015-04-08 北京神舟航天软件技术有限公司 Kahn-based process network program parallel framework extraction technique
US20160196131A1 (en) * 2014-07-07 2016-07-07 Symphony Teleca Corporation Remote Embedded Device Update Platform Apparatuses, Methods and Systems
CN106126359A (en) * 2016-08-25 2016-11-16 成都交大光芒科技股份有限公司 The rapid transmission method of process data sharing

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8271336B2 (en) * 1999-11-22 2012-09-18 Accenture Global Services Gmbh Increased visibility during order management in a network-based supply chain environment
CN103455380A (en) * 2012-06-05 2013-12-18 上海斐讯数据通信技术有限公司 Multi-process communication system and establishment and communication method thereof
CN103049245A (en) * 2012-10-25 2013-04-17 浪潮电子信息产业股份有限公司 Software performance optimization method based on central processing unit (CPU) multi-core platform
CN103218176A (en) * 2013-04-02 2013-07-24 中国科学院信息工程研究所 Data processing method and device
CN103414582A (en) * 2013-07-26 2013-11-27 北京星网锐捷网络技术有限公司 Method and device for synchronizing main process and standby process and network device
US20160196131A1 (en) * 2014-07-07 2016-07-07 Symphony Teleca Corporation Remote Embedded Device Update Platform Apparatuses, Methods and Systems
CN104503734A (en) * 2014-12-31 2015-04-08 北京神舟航天软件技术有限公司 Kahn-based process network program parallel framework extraction technique
CN106126359A (en) * 2016-08-25 2016-11-16 成都交大光芒科技股份有限公司 The rapid transmission method of process data sharing

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508241A (en) * 2018-11-20 2019-03-22 中国电子科技集团公司第五十四研究所 A kind of Data Exchange method
CN109508241B (en) * 2018-11-20 2021-04-20 中国电子科技集团公司第五十四研究所 Interprocess data exchange method
CN109857698A (en) * 2019-02-26 2019-06-07 重庆零壹空间航天科技有限公司 A kind of rocket flight data processing method, device
CN109947575A (en) * 2019-03-21 2019-06-28 恒生电子股份有限公司 Locking, method for releasing and the related system of Read-Write Locks
CN113132065A (en) * 2019-12-30 2021-07-16 西安诺瓦星云科技股份有限公司 Data communication method, device and system, storage medium and video processing equipment
CN112631768A (en) * 2020-11-23 2021-04-09 北京思特奇信息技术股份有限公司 Resource sharing method and system based on asynchronous mechanism
CN115113931A (en) * 2022-07-22 2022-09-27 瀚博半导体(上海)有限公司 Data processing system, method, artificial intelligence chip, electronic device and medium
CN115113931B (en) * 2022-07-22 2023-02-14 瀚博半导体(上海)有限公司 Data processing system, method, artificial intelligence chip, electronic device and medium

Similar Documents

Publication Publication Date Title
CN107992368A (en) Method for interchanging data and system between a kind of multi-process
JP4334901B2 (en) Computer processing system and processing method executed by computer
JP4489399B2 (en) Data processing method and data processing system in processor
JP3696563B2 (en) Computer processor and processing device
JP3687990B2 (en) Memory access mechanism
US8478982B2 (en) Media access control security management in physical layer
JP4768386B2 (en) System and apparatus having interface device capable of data communication with external device
JP4499420B2 (en) Supercharge message exchange device
JP5635521B2 (en) Method and system for improving latency and reliability of serial port memory communication
US4480304A (en) Method and means for the retention of locks across system, subsystem, and communication failures in a multiprocessing, multiprogramming, shared data environment
US5418913A (en) System of two-way communication between processors using a single queue partitioned with pointers and limited overwrite privileges
CN112948318B (en) RDMA-based data transmission method and device under Linux operating system
CN105183662B (en) Storage architecture on a kind of Distributed sharing piece of no cache consistency protocols
CN104346317B (en) Shared resource access method and device
CN111400307B (en) Persistent hash table access system supporting remote concurrent access
CN104699631A (en) Storage device and fetching method for multilayered cooperation and sharing in GPDSP (General-Purpose Digital Signal Processor)
JP2003271570A (en) Data processing method
US20150296018A1 (en) System for the management of out-of-order traffic in an interconnect network and corresponding method and integrated circuit
CN100458790C (en) Method and system for access data base
CN113032162B (en) Multi-process communication method based on shared memory backup mechanism
CN103218337A (en) SoC (System on Chip) and method for realizing communication between master modules and between slave modules based on wishbone bus
KR100895536B1 (en) Data transfer mechanism
US7035956B2 (en) Transmission control circuit, reception control circuit, communications control circuit, and communications control unit
US11385900B2 (en) Accessing queue data
US6708258B1 (en) Computer system for eliminating memory read-modify-write operations during packet transfers

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