CN101470623B - Queue management method and queue management device, method and system for processing queue message - Google Patents

Queue management method and queue management device, method and system for processing queue message Download PDF

Info

Publication number
CN101470623B
CN101470623B CN 200710160669 CN200710160669A CN101470623B CN 101470623 B CN101470623 B CN 101470623B CN 200710160669 CN200710160669 CN 200710160669 CN 200710160669 A CN200710160669 A CN 200710160669A CN 101470623 B CN101470623 B CN 101470623B
Authority
CN
China
Prior art keywords
tail pointer
queue
capture
counter
pointer
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
Application number
CN 200710160669
Other languages
Chinese (zh)
Other versions
CN101470623A (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.)
Wuxi Jiangnan Computing Technology Institute
Original Assignee
Wuxi Jiangnan Computing Technology Institute
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 Wuxi Jiangnan Computing Technology Institute filed Critical Wuxi Jiangnan Computing Technology Institute
Priority to CN 200710160669 priority Critical patent/CN101470623B/en
Publication of CN101470623A publication Critical patent/CN101470623A/en
Application granted granted Critical
Publication of CN101470623B publication Critical patent/CN101470623B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention relates to a queue management method, which comprises an initial setting queue pointer and a queue counter, wherein the queue pointer comprises a head pointer, a virtual tail pointer and a real tail pointer, writing requests which correspond to queue information which is received are sent, the virtual tail pointers are accumulated according to the sent writing requests, the queue counter is confirmed and updated according to writing end which is received, the address of element space which is contained and an update real tail pointer of the queue counter after updating are confirmed according to the writing end, and the element space between the head pointer and the real tail pointer is consumable queue space. The invention further discloses a treatment method of a queue manager and queue information and a system, the update of the queue tail pointer and the writing of data to the element space of a queue also can be guaranteed to be synchronous no need to execute sequentially, the invention can be suitable for a large-scale parallel computer system, thereby achieving effective transport mechanism based on the queue information, and enlarging the application range of the queue information.

Description

Queue management method and queue manager, and processing method and system of queue message
Technical Field
The present invention relates to computer technologies, and in particular, to a queue management method, a queue manager, and a method and a system for processing queue messages.
Background
In massively parallel computer network systems, shared storage and messaging are two major programming models of parallel computing. Generally, a system includes a plurality of nodes, each node has a plurality of processors (CPUs), and the memories in the nodes are distributed and shared memory structures, so that the CPUs in the nodes can directly read and write data of all the memories (i.e., shared memory) in the node; and when the CPU of one node is to access the memory of another node, the access needs to be realized through message passing.
The queue message is a way to write data from the CPU of one node to the memory of another node, where the queue message is to send data in a source storage space to a queue specified by a destination, the queue is a physical space or a virtual space of a segment of continuous memory allocated in advance (generally configured by software), and a basic unit of the queue, i.e., a storage space for storing one queue element, is referred to as an element space.
Generally speaking, the queue of the destination (i.e. receiving party) of the queue message adopts a circular queue, and the receiving party manages the queue through a queue manager and software: information such as the base address of the queue, the capacity of the queue, the attribute of the queue and the like can be initialized and configured by software; modifying, by the queue manager, the queue tail pointer after production of the queue element (i.e., writing data); the queue head pointer is modified by software after the consumption of the queue element (i.e., reading the data). Information about the queue and its data storage method can be found in the chinese invention patent application No. 200610057353.0.
When the queue message is transmitted, the sender does not know the address of the target queue, only needs to know a queue number, and sends the queue message containing the queue number and queue elements; when a queue manager of a receiving party receives a queue message, according to the initial configuration of the queue and a queue number sent by a sending party, sending a corresponding write request containing data to be written and an address of an element space of the data to be written to a memory where the queue is located, and adding one to a queue tail pointer after receiving a write end confirmation returned by the memory to indicate a latest free element space of the queue; the process consumes the queue under the indication of the queue head pointer, and after a part of queue elements of the queue are taken away each time, the queue head pointer is updated according to the number of consumed queue elements so as to indicate the next consumable element space in the queue.
The process may consume the queue using an interrupt or query approach, and in either approach, first read the head and tail pointers of the corresponding queue in the queue manager, determine how many queue elements are available for consumption in the queue and the position of the queue head element (the head address of the consumable data), and then read the queue elements in the corresponding element space. In queue management, the queue tail pointer can be modified only after the message data is written into the element space of the queue, so as to ensure that the queue elements between the head pointer and the tail pointer can be consumed, namely, the process can access effective data.
However, in the parallel computer network system using multiple processors and distributed shared memory, due to the distributed nature of the memory or to support a CACHE coherency protocol such as invalidate on set, update on write, etc. (CACHE), the return order of the write end acknowledgement is generally not consistent with the sending order of the write request, that is, the write request is not executed in sequence but executed out of sequence, which limits the application of the queue message, and the queue manager cannot add one to the queue tail pointer in sequence according to the address of the element space included in the received write end acknowledgement.
In order for the queue manager to add one to the queue tail pointer in order based on the address of the element space contained in the received write end acknowledge, it is necessary to ensure that the write requests of the queue are executed in order. One solution is to execute write requests serially, and the queue manager starts processing a new write request only after receiving a write completion acknowledgement of the last write request, which reduces the transmission efficiency of queue messages.
Another solution is to ensure sequential execution of write requests by hardware and software together, for example, the hardware ensures that the write requests and the write end acknowledgements flow in sequence on a path (i.e. the return sequence of the write end acknowledgements is consistent with the sending sequence of the write requests), and the software limits the storage space of the queue to an uncacheable space, thereby ensuring that the storage space of the queue has no cache consistency. The combination of hardware and software is not only disadvantageous for programming, but also limits the hardware implementation.
Disclosure of Invention
The problem to be solved by the invention is to provide a queue management method, a queue manager, a queue message processing method and a queue message processing system, which can ensure the updating of a queue tail pointer and the synchronization of data writing into the element space of a queue without sequentially executing writing requests, thereby expanding the application range of the queue message.
In order to solve the above problems, the present invention provides a queue management method, including the following steps:
initially setting a queue pointer and a queue counter, wherein the queue pointer comprises a head pointer, a virtual tail pointer and a real tail pointer, and an element space between the head pointer and the real tail pointer is a consumable queue space;
sending write requests corresponding to the received queue messages, and accumulating the virtual tail pointers according to the number of the sent write requests;
and updating a queue counter according to the received write end confirmation, and updating a real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter.
Optionally, the initially setting the queue pointer and the queue counter includes: in the initial state of the system, the queue pointer points to the position of the first element space of the queue, and the queue counter is cleared.
In one embodiment of the present invention, the queue pointers further include a maximum capture tail pointer pointing to a location of an element space subsequent to a last element space into which data has been written; the queue counter is a maximum capture write end counter, and counts the number of element spaces in which data has been written between the maximum capture tail pointer and the real tail pointer.
The method for updating the queue counter according to the received write end confirmation and updating the real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter comprises the following steps:
accumulating the count value of the maximum capture write end counter according to the number of the received write end acknowledgements;
acquiring the address of the element space of the written data from the received writing end confirmation;
when the obtained address of the element space is larger than or equal to the value of the maximum capture tail pointer, pointing the maximum capture tail pointer to the position of the element space behind the element space in which the data is written;
and when the difference value of the maximum capture tail pointer and the real tail pointer is equal to the count value of the maximum capture write-over counter, pointing the real tail pointer to the position pointed by the maximum capture tail pointer, and clearing the maximum capture write-over counter.
The queue management method further comprises: and when the difference value of the virtual tail pointer and the real tail pointer is larger than or equal to the preset maximum message processing amount, blocking the new queue message until the real tail pointer is updated, or discarding the new queue message and sending a failure confirmation of the queue message to a sender of the new queue message.
In another embodiment of the present invention, the queue pointer further includes a first capture tail pointer and a maximum capture tail pointer, the maximum capture tail pointer pointing to a location of the element space subsequent to the last element space to which data has been written, the first capture tail pointer pointing to a location of the element space subsequent to the element space corresponding to an end-of-write confirmation when the end-of-write confirmation is received and a value of the real tail pointer is equal to a value of the first capture tail pointer; the queue counters include a maximum capture write end counter that counts a number of element spaces between a maximum capture tail pointer and a first capture tail pointer into which data has been written and a first capture write end counter that counts a number of element spaces between the first capture tail pointer and a real tail pointer into which data has been written.
The updating of the queue counter according to the write end acknowledgement and the updating of the real tail pointer according to the address of the element space contained in the write end acknowledgement and the updated queue counter comprises the following steps:
acquiring the address of the element space of the written data from the received writing end confirmation;
when the value of the real tail pointer is equal to the value of the first capture tail pointer, pointing the first capture tail pointer and the maximum capture tail pointer to the position of the element space behind the element space in which the data is written, and adding one to the first capture write end counter;
incrementing a maximum capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the value of the first capture tail pointer;
incrementing a first capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is less than the value of the first capture tail pointer;
when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the value of the maximum capture tail pointer, pointing the maximum capture tail pointer to a position of an element space subsequent to the element space in which the data has been written;
and when the first capture write end counter is updated and the difference value between the first capture tail pointer and the real tail pointer is equal to the count value of the first capture write end counter, pointing the real tail pointer to the position pointed by the first capture tail pointer, then pointing the first capture tail pointer to the position pointed by the maximum capture tail pointer, setting the count value of the first capture write end counter as the count value of the maximum capture write end counter, and then resetting the maximum capture write end counter.
Corresponding to the above queue management method, the present invention further provides a queue manager, including:
a queue pointer register storing queue pointers, the queue pointers including a head pointer, a virtual tail pointer, and a real tail pointer, an element space between the head pointer and the real tail pointer being a consumable queue space;
a queue counter that counts the number of element spaces into which data has been written;
the setting unit is used for initially setting a queue pointer register and a queue counter;
a sending unit, which sends write requests corresponding to the received queue messages and accumulates the virtual tail pointers according to the number of the sent write requests;
and the updating unit updates the queue counter according to the received write end confirmation, and updates the real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter.
In order to solve the above problem, the present invention further provides a method for processing queue messages, including the following steps:
a transmitting side transmits a queue message for accessing a queue memory of a receiving side to the receiving side;
after receiving the queue message, the queue manager of the receiving party sends a write request corresponding to the queue message to a queue memory of the receiving party, and accumulates a virtual tail pointer of the queue manager according to the quantity of the sent write requests;
after receiving the write request, the queue memory of the receiving party writes the data in the write request into the corresponding element space and returns a corresponding write end confirmation to the queue manager of the receiving party;
after receiving a write end confirmation, the queue manager of the receiving party updates a queue counter of the queue manager according to the write end confirmation, and updates a real tail pointer of the queue manager according to an address of an element space contained in the write end confirmation and the updated queue counter;
and the queue manager of the receiving party returns the confirmation of the corresponding queue message to the sending party according to the writing end confirmation.
Corresponding to the processing method of the queue message, the invention also provides a processing system of the queue message, which comprises a sending party and a receiving party, wherein the receiving party comprises a queue memory and a queue manager,
the sender sends a queue message for accessing a queue memory of the receiver to the receiver and receives a confirmation of the corresponding queue message returned by the receiver;
the queue memory receives the write request sent by the queue manager, writes the data in the write request into the corresponding element space, and returns a corresponding write end confirmation to the queue manager;
the queue manager receives the queue message sent by the sender, sends the write request corresponding to the queue message to the queue memory, accumulates the virtual tail pointer according to the number of the sent write requests, receives the write end confirmation returned by the queue memory, updates the queue counter according to the write end confirmation, updates the real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter, and returns the confirmation of the corresponding queue message to the sender according to the write end confirmation.
Compared with the prior art, the technical scheme is provided with the head pointer, the virtual tail pointer, the real tail pointer and the queue counter, the queue counter is updated according to the received write end confirmation, and the real tail pointer is updated according to the address of the element space contained in the write end confirmation and the updated queue counter, so that the element space between the head pointer and the real tail pointer represents the consumable queue space; the element space between the real tail pointer and the virtual tail pointer represents the queue space that is not consumable. Therefore, even if the return order of the write end acknowledgement and the transmission order of the memory write request do not coincide, the update of the queue tail pointer (real tail pointer) and the synchronization of the element space of the data write queue can be ensured, thereby expanding the application range of the queue message.
Drawings
Fig. 1 is a flowchart of pointer setting of a queue management method according to a first embodiment of the present invention;
FIG. 2 is a diagram of an example of the queue management method shown in FIG. 1;
FIG. 3 is a schematic diagram of a queue manager according to a first embodiment of the present invention;
FIG. 4 is a flowchart of pointer setting of a queue management method according to a second embodiment of the present invention;
FIG. 5 is a diagram of an example of the queue management method shown in FIG. 4;
FIG. 6 is a diagram illustrating a structure of a queue manager according to a second embodiment of the present invention;
fig. 7 is a flowchart of a method for processing queue messages according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention adds the queue pointer and the queue counter, updates the queue counter according to the write end confirmation, and updates the real tail pointer according to the address of the element space contained in the write end confirmation and the queue counter, so as to ensure that the element space between the head pointer and the real tail pointer is consumable queue space. Therefore, even if the return order of the write end acknowledgement and the transmission order of the write request do not coincide, the update of the queue tail pointer and the synchronization of the element space of the data write queue can be ensured.
The queue management method of the embodiment of the invention comprises the following steps:
initially setting a queue pointer and a queue counter, wherein the queue pointer comprises a head pointer, a virtual tail pointer and a real tail pointer;
sending write requests corresponding to the received queue messages, and accumulating the virtual tail pointers according to the number of the sent write requests;
and updating a queue counter according to the received write end confirmation, and updating a real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter, wherein the element space between the head pointer and the real tail pointer is a consumable queue space.
The queue manager of the embodiment of the invention comprises:
a queue pointer register storing queue pointers, the queue pointers including a head pointer, a virtual tail pointer, and a real tail pointer;
a queue counter that counts the number of element spaces into which data has been written;
the setting unit is used for initially setting a queue pointer register and a queue counter;
a sending unit, which sends write requests corresponding to the received queue messages and accumulates the virtual tail pointers according to the number of the sent write requests;
and the updating unit updates the queue counter according to the received write end confirmation, and updates the real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter, wherein the element space between the head pointer and the real tail pointer is a consumable queue space.
The following describes embodiments of the present invention in detail with reference to the accompanying drawings.
First embodiment
The queue management method of the present embodiment sets four queue pointers and a queue counter, where the queue pointers include: head pointers (hp, Head Pointer), Real Tail pointers (tp, Real Tail Pointer), Virtual Tail pointers (v _ tp, Virtual Tail Pointer), and maximum capture Tail pointers (mc _ tp, maximum capture Tail Pointer). The queue Counter is a maximum Capture write End Counter (mc _ cnt, maximum Capture End Counter).
The element space between the head pointer and the real tail pointer is a consumable queue space, the head pointer points to the position of the element space where the consumable queue head element is located, and the real tail pointer points to the position of the element space behind the element space where the consumable queue tail element is located. The virtual tail pointer points to the position of an element space behind the element space of the data to be written of the last write request, and the element space between the real tail pointer and the virtual tail pointer is an expendable queue space and comprises at least one element space without written data. In the initial state, the head pointer, real tail pointer and virtual tail pointer are all set to point to the first element space of the queue.
The maximum capture tail pointer points to a location of the last element space that is subsequent to the last element space to which data has been written. In the initial state, the maximum capture tail pointer is set to point to the position of the first element space of the queue, and along with the return of the write end confirmation, the maximum capture tail pointer is updated according to the address of the element space contained in the write end confirmation.
The maximum capture write end counter counts the number of element spaces between the maximum capture tail pointer and the real tail pointer into which data has been written.
The queue management method of the present embodiment includes: initialization flow, queue message processing flow and pointer setting flow.
The initialization process comprises the following steps: and initially configuring a queue, and initially setting a queue pointer and a queue counter. In the initial state of the system, the storage space of data is configured for the queue in the system memory space, the definition of the attributes of the base address, the capacity, the space attribute, the access authority and the like of the queue is completed, the head pointer, the real tail pointer, the virtual tail pointer and the maximum capture tail pointer point to the position of the first element space of the queue, and the maximum capture write end counter is cleared. In this embodiment, the values of the head pointer, real tail pointer, virtual tail pointer, and maximum capture tail pointer are offsets from the base address of the queue.
After the initialization process, the queue message processing process and the pointer setting process may be executed in parallel, or the queue message processing process and the pointer setting process may be executed in series.
The queue message processing flow comprises the following steps: after receiving the queue message, sending write requests corresponding to the queue message, and accumulating the virtual tail pointers according to the number of the sent write requests, namely updating the virtual tail pointers. In this embodiment, the write request includes data to be written and an address of an element space of the data to be written, where the address of the element space of the data to be written is obtained according to a base address of the queue and a value of a virtual tail pointer before update.
The pointer setting process is shown in fig. 1:
in step S11, after receiving the write end acknowledgements, the maximum capture write end counter is updated by accumulating the count value of the maximum capture write end counter according to the number of the received write end acknowledgements. And after the data is written into the element space of the data to be written, receiving a write end confirmation of the address containing the element space returned by the memory.
In step S12, the address of the element space to which data has been written is acquired from the received write end confirmation. And after receiving the writing end confirmation, acquiring the address of the element space contained in the writing end confirmation, wherein the address is the address of the element space in which the data is written. In the present embodiment, the address of the element space included in the write completion confirmation is an offset from the base address of the queue.
The sequence of steps S11 and S12 is not limited to the sequence described in the present embodiment, and step S12 may be executed first, and step S11 may be executed later.
Step S13, determining whether the address of the element space obtained from the received write end confirmation is greater than or equal to the value of the maximum capture tail pointer: if so, go to step S14, otherwise, go to step S15.
Step S14, if the address of the obtained element space is greater than or equal to the value of the maximum capture tail pointer, the maximum capture tail pointer is updated, and the value of the maximum capture tail pointer is set as the address of the obtained element space plus one, that is, the maximum capture tail pointer points to the position of the element space subsequent to the element space to which data has been written.
Step S15, if the address of the acquired element space is smaller than the value of the maximum capture tail pointer, it is determined whether the difference between the maximum capture tail pointer and the real tail pointer is equal to the count value of the maximum capture write end counter: if so, go to step S16, otherwise, go to step S11.
Step S16, the real tail pointer is updated, that is, the real tail pointer points to the position pointed by the maximum capture tail pointer, the maximum capture write end counter is cleared, and step S11 is continuously executed. When the judgment result of step S15 is that the difference between the maximum capture tail pointer and the real tail pointer is equal to the count value of the maximum capture write end counter, the element space between the real tail pointer and the maximum capture tail pointer is full of data and becomes a consumable queue space, and therefore, the value of the real tail pointer is updated to the value of the maximum capture tail pointer, and the maximum capture write end counter is cleared to count the number of element spaces in which data has been written between the maximum capture tail pointer and the real tail pointer again.
When all the write end acknowledgements corresponding to the write requests are returned, it is indicated that all the sent write requests are processed, the data of the queue messages are all written into the corresponding element space, and the value of the real tail pointer is equal to the value of the virtual tail pointer.
In addition, in the above-mentioned pointer setting flow, there may be a case where the element space between the real tail pointer and the maximum capture tail pointer cannot be filled with data for a long time due to the continuous update of the maximum capture tail pointer, and the real tail pointer cannot be updated according to the maximum capture tail pointer, and the queue cannot be consumed. To ensure that the element space between the proof tail pointer and the maximum capture tail pointer can be filled with data, the present embodiment also sets the maximum message throughput.
Therefore, the queue message processing flow may further include that, when a new queue message is received, it is determined whether a difference between the virtual tail pointer and the real tail pointer is greater than or equal to a preset maximum message processing amount:
if the difference value between the virtual tail pointer and the real tail pointer is larger than or equal to the preset maximum message processing amount, blocking (not processing) the new queue message until the real tail pointer is updated and then processing the received queue message;
or if the difference value between the virtual tail pointer and the real tail pointer is greater than or equal to the preset maximum message processing amount, discarding the new queue message, sending a failure confirmation of the queue message to a sender of the queue message, and informing the sender to resend the queue message.
And if the difference value of the virtual tail pointer and the real tail pointer is less than the preset maximum message processing amount, continuing to process the received queue message.
The queue management method according to this embodiment is described below by taking an example, where the maximum message throughput is set to 8, and changes in the element space of the head pointer, the real tail pointer, the virtual tail pointer, the maximum capture write end counter, and the queue are shown in fig. 2:
(2-1) when the system is in an initial state, the initial values of the head pointer hp, the real tail pointer tp, the virtual tail pointer v _ tp, the maximum capture tail pointer mc _ tp and the maximum capture write-over counter mc _ cnt are all 0.
(2-2) receiving 8 queue messages from a plurality of remote processes accessing the same queue, and setting the value of the virtual tail pointer v _ tp to be 8. 8 write requests, defined as MemW0 and MemW1.. MemW7, are sent to the memory to write data to the element spaces 0-7 of the queue, respectively.
(2-3) receiving a write end confirmation corresponding to the write request MemW3, updating the value of the maximum capture tail pointer mc _ tp to 4, and updating the count value of the maximum capture write end counter mc _ cnt to 1.
(2-4) receiving the write end acknowledgements corresponding to the write requests MemW1, MemW2, and MemW6, respectively, updating the value of the maximum capture tail pointer mc _ tp to 7, and updating the count value of the maximum capture write end counter mc _ cnt to 4.
(2-5) receiving a write end acknowledgement corresponding to the write request MemW0, updating the count value of the maximum captured write end counter mc _ cnt to 5.
(2-6) receiving 2 queue messages for accessing the queue, because the difference value of the virtual tail pointer and the real tail pointer is equal to the preset maximum message processing amount, asynchronous messages of the subsequent queue cannot be processed, so that the 2 queue messages are blocked (not processed) or failure confirmation of returning the messages to the message initiator is returned, and the value of the virtual tail pointer v _ tp is kept unchanged.
(2-7) respectively receiving write end confirmations corresponding to the write requests MemW4 and MemW5, wherein the element space between the real tail pointer tp and the maximum capture tail pointer mc _ tp is full of data and becomes a seamless data space, the value of the real tail pointer tp is updated to be 7, and the maximum capture write end counter mc _ cnt is cleared by 0.
……
In accordance with the queue management method, as shown in fig. 3, the queue manager according to the present embodiment includes: a queue pointer register 30, a maximum capture write end counter 31, a setting unit 32, a sending unit 33 and an updating unit (not shown).
A queue pointer register 30 for storing a queue pointer, the queue pointer comprising: head pointer hp, real tail pointer tp, virtual tail pointer v _ tp, and maximum capture tail pointer mc _ tp.
The maximum capture write end counter 31 counts the number of element spaces in which data has been written between the maximum capture tail pointer mc _ tp and the real tail pointer tp.
A setup unit 32, an initial configuration queue, an initial setup queue pointer register 30 and a maximum capture write end counter 31. In the initial state of the system, a head pointer hp, a real tail pointer tp, a virtual tail pointer v _ tp, a maximum capture tail pointer mc _ tp, and a maximum capture write-over counter 31 are set to 0.
The sending unit 33 sends write requests corresponding to the received queue messages, and accumulates the virtual tail pointers according to the number of the sent write requests. The write request contains the data to be written and the address of the element space where the data is to be written.
The update unit includes: an accumulation unit 34, an acquisition unit 35, a first update unit 36 and a second update unit 37.
The accumulation unit 34 accumulates the count value of the maximum capture write end counter 31 according to the number of received write end acknowledgements.
The acquiring unit 35 acquires the address of the element space to which data has been written from the received write end acknowledgement. And after the data is written into the element space of the data to be written, the returned writing end confirmation comprises the address of the element space of the written data.
A first updating unit 36, configured to determine whether the address of the element space acquired by the acquiring unit 35 is greater than or equal to the value of the maximum capture tail pointer mc _ tp: if so, pointing the maximum capture tail pointer mc _ tp to the position of the element space behind the element space with the written data; if not, the maximum capture tail pointer mc _ tp is not updated.
The second updating unit 37, according to the maximum capture tail pointer mc _ tp obtained by the first updating unit 36, determines whether the difference between the maximum capture tail pointer mc _ tp and the real tail pointer tp is equal to the count value of the maximum capture write end counter mc _ cnt: if yes, pointing the real tail pointer tp to the position pointed by the maximum capture tail pointer mc _ tp, and clearing the maximum capture write end counter 31; if not, the real tail pointer tp is not updated.
Then, the accumulation unit 34, the acquisition unit 35, the first update unit 36, and the second update unit 37 continue to process the received write end acknowledgement.
The queue manager may further include a blocking unit 38, which determines whether a difference between the virtual tail pointer and the real tail pointer is greater than or equal to a preset maximum message throughput when a new queue message is received:
if the difference between the virtual tail pointer and the real tail pointer is greater than or equal to the preset maximum message processing amount, blocking (not processing) the new queue message until the real tail pointer is updated, and then continuously processing the received queue message by the sending unit 33;
or if the difference value between the virtual tail pointer and the real tail pointer is greater than or equal to the preset maximum message processing amount, discarding the new queue message, and sending a failure confirmation of the queue message to a sender of the queue message;
if the difference between the virtual tail pointer and the real tail pointer is smaller than the preset maximum message processing amount, the sending unit 33 continues to process the received queue message.
Second embodiment
The queue management method of the present embodiment sets five queue pointers and two queue counters, where the queue pointers include: a head Pointer, a real Tail Pointer, a virtual Tail Pointer, a maximum Capture Tail Pointer, and a First Capture Tail Pointer (fc _ tp, First Capture Tail Pointer). The queue counter includes: a maximum trapped write end counter and a first trapped write end counter.
The element space between the head pointer and the real tail pointer is a consumable queue space, the head pointer points to the position of the element space where the consumable queue head element is located, and the real tail pointer points to the position of the element space behind the element space where the consumable queue tail element is located. The virtual tail pointer points to the position of an element space behind the element space of the data to be written of the last write request, and the element space between the real tail pointer and the virtual tail pointer is an expendable queue space and comprises at least one element space without written data. In the initial state, the head pointer, real tail pointer and virtual tail pointer are all set to point to the first element space of the queue.
The maximum capture tail pointer points to a location of the last element space that is subsequent to the last element space to which data has been written. The value of the first capture tail pointer is less than or equal to the value of the maximum capture tail pointer. In an initial state, a first capture tail pointer and a maximum capture tail pointer are set to point to the position of a first element space of the queue; when a write end confirmation is received and the value of the real tail pointer is equal to the value of the first capture tail pointer, the first capture tail pointer and the maximum capture tail pointer point to the position of the element space behind the element space corresponding to the write end confirmation (the address of the element space corresponding to the write end confirmation is the address of the element space included in the write end confirmation); and along with the return of the subsequent writing end confirmation, the maximum capturing tail pointer is updated according to the address of the element space contained in the writing end confirmation, and the first capturing tail pointer is updated according to the maximum capturing tail pointer after the real tail pointer is updated.
A maximum capture write end counter that counts the number of element spaces between the maximum capture tail pointer and the first capture tail pointer into which data has been written; a first capture write end counter that counts a number of element spaces between the first capture tail pointer and the real tail pointer into which data has been written.
The queue management method of the present embodiment includes: initialization flow, queue message processing flow and pointer setting flow.
The initialization process comprises the following steps: and initially configuring a queue, and initially setting a queue pointer and a queue counter. In the initial state of the system, the storage space of data is configured for the queue in the system memory space, the definition of attributes such as the base address, the capacity, the space attribute, the access authority and the like of the queue is completed, a head pointer, a real tail pointer, a virtual tail pointer, a first capture tail pointer and a maximum capture tail pointer all point to the position of the first element space of the queue, and a first capture write end counter and a maximum capture write end counter are cleared. In this embodiment, the values of the head pointer, real tail pointer, virtual tail pointer, first capture tail pointer, and maximum capture tail pointer are offsets from the base address of the queue.
After the initialization process, the queue message processing process and the pointer setting process may be executed in parallel, or the queue message processing process and the pointer setting process may be executed in series.
The queue message processing flow comprises the following steps: after receiving the queue message, sending write requests corresponding to the queue message, and accumulating the virtual tail pointers according to the number of the sent write requests, namely updating the virtual tail pointers. In this embodiment, the write request includes data to be written and an address of an element space of the data to be written, where the address of the element space of the data to be written is obtained according to a base address of the queue and a value of a virtual tail pointer before update.
The pointer setting process is shown in fig. 4:
in step S41, after the write end confirmation is received, the address of the element space to which data has been written is acquired from the received write end confirmation. And after the data is written into the element space of the data to be written, confirming the end of writing of the address containing the element space returned by the received memory, wherein the address is the address of the element space in which the data is written. In the present embodiment, the address of the element space included in the write completion confirmation is an offset from the queue base address.
Step S42, determine whether the value of the real tail pointer is equal to the value of the first capture tail pointer: if yes, go to step S43; if not, step S44 is executed.
Step S43, setting the values of the first capture tail pointer and the maximum capture tail pointer to the address of the acquired element space plus one, that is, the first capture tail pointer and the maximum capture tail pointer point to the position of the element space subsequent to the element space of the written data, and then executing step S47.
Step S44, determining whether the address of the acquired element space is greater than or equal to the value of the first capture tail pointer: if so, go to step S45, otherwise, go to step S47.
Step S45, add one to the maximum capture write end counter, and determine whether the address of the acquired element space is greater than or equal to the value of the maximum capture tail pointer: if so, go to step S46, otherwise, go to step S41.
Step S46, the address of the obtained element space is greater than or equal to the maximum capture tail pointer, the maximum capture tail pointer is updated, and the value of the maximum capture tail pointer is set to be the address of the obtained element space plus one, that is, the maximum capture tail pointer points to the position of the element space subsequent to the element space in which data has been written. Step S41 is then performed.
Step S47, add one to the first captured write end counter, determine whether the difference between the first captured tail pointer and the real tail pointer is equal to the count value of the first captured write end counter: if yes, go to step S48; if not, step S41 is executed.
Step S48, the real tail pointer and the first capture tail pointer are updated, that is, the real tail pointer points to the position pointed by the first capture tail pointer, the first capture tail pointer points to the position pointed by the maximum capture tail pointer, the count value of the first capture write end counter is set as the count value of the maximum capture write end counter, the maximum capture write end counter is cleared, and step S41 is continuously executed. When the judgment result of the step S47 is that the difference between the first capture tail pointer and the real tail pointer is equal to the count value of the first capture write end counter, the element space between the real tail pointer and the first capture tail pointer is full of data and becomes a consumable queue space, and therefore, the value of the real tail pointer is updated to the value of the first capture tail pointer, the value of the first capture tail pointer is updated to the value of the maximum capture tail pointer, and the count value of the first capture write counter is updated to the count value of the maximum capture write end counter, so as to count the number of the element spaces in which data has been written between the updated first capture tail pointer and the real tail pointer, and then the maximum capture write end counter is cleared, so as to count the number of the element spaces in which data has been written between the maximum capture tail pointer and the first capture tail pointer again.
When all the write end acknowledgements corresponding to the write requests are returned, it is indicated that all the sent write requests are processed, the data of the queue messages are all written into the corresponding element space, and the value of the real tail pointer is equal to the value of the virtual tail pointer.
Compared with the first embodiment, the first capture tail pointer and the first capture write-end counter are additionally arranged in the embodiment, the real tail pointer, the first capture tail pointer and the maximum capture tail pointer finish updating the real tail pointer in a value transfer mode, namely the real tail pointer is updated according to the first capture tail pointer, and the first capture tail pointer is updated according to the maximum capture tail pointer after the real tail pointer is updated, so that the situations that the real tail pointer cannot be updated and the queue cannot consume as in the first embodiment can be avoided.
The queue management method according to this embodiment is described below by way of an example, and changes in the head pointer, real tail pointer, virtual tail pointer, first capture tail pointer, maximum capture tail pointer, first capture write end counter, maximum capture write end counter, and element space of the queue are shown in fig. 5:
(5-1) when the system is in the initial state, the initial values of the head pointer hp, the real tail pointer tp, the virtual tail pointer v _ tp, the first capture tail pointer fc _ tp, the maximum capture tail pointer mc _ tp, the first capture write end counter fc _ cnt and the maximum capture write end counter mc _ cnt are all 0.
(5-2) 8 queue messages from a plurality of remote processes accessing the same queue are received, and the virtual tail pointer v _ tp is set to be 8. 8 write requests, defined as MemW0 and MemW1.. MemW7, are sent to the memory, and data are written into the element spaces 0-7 of the queue memory respectively.
(5-3) receiving a write end confirmation corresponding to the write request MemW3, wherein the value of the real tail pointer tp is equal to the value of the first capture tail pointer fc _ tp, the values of the first capture tail pointer fc _ tp and the maximum capture tail pointer mc _ tp are updated to be 4, and the count value of the first capture write end counter fc _ cnt is updated to be 1.
(5-4) receiving the write end acknowledgements corresponding to the write requests MemW1, MemW2, and MemW6, respectively, updating the value of the maximum capture tail pointer mc _ tp to 7, the count value of the first capture write end counter fc _ cnt to 3, and the count value of the maximum capture write end counter mc _ cnt to 1.
(5-5) receiving the end-of-write acknowledgement corresponding to the write request MemW0, updating the count value of the first captured end-of-write counter fc _ cnt to 4. At this time, the element space between the real tail pointer tp and the first capture tail pointer fc _ tp is full of data and becomes a seamless data space, the value of the update real tail pointer tp is 4, the value of the update first capture tail pointer fc _ tp is 7, the count value of the update first capture write end fc _ cnt counter is 1, and the maximum capture write end counter mc _ cnt is cleared by 0.
(5-6) receiving 2 queue messages for accessing the queue, and setting the value of the virtual tail pointer v _ tp to 10. Sending 2 write requests, defined as MemW8 and MemW9, to the memory, and respectively writing data to the element spaces 8-9 of the queue memory.
(5-7) receiving the write end acknowledgements corresponding to the write requests MemW4, MemW5, and MemW9, respectively, updating the maximum capture tail pointer to a value of 10, the first capture write end counter fc _ cnt to a count value of 3, and the maximum capture write end counter mc _ cnt to a count value of 1. At this time, the element space between the real tail pointer tp and the first capture tail pointer fc _ tp is full of data and becomes a seamless data space, the value of the update real tail pointer tp is 7, the value of the update first capture tail pointer fc _ tp is 10, the count value of the update first capture write end fc _ cnt counter is 1, and the maximum capture write end counter mc _ cnt is cleared by 0.
……
In accordance with the queue management method, as shown in fig. 6, the queue manager according to the present embodiment includes: queue pointer register 60, queue counter 61, setting unit 62, sending unit 63, and updating unit (not shown).
A queue pointer register 60 for storing a queue pointer, the queue pointer comprising: a head pointer hp, a real tail pointer tp, a virtual tail pointer v _ tp, a first capture tail pointer fc _ tp, and a maximum capture tail pointer mc _ tp.
A queue counter 61 comprising: a first capture write end counter fc _ cnt that counts the number of element spaces into which data has been written between the first capture tail pointer fc _ tp and the real tail pointer tp, and a maximum capture write end counter mc _ cnt that counts the number of element spaces into which data has been written between the maximum capture tail pointer mc _ tp and the first capture tail pointer fc _ tp.
A setting unit 62, initially configure the queue, initially set the queue pointer register 60 and the queue counter 61. In the initial state of the system, a head pointer hp, a real tail pointer tp, a virtual tail pointer v _ tp, a first capture tail pointer fc _ tp, a maximum capture tail pointer mc _ tp, a first capture write end counter fc _ cnt and a maximum capture write end counter mc _ cnt are set to 0.
The sending unit 63 sends write requests corresponding to the received queue messages, and accumulates the virtual tail pointers according to the number of the sent write requests. The write request contains the data to be written and the address of the element space where the data is to be written.
The update unit includes: an acquisition unit 64, a first updating unit 65, a second updating unit 66, a third updating unit 67, and a fourth updating unit 68.
The obtaining unit 64 obtains the address of the element space to which data has been written from the received write end acknowledgement. And after the data is written into the element space of the data to be written, the returned writing end confirmation comprises the address of the element space of the written data.
The first updating unit 65 determines whether the value of the real tail pointer is equal to the value of the first capture tail pointer: if the real tail pointer is equal to the first capture tail pointer, setting the values of the first capture tail pointer fc _ tp and the maximum capture tail pointer mc _ tp as addresses of the acquired element space plus one, that is, setting the first capture tail pointer fc _ tp and the maximum capture tail pointer mc _ tp to the position of the element space subsequent to the element space in which data has been written, adding one to the count value of the first capture write end counter fc _ cnt, and transmitting the judgment result, the obtained first capture tail pointer fc _ tp and the first capture write end counter fc _ cnt to the fourth updating unit 68; if the real tail pointer is not equal to the first capture tail pointer, the determination result is transmitted to the second updating unit 66.
A second updating unit 66, when the judgment result of the first updating unit 65 is that the value of the real tail pointer is not equal to the value of the first capture tail pointer, judging whether the address of the acquired element space is greater than or equal to the value of the first capture tail pointer fc _ tp: if yes, the count value of the maximum capture write-end counter mc _ cnt is increased by one, and the judgment result is transmitted to the third updating unit 67; if not, the count value of the first captured write end counter fc _ cnt is incremented by one, and the determination result and the obtained first captured write end counter fc _ cnt are transmitted to the fourth updating unit 68.
A third updating unit 67, configured to determine whether the address of the acquired element space is greater than or equal to the value of the maximum capture tail pointer mc _ tp, when the determination result of the second updating unit 66 is that the address of the acquired element space is greater than or equal to the value of the first capture tail pointer fc _ tp: if the address of the acquired element space is greater than or equal to the value of the maximum capture tail pointer mc _ tp, updating the maximum capture tail pointer mc _ tp, setting the value of the maximum capture tail pointer mc _ tp as the address of the acquired element space plus one, that is, the maximum capture tail pointer mc _ tp points to the position of the element space after the element space in which data has been written, and then, the acquisition unit 64, the first updating unit 65, the second updating unit 66, the third updating unit 67, and the fourth updating unit 68 continue to process the received write end confirmation.
A fourth updating unit 68, configured to determine whether a difference between the first capture tail pointer fc _ tp and the real tail pointer tp is equal to the count value of the first capture write end counter fc _ cnt when the determination result of the first updating unit 65 is that the value of the real tail pointer is not equal to the value of the first capture tail pointer, or the determination result of the second updating unit 66 is that the address of the acquired element space is smaller than the value of the first capture tail pointer fc _ tp (i.e., after the count value of the first capture write end counter fc _ cnt is updated): if the difference between the first capture tail pointer fc _ tp and the real tail pointer tp is equal to the count value of the first capture write-end counter fc _ cnt, the real tail pointer tp and the first capture tail pointer fc _ tp are updated, that is, the real tail pointer tp points to the position pointed by the first capture tail pointer fc _ tp, then the first capture tail pointer fc _ tp points to the position pointed by the maximum capture tail pointer mc _ tp, and the count value of the first capture write-end counter fc _ cnt is set as the count value of the maximum capture write-end counter mc _ cnt, then the maximum capture write-end counter mc _ cnt is cleared, and then the obtaining unit 64, the first updating unit 65, the second updating unit 66, the third updating unit 67, and the fourth updating unit 68 continue to process the received write-end confirmation.
If the judgment result of the third updating unit 67 is that the address of the acquired element space is smaller than the value of the maximum capture tail pointer mc _ tp, or the judgment result of the fourth updating unit 68 is that the difference value between the first capture tail pointer fc _ tp and the real tail pointer tp is not equal to the count value of the first capture write end counter fc _ cnt, the acquiring unit 64, the first updating unit 65, the second updating unit 66, the third updating unit 67, and the fourth updating unit 68 continue to process the received write end acknowledgement.
An embodiment of the present invention further provides a method for processing a queue message, as shown in fig. 7, including the following steps:
in step S71, the sending side 71 sends a queue message to the receiving side 72, which accesses the queue memory 721 of the receiving side 72 (i.e., the memory in which the queue resides).
In step S72, the queue manager 722 of the receiving side 72, after receiving the queue message, sends a write request corresponding to the queue message to the queue memory 721 of the receiving side, and accumulates the virtual tail pointer according to the number of the sent write requests.
In step S73, after receiving the write request, the queue memory 721 of the receiving side 72 writes the data in the write request into the corresponding element space, and returns a corresponding write end confirmation to the queue manager 722 of the receiving side 72.
In step S74, after receiving the write end confirmation, the queue manager 722 of the receiving side 72 updates the queue counter of the queue manager 722 according to the write end confirmation, and updates the real tail pointer of the queue manager 722 according to the address of the element space included in the write end confirmation and the updated queue counter. Step S74 may include steps S11 to S16 shown in fig. 1, and may also include steps S41 to S48 shown in fig. 4.
In step S75, the queue manager 722 of the receiving side 72 returns an acknowledgement of the corresponding queue message to the sending side 71 according to the write completion acknowledgement.
In addition, if the step S74 includes steps S11 to S16 shown in fig. 1, the method for processing the queue message may further include step S76, where the queue manager 722 of the receiving side 72 discards a new queue message (does not send a corresponding write request) when the difference between the virtual tail pointer and the real tail pointer is greater than or equal to the preset maximum message handling capacity, and returns a failure acknowledgement of the queue message to the sender of the new queue message. This step is optional, and in other embodiments, when the difference between the virtual tail pointer and the real tail pointer is greater than or equal to the preset maximum message throughput, the queue manager 722 of the receiving side 72 blocks new queue messages until the real tail pointer is updated, and then sends a corresponding write request to the memory 721 where the queue is located.
Corresponding to the above-mentioned queue message processing method, the queue message processing system of the present embodiment, as shown in fig. 7, includes a sending side 71 and a receiving side 72, where the receiving side 72 includes a queue memory 721 and a queue manager 722.
The sending side 71 sends a queue message for accessing the queue memory 721 of the receiving side 72 to the receiving side 72, and receives an acknowledgement of the corresponding queue message returned by the receiving side 72.
The queue memory 721 of the receiving side 72 receives the write request sent by the queue manager 722, writes the data in the write request into the corresponding element space, and returns a corresponding write completion acknowledgement to the queue manager 722.
The queue manager 722 receives the queue message sent by the sender 71, sends a write request corresponding to the queue message to the queue memory 721, accumulates the virtual tail pointer according to the number of the sent write requests, receives a write end acknowledgement returned by the queue memory 721, updates the queue counter according to the write end acknowledgement, updates the real tail pointer according to the address of the element space included in the write end acknowledgement and the updated queue counter, and returns an acknowledgement of the corresponding queue message to the sender 71 according to the write end acknowledgement.
The queue manager 722 can be as shown in fig. 3 or as shown in fig. 6.
To sum up, the above technical solution sets a head pointer, a virtual tail pointer, a real tail pointer and a queue counter, updates the queue counter according to the received write end acknowledgement, and updates the real tail pointer according to the address of the element space included in the write end acknowledgement and the updated queue counter, so that the element space between the head pointer and the real tail pointer is a consumable queue space; the element space between the real tail pointer and the virtual tail pointer is the queue space that is not consumable. Therefore, the technical scheme can ensure the updating of the queue tail pointer (real tail pointer) and the synchronization of the element space of the data writing queue without executing the memory writing requests in sequence, thereby expanding the application range of the queue message.
Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto, and variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present invention.

Claims (9)

1. A method of queue management, comprising the steps of:
initially setting a queue pointer and a queue counter, wherein the queue pointer comprises a head pointer, a virtual tail pointer, a real tail pointer and a maximum capture tail pointer, an element space between the head pointer and the real tail pointer is a consumable queue space, and the maximum capture tail pointer points to a position of an element space behind a last element space in which data is written;
sending write requests corresponding to the received queue messages, and accumulating the virtual tail pointers according to the number of the sent write requests;
updating a queue counter according to the received write end acknowledgement, updating a real tail pointer according to the address of the element space contained in the write end acknowledgement and the updated queue counter,
wherein,
the queue counter is a maximum capture write-end counter for counting the number of element spaces in which data has been written between the maximum capture tail pointer and the real tail pointer, the queue counter is updated according to the received write-end acknowledgement, and the real tail pointer is updated according to the address of the element space included in the write-end acknowledgement and the updated queue counter, and the method includes the following steps:
accumulating the count value of the maximum capture write end counter according to the number of the received write end acknowledgements;
acquiring the address of the element space of the written data from the received writing end confirmation;
when the obtained address of the element space is larger than or equal to the value of the maximum capture tail pointer, pointing the maximum capture tail pointer to the position of the element space behind the element space in which data is written;
when the difference value of the maximum capture tail pointer and the real tail pointer is equal to the count value of the maximum capture write-over counter, the real tail pointer points to the position pointed by the maximum capture tail pointer, the maximum capture write-over counter is cleared,
or,
the queue pointer further includes a first capture tail pointer that points to a position of a subsequent element space of an element space corresponding to a write end confirmation when the write end confirmation is received and a value of a real tail pointer is equal to a value of the first capture tail pointer, the queue counter includes a maximum capture write end counter that counts a number of element spaces in which data has been written between the maximum capture tail pointer and the first capture tail pointer and a first capture write end counter that counts a number of element spaces in which data has been written between the first capture tail pointer and the real tail pointer, the queue counter is updated according to the received write end confirmation, and the real tail pointer is updated according to an address of an element space included in the write end confirmation and the updated queue counter, including the steps of:
acquiring the address of the element space of the written data from the received writing end confirmation;
when the value of the real tail pointer is equal to the value of the first capture tail pointer, pointing the first capture tail pointer and the maximum capture tail pointer to the position of the element space behind the element space in which the data is written, and adding one to the first capture write end counter;
incrementing a maximum capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the value of the first capture tail pointer;
incrementing a first capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is less than the value of the first capture tail pointer;
when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the value of the maximum capture tail pointer, pointing the maximum capture tail pointer to a position of an element space subsequent to the element space in which the data has been written;
and when the first capture write end counter is updated and the difference value between the first capture tail pointer and the real tail pointer is equal to the count value of the first capture write end counter, pointing the real tail pointer to the position pointed by the first capture tail pointer, then pointing the first capture tail pointer to the position pointed by the maximum capture tail pointer, setting the count value of the first capture write end counter as the count value of the maximum capture write end counter, and then resetting the maximum capture write end counter.
2. The method of queue management according to claim 1, wherein said initially setting a queue pointer and a queue counter comprises: in the initial state of the system, the queue pointer points to the position of the first element space of the queue, and the queue counter is cleared.
3. The queue management method according to claim 1, wherein when the queue counter is a maximum capture write end counter that counts the number of element spaces between the maximum capture tail pointer and the real tail pointer into which data has been written, the queue management method further comprises: and when the difference value of the virtual tail pointer and the real tail pointer is larger than or equal to the preset maximum message processing amount, blocking the new queue message until the real tail pointer is updated, or discarding the new queue message and sending a failure confirmation of the queue message to a sender of the new queue message.
4. A queue manager, comprising:
a queue pointer register storing queue pointers, the queue pointers including a head pointer, a virtual tail pointer, a real tail pointer, and a maximum capture tail pointer, an element space between the head pointer and the real tail pointer being a consumable queue space, the maximum capture tail pointer pointing to a location of an element space subsequent to a last element space where data has been written;
a queue counter that counts the number of element spaces into which data has been written;
the setting unit is used for initially setting a queue pointer register and a queue counter;
a sending unit, which sends write requests corresponding to the received queue messages and accumulates the virtual tail pointers according to the number of the sent write requests;
an updating unit for updating the queue counter according to the received write end acknowledgement, and updating the real tail pointer according to the address of the element space contained in the write end acknowledgement and the updated queue counter,
wherein,
the queue counter is a maximum capture write end counter that counts the number of element spaces in which data has been written between the maximum capture tail pointer and the real tail pointer, and the update unit includes:
an accumulation unit accumulating the count value of the maximum capture write end counter according to the number of the received write end acknowledgements;
an acquisition unit that acquires an address of an element space to which data has been written from the received write end acknowledgement;
a first updating unit configured to point the maximum capture tail pointer to a position of an element space subsequent to the element space to which the data has been written, when the address of the acquired element space is greater than or equal to a value of the maximum capture tail pointer;
a second updating unit that points the real tail pointer to a position pointed by the maximum capture tail pointer and clears the maximum capture write end counter when a difference between the maximum capture tail pointer and the real tail pointer is equal to a count value of the maximum capture write end counter,
or,
the queue pointer further includes a first capture tail pointer that points to a position of a subsequent element space of an element space corresponding to a write end confirmation when the write end confirmation is received and a value of the real tail pointer is equal to a value of the first capture tail pointer, the queue counter includes a maximum capture write end counter that counts a number of element spaces in which data has been written between the maximum capture tail pointer and the first capture tail pointer and a first capture write end counter that counts a number of element spaces in which data has been written between the first capture tail pointer and the real tail pointer, the updating unit includes:
an acquisition unit that acquires an address of an element space to which data has been written from the received write end acknowledgement;
a first updating unit, configured to point the first capture tail pointer and the maximum capture tail pointer to a position of an element space subsequent to the element space to which data has been written, and increment a first capture write end counter by one when the value of the real tail pointer is equal to the value of the first capture tail pointer;
a second updating unit that increments the maximum capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the value of the first capture tail pointer, and increments the first capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is less than the value of the first capture tail pointer;
a third updating unit that points the maximum capture tail pointer to a position of an element space subsequent to the element space to which data has been written, when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the value of the maximum capture tail pointer;
and a fourth updating unit configured to, after the first captured write end counter is updated and when the difference between the first captured tail pointer and the real tail pointer is equal to the count value of the first captured write end counter, point the real tail pointer to a position pointed by the first captured tail pointer, point the first captured tail pointer to a position pointed by the maximum captured tail pointer, set the count value of the first captured write end counter as the count value of the maximum captured write end counter, and clear the maximum captured write end counter.
5. The queue manager of claim 4, wherein the setting unit, at an initial state of the system, points the queue pointer to a first element space of the queue and clears the queue counter.
6. The queue manager of claim 4, wherein when the queue counter is a maximum capture write end counter that counts a number of element spaces between the maximum capture tail pointer and real tail pointer into which data has been written, the queue manager further comprises: and the stopping unit blocks the new queue message until the real tail pointer is updated or discards the new queue message and sends a failure confirmation of the queue message to a sender of the new queue message when the difference value of the virtual tail pointer and the real tail pointer is greater than or equal to the preset maximum message processing capacity.
7. A method for processing queue messages, comprising the steps of:
a transmitting side transmits a queue message for accessing a queue memory of a receiving side to the receiving side;
after receiving the queue message, the queue manager of the receiving party sends a write request corresponding to the queue message to a queue memory of the receiving party, and accumulates a virtual tail pointer of the queue manager according to the quantity of the sent write requests;
after receiving the write request, the queue memory of the receiving party writes the data in the write request into the corresponding element space and returns a corresponding write end confirmation to the queue manager of the receiving party;
after receiving a write end confirmation, the queue manager of the receiving party updates a queue counter of the queue manager according to the write end confirmation, and updates a real tail pointer of the queue manager according to an address of an element space contained in the write end confirmation and the updated queue counter;
the queue manager of the receiving party returns the confirmation of the corresponding queue message to the sending party according to the writing end confirmation,
wherein,
the queue counter is a maximum capture write-over counter, the queue manager of the receiver updates the queue counter according to the write-over confirmation, and updates the real tail pointer according to the address of the element space contained in the write-over confirmation and the updated queue counter, and the method comprises the following steps:
accumulating the count value of the maximum capture write end counter according to the number of the received write end acknowledgements;
capturing an address of the element space of the written data from the received write end acknowledgement;
when the obtained address of the element space is larger than or equal to the value of the maximum capture tail pointer, pointing the maximum capture tail pointer to the position of the element space behind the element space in which data is written;
when the difference value of the maximum capture tail pointer and the real tail pointer is equal to the count value of the maximum capture write-over counter, the real tail pointer points to the position pointed by the maximum capture tail pointer, the maximum capture write-over counter is cleared,
or,
the queue counter comprises a first capture write end counter and a maximum capture write end counter, after receiving a write end confirmation, the queue manager of the receiving party updates the queue counter according to the write end confirmation, and updates the real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter, and the method comprises the following steps:
acquiring the address of the element space of the written data from the received writing end confirmation;
when the value of the real tail pointer is equal to the value of the first capture tail pointer, pointing the first capture tail pointer and the maximum capture tail pointer to the position of the element space behind the element space in which the data is written, and adding one to the first capture write end counter;
when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the first capture tail pointer, incrementing a maximum capture write end counter by one;
incrementing a first capture write end counter by one when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is less than the value of the first capture tail pointer;
when the value of the real tail pointer is not equal to the value of the first capture tail pointer and the address of the acquired element space is greater than or equal to the maximum capture tail pointer, pointing the maximum capture tail pointer to the position of the element space behind the element space in which the data is written;
and when the first capture write end counter is updated and the difference value between the first capture tail pointer and the real tail pointer is equal to the count value of the first capture write end counter, pointing the real tail pointer to the position pointed by the first capture tail pointer, then pointing the first capture tail pointer to the position pointed by the maximum capture tail pointer, setting the count value of the first capture write end counter as the count value of the maximum capture write end counter, and then resetting the maximum capture write end counter.
8. The method of processing queue messages of claim 7, wherein when the queue counter is a maximum capture write end counter that counts the number of element spaces between the maximum capture tail pointer and real tail pointer into which data has been written, the method further comprises: when the difference value of the virtual tail pointer and the real tail pointer is larger than or equal to the preset maximum message processing amount, the queue manager of the receiver blocks new queue messages until the real tail pointer is updated; or discarding the new queue message and returning a failure confirmation of the queue message to the sender of the new queue message.
9. A system for processing queued messages, comprising a sending party and a receiving party, the receiving party comprising a queue memory and a queue manager, wherein,
the sender sends a queue message for accessing a queue memory of the receiver to the receiver and receives a confirmation of the corresponding queue message returned by the receiver;
the queue memory receives the write request sent by the queue manager, writes the data in the write request into the corresponding element space, and returns a corresponding write end confirmation to the queue manager;
the queue manager receives the queue message sent by the sender, sends the write request corresponding to the queue message to the queue memory, accumulates the virtual tail pointer according to the number of the sent write requests, receives the write end confirmation returned by the queue memory, updates the queue counter according to the write end confirmation, updates the real tail pointer according to the address of the element space contained in the write end confirmation and the updated queue counter, and returns the confirmation of the corresponding queue message to the sender according to the write end confirmation,
wherein the queue manager is as claimed in any one of claims 4 to 6.
CN 200710160669 2007-12-26 2007-12-26 Queue management method and queue management device, method and system for processing queue message Active CN101470623B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710160669 CN101470623B (en) 2007-12-26 2007-12-26 Queue management method and queue management device, method and system for processing queue message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710160669 CN101470623B (en) 2007-12-26 2007-12-26 Queue management method and queue management device, method and system for processing queue message

Publications (2)

Publication Number Publication Date
CN101470623A CN101470623A (en) 2009-07-01
CN101470623B true CN101470623B (en) 2011-02-16

Family

ID=40828113

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710160669 Active CN101470623B (en) 2007-12-26 2007-12-26 Queue management method and queue management device, method and system for processing queue message

Country Status (1)

Country Link
CN (1) CN101470623B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377043B (en) * 2012-04-24 2016-06-22 腾讯科技(深圳)有限公司 Message queue realize method and system, message queue process system
CN105550319B (en) * 2015-12-12 2019-06-25 天津南大通用数据技术股份有限公司 The optimization method of persistence under a kind of cluster Consistency service high concurrent
CN106095604A (en) * 2016-06-21 2016-11-09 京信通信技术(广州)有限公司 The communication method between cores of a kind of polycaryon processor and device
CN109960595A (en) * 2017-12-22 2019-07-02 北京国双科技有限公司 A kind of queue quoting method and device
CN108846045B (en) * 2018-05-30 2022-10-18 杭州吉吉知识产权运营有限公司 Storage method and system for drinking water data of intelligent water cup
CN109144749B (en) * 2018-08-14 2021-07-27 苏州硅岛信息科技有限公司 Method for realizing communication between multiple processors by using processor
CN115348218B (en) * 2022-10-18 2022-12-27 井芯微电子技术(天津)有限公司 Queue scheduling method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549108A (en) * 2003-05-07 2004-11-24 中兴通讯股份有限公司 Method for realizing communication process zero copy information queue
CN1630247A (en) * 2003-12-18 2005-06-22 华为技术有限公司 A method for maintaining routing table in storage capable of content-address mapping

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549108A (en) * 2003-05-07 2004-11-24 中兴通讯股份有限公司 Method for realizing communication process zero copy information queue
CN1630247A (en) * 2003-12-18 2005-06-22 华为技术有限公司 A method for maintaining routing table in storage capable of content-address mapping

Also Published As

Publication number Publication date
CN101470623A (en) 2009-07-01

Similar Documents

Publication Publication Date Title
CN101470623B (en) Queue management method and queue management device, method and system for processing queue message
US10541945B2 (en) Systems and methods for storing message data
CN111949568B (en) Message processing method, device and network chip
CN105378682B (en) The observation of data in long-time memory
US5418913A (en) System of two-way communication between processors using a single queue partitioned with pointers and limited overwrite privileges
US5900020A (en) Method and apparatus for maintaining an order of write operations by processors in a multiprocessor computer to maintain memory consistency
US9996403B2 (en) System and method for providing message queues for multinode applications in a middleware machine environment
JP3996454B2 (en) System and method for inter-domain low overhead message passing in a split server
CN110741356A (en) Relay -induced memory management in multiprocessor systems
US9569291B1 (en) Systems and methods for inter-process messaging
US9405725B2 (en) Writing message to controller memory space
CN111427859B (en) Message processing method and device, electronic equipment and storage medium
US20090006605A1 (en) Extended write combining using a write continuation hint flag
CN110119304B (en) Interrupt processing method and device and server
KR20230163559A (en) Message passing circuit and method
CN112698959A (en) Multi-core communication method and device
US7552232B2 (en) Speculative method and system for rapid data communications
US9137780B1 (en) Synchronizing multicast data distribution on a computing device
US9910808B2 (en) Reflective memory bridge for external computing nodes
CN113836184A (en) Service persistence method and device
US20190026233A1 (en) Partially coherent memory transfer
CN108388529B (en) Method for actively realizing data exchange between peripheral and CPU
US11449489B2 (en) Split transaction coherency protocol in a data processing system
CN116755635B (en) Hard disk controller cache system, method, hard disk device and electronic device
CN118069387A (en) RDMA data transmission queue management method and device based on hardware multithreading

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