CN103425518A - Cross-process data transmission method and cross-process data transmission device - Google Patents

Cross-process data transmission method and cross-process data transmission device Download PDF

Info

Publication number
CN103425518A
CN103425518A CN2012101513585A CN201210151358A CN103425518A CN 103425518 A CN103425518 A CN 103425518A CN 2012101513585 A CN2012101513585 A CN 2012101513585A CN 201210151358 A CN201210151358 A CN 201210151358A CN 103425518 A CN103425518 A CN 103425518A
Authority
CN
China
Prior art keywords
data
pipeline
internal memory
pointer
reference position
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012101513585A
Other languages
Chinese (zh)
Other versions
CN103425518B (en
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.)
Shenzhen Tencent Computer Systems Co Ltd
Original Assignee
Shenzhen Tencent Computer Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Tencent Computer Systems Co Ltd filed Critical Shenzhen Tencent Computer Systems Co Ltd
Priority to CN201210151358.5A priority Critical patent/CN103425518B/en
Publication of CN103425518A publication Critical patent/CN103425518A/en
Application granted granted Critical
Publication of CN103425518B publication Critical patent/CN103425518B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention provides a cross-process data transmission method and a cross-process data transmission device applicable to the field of data communication. The method includes copying data into a memory pipeline by a first process, acquiring pipeline pointers pointing to initial positions of the data in the memory pipeline by a second process, and decoding the data into structural bodies of the second process according to the pointer. According to the method, after the first process copies the data into the memory pipeline, the second process acquires the pipeline pointers indicating the initial positions of the data in the memory pipeline, and the data can be positioned through the pipeline pointers for data decoding when the data are processed. Compared with existing pipeline communication, the method and the device have the advantages that two times of data copying are decreased, and accordingly processing performance of communication programs of the processes is further improved.

Description

The method of data transmission and device between a kind of process
Technical field
The invention belongs to data communication field, relate in particular to method and the device of data transmission between a kind of process.
Background technology
The data copy is an operation with consuming performance more consuming time in program module always, how to reduce the data copy and can improve efficiency of code execution under various scene, and be the target that code developer is pursued always.For the data communication between process, because different processes operates in different separately memory headrooms, a side can't perception for modification the opposing party of variable.Therefore, the information transmission between process can not directly be carried out by variable or other data structure, can only complete by interprocess communication.
Pipeline communication is a kind of concrete implementation of process communication, and pipeline (internal memory pipeline) is a special file that connects the read-write process, and the permission process is pressed first-in first-out and transmitted data, also can make the Process Synchronization executable operations.The transmission process is sent into pipeline to mass data with the character stream form, and receiving process receives data from pipeline, sends process and receiving process here and is divided into and is called the first process and the second process.
Before the data that the second process need to be used the first process to send, the first process need to copy data in the internal memory pipeline, the second process copies out data again, in addition, the second process supplies next step logical operation again through once copying data decode in structure, whole process need carries out three secondary data copies, must need extra performance consumption.
Summary of the invention
In view of the above problems, the invention provides data transmission method between a kind of process, being intended to solve between existing process needs repeatedly the technical matters of data copy in data transmission procedure, thereby has improved the routine processes performance.
The present invention is achieved in that data transmission method between a kind of process, and described method comprises the steps:
The first process copies data in the internal memory pipeline to;
The second process is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline;
According to described pointer, decode described data in the structure of described the second process.
Further, in copying data to the internal memory pipeline, the first process also comprises the steps: after step
Judge that whether described data are Coutinuous store in the internal memory pipeline, if be false, copy described data in the second proceeding internal memory to.
Further, the first process also comprises the steps: before copying in the internal memory pipeline by data
Raw data is obtained after serializing to described data, the data after serializing exist with the form of character stream.。
Further, described according to described pointer, the described data of decoding comprise to step in the structure of described the second process:
The second process is searched the reference position of each structure data that comprise in described data, and preserves the pointer that points to these positions.
Another object of the present invention is to provide data transmission device between a kind of process, this device has reduced the data copy and has obtained process, and described device comprises:
Data copy module, copy data to the internal memory pipeline for the first process;
The pointer acquisition module, the second process is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline;
The data decode module, according to described pointer, decode described data in the structure of described the second process.
Further, described device also comprises:
Whether the data judge module is Coutinuous store for judging described data at the internal memory pipeline.
The direct copying module, for copying described data to second proceeding internal memory when described data are not Coutinuous store.
Further, described device also comprises:
The serializing module, for raw data being obtained after serializing to described data, the data after serializing exist with the form of character stream.
Described data decode module is searched the reference position of each structure data that comprise in described data by the second process, and preserves the pointer that points to these positions and carry out data decode.
The beneficial effect of the embodiment of the present invention is: the invention provides data transmission method and device between a kind of process, in described method, after the first process copies in the internal memory pipeline by data, the second process has been obtained the pipeline pointer that means described data reference position in the internal memory pipeline, just can navigate to these data by this pipeline pointer when deal with data, the embodiment of the present invention is compared existing pipeline communication and has been reduced by two secondary data copies, thereby can further improve the handling property of process communication program.
The accompanying drawing explanation
Fig. 1 is the process flow diagram of data transmission method between a kind of process of providing of first embodiment of the invention;
Fig. 2 is the process flow diagram of data transmission method between a kind of process of providing of second embodiment of the invention;
Fig. 3 is data decode schematic diagram in prior art;
Fig. 4 is the data decode schematic diagram that second embodiment of the invention provides;
Fig. 5 is the block diagram of data transmission device between a kind of process of providing of third embodiment of the invention;
Fig. 6 is the block diagram of data transmission device between a kind of process of providing of fourth embodiment of the invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
The embodiment of the present invention is mainly the optimization for data transmission procedure between process, has reduced the number of times of data copy in the pipeline communication process.
For technical solutions according to the invention are described, below by specific embodiment, describe.
Embodiment mono-:
Fig. 1 shows the flow process of data transmission method between a kind of process that first embodiment of the invention provides, and only shows for convenience of explanation the part relevant to the embodiment of the present invention.
In step S101, the first process copies data in the internal memory pipeline to.
At first this step will need the data of transmission to copy in the internal memory pipeline, and described internal memory pipeline essence is a shared file, can realize by means of file system mechanism, comprise pipe file establishment, open, close and read and write.The first process and the second process all must be able to perceive the other side's existence before carrying out data communication, if the other side does not exist, just there is no need to internal memory pipeline copies data.
Common described data are the data after serializing, and serializing is the process of the form that can store or transmit that the status information of object is converted to.The first process needed Data Serialization to be saved in local internal memory before copies data, data after serializing are kept in internal memory with the form of character stream, communication is two send out can both identification character stream data layout, also can carry out data transmission even therefore the development platform of both sides' process is different, simultaneously, because data are preserved with the character stream form, therefore also can improve communications security.
In step S102, the second process is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline.
This step is core of the present invention place, in this step, the second process copies in local internal memory without the corresponding data that will be kept in the internal memory pipeline, increased a pipeline pointer that points to described data reference position in the internal memory pipeline, because described internal memory pipeline essence is one section memory headroom, the first process just can obtain the start address of copies data when copies data, the second process just can navigate to described data by the pipeline pointer that points to this address, described data length is two distances between adjacent pipeline pointer, thereby can further to these data, be operated.Therefore, this step is by preserving the data of a pipeline pointer that points to described data in having replaced in existing copy internal memory pipeline.
In step S103, according to described pointer, decode described data in the structure of described the second process.
Navigate to this data by described pipeline pointer, the second process is searched the reference position of each structure data that comprise in these data again, then preserves the structure pointer that points to these positions and can realize data decode.In the present embodiment, using described structure pointer as decoded result, be kept in the message result, the data decode of the present embodiment only can relate to the copy of pointer, can significantly improve the program execution performance.
Embodiment bis-:
Fig. 2 shows the flow process of data transmission method between a kind of process that second embodiment of the invention provides, and only shows for convenience of explanation the part relevant to the embodiment of the present invention.
In step S201, raw data obtains described data after serializing, and the data after serializing exist with the form of character stream.
Usually raw data need to have obtain described data after serializing, and serializing is the process of the form that can store or transmit that the status information of object is converted to.The first process needed Data Serialization to be saved in local internal memory before copies data, data after serializing are kept in internal memory with the form of character stream, communication is two send out can both identification character stream data layout, also can carry out data transmission even therefore the development platform of both sides' process is different, simultaneously, because data are preserved with the character stream form, therefore also can improve communications security.
In step S202, the first process copies data in the internal memory pipeline to.This step is identical with the step S101 of embodiment mono-, repeats no more.
In step S203, judge whether described data are Coutinuous store in the internal memory pipeline.
In step S204, if described data are not Coutinuous store, described data are copied in the second proceeding internal memory.
In embodiments of the present invention, because the internal memory pipeline is a round-robin queue, data may not be to be arranged in a continuous storage space, now need to adopt existing data copying method data to be copied in the internal memory of the second process, because now described data may be positioned at the two ends of queue, pipeline pointer by described sensing data reference position can't find complete data, but this situation probability of occurrence is smaller, described is that data big city is stored in continuous space, only after turning around, internal memory pipeline wheel just there will be once this situation, so execution efficiency of the signal procedure that can not influence the course on the whole.
In step S205, if described data are Coutinuous store, the second process is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline.
In embodiments of the present invention, considered that data may not be Coutinuous stores, directly obtained the pipeline pointer that points to the data reference position and possibly can't navigate to all data, therefore after the specified data Coutinuous store, carried out again this step.After getting the pipeline pointer, the second process can be carried out follow-up logical operation, jumps out current data after being disposed after end.
In step S206, the second process is searched the reference position of each structure data that comprise in described data, and preserves the pointer that points to these positions.This step has realized carrying out according to the pipeline pointer process of data decode, because the data of transmitting between the first process and the second process are the data after serializing, these data exist with the form of character stream, and the second process needs character stream is carried out to the unserializing decoding before using these data.In the prior art, the process of data decode is to convert corresponding data in the middle of copying the data after serializing to a structure, such as the segment value in structure, property value etc.As Fig. 3 shows the process of data decode in prior art, one piece of data in buffer memory in figure is decoded, carry out data-switching in the middle of need to structure corresponding to each prototype structure volume data comprised in this segment data copying to, three structures are arranged in figure, and this structure can be a structured message.Obviously, also need in the available data decoding technique to carry out a secondary data copy, can consume performance equally.
As concrete implementation, as Fig. 4 shows a kind of data decode process that the invention process provides, be provided with three structure pointers in figure, be respectively used to point to the reference position of corresponding construction volume data, using described structure pointer as decoded result, be kept in the message result, the data decode of the present embodiment only can relate to the copy of pointer, can significantly improve the program execution performance.
In embodiments of the present invention, data to be decoded may be kept in the internal memory of the second process or be kept in the internal memory pipeline, if described data have copied in the internal memory of the second process, the second process is directly searched the reference position of each structure data that comprise in described data, preserves these pointers and realizes data decode; If described data are arranged in described internal memory pipeline, by described pipeline pointer, navigate to this data, the second process is searched the reference position of each structure data that comprise in these data again, then preserves these pointers and can realize data decode.
Embodiment tri-:
Fig. 5 shows the block diagram of data transmission device between a kind of process that third embodiment of the invention provides, and only shows for convenience of explanation the part relevant to the embodiment of the present invention.
Data transmission device between a kind of process, described device comprises:
Data copy module 501, copy data to the internal memory pipeline for the first process;
Pointer acquisition module 502, obtain and point to the pipeline pointer of described data in internal memory pipeline reference position for the second process;
Data decode module 503, according to described pointer, decode described data in the structure of described the second process.
In embodiments of the present invention, data copy module controls the first process copies data in the internal memory pipeline to, the pointer acquisition module is controlled the second process and is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline, the second process copies in local internal memory without the corresponding data that will be kept in the internal memory pipeline, increased a pipeline pointer that points to described data reference position in the internal memory pipeline, because described internal memory pipeline essence is one section memory headroom, the first process just can obtain the start address of copies data when copies data, the second process just can navigate to described data by the pipeline pointer that points to this address, described data length is two distances between adjacent pipeline pointer, thereby can further to these data, be operated.The data decode module navigates to this data by described pipeline pointer, and the second process is searched the reference position of each structure data that comprise in these data again, then preserves the structure pointer that points to these positions and can realize data decode.In the present embodiment, using described structure pointer as decoded result, be kept in the message result, the data decode of the present embodiment only can relate to the copy of pointer, can significantly improve the program execution performance.
Embodiment tetra-:
Fig. 6 shows the block diagram of data transmission device between a kind of process that fourth embodiment of the invention provides, and only shows for convenience of explanation the part relevant to the embodiment of the present invention.
Serializing module 601, for raw data being obtained after serializing to described data, the data after serializing exist with the form of character stream;
Data copy module 602, copy data to the internal memory pipeline for the first process;
Whether data judge module 603 is Coutinuous store for judging described data at the internal memory pipeline;
Direct copying module 604, for not being Coutinuous store when data, copy described data in the second proceeding internal memory to.
Pointer acquisition module 605, if be Coutinuous store for described data, the second process is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline.
Data decode module 606, according to described pointer, decode described data in the structure of described the second process.
In embodiments of the present invention, because the internal memory pipeline is round-robin queue, therefore the data that are stored in the internal memory pipeline may not be Coutinuous stores, the pipeline pointer that points to the data first address can't navigate to complete data, therefore before obtaining the pipeline pointer, the data judge module need to judge whether described data are Coutinuous store, if set up, the pointer acquisition module just removes to obtain the pipeline pointer that points to the data reference position, otherwise according to the direct copying module, data are copied in the second process, because data are not that the probability of Coutinuous store is less, can not affect on the whole the execution efficiency of program.
In embodiments of the present invention, after the second process gets described pipeline address or the described data of the second process and copies local internal memory to, before carrying out usage data, need to carry out data decode, because the character stream that described data normally obtain after serializing.The available data decoding technique is that related data is copied in the middle of corresponding structure, or needs a secondary data copy, must consume extra performance.In the present invention, as concrete implementation, the data decode module is searched the reference position of each structure data that comprise in described data by the second process, and preserve the pointer that points to these positions and realize data decode, to like this pointer copy have been replaced to the data copy, further improve the routine processes performance.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.

Claims (10)

1. data transmission method between a process, is characterized in that, described method comprises the steps:
The first process copies data in the internal memory pipeline to;
The second process is obtained the pipeline pointer that points to described data reference position in the internal memory pipeline;
According to described pointer, decode described data in the structure of described the second process.
2. data transmission method between a kind of process as claimed in claim 1, is characterized in that, in the first process copies data to the internal memory pipeline, after step, also comprises the steps:
Judge that whether described data are Coutinuous store in the internal memory pipeline, if be false, copy described data in the second proceeding internal memory to.
3. data transmission method between a kind of process as claimed in claim 1 or 2, is characterized in that, also comprises the steps: before in the first process copies data to the internal memory pipeline
Raw data is obtained after serializing to described data, the data after serializing exist with the form of character stream.
4. data transmission method between a kind of process as claimed in claim 1 or 2, is characterized in that, described according to described pointer, and the described data of decoding comprise to step in the structure of described the second process:
The second process is searched the reference position of each structure data that comprise in described data, and preserves the pointer that points to these positions.
5. data transmission method between a kind of process as claimed in claim 4, is characterized in that, if described data have copied in the internal memory of the second process, the second process is directly searched the reference position of each structure data that comprise in described data; If described data are arranged in described internal memory pipeline, by described pipeline pointer, navigate to this data, the second process is searched the reference position of each structure data that comprise in these data again.
6. data transmission device between a process, is characterized in that, described device comprises:
Data copy module, copy data to the internal memory pipeline for the first process;
The pointer acquisition module, obtain and point to the pipeline pointer of described data in internal memory pipeline reference position for the second process;
The data decode module, according to described pointer, decode described data in the structure of described the second process.
7. data transmission device between a kind of process as claimed in claim 6, is characterized in that, described device also comprises:
Whether the data judge module is Coutinuous store for judging described data at the internal memory pipeline;
The direct copying module, for not being Coutinuous store when data, copy described data in the second proceeding internal memory to.
8. data transmission device between a kind of process as described as claim 6 or 7, is characterized in that, described device also comprises:
The serializing module, for raw data being obtained after serializing to described data, the data after serializing exist with the form of character stream.
9. data transmission device between a kind of process as described as claim 6 or 7 is characterized in that:
Described data decode module, search the reference position of each structure data that comprise in described data by the second process, and preserve the pointer that points to these positions and carry out data decode.
10. data transmission device between a kind of process as claimed in claim 9, is characterized in that, if described data have copied in the internal memory of the second process, the second process is directly searched the reference position of each structure data that comprise in described data; If described data are arranged in described internal memory pipeline, by described pipeline pointer, navigate to this data, the second process is searched the reference position of each structure data that comprise in these data again.
CN201210151358.5A 2012-05-16 2012-05-16 A kind of method and device of inter-process data transmission Active CN103425518B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210151358.5A CN103425518B (en) 2012-05-16 2012-05-16 A kind of method and device of inter-process data transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210151358.5A CN103425518B (en) 2012-05-16 2012-05-16 A kind of method and device of inter-process data transmission

Publications (2)

Publication Number Publication Date
CN103425518A true CN103425518A (en) 2013-12-04
CN103425518B CN103425518B (en) 2016-08-17

Family

ID=49650312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210151358.5A Active CN103425518B (en) 2012-05-16 2012-05-16 A kind of method and device of inter-process data transmission

Country Status (1)

Country Link
CN (1) CN103425518B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105068878A (en) * 2015-07-30 2015-11-18 汉柏科技有限公司 Inter-process communication method and system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5799314A (en) * 1995-06-30 1998-08-25 Sun Microsystems, Inc. System and method of controlling mapping of data buffers for heterogenous programs in digital computer system
CN1924817A (en) * 2006-09-15 2007-03-07 华为技术有限公司 Data structure transmission method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5799314A (en) * 1995-06-30 1998-08-25 Sun Microsystems, Inc. System and method of controlling mapping of data buffers for heterogenous programs in digital computer system
CN1924817A (en) * 2006-09-15 2007-03-07 华为技术有限公司 Data structure transmission method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105068878A (en) * 2015-07-30 2015-11-18 汉柏科技有限公司 Inter-process communication method and system

Also Published As

Publication number Publication date
CN103425518B (en) 2016-08-17

Similar Documents

Publication Publication Date Title
CN110647480B (en) Data processing method, remote direct access network card and equipment
KR101710116B1 (en) Processor, Apparatus and Method for memory management
US10257304B2 (en) System and method for mobile platform cache using mobile devices
US8832666B2 (en) Dynamic instrumentation
CN108431831B (en) Cyclic code processor optimization
US11050814B2 (en) Method, device and vehicle for message deduplication
CN103853620A (en) Method, device and system for mutually communicating between many-core processor programs
CN103218329A (en) Digital signal processing data transfer
US20210334234A1 (en) Distributed graphics processor unit architecture
CN103064748A (en) Method for processing communication among multiple processes in Linux system
EP1938173A2 (en) Method and apparatus for sharing memory in a multiprocessor system
KR101576067B1 (en) Method of handling korean variable message format message for embedded system and device thereof
WO2008118522A1 (en) Distributed processing system and method
CN115640052A (en) Multi-core multi-pipeline parallel execution optimization method for graphics processor
US11190620B2 (en) Methods and electronic devices for data transmission and reception
CN110377339B (en) Long-delay instruction processing apparatus, method, and device, and readable storage medium
CN114399035A (en) Method for transferring data, direct memory access device and computer system
US20200034195A1 (en) Network-related performance for gpus
CN103425518A (en) Cross-process data transmission method and cross-process data transmission device
US20210271475A1 (en) Caching device, cache, system, method and apparatus for processing data, and medium
US9965344B2 (en) Method and apparatus for transmitting data in a robot operating system
US9311225B2 (en) DMA channels
US8412862B2 (en) Direct memory access transfer efficiency
CN112418389A (en) Data processing method and device, electronic equipment and computer readable storage medium
US8706923B2 (en) Methods and systems for direct memory access (DMA) in-flight status

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant