CN101504617B - Data transmitting method and device based on processor sharing internal memory - Google Patents
Data transmitting method and device based on processor sharing internal memory Download PDFInfo
- Publication number
- CN101504617B CN101504617B CN2009101278032A CN200910127803A CN101504617B CN 101504617 B CN101504617 B CN 101504617B CN 2009101278032 A CN2009101278032 A CN 2009101278032A CN 200910127803 A CN200910127803 A CN 200910127803A CN 101504617 B CN101504617 B CN 101504617B
- Authority
- CN
- China
- Prior art keywords
- message
- pointer
- message header
- data
- father
- 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.)
- Active
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides a method and a device for sending/receiving data on the basis of processor shared memory, wherein the data-sending method based on processor shared memory comprises the following steps of writing data into at least one memory block in a shared memory pool of a processor, generating a memory block pointer according to the address information of the memory block and sending the memory block pointer to a receiver. The invention also provides a data-sending device based on processor shared memory, as well as a method and a device for receiving data on the basis of processor shared memory. As the invention adopts a technical means of transmitting the memory block pointer instead of message data, the invention has the advantages of solving the problem that the message data is repeatedly copied during message transmission and achieving the technical effect of reducing overhead for both memory and time.
Description
Technical field
The present invention relates to field of processors, relate in particular to a kind of data transmission method for uplink and device based on processor sharing internal memory.
Background technology
At processor system, especially in the multiprocessing system, the message transmission concerns because of can be good at reflection " producer-consumer ", and has portable strong advantage, frequent main mode as intertask communication and inter-processor communication.(Message Passing Interface Forum MPIF) has formulated message passing interface (Message Passing Interface, MPI) standard for this communication mode in message passing interface forum.In some application scenarios, not only there is point-to-point message transmission, be that message is sent to a recipient by a sender, also there is the point-to-multipoint information broadcast, be that message is sent to a plurality of recipients by a sender, and forwarding message, sent to other recipient after promptly message is received by a recipient again by it.The DLL (dynamic link library) of MPI definition is supported these application.
In the polycaryon processor environment, kernel has shared storage space.Message transmission between the task, between the kernel can reduce the copying data number of times by the visit shared drive.Yet existing message transferring technology but can not allow information broadcast and forwards obtained performance from the share and access of internal memory promote.Under the previous case, the sender can't know when each recipient receives message, and when message be used and finish, so it can only copy into these recipients' message buffer to same piece of data several times when sending message.Under the latter event, forwarding person can't know when a back recipient receives message, changes simultaneously its piece of data of also must having to duplicate for the description messages sender.
In realizing process of the present invention, the inventor finds that there are the following problems at least in the prior art: though MPI suggestion specific implementation is avoided the copy of memory to memory, but in the face of information broadcast and forwarding, its DLL (dynamic link library) can't avoid data to be duplicated repeatedly.Prior art exists mailbox and two kinds of methods that realize that message transmits of message pool at present: adopt static buffer formation messaging in the mailbox method, a mailbox is corresponding to a task, and correspondingly, message buffers all in the mailbox all are subordinated to this task.The information broadcast operation comprises the copy procedure of same piece of data to the message buffer of a plurality of reception tasks.For the forwards operation, data are copied the message buffer of next reception task once more.Therefore, the mailbox method can't be avoided producing extra internal memory, time overhead because of repeatedly copying message data.The message pool method has been introduced the dynamic buffer distribution mechanism, adopts the chained list mode to manage the buffer zone formation, this chained list of message queue pointed in the task control block (TCB) (TCB), and message pool is by all task sharings.Yet in a single day buffer zone is wherein obtained by certain task, and after bearer messages mail to the reception task, it just was subordinated to this reception task, finished just being discharged into message pool up to message sink.Under the information broadcast scene, message transmitting process must obtain a plurality of buffer zones, after copying message data respectively and filling in message header, sends to one by one in the buffer zone formation of a plurality of reception tasks.Under the forwards scene, in order to reduce the copying data number of times, can directly transfer to the buffer zone that carries data the buffer zone formation of next reception task, promptly from the buffer zone formation of this task, win this message buffer, transmission task identification in its message header is modified as current task, directly sends to the buffer zone formation of next reception task.But if current task is not that such processing just goes wrong when being forwarded the unique reception task of message: the change that sends task identification in the message header makes mistakes in the time of can causing other to receive task processing messages.Therefore, the forwards process must be obtained new buffer zone equally, carries out sending in the buffer zone formation of next reception task after data are duplicated.In summary, prior art message transmits the problem that (when particularly facing information broadcast and forwards scene) exists repeatedly message data to duplicate, and causes internal memory and times two aspect expense to increase.
Summary of the invention
Goal of the invention of the present invention is in order to solve message and to transmit, the problem that message data is repeatedly duplicated.
On the one hand, the embodiment of the invention provides a kind of data transmission method for uplink based on processor sharing internal memory, and described method comprises: data are write at least one memory block in the shared drive pond of processor; Address information according to memory block generates the memory block pointer; The memory block pointer is sent to a plurality of different take over partys; If it is forwards that described data send, described method specifically comprises: message establishing: obtain two memory blocks from memory pool, one as message header, and another is as the data buffer; The message data that needs are sent writes described data buffer; Pointer generates: the address information according to described message header generates message header pointer, according to the address information generation data buffer pointer of described data buffer; Write data buffer pointer, father's message pointer and send task identification to described message header, and put described father's message pointer for empty; Message sends: judge at first whether the transmission task identification in the described message header is consistent with the current task sign: if consistent, then generate a formation node, after in described formation node, writing described message header pointer, described formation node is sent in the message queue of reception task; If it is inconsistent, obtain another memory block as sub-message header from described memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to described sub-message header, and the transmission task identification of putting in the described sub-message header is that current task identifies the described father's message header of father's message pointed in the described sub-message header; At last, for described sub-message header generates another formation node, send in the message queue of reception task.
Another aspect, the embodiment of the invention provide a kind of data sending device based on processor sharing internal memory, and described data sending device comprises: data storage cell is used for data are write at least one memory block in the shared drive pond of processor; Pointer generator is used for generating the memory block pointer according to the address information of memory block; The pointer transmitting element is used for the memory block pointer is sent to a plurality of different take over partys; If what described data sending device sent is forwards: described data storage cell comprises the second data writing module, be used for obtaining two memory blocks from memory pool, one as message header, and another is as the data buffer; The message data that needs are sent writes described data buffer; Described pointer generator comprises the second pointer generation module: be used for generating message header pointer according to the address information of described message header, according to the address information generation data buffer pointer of described data buffer; Write data buffer pointer, father's message pointer and send task identification to described message header, and put described father's message pointer for empty; Described pointer transmitting element comprises the second pointer sending module, be used at first judging whether the transmission task identification of described message header is consistent with the current task sign: if consistent, then generate a formation node, after in described formation node, writing described message header pointer, described formation node is sent in the message queue of reception task; If it is inconsistent, then notify the described second data writing module to obtain another memory block as sub-message header from described memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to described sub-message header, and the transmission task identification of putting in the described sub-message header is that current task identifies the described father's message header of father's message pointed in the described sub-message header; At last, for described sub-message header generates another formation node, send in the message queue of reception task.
Technique scheme has following beneficial effect: transmit the memory block pointer because adopt, rather than the technological means of message data itself, so when having overcome the message transmission, the problem that message data is repeatedly duplicated, and then reached the technique effect that reduces internal memory and time two aspect expenses.
Description of drawings
Accompanying drawing described herein is used to provide further understanding of the present invention, constitutes the application's a part, does not constitute limitation of the invention.In the accompanying drawings:
Fig. 1 is a kind of data sending device block diagram based on processor sharing internal memory of the embodiment of the invention;
Fig. 2 is the block diagram of the data storage cell among embodiment of the invention Fig. 1;
Fig. 3 is the block diagram of the pointer generator among embodiment of the invention Fig. 1;
Fig. 4 is the block diagram of the pointer transmitting element among embodiment of the invention Fig. 1;
Fig. 5 is a kind of data sink block diagram based on processor sharing internal memory of the embodiment of the invention;
Fig. 6 A is the block diagram of the data releasing unit among embodiment of the invention Fig. 5;
Fig. 6 B is the block diagram of the data capture unit among embodiment of the invention Fig. 5;
Fig. 7 is a kind of data transmission method for uplink process flow diagram based on processor sharing internal memory of the embodiment of the invention;
Fig. 8 is a kind of data receive method process flow diagram based on processor sharing internal memory of the embodiment of the invention;
Fig. 9 is queue structure's synoptic diagram that message queue separates with buffer zone in the embodiment of the invention information broadcast;
Figure 10 is that one of the embodiment of the invention has three process of transmitting synoptic diagram that receive the information broadcast of task;
Figure 11 is the embodiment of the invention further queue structure's synoptic diagram of detach message head and data buffer on the basis of Fig. 9;
To be the embodiment of the invention transmit the forwards process synoptic diagram of message with one of two reception tasks of message to Figure 12 to the 3rd task.
Embodiment
For making purpose of the present invention, technical scheme and beneficial effect clearer,, the present invention is described in further details below in conjunction with embodiment and accompanying drawing.At this, exemplary embodiment of the present invention and explanation thereof are used to explain the present invention, but not as a limitation of the invention.
The embodiment of the invention is utilized the transfer data buffer pointer, rather than the technological means of data itself, in the time of can overcoming the message transmission, and the problem that message data is repeatedly duplicated.
Embodiment one:
As shown in Figure 1, be a kind of information transfer device block diagram of the embodiment of the invention based on processor sharing internal memory, data sending device 10 comprises: data storage cell 101 is used for data are write at least one memory block in the shared drive pond of processor; Pointer generator 102 is used for generating the memory block pointer according to the address information of memory block; Pointer transmitting element 103 is used for the memory block pointer is sent to the take over party.
If what install 10 transmissions is information broadcast:
As shown in Figure 2, data storage cell 101 can comprise the first data writing module 1011: be used for obtaining a memory block from memory pool, as the message buffer, the message data that needs are sent writes the data field in the message buffer; As shown in Figure 3, pointer generator 102 can comprise the first pointer generation module 1021: be used for generating the message buffer pointer according to the address information of message buffer; As shown in Figure 4, pointer transmitting element 103 can comprise the first pointer sending module 1031: be used to generate a formation node, in the formation node, write the message buffer pointer of message buffer after, the formation node is sent in the message queue of reception task.The first data writing module 1011, specifically be used for obtaining a memory block from memory pool, behind the message buffer, in the message header of message buffer, increase the transmission number of times of lifetime field recording messages, return the first message handle then, the message data of utilizing the first message handle will need to send writes the data field in the message buffer; The first pointer sending module 1031, specifically be used for increased progressively 1 the life cycle of the message header of message buffer, generate a formation node, in the formation node, write the message buffer pointer of message buffer after, the formation node is sent in the message queue of reception task.
Optionally, the first data writing module 1011 specifically is used for obtaining a memory block from memory pool, behind the message buffer, also writes in message name, type of message, data volume and the transmission task identification one or more in the message header of message buffer.The first pointer sending module 1031 if be used for the message that needs send is carried out repeatedly broadcast transmission, then repeat to call the pointer forwarding step, thereby generates a plurality of formation nodes, sends to respectively in the message queue of different reception tasks.
If what install 10 transmissions is forwards:
As shown in Figure 2, information writing unit 101 can comprise the second data writing module 1012, is used for obtaining two memory blocks from memory pool, and one as message header, and another is as the data buffer; The message data that needs are sent writes the data buffer; As shown in Figure 3, pointer generator 102 can comprise the second pointer generation module 1022: be used for generating message header pointer according to the address information of message header, according to the address information generation data buffer pointer of data buffer; Write data buffer pointer, father's message pointer and send task identification to message header, and put father's message pointer for empty; As shown in Figure 4, pointer transmitting element 103 can comprise the second pointer sending module 1032, be used at first judging whether the transmission task identification of message header is consistent with the current task sign: if consistent, then generate a formation node, after in the formation node, writing message header pointer, the formation node is sent in the message queue of reception task; If it is inconsistent, then notify the second message establishing module to obtain another memory block as sub-message header from memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to sub-message header, and the transmission task identification of putting in the sub-message header is that current task identifies the father's message pointed father message header in the sub-message header; At last, for sub-message header generates another formation node, send in the message queue of reception task.
Optionally, the second pointer generation module 1022 specifically is used for generating message header pointer according to the address information of message header, according to the address information generation data buffer pointer of data buffer; Write data buffer pointer, father's message pointer and send task identification to message header, also write lifetime field, and life cycle be 0, put father's message pointer for empty; The second pointer sending module 1032, specifically being used for pointer sends: if judge unanimity, then increased progressively 1 the life cycle in the message header, generate a formation node, after in the formation node, writing message header pointer, the formation node is sent in the message queue of reception task; In the message forwarding step: if judge inconsistent, then notify the second message establishing module to obtain another memory block as sub-message header from memory pool, former message header is father's message header, write the data buffer pointer to sub-message header, father's message pointer and transmission task identification, also write lifetime field, and the transmission task identification of putting in the sub-message header is the current task sign, put 1 life cycle, father's message pointed father message header in the sub-message header, data buffer pointer in the sub-message header equals the data buffer pointer in father's message header, is simultaneously increased progressively 1 the life cycle in father's message header; At last, for sub-message header generates another formation node, send in the message queue of reception task.The second pointer generation module 1022 specifically is used for also writing in message name, type of message and the data volume one or more at father's message header and sub-message header.The second pointer sending module 1032 if be used for the message that needs send is repeatedly transmitted, then repeat to call the message forwarding step of the second pointer sending module, thereby generates a plurality of formation nodes, sends to respectively in the message queue of different reception tasks.
As shown in Figure 5, be a kind of data sink block diagram of the embodiment of the invention based on processor sharing internal memory, data sink 50 comprises: command reception unit 501 is used to receive the Data Receiving instruction that comprises the memory block pointer; Data capture unit 502 is used for obtaining the data of storing the memory block of memory block pointed from the shared drive pond.Optionally, data sink 50 also comprises data releasing unit 503.
If what data sink 50 received is information broadcast,
Shown in Fig. 6 B, data capture unit 502 can comprise first data acquisition module 5021, is used to resolve the message of receiving, obtains the formation node from the message queue of the reception task of message, therefrom obtains the message buffer pointer of data; Be used for utilizing the message buffer pointer to obtain data from the data field of the message buffer in the shared drive pond of processor.As shown in Figure 6A, data sink 50 can also comprise data releasing unit 503, it can comprise the first data release module 5031, the first data release module 5031, be used for after finishing each message sink, successively decreased 1 the life cycle in the message header of message buffer: if be 0 life cycle this moment, then to memory pool release message buffer zone; If be non-0 life cycle, wouldn't the release message buffer zone, directly return.
If what data sink 50 received is forwards,
Shown in Fig. 6 B, data capture unit 502 can comprise second data acquisition module 5022, is used to resolve the message of receiving, obtains the formation node from the message queue of the reception task of message, therefrom obtains message header pointer; Be used to utilize message header pointer to obtain the data buffer pointer of data, utilize the data buffer pointer to obtain message data at last from the data buffer.As shown in Figure 6A, data sink 50 can also comprise data releasing unit 503, it can comprise the second data release module 5032, the second data release module 5032, be used for after finishing each message sink, successively decreased 1 the life cycle in father's message header and the sub-message header simultaneously: as becoming 0 the life cycle in the fruit message header, and the life cycle in its corresponding father's message header be non-0, then sub-message header is discharged into memory pool; If all be 0 the life cycle in father's message header and the sub-message header, then discharge father's message header and sub-message header simultaneously, and the data buffer; If all be non-0 the life cycle in father's message header and the sub-message header, do not discharge father's message header and sub-message header so, and the data buffer.
As shown in Figure 7, be a kind of data transmission method for uplink process flow diagram of the embodiment of the invention based on processor sharing internal memory, this method comprises:
If it is information broadcast that data send, described method specifically can comprise: message establishing: obtain a memory block from memory pool, as the message buffer, the message data that needs are sent writes the data field in the message buffer; Pointer generates: the address information according to the message buffer generates the message buffer pointer; Message sends: generate a formation node, in the formation node, write the message buffer pointer of message buffer after, the formation node is sent in the message queue of reception task.In the message establishing step: obtain a memory block from memory pool, behind the message buffer, in the message header of message buffer, increase the transmission number of times of lifetime field recording messages, return the first message handle then, the message data of utilizing the first message handle will need to send writes the data field in the message buffer; In the message forwarding step: increased progressively 1 the life cycle in the message header of message buffer, generate a formation node, in the formation node, write the message buffer pointer of message buffer after, the formation node is sent in the message queue of reception task.In the message establishing step: obtain a memory block from memory pool, behind the message buffer, in the message header of message buffer, also write in message name, type of message, data volume and the transmission task identification one or more.If the message that needs send is carried out repeatedly broadcast transmission, then repeat the message call forwarding step, thereby generate a plurality of formation nodes, send to respectively in the message queue of different reception tasks.
If it is forwards that data send, described method specifically can comprise: message establishing: obtain two memory blocks from memory pool, one as message header, and another is as the data buffer; The message data that needs are sent writes the data buffer; Pointer generates: the address information according to message header generates message header pointer, according to the address information generation data buffer pointer of data buffer; Write data buffer pointer, father's message pointer and send task identification to message header, and put father's message pointer for empty; Message sends: judge at first whether the transmission task identification in the message header consistent with the current task sign: as if unanimity, then generate a formation node, in the formation node, write message header pointer after, the formation node is sent in the message queue of reception task; If it is inconsistent, obtain another memory block as sub-message header from memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to sub-message header, and the transmission task identification of putting in the sub-message header is that current task identifies the father's message pointed father message header in the sub-message header; At last, for sub-message header generates another formation node, send in the message queue of reception task.Pointer generates in the step: the address information according to message header generates message header pointer, according to the address information generation data buffer pointer of data buffer; Write data buffer pointer, father's message pointer and send task identification to message header, also write lifetime field, and life cycle be 0, put father's message pointer for empty; In the message forwarding step: if consistent, then increased progressively 1 the life cycle in the message header, generate a formation node, in the formation node, write message header pointer after, the formation node is sent in the message queue of reception task; If it is inconsistent, obtain another memory block as sub-message header from memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to sub-message header, also write lifetime field, and the transmission task identification of putting in the sub-message header is the current task sign, put 1 life cycle, father's message pointed father message header in the sub-message header, data buffer pointer in the sub-message header equals the data buffer pointer in father's message header, is simultaneously increased progressively 1 the life cycle in father's message header; At last, for sub-message header generates another formation node, send in the message queue of reception task.In father's message header and sub-message header, also write in message name, type of message and the data volume one or more.If the message that needs send is repeatedly transmitted, then repeat the message call forwarding step, thereby generate a plurality of formation nodes, send to respectively in the message queue of different reception tasks.
As shown in Figure 8, be a kind of data receive method process flow diagram of the embodiment of the invention based on processor sharing internal memory, described method comprises:
Receive if Data Receiving is an information broadcast, described method specifically can comprise: the message that receives the reception data of transmit leg transmission; The message that parsing is received obtains the formation node from the message queue of the reception task of message, therefrom obtains the message buffer pointer of data; Utilize the data field of message buffer pointer from the message buffer in the shared drive pond of processor to obtain data.After finishing each Data Receiving, method can also comprise: message discharges: successively decreased 1 the life cycle in the message header of message buffer: if be 0 life cycle this moment, then to memory pool release message buffer zone; If be non-0 life cycle, wouldn't the release message buffer zone, directly return.
Receive if Data Receiving is a forwards, described method specifically can comprise: the message that receives the reception data of transmit leg transmission; The message that parsing is received obtains the formation node from the message queue of the reception task of message, therefrom obtains message header pointer; Utilize message header pointer to obtain the data buffer pointer of data, utilize the data buffer pointer to obtain message data at last from the data buffer.After finishing each Data Receiving, method can also comprise: message discharges: successively decreased 1 the life cycle in father's message header and the sub-message header simultaneously: as becoming 0 the life cycle in the fruit message header, and the life cycle in its corresponding father's message header be non-0, then sub-message header is discharged into memory pool; If all be 0 the life cycle in father's message header and the sub-message header, then discharge father's message header and sub-message header simultaneously, and the data buffer; If all be non-0 the life cycle in father's message header and the sub-message header, do not discharge father's message header and sub-message header so, and the data buffer.
The above embodiment of the present invention is because adopt to transmit the memory block pointer, rather than the technological means of message data itself, so when having overcome message and transmitting, the problem that message data is repeatedly duplicated, and then the expense of reduction internal memory and times two aspect.
Embodiment two:
The embodiment of the invention comprises following two parts: the queue structure that message queue separates with buffer zone is used for the high speed information broadcast.
The queue structure that message queue separates with buffer zone as shown in Figure 9.Message queue is the message buffer pointer alignment that exists with the chain sheet form, the queue pointer's refer message formation in the task control block (TCB).The message buffer is made up of message header and data field.Wherein, message header also comprises a life cycle except recording messages name, type of message, data volume and transmission task identification.Write down the transmission number of times of this message life cycle.
In the polycaryon processor system, above-mentioned queue structure is positioned at shared storage space.Like this, not only the message transmission can be carried out between the task of same kernel, and the message communicating mode can be adopted equally between the task of different kernels.Therefore, transmission task and reception task that the present invention is mentioned comprise the situation that belongs to a kernel together, also comprise the situation that adheres to different kernels separately.
The high speed information broadcast is made of establishment, transmission, reception and four processes of release of message.
The message establishing process is obtained a message buffer from memory pool; Insert message name, type of message, life cycle, data volume and transmission task identification to message header, and to put life cycle be 0; Last return messages handle.Utilize the message handle to send task and the message data that needs send can be write the data field.
Message transmitting process makes increase progressively 1 the life cycle that is sent out message; Generate a formation node; After inserting the message buffer pointer, it is sent to the message queue tail of the queue of reception task.If desired message is carried out broadcast transmission, the transmission task can repeat the message call process of transmitting, thereby generates a plurality of formation nodes, sends to the message queue of different reception tasks respectively.At this moment, these formation nodes all point to same message buffer, and equal the number of times that this message is sent out the life cycle in the message header just, also equal the number of the task that receives.As shown in figure 10, having three message that receive task with one is example, the broadcast transmission process of description messages.
As seen, only there is a message buffer in broadcast after repeatedly sending, and just its pointer has sent to the message queue of a plurality of reception tasks.Therefore there is not repeatedly data copy operation in the information broadcast process.
The message sink process is won first formation node from the message queue of current task; Therefrom obtain the message buffer pointer; The return messages handle.Utilize the message handle to receive task and can from the data field, obtain message data.
The message dispose procedure makes successively decrease 1 the life cycle in the message header; If be 0 life cycle this moment, expression is released all reception tasks of message and has all called releasing operation, then to memory pool release message buffer zone; If life cycle is non-0, expression also has other reception task not use this message, wouldn't the release message buffer zone, directly return.
Can't avoid repeatedly the problem of copying data when facing the information broadcast scene at prior art, the embodiment of the invention proposes a kind of method of high-speed broadcast, be intended to reduce the expense of internal memory and times two aspect in the message transport process, thereby improve the handling property of polycaryon processor software.It is limited and to the exigent embedded multi-core processor of real-time and multinuclear digital signal processor (Digital Signal Processor, DSP) system to be particularly useful for memory source.Embedded multi-core processor, especially multi-core DSP have the demanding characteristics of memory source finite sum real-time.Application scenarios at information broadcast is avoided copying data, can reduce the use of message buffer on the one hand, reduces memory cost, and kernel is freed from simple data read-write operation, thereby reduces time overhead.
Embodiment three:
The embodiment of the invention comprises following three parts: the queue structure that message queue, message header separate with the data buffer is used for the high speed forwards.
As shown in figure 11, shown the queue structure of further detach message head and data buffer on the basis of Fig. 9 in a second embodiment, message header and data buffer all independent committed memory piece.Wherein, message header is except comprising message name, type of message, data volume, transmission task identification and life cycle, also increasing by two pointers: data buffer pointer and father's message pointer.Message directs his father's message that father's message pointer is used to be forwarded.
The high speed forwards is made of establishment, transmission, reception and four processes of release of message equally.
The message establishing process is obtained two memory blocks from memory pool, a message header as fixed size, and another obtains the data buffer according to the data volume that sends mission requirements; Insert message name, type of message, data buffer pointer, father's message pointer, life cycle, data volume and transmission task identification to message header, and to put life cycle be 0, put father's message pointer for empty; Last return messages handle.Utilize the message handle to send task and the message data that needs send can be write the data field.
Message transmitting process judges at first whether the transmission task identification in the message header is consistent with the current task sign: if consistent then expression transmission is the message that current task is created, the processing procedure and second embodiment are similar, difference is: what insert the formation node is message header pointer, rather than the message buffer pointer.Illustrate then that as if inconsistent this is a forwards operation.The message header that is forwarded message is called sub-message header, and message header originally is called father's message header.
After acknowledge message was transmitted operation, process of transmitting obtained a new memory block as sub-message header from memory pool; The transmission task identification that is provided with then in the sub-message header is the current task sign, puts 1 life cycle, father's message pointed father message header, and all the other information and father's message header are consistent; Also to increase progressively the life cycle in father's message header simultaneously; At last, for sub-message header generates a formation node, send to the tail of the queue that receives the task message formation.As shown in figure 12, transmitting message with one of two reception tasks of message to the 3rd task is example, the description messages repeating process.
This shows that message has only increased a memory block as sub-message header on the memory cost after transmitting, only increased a spot of setting operation on the time overhead.Therefore there is not data copy operation in the forwards process yet.
The message sink process is identical with second embodiment.
The message dispose procedure successively decreases simultaneously and is released the life cycle of message and his father's message: become 0 if be released the life cycle of message, and the life cycle of father's message non-0, expression also exists the reception task of father's message not use this message, then only the message header that is released message is discharged into memory pool, and does not discharge the data buffer; If also become 0 the life cycle of father's message, expression is released all reception tasks of message and his father's message and has all called releasing operation, then discharges the message header of two message simultaneously, and the data buffer; If the life cycle of two message is all non-0, message header and data buffer do not discharge so.
Can't avoid repeatedly the problem of copying data when facing the forwards scene at prior art, the embodiment of the invention proposes a kind of method of transmitting message, be intended to reduce the expense of internal memory and times two aspect in the information receiving and transmitting process, thereby improve the handling property of polycaryon processor software.It is limited and to exigent embedded multi-core processor of real-time and multi-nuclear DSP system to be particularly useful for memory source.Embedded multi-core processor, especially multi-core DSP have the demanding characteristics of memory source finite sum real-time.Application scenarios in forwards is avoided copying data, can reduce the use of message buffer on the one hand, reduces memory cost, and kernel is freed from simple data read-write operation, thereby reduces time overhead.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct related hardware to finish by program, described program can be stored in the computer read/write memory medium, this program is when carrying out, comprise above-mentioned all or part of step, described storage medium, as: ROM/RAM, disk, CD etc.
Above-mentioned three technical schemes that embodiment provides of the present invention in detach message formation, message header and/or data buffer, increase life cycle and/or father's message pointer to message header.Adopt message algorithm life cycle and message to inherit algorithm, make full use of the characteristics that polycaryon processor has shared storage space, make information broadcast and forwards all only carry out a spot of setting operation, and do not copy message data.No matter to same kernel task, still different kernel tasks, the technical scheme of the embodiment of the invention has all reduced carries out memory cost and the time overhead that message is transmitted between them, thereby has improved the handling property of software.
Above-described embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above only is the specific embodiment of the present invention; and be not intended to limit the scope of the invention; within the spirit and principles in the present invention all, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.6
Claims (6)
1. the data transmission method for uplink based on processor sharing internal memory is characterized in that, described method comprises:
Data are write at least one memory block in the shared drive pond of processor;
Address information according to described memory block generates the memory block pointer;
Described memory block pointer is sent to a plurality of different take over partys;
If it is forwards that described data send, described method specifically comprises:
Message establishing: obtain two memory blocks from memory pool, one as message header, and another is as the data buffer; The message data that needs are sent writes described data buffer;
Pointer generates: the address information according to described message header generates message header pointer, according to the address information generation data buffer pointer of described data buffer; Write data buffer pointer, father's message pointer and send task identification to described message header, and put described father's message pointer for empty;
Message sends: judge at first whether the transmission task identification in the described message header is consistent with the current task sign: if consistent, then generate a formation node, after in described formation node, writing described message header pointer, described formation node is sent in the message queue of reception task; If it is inconsistent, obtain another memory block as sub-message header from described memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to described sub-message header, and the transmission task identification of putting in the described sub-message header is that current task identifies the described father's message header of father's message pointed in the described sub-message header; At last, for described sub-message header generates another formation node, send in the message queue of reception task.
2. data transmission method for uplink according to claim 1 is characterized in that,
Described pointer generates in the step: the address information according to described message header generates message header pointer, according to the address information generation data buffer pointer of described data buffer; Write data buffer pointer, father's message pointer and send task identification to described message header, also write lifetime field, and described life cycle be 0, put described father's message pointer for empty;
In the described message forwarding step: if judge that the transmission task identification in the described message header is consistent with the current task sign, then increased progressively 1 the life cycle in the described message header, generate a formation node, after in described formation node, writing described message header pointer, described formation node is sent in the message queue of reception task; If judge that transmission task identification and current task sign in the described message header are inconsistent, obtain another memory block as sub-message header from described memory pool, former message header is father's message header, write the data buffer pointer to described sub-message header, father's message pointer and transmission task identification, also write lifetime field, and the transmission task identification of putting in the described sub-message header is the current task sign, put 1 described life cycle, the described father's message header of father's message pointed in the described sub-message header, data buffer pointer in the described sub-message header equals the data buffer pointer in described father's message header, is simultaneously increased progressively 1 the life cycle in described father's message header; At last, for described sub-message header generates another formation node, send in the message queue of reception task.
3. as data transmission method for uplink as described in the claim 2, it is characterized in that,
In described father's message header and described sub-message header, also write in message name, type of message and the data volume one or more;
If the described message that needs to send is repeatedly transmitted, then repeat to call described message forwarding step, thereby generate a plurality of formation nodes, send to respectively in the message queue of different reception tasks.
4. the data sending device based on processor sharing internal memory is characterized in that, described data sending device comprises:
Data storage cell is used for data are write at least one memory block in the shared drive pond of processor;
Pointer generator is used for generating the memory block pointer according to the address information of described memory block;
The pointer transmitting element is used for described memory block pointer is sent to a plurality of different take over partys;
If what described data sending device sent is forwards:
Described data storage cell comprises the second data writing module, is used for obtaining two memory blocks from memory pool, and one as message header, and another is as the data buffer; The message data that needs are sent writes described data buffer;
Described pointer generator comprises the second pointer generation module: be used for generating message header pointer according to the address information of described message header, according to the address information generation data buffer pointer of described data buffer; Write data buffer pointer, father's message pointer and send task identification to described message header, and put described father's message pointer for empty;
Described pointer transmitting element comprises the second pointer sending module, be used at first judging whether the transmission task identification of described message header is consistent with the current task sign: if consistent, then generate a formation node, after in described formation node, writing described message header pointer, described formation node is sent in the message queue of reception task; If it is inconsistent, then notify the described second data writing module to obtain another memory block as sub-message header from described memory pool, former message header is father's message header, write data buffer pointer, father's message pointer and send task identification to described sub-message header, and the transmission task identification of putting in the described sub-message header is that current task identifies the described father's message header of father's message pointed in the described sub-message header; At last, for described sub-message header generates another formation node, send in the message queue of reception task.
5. as data sending device as described in the claim 4, it is characterized in that,
The described second pointer generation module specifically is used for generating message header pointer according to the address information of described message header, according to the address information generation data buffer pointer of described data buffer; Write data buffer pointer, father's message pointer and send task identification to described message header, also write lifetime field, and described life cycle be 0, put described father's message pointer for empty;
The described second pointer sending module, specifically being used for pointer sends: if judge that the transmission task identification in the described message header is consistent with the current task sign, then increased progressively 1 the life cycle in the described message header, generate a formation node, after in described formation node, writing described message header pointer, described formation node is sent in the message queue of reception task; During described pointer sends: if judge that transmission task identification and current task sign in the described message header are inconsistent, then notify the described second data writing module to obtain another memory block as sub-message header from described memory pool, former message header is father's message header, write the data buffer pointer to described sub-message header, father's message pointer and transmission task identification, also write lifetime field, and the transmission task identification of putting in the described sub-message header is the current task sign, put 1 described life cycle, the described father's message header of father's message pointed in the described sub-message header, data buffer pointer in the described sub-message header equals the data buffer pointer in described father's message header, is simultaneously increased progressively 1 the life cycle in described father's message header; At last, for described sub-message header generates another formation node, send in the message queue of reception task.
6. as data sending device as described in the claim 5, it is characterized in that,
The described second pointer generation module specifically is used for also writing in message name, type of message and the data volume one or more at described father's message header and described sub-message header;
The described second pointer sending module, if be used for the message that described needs send is repeatedly transmitted, then repeat to call the pointer transmission of the described second pointer sending module, thereby generate a plurality of formation nodes, send to respectively in the message queue of different reception tasks.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009101278032A CN101504617B (en) | 2009-03-23 | 2009-03-23 | Data transmitting method and device based on processor sharing internal memory |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009101278032A CN101504617B (en) | 2009-03-23 | 2009-03-23 | Data transmitting method and device based on processor sharing internal memory |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101504617A CN101504617A (en) | 2009-08-12 |
CN101504617B true CN101504617B (en) | 2011-05-11 |
Family
ID=40976872
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009101278032A Active CN101504617B (en) | 2009-03-23 | 2009-03-23 | Data transmitting method and device based on processor sharing internal memory |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101504617B (en) |
Families Citing this family (22)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101634956B (en) * | 2009-08-25 | 2012-08-08 | 华为技术有限公司 | Dispatching method and dispatcher of information of polynuclear processor |
CN102799490B (en) * | 2011-05-27 | 2014-08-06 | 北京神州泰岳软件股份有限公司 | System and method for realizing one-to-many interprocess communication |
CN103218360B (en) * | 2012-01-18 | 2016-08-03 | 中国石油天然气集团公司 | RTDB in Industry Control uses the method that memory pool technique realizes dynamic memory management |
CN102880507A (en) * | 2012-09-12 | 2013-01-16 | 科立讯通信股份有限公司 | Method for applying and distributing chain structure message |
CN103886167B (en) * | 2012-11-15 | 2018-10-09 | 上海联影医疗科技有限公司 | Medical image processing method and system, client and server |
CN104239134B (en) | 2013-06-21 | 2018-03-09 | 华为技术有限公司 | The task management method and device of a kind of many-core system |
CN105787771A (en) * | 2014-12-16 | 2016-07-20 | 航天信息股份有限公司 | Method and system for improving stability of data interaction in network invoice system |
SG11201706340TA (en) * | 2015-02-16 | 2017-09-28 | Huawei Tech Co Ltd | Method for accessing data visitor directory in multi-core system and device |
CN106549869A (en) * | 2015-09-21 | 2017-03-29 | 北京信威通信技术股份有限公司 | Data package processing method and device |
CN108062252B (en) * | 2016-11-08 | 2022-02-01 | 斑马智行网络(香港)有限公司 | Information interaction method, object management method, device and system |
CN109992352B (en) * | 2017-12-29 | 2021-10-08 | 迈普通信技术股份有限公司 | Data transmission method and device, electronic equipment and readable storage medium |
CN108287793B (en) * | 2018-01-09 | 2020-12-25 | 网宿科技股份有限公司 | Response message buffering method and server |
CN108958953A (en) * | 2018-06-29 | 2018-12-07 | 南京南瑞继保电气有限公司 | A kind of method for message interaction based on multi-core processor |
CN109471710B (en) * | 2018-10-25 | 2021-05-25 | 网易(杭州)网络有限公司 | Task request processing method and device, processor, terminal and server |
CN109558107B (en) * | 2018-12-04 | 2023-06-30 | 中国航空工业集团公司西安航空计算技术研究所 | FC message receiving management method for shared buffer area |
CN109857573B (en) * | 2018-12-29 | 2021-03-05 | 深圳云天励飞技术有限公司 | Data sharing method, device, equipment and system |
CN111404986B (en) * | 2019-12-11 | 2023-07-21 | 杭州海康威视***技术有限公司 | Data transmission processing method, device and storage medium |
CN113132065A (en) * | 2019-12-30 | 2021-07-16 | 西安诺瓦星云科技股份有限公司 | Data communication method, device and system, storage medium and video processing equipment |
CN111736533B (en) * | 2020-06-04 | 2021-10-15 | 佛山冠湾智能科技有限公司 | Data synchronization method and device based on control and drive integrated robot |
CN112532690B (en) * | 2020-11-04 | 2023-03-24 | 杭州迪普科技股份有限公司 | Message parsing method and device, electronic equipment and storage medium |
CN114253741B (en) * | 2021-12-02 | 2022-11-08 | 国汽智控(北京)科技有限公司 | Inter-core communication method of multi-core microprocessor and multi-core microprocessor |
CN114281484B (en) * | 2021-12-29 | 2022-08-26 | 元心信息科技集团有限公司 | Data transmission method, device, equipment and storage medium |
-
2009
- 2009-03-23 CN CN2009101278032A patent/CN101504617B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN101504617A (en) | 2009-08-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101504617B (en) | Data transmitting method and device based on processor sharing internal memory | |
KR102011949B1 (en) | System and method for providing and managing message queues for multinode applications in a middleware machine environment | |
CN100403739C (en) | News transfer method based on chained list process | |
CN101616083B (en) | Message forwarding method and device | |
CN1443413A (en) | Switching system | |
CN101188544A (en) | File transfer method for distributed file server based on buffer | |
US8489694B2 (en) | Peer-to-peer collaboration of publishers in a publish-subscription environment | |
CN103647726A (en) | Message dispatching method and device thereof | |
CN113703954A (en) | Message backup method and device, electronic equipment and computer storage medium | |
CN107025184A (en) | A kind of data managing method and device | |
JP2012054623A (en) | Mail transfer system, mail gateway and data store server | |
EP2869503B1 (en) | Multicast message replication method and device | |
CN101414973A (en) | Method and apparatus for transmitting data packet | |
CN101753580B (en) | Packet processing chip and data storage and forwarding method thereof | |
CN101634956A (en) | Dispatching method and dispatcher of information of polynuclear processor | |
WO2013177854A1 (en) | Device and method for inter-core communication in multi-core processor | |
US8762603B2 (en) | Addressable FIFO | |
CN102308538B (en) | Message processing method and device | |
CN104038441A (en) | Method and system for transmitting data | |
US20090086746A1 (en) | Direct messaging in distributed memory systems | |
CN108418879A (en) | A kind of the magnanimity isomeric data transmission method and system of high reliability | |
CN115766610A (en) | Message queue based on publish-subscribe | |
US9423976B2 (en) | System and method of expedited message processing using a first-in-first-out transport mechanism | |
CN110865891A (en) | Asynchronous message arranging method and device | |
CN109558107A (en) | A kind of FC message sink management method of shared buffer |
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 |