CN115348218B - Queue scheduling method and device - Google Patents

Queue scheduling method and device Download PDF

Info

Publication number
CN115348218B
CN115348218B CN202211273005.2A CN202211273005A CN115348218B CN 115348218 B CN115348218 B CN 115348218B CN 202211273005 A CN202211273005 A CN 202211273005A CN 115348218 B CN115348218 B CN 115348218B
Authority
CN
China
Prior art keywords
queue
pointer
sent
counter
area
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
CN202211273005.2A
Other languages
Chinese (zh)
Other versions
CN115348218A (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.)
Jingxin Microelectronics Technology Tianjin Co Ltd
Original Assignee
Jingxin Microelectronics Technology Tianjin Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingxin Microelectronics Technology Tianjin Co Ltd filed Critical Jingxin Microelectronics Technology Tianjin Co Ltd
Priority to CN202211273005.2A priority Critical patent/CN115348218B/en
Publication of CN115348218A publication Critical patent/CN115348218A/en
Application granted granted Critical
Publication of CN115348218B publication Critical patent/CN115348218B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/622Queue service order
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/901Buffering arrangements using storage descriptor, e.g. read or write pointers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The application discloses a queue scheduling method and device. The method comprises the following steps: acquiring a queue to be processed, wherein the queue to be processed comprises configuration data of a plurality of elements; creating a queue pointer and a queue counter of a queue to be processed; the queue pointer is used for pointing to the position of the configuration data of the element in the queue to be processed; the queue counter is used for representing the state of the element; and responding to a queue scheduling instruction triggered by the data terminal, and operating the queue pointer and the queue counter to schedule the queue to be processed. By configuring the queue pointer and the queue counter and operating the queue pointer and the queue counter, the elements in the queue can be flexibly scheduled, and the scheduling process has high universality and is irrelevant to a specific transmission protocol, so that the method can be widely adapted to various reliable transmission protocols, and the data transmission effect can be improved.

Description

Queue scheduling method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a queue scheduling method and apparatus.
Background
In recent years, with the development of emerging technologies such as big data and cloud computing, the demand of service scenarios is gradually increased, and many message middleware can support queue-based data processing, such as Kafka (open distributed publish-subscribe message system), rocktmq (message queue software), and the like.
However, the specific scheduling manner of the elements in the queue is not considered too much in the queue-based data processing scheme, so that there is no feasible queue scheduling scheme that can implement scheduling of the elements in the queue, such as acknowledgement and retransmission of the elements, based on a data transmission manner specified by reliable transmission protocols such as RAPIDIO (packet switching-based Interconnect architecture), PCIe (Peripheral Component Interconnect Express), and the like.
Disclosure of Invention
The embodiment of the application provides a queue scheduling method and device, so that flexible scheduling of elements in a queue is realized, and the data transmission effect is improved.
In a first aspect, an embodiment of the present application provides a queue scheduling method, including:
acquiring a queue to be processed, wherein the queue to be processed comprises configuration data of a plurality of elements;
creating a queue pointer and a queue counter of the queue to be processed; the queue pointer is used for pointing to the position of the configuration data of the element in the queue to be processed; the queue counter is used for representing the state of the element;
and responding to a queue scheduling instruction triggered by a data end, and operating the queue pointer and the queue counter to schedule the queue to be processed.
Optionally, the creating a queue pointer of the pending queue includes:
dividing the queue to be processed into a first idle area, an area to be sent, an area to be confirmed and sent and a second idle area;
setting a first queue pointer between the first idle area and the area to be sent; the first queue pointer is used for pointing to configuration data of a first free element in the first free area;
setting a second queue pointer between the region to be sent and the region to be confirmed which is sent; the second queue pointer is used for pointing to configuration data of the next element to be transmitted in the region to be transmitted;
setting a third queue pointer between the sent to-be-confirmed area and the second idle area; the third queue pointer is used for pointing to configuration data of a target element to be confirmed in the sent area to be confirmed; and the target element to be confirmed is the element to be confirmed which has the longest storage time in the sent area to be confirmed.
Optionally, the first queue pointer, the second queue pointer, and the third queue pointer are set by:
acquiring the number N of storable elements of the queue to be processed; n is a positive integer;
initializing the first, second, and third queue pointers to set the values of the first, second, and third queue pointers to 0, respectively;
setting the first queue pointer, the second queue pointer, and the third queue pointer to a round robin work; the loop work is used for indicating that when the accumulated value of the first queue pointer, the second queue pointer and the third queue pointer is N-1, the values of the first queue pointer, the second queue pointer and the third queue pointer are reset to 0.
Optionally, creating a queue counter of the queue to be processed includes:
respectively creating a first queue counter and a second queue counter; the first queue counter is used for representing the sum of the number of elements to be sent in the area to be sent and the number of elements to be confirmed sent in the area to be confirmed sent; the second queue counter is used for representing the number of elements to be sent in the area to be sent.
Optionally, the queue scheduling instruction is an element enqueue instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
responding to the element enqueuing instruction triggered by the data receiving end, and acquiring configuration data of the element to be stored;
and inserting the configuration data of the element to be stored into the position pointed by the first queue pointer, and adding 1 to the first queue pointer and the first queue counter respectively.
Optionally, the queue scheduling instruction is an element sequential dequeue instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
responding to the element sequence dequeuing instruction triggered by the data sending end, and acquiring configuration data of the next element to be sent;
and sending the configuration data of the next element to be sent to the data sending end, adding 1 to the second queue pointer, and subtracting 1 from the second queue counter.
Optionally, the queue scheduling instruction is an element-first dequeue instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data end includes:
responding to the element priority dequeuing instruction triggered by the data sending end, and acquiring the priority of the element to be sent in the area to be sent;
determining an element with the highest priority as a priority element from the elements to be sent according to the priority, and acquiring an initial position of configuration data of the priority element in the area to be sent;
inserting configuration data of the priority element into a position pointed to by the second queue pointer, and moving the configuration data of the element between the initial position and the position pointed to by the second queue pointer in the direction of the first queue pointer;
and sending the configuration data of the priority element to the data sending end, adding 1 to the second queue pointer and subtracting 1 from the second queue counter.
Optionally, the queue scheduling instruction is an element validation instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data end includes:
responding to the element confirmation instruction triggered by a data receiving end, and acquiring configuration data of the target element to be confirmed;
sending the configuration data of the target element to be confirmed to a data cache end so that the data cache end releases a cache based on the configuration data of the target element to be confirmed;
and adding 1 to the third queue pointer and subtracting 1 from the first queue counter.
Optionally, the queue scheduling instruction is an element retransmission instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
in response to the element retransmission instruction triggered by a data receiving end, assigning the value of the third queue pointer to the second queue pointer, and assigning the value of the first queue counter to the second queue counter.
In a second aspect, an embodiment of the present application provides a queue scheduling apparatus, including:
the queue acquiring module is used for acquiring a queue to be processed, wherein the queue to be processed comprises configuration data of a plurality of elements;
the queue creating module is used for creating a queue pointer and a queue counter of the queue to be processed; the queue pointer is used for pointing to the position of the configuration data of the element in the queue to be processed; the queue counter is used for representing the state of the element;
and the queue scheduling module is used for responding to a queue scheduling instruction triggered by a data end, and operating the queue pointer and the queue counter so as to schedule the queue to be processed.
According to the technical scheme, the embodiment of the application has the following advantages:
in the embodiment of the present application, after a queue to be processed including configuration data of a plurality of elements is obtained, a queue pointer and a queue counter of the queue to be processed may be created. Wherein the queue pointer may point to a position of the configuration data of the element in the pending queue, and the queue counter may represent a state of the element. Therefore, when the data end triggers the queue scheduling instruction, the queue pointer and the queue counter are operated, so that the elements in the queue to be processed can be scheduled, and the scheduling of the queue to be processed is further realized. Therefore, the flexible scheduling of the elements in the queue can be realized by configuring the queue pointer and the queue counter and operating the queue pointer and the queue counter, and the scheduling process has high universality and is irrelevant to a specific transmission protocol, so that the method can be widely adapted to various reliable transmission protocols, and the data transmission effect can be improved.
Drawings
Fig. 1 is a flowchart of a queue scheduling method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a pending queue according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a pending queue when an element enqueue instruction is executed according to an embodiment of the present disclosure;
FIG. 4 is a diagram illustrating a structure of a queue to be processed when an element sequential dequeue instruction is executed according to an embodiment of the present disclosure;
FIG. 5 is a diagram illustrating a structure of a pending queue when an element first dequeue instruction is executed according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a pending queue when an element validation instruction is executed according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a pending queue when an element retransmit instruction is executed according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a queue scheduling apparatus according to an embodiment of the present application.
Detailed Description
As described hereinbefore, the inventors found in the research for cohorts that: the data processing scheme based on the queue does not consider the specific scheduling manner of the elements in the queue too much, so that there is no feasible queue scheduling scheme at present that can implement scheduling of the elements in the queue, such as acknowledgement and retransmission of the elements, based on the data transmission manner specified by reliable transmission protocols such as RAPIDIO (an interconnection system based on packet switching), PCIe (Peripheral Component Interconnect Express), and the like.
In order to solve the above problem, an embodiment of the present application provides a queue scheduling method, where the method may include: after a pending queue comprising configuration data for a plurality of elements is obtained, a queue pointer and a queue counter for the pending queue may be created. Wherein the queue pointer may point to a position of the configuration data of the element in the pending queue, and the queue counter may represent a state of the element. Therefore, when the data end triggers the queue scheduling instruction, the queue pointer and the queue counter are operated, so that the elements in the queue to be processed can be scheduled, and the scheduling of the queue to be processed is further realized.
Therefore, the flexible scheduling of the elements in the queue can be realized by configuring the queue pointer and the queue counter and operating the queue pointer and the queue counter, and the scheduling process has high universality and is irrelevant to a specific transmission protocol, so that the method can be widely adapted to various reliable transmission protocols, and the data transmission effect can be improved.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a flowchart of a queue scheduling method according to an embodiment of the present application. As shown in fig. 1, a method for scheduling a queue according to an embodiment of the present application may include:
s101: a queue to be processed is obtained, wherein the queue to be processed comprises configuration data of a plurality of elements.
In the embodiment of the present application, the plurality of elements may include at least one element to be sent and at least one element to be confirmed that is sent. Accordingly, the configuration data of the plurality of elements may be embodied as priority data corresponding to the plurality of elements respectively and storage address data of the data packet corresponding to the plurality of elements respectively. Specifically, in the embodiment of the present application, the queue to be processed may include a priority array and an address array, where the priority array is used to store priority data of an element to be sent and an element to be confirmed that has been sent; the address array is used for storing the storage address data of the data packet corresponding to the element to be sent and the element to be confirmed sent respectively.
S102: a queue pointer and a queue counter for the pending queue are created.
In an embodiment of the present application, the queue pointer may be used to point to a position of the configuration data of the element in the pending queue. The process of creating the queue pointer may not be specifically limited, and for the convenience of understanding, the following description is respectively made in conjunction with one possible embodiment and the accompanying drawings.
Fig. 2 is a schematic structural diagram of a pending queue according to an embodiment of the present disclosure. With reference to fig. 2, in a possible implementation, the process of creating a queue pointer may specifically include: dividing 20 the queue to be processed into a first free area 21, an area to be sent 22, an area to be confirmed sent 23 and a second free area 24; a first queue pointer 25 is set between the first free area 21 and the area to be transmitted 22; a second queue pointer 26 is set between the to-be-transmitted region 22 and the transmitted to-be-confirmed region 23; a third queue pointer 27 is arranged between the sent to be confirmed area 23 and the second free area 24. Wherein the first queue pointer 25 is used to point to the configuration data of the first free element in the first free area 21; second queue pointer 26 is used to point to configuration data of the next element to be transmitted in region 22 to be transmitted; the third queue pointer 27 is used to point to the configuration data of the target element to be confirmed in the sent area to be confirmed 23; the target element to be confirmed is the element to be confirmed which is stored in the transmitted area to be confirmed 23 for the longest time. In fig. 2, the specific transmission process of the element in the pending queue 20 may be embodied as: an element enqueues from the first free area 21, passes through the area to be transmitted 22, has transmitted the area to be confirmed 23, and dequeues from the second free area 24.
Further, in the embodiment of the present application, the first queue pointer, the second queue pointer, and the third queue pointer may be set by: acquiring the number N of storable elements of a queue to be processed; initializing a first queue pointer, a second queue pointer and a third queue pointer to set the values of the first queue pointer, the second queue pointer and the third queue pointer to 0 respectively; the first queue pointer, the second queue pointer, and the third queue pointer are set to be a round robin work. Here, the loop work is used to indicate that the values of the first, second, and third queue pointers are reset to 0 when the accumulated value of the first, second, and third queue pointers is N-1. Wherein N is a positive integer.
In embodiments of the present application, a queue counter may be used to represent the state of an element. Here, the states of the elements may include an idle state, a to-be-sent state, and a sent to-be-confirmed state. The process of creating the queue counter is not particularly limited, and for the sake of understanding, the following description is respectively made in conjunction with one possible embodiment.
In a possible implementation, the process of creating the queue counter may specifically include: respectively creating a first queue counter and a second queue counter; the first queue counter is used for representing elements to be sent in the area to be sent and the sum of the number of the elements to be confirmed sent in the area to be confirmed sent; the second queue counter is used for representing the number of elements to be sent in the area to be sent. Therefore, the state of the element can be represented by setting the queue counter to count the number of the element in each area, so that the queue management is facilitated.
Based on the relevant content of S102, in the embodiment of the present application, by setting three queue pointers and two queue counters and setting a circular working manner of the queue pointers, a circular queue capable of representing element states is constructed, and then a logical circular space is formed for the queue to be used circularly, so that the storage space can be effectively utilized, and the scheduling efficiency is improved.
S103: and responding to a queue scheduling instruction triggered by the data terminal, and operating the queue pointer and the queue counter to schedule the queue to be processed.
Here, the queue scheduling instruction may specifically include an element enqueue instruction, an element dequeue instruction, an element acknowledgement instruction, and an element retransmit instruction. The element dequeue instruction may specifically include an element sequential dequeue instruction and an element priority dequeue instruction. Specifically, the element sequential dequeue instruction is to dequeue the elements in the queue to be processed in a first-in first-out order, that is, the enqueued elements may be dequeued first. The element priority dequeue instruction refers to dequeuing the elements in the queue to be processed according to the priority order, that is, the elements with high priority can be dequeued first, and it can be understood that the elements with the same priority are further dequeued according to the first-in first-out order. Therefore, various scheduling modes of elements can be realized through different queue scheduling instructions, the universality of the scheduling process is high, and the scheduling process is irrelevant to a specific transmission protocol, so that the method can be widely adapted to various reliable transmission protocols, and the data transmission effect can be improved. In addition, flexible scheduling of elements can be further realized through two different dequeuing modes, so that application scenes of the queue to be processed are wider.
In addition, the process of operating the queue pointer and the queue counter in response to different element scheduling instructions is not particularly limited, and for convenience of understanding, the embodiments of the present application may provide possible implementation manners to describe, and please refer to the descriptions of the embodiments below for technical details.
Based on the above-mentioned relevant contents of S101 to S103, in the embodiment of the present application, after the to-be-processed queue including the configuration data of the plurality of elements is obtained, the queue pointer and the queue counter of the to-be-processed queue may be created. Wherein the queue pointer may point to a position of the configuration data of the element in the pending queue, and the queue counter may represent a state of the element. Therefore, when the data end triggers the queue scheduling instruction, the queue pointer and the queue counter are operated, so that the elements in the queue to be processed can be scheduled, and the scheduling of the queue to be processed is further realized. Therefore, the flexible scheduling of the elements in the queue can be realized by configuring the queue pointer and the queue counter and operating the queue pointer and the queue counter, and the scheduling process has high universality and is irrelevant to a specific transmission protocol, so that the method can be widely adapted to various reliable transmission protocols, and the data transmission effect can be improved.
Because different queue scheduling instructions can perform different operations on the queue pointer and the queue counter, thereby implementing flexible scheduling of elements in the queue to be processed, embodiments of the present application can also be described with reference to embodiments and drawings respectively for different operation processes corresponding to different queue scheduling instructions, that is, S103.
Fig. 3 is a schematic structural diagram of a queue to be processed when an element enqueue instruction is executed according to an embodiment of the present disclosure. Here, the queue scheduling instruction may be an element enqueue instruction. Accordingly, with reference to fig. 3, the process of operating the queue pointer and the queue counter, that is, S103, may specifically include:
responding to an element enqueue instruction triggered by a data receiving end, and acquiring configuration data of an element to be stored 31;
the configuration data of the element to be stored 31 is inserted into the position pointed to by the first queue pointer 25 and the first queue counter are incremented by 1, respectively.
The configuration data of the element to be stored 31, that is, the priority data of the element to be stored 31 and the storage address data of the corresponding data packet. When the configuration data of the element to be stored 31 is inserted into the position pointed by the first queue pointer 25, the state of the element to be stored 31 is updated to the state to be sent, accordingly, since the first queue pointer 25 is used to point to the configuration data of the first free element in the first free area 21, and the first queue counter is used to indicate the sum of the number of the element to be sent in the area to be sent 22 and the number of the elements to be confirmed sent in the area to be confirmed sent 23, both the values of the first queue pointer 25 and the first queue counter need to be increased by 1, thereby completing the operation of enqueuing the element to be stored 31.
Fig. 4 is a schematic structural diagram of a queue to be processed when an element sequential dequeue instruction is executed according to an embodiment of the present application. Here, the queue scheduling instruction may be an element sequential dequeue instruction. Accordingly, with reference to fig. 4, the process of operating the queue pointer and the queue counter, that is, S103, may specifically include:
in response to an element sequence dequeuing instruction triggered by a data sending end, obtaining configuration data of a next element to be sent 41;
and sending the configuration data of the next element to be sent 41 to the data sending end, adding 1 to the second queue pointer 26, and subtracting 1 from the second queue counter.
The configuration data of the next element to be transmitted 41, that is, the priority data of the next element to be transmitted 41 and the storage address data of the corresponding data packet. When the configuration data of the next element to be transmitted 41 is transmitted to the data transmitting end, the state of the next element to be transmitted 41 is updated to the state to be transmitted, and the next element to be transmitted 41 is moved from the region to be transmitted 22 to the region to be transmitted 23, accordingly, since the second queue pointer 26 is used for pointing to the configuration data of the next element to be transmitted 41 in the region to be transmitted 22, and the second queue counter is used for indicating the number of the elements to be transmitted in the region to be transmitted 22, the value of the second queue pointer 26 needs to be increased by 1, and the values of the second queue counters need to be decreased by 1, so that the operation of sequentially dequeuing the next element to be transmitted 41 is completed according to the order of enqueuing the elements.
Fig. 5 is a schematic structural diagram of a pending queue when an element first dequeue instruction is executed according to an embodiment of the present disclosure. Here, the queue scheduling instruction may be an element first dequeue instruction. Accordingly, with reference to fig. 5, the process of operating the queue pointer and the queue counter, that is, S103, may specifically include:
in response to an element priority dequeue instruction triggered by the data sending end, acquiring the priority of an element to be sent in the area 22 to be sent;
according to the priority, determining an element with the highest priority from the elements to be sent as a priority element 51, and acquiring an initial position of configuration data of the priority element 51 in the area 22 to be sent;
inserting the configuration data of the priority element 51 into the position pointed to by the second queue pointer 26 and moving the configuration data of the element between the initial position and the position pointed to by the second queue pointer 26 in the direction of the first queue pointer 25;
the configuration data of the priority element 51 is sent to the data sender, and the second queue pointer 26 is incremented by 1 and the second queue counter is decremented by 1.
The configuration data of the priority element 51, that is, the priority data of the priority element 51 and the storage address data of the corresponding data packet. In fig. 5, a region 22 to be transmitted includes a plurality of elements to be transmitted, which are respectively denoted as element 1, element 2, element 3, element 8230. When the configuration data of the priority element 51 is inserted into the position pointed to by the second queue pointer 26, the priority element 51 can be used as the next element to be transmitted, and accordingly, the configuration data of the element between the initial position of the priority element 51 in the region 22 to be transmitted and the second queue pointer 26 needs to be moved along the direction of the first queue pointer 25, that is, shifted up. Moreover, since the second queue pointer 26 is used to point to the configuration data of the next element to be transmitted in the region to be transmitted 22, and the second queue counter is used to indicate the number of elements to be transmitted in the region to be transmitted 22, the value of the second queue pointer 26 needs to be increased by 1, and the value of the second queue counter needs to be decreased by 1, so as to complete the operation of dequeuing the priority element 51 preferentially according to the priority data of the element.
Fig. 6 is a schematic structural diagram of a pending queue when an element validation instruction is executed according to an embodiment of the present disclosure. Here, the queue scheduling instruction may be an element validation instruction. Accordingly, with reference to fig. 6, the process of operating the queue pointer and the queue counter, that is, S103, may specifically include:
responding to an element confirmation instruction triggered by a data receiving end, and acquiring configuration data of a target element to be confirmed 61;
sending the configuration data of the target element to be confirmed 61 to a data cache end so that the data cache end releases cache based on the configuration data of the target element to be confirmed 61;
the third queue pointer 27 is incremented by 1 and the first queue counter is decremented by 1.
The configuration data of the target element to be confirmed 61, that is, the priority data of the target element to be confirmed 61 and the storage address data of the corresponding data packet. When the configuration data of the target element to be confirmed 61 is sent to the data cache, the data cache may release the corresponding cache based on the configuration data of the target element to be confirmed 61, and accordingly, the configuration data of the target element to be confirmed 61 is moved out of the queue to be processed, that is, moved from the sent area to be confirmed 23 to the second free area 24 for dequeuing. Moreover, since the third queue pointer 27 is used to point to the configuration data of the target element to be confirmed in the sent area to be confirmed 23, and the first queue counter is used to indicate the sum of the element to be sent in the area to be sent 22 and the number of the element to be confirmed sent in the sent area to be confirmed 23, the value of the third queue pointer 26 needs to be increased by 1, and the value of the second queue counter needs to be decreased by 1, so as to complete the element confirmation operation.
Fig. 7 is a schematic structural diagram of a pending queue when an element retransmit instruction is executed according to an embodiment of the present disclosure. Here, the queue scheduling instruction may be an element retransmit instruction. Accordingly, with reference to fig. 7, the process of operating the queue pointer and the queue counter, that is, S103, may specifically include:
in response to an element retransmit instruction triggered by the data receiving end, the value of the third queue pointer 27 is assigned to the second queue pointer 26, and the value of the first queue counter is assigned to the second queue counter.
Since the second queue pointer 26 is used to point to the configuration data of the next element to be transmitted in the region to be transmitted 22, the third queue pointer 27 is used to point to the configuration data of the target element to be confirmed in the region to be transmitted 23, the first queue counter is used to indicate the sum of the element to be transmitted in the region to be transmitted 22 and the number of the element to be confirmed in the region to be transmitted 23, and the second queue counter is used to indicate the number of the element to be transmitted in the region to be transmitted 22, so that the value of the third queue pointer 27 is assigned to the second queue pointer 26, and the value of the first queue counter is assigned to the second queue counter, which can indicate that all the elements to be confirmed in the region to be transmitted 23 will be updated to the element to be transmitted and wait for the scheduling instruction of dequeuing, that the region to be confirmed to be transmitted 23 merges into the region to be transmitted 22, thereby completing the operation of element retransmission.
Based on the relevant content of S103, in the embodiment of the present application, by using the element enqueue instruction, the element dequeue instruction, the element acknowledgement instruction, and the element instruction, and by processing the queue pointer and the queue counter of the queue to be processed respectively, multiple scheduling modes of the element can be implemented, and the scheduling process has high versatility and is unrelated to a specific transmission protocol, so that the scheduling method can be widely adapted to multiple reliable transmission protocols, and thus, the data transmission effect can be improved. In addition, through two different dequeuing modes of sequential dequeuing and preferential dequeuing, flexible scheduling of elements can be further realized, and application scenes of queues to be processed are wider.
Based on the queue scheduling method provided by the above embodiment, the embodiment of the present application further provides a queue scheduling apparatus. The queue scheduling apparatus is described below with reference to the embodiments and the drawings.
Fig. 8 is a schematic structural diagram of a queue scheduling apparatus according to an embodiment of the present application. Referring to fig. 8, a queue scheduling apparatus 800 according to an embodiment of the present application may include:
a queue obtaining module 801, configured to obtain a queue to be processed, where the queue to be processed includes configuration data of multiple elements;
a queue creating module 802, configured to create a queue pointer and a queue counter of a queue to be processed; the queue pointer is used for pointing to the position of the configuration data of the element in the queue to be processed; the queue counter is used for representing the state of the element;
and the queue scheduling module 803 is configured to operate the queue pointer and the queue counter in response to a queue scheduling instruction triggered by the data end, so as to schedule the queue to be processed.
In the embodiment of the present application, through the cooperation of the queue obtaining module 801, the queue creating module 802, and the queue scheduling module 803, the queue pointer and the queue counter are configured and operated, so that flexible scheduling of elements in the queue can be realized, and the scheduling process has high versatility and is unrelated to a specific transmission protocol, so that the scheduling process can be widely adapted to a plurality of reliable transmission protocols, and the data transmission effect can be improved.
As an embodiment, to implement flexible scheduling of elements in a queue, the queue creating module 802 may specifically include:
the queue dividing module is used for dividing the queue to be processed into a first idle area, an area to be sent, an area to be confirmed which is sent and a second idle area;
the first queue pointer setting module is used for setting a first queue pointer between a first idle area and an area to be sent; the first queue pointer is used for pointing to configuration data of a first free element in the first free area;
the second queue pointer setting module is used for setting a second queue pointer between the area to be sent and the area to be confirmed which is sent; the second queue pointer is used for pointing to the configuration data of the next element to be transmitted in the region to be transmitted;
the third queue pointer setting module is used for setting a third queue pointer between the sent to-be-confirmed area and the second idle area; the third queue pointer is used for pointing to the configuration data of the target element to be confirmed in the sent area to be confirmed; the target element to be confirmed is the element to be confirmed which is stored in the sent area to be confirmed for the longest time.
As an embodiment, in order to implement flexible scheduling of elements in a queue, the first queue pointer setting module, the second queue pointer setting module, and the third queue pointer setting module may specifically include:
the device comprises a storable element quantity acquisition module, a processing module and a processing module, wherein the storable element quantity acquisition module is used for acquiring the storable element quantity N of a queue to be processed; n is a positive integer;
a queue pointer initializing module, configured to initialize a first queue pointer, a second queue pointer, and a third queue pointer, so as to set values of the first queue pointer, the second queue pointer, and the third queue pointer to 0, respectively;
the circular work setting module is used for setting the first queue pointer, the second queue pointer and the third queue pointer as circular work; the loop work is used to indicate that the values of the first queue pointer, the second queue pointer, and the third queue pointer are reset to 0 when the accumulated value of the first queue pointer, the second queue pointer, and the third queue pointer is N-1.
As an embodiment, in order to implement flexible scheduling of elements in a queue, the queue creating module 802 may further include:
the queue counter creating module is used for respectively creating a first queue counter and a second queue counter; the first queue counter is used for representing the sum of elements to be sent in the area to be sent and the number of elements to be confirmed sent in the area to be confirmed sent; the second queue counter is used for representing the number of elements to be sent in the area to be sent.
As one embodiment, to enable flexible scheduling of elements in a queue, a queue scheduling instruction is an element enqueue instruction. Accordingly, the queue scheduling module 803 may specifically include:
the first data acquisition module is used for responding to an element enqueue instruction triggered by a data receiving end and acquiring configuration data of an element to be stored;
and the element enqueue module is used for inserting the configuration data of the element to be stored into the position pointed by the first queue pointer and adding 1 to the first queue pointer and the first queue counter respectively.
As one embodiment, to enable flexible scheduling of elements in a queue, a queue scheduling instruction is an element sequential dequeue instruction. Accordingly, the queue scheduling module 803 may specifically include:
the second data acquisition module is used for responding to an element sequence dequeuing instruction triggered by the data sending end and acquiring configuration data of the next element to be sent;
and the first element dequeuing module is used for sending the configuration data of the next element to be sent to the data sending end, adding 1 to the second queue pointer and subtracting 1 from the second queue counter.
As one embodiment, to enable flexible scheduling of elements in a queue, a queue scheduling instruction is an element-first dequeue instruction. Accordingly, the queue scheduling module 803 may specifically include:
the priority acquisition module is used for responding to an element priority dequeuing instruction triggered by a data sending end and acquiring the priority of an element to be sent in a region to be sent;
a priority element determining module, configured to determine, according to the priority, an element with the highest priority from the elements to be sent as a priority element, and obtain an initial position of configuration data of the priority element in a region to be sent;
the second element dequeuing module is used for inserting the configuration data of the priority element into the position pointed by the second queue pointer and moving the configuration data of the element between the initial position and the position pointed by the second queue pointer along the direction of the first queue pointer;
and the third element dequeuing module is used for sending the configuration data of the priority element to the data sending end, adding 1 to the second queue pointer and subtracting 1 from the second queue counter.
As an embodiment, to enable flexible scheduling of elements in a queue, the queue scheduling instruction is an element validation instruction. Accordingly, the queue scheduling module 803 may specifically include:
the third data acquisition module is used for responding to an element confirmation instruction triggered by the data receiving end and acquiring configuration data of a target element to be confirmed;
the first element confirming module is used for sending the configuration data of the target element to be confirmed to the data cache end so that the data cache end releases cache based on the configuration data of the target element to be confirmed;
and the second element confirmation module is used for adding 1 to the third queue pointer and subtracting 1 from the first queue counter.
As an embodiment, to enable flexible scheduling of elements in a queue, the queue scheduling instruction is an element retransmit instruction. Accordingly, the queue scheduling module 803 may specifically include:
and the element retransmission instruction is used for responding to the element retransmission instruction triggered by the data receiving end, assigning the value of the third queue pointer to the second queue pointer and assigning the value of the first queue counter to the second queue counter.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (7)

1. A method for queue scheduling, comprising:
acquiring a queue to be processed, wherein the queue to be processed comprises configuration data of a plurality of elements;
creating a queue pointer and a queue counter of the queue to be processed; the queue pointer is used for pointing to the position of the configuration data of the element in the queue to be processed; the queue counter is used for representing the state of the element;
responding to a queue scheduling instruction triggered by a data end, and operating the queue pointer and the queue counter to schedule the queue to be processed;
wherein the creating a queue pointer of the queue to be processed includes:
dividing the queue to be processed into a first idle area, an area to be sent, an area to be confirmed which has been sent and a second idle area;
setting a first queue pointer between the first idle area and the area to be sent; the first queue pointer is used for pointing to configuration data of a first free element in the first free area;
setting a second queue pointer between the region to be sent and the region to be confirmed which is sent; the second queue pointer is used for pointing to configuration data of the next element to be transmitted in the region to be transmitted;
setting a third queue pointer between the sent to-be-confirmed area and the second idle area; the third queue pointer is used for pointing to configuration data of a target element to be confirmed in the sent area to be confirmed; the target element to be confirmed is the element to be confirmed which has the longest storage time in the sent area to be confirmed;
creating a queue counter for the pending queue, comprising:
respectively creating a first queue counter and a second queue counter; the first queue counter is used for representing the sum of the number of elements to be sent in the area to be sent and the number of elements to be confirmed sent in the area to be confirmed sent; the second queue counter is used for representing the number of elements to be sent in the area to be sent;
the queue scheduling instruction is an element priority dequeuing instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data end includes:
responding to the element priority dequeuing instruction triggered by the data sending end, and acquiring the priority of the element to be sent in the area to be sent;
determining an element with the highest priority as a priority element from the elements to be sent according to the priority, and acquiring an initial position of configuration data of the priority element in the area to be sent;
inserting configuration data of the priority element into a position pointed to by the second queue pointer, and moving the configuration data of the element between the initial position and the position pointed to by the second queue pointer along the direction of the first queue pointer;
and sending the configuration data of the priority element to the data sending end, adding 1 to the second queue pointer and subtracting 1 from the second queue counter.
2. The method of claim 1, wherein the first queue pointer, the second queue pointer, and the third queue pointer are set by:
acquiring the number N of storable elements of the queue to be processed; n is a positive integer;
initializing the first, second, and third queue pointers to set the values of the first, second, and third queue pointers to 0, respectively;
setting the first queue pointer, the second queue pointer, and the third queue pointer to a round robin work; the loop work is used for indicating that when the accumulated value of the first queue pointer, the second queue pointer and the third queue pointer is N-1, the values of the first queue pointer, the second queue pointer and the third queue pointer are reset to 0.
3. The method of claim 1, wherein the queue scheduling instruction is an element enqueue instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
responding to the element enqueue instruction triggered by the data receiving end, and acquiring configuration data of the element to be stored;
and inserting the configuration data of the element to be stored into the position pointed by the first queue pointer, and adding 1 to the first queue pointer and the first queue counter respectively.
4. The method of claim 1, wherein the queue scheduling instruction is an element sequential dequeue instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
responding to the element sequence dequeuing instruction triggered by the data sending end, and acquiring configuration data of the next element to be sent;
and sending the configuration data of the next element to be sent to the data sending end, adding 1 to the second queue pointer and subtracting 1 from the second queue counter.
5. The method of claim 1, wherein the queue scheduling instruction is an element validation instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
responding to the element confirmation instruction triggered by a data receiving end, and acquiring configuration data of the target element to be confirmed;
sending the configuration data of the target element to be confirmed to a data cache end so that the data cache end releases a cache based on the configuration data of the target element to be confirmed;
and adding 1 to the third queue pointer and subtracting 1 from the first queue counter.
6. The method of claim 1, wherein the queue scheduling instruction is an element retransmit instruction; the operation of the queue pointer and the queue counter in response to the queue scheduling instruction triggered by the data terminal includes:
in response to the element retransmission instruction triggered by a data receiving end, assigning the value of the third queue pointer to the second queue pointer, and assigning the value of the first queue counter to the second queue counter.
7. A queue scheduling apparatus, comprising:
the queue acquiring module is used for acquiring a queue to be processed, wherein the queue to be processed comprises configuration data of a plurality of elements;
the queue creating module is used for creating a queue pointer and a queue counter of the queue to be processed; the queue pointer is used for pointing to the position of the configuration data of the element in the queue to be processed; the queue counter is used for representing the state of the element;
the queue scheduling module is used for responding to a queue scheduling instruction triggered by a data end and operating the queue pointer and the queue counter so as to schedule the queue to be processed;
wherein the queue creating module comprises:
the queue dividing module is used for dividing the queue to be processed into a first idle area, an area to be sent, an area to be confirmed which is sent and a second idle area;
the first queue pointer setting module is used for setting a first queue pointer between a first idle area and an area to be sent; the first queue pointer is used for pointing to configuration data of a first free element in the first free area;
the second queue pointer setting module is used for setting a second queue pointer between the area to be sent and the area to be confirmed which is sent; the second queue pointer is used for pointing to the configuration data of the next element to be transmitted in the region to be transmitted;
the third queue pointer setting module is used for setting a third queue pointer between the sent to-be-confirmed area and the second idle area; the third queue pointer is used for pointing to the configuration data of the target element to be confirmed in the sent area to be confirmed; the target element to be confirmed is the element to be confirmed which has the longest storage time in the sent area to be confirmed;
the queue creating module further comprises:
the queue counter creating module is used for respectively creating a first queue counter and a second queue counter; the first queue counter is used for representing elements to be sent in the area to be sent and the sum of the number of the elements to be confirmed sent in the area to be confirmed sent; the second queue counter is used for representing the number of elements to be sent in the area to be sent;
the queue scheduling module comprises:
the priority acquisition module is used for responding to an element priority dequeuing instruction triggered by a data sending end and acquiring the priority of an element to be sent in a region to be sent;
the priority element determining module is used for determining an element with the highest priority from the elements to be sent as a priority element according to the priority, and acquiring the initial position of configuration data of the priority element in a region to be sent;
the second element dequeuing module is used for inserting the configuration data of the priority element into the position pointed by the second queue pointer and moving the configuration data of the element between the initial position and the position pointed by the second queue pointer along the direction of the first queue pointer;
and the third element dequeuing module is used for sending the configuration data of the priority element to the data sending end, adding 1 to the second queue pointer and subtracting 1 from the second queue counter.
CN202211273005.2A 2022-10-18 2022-10-18 Queue scheduling method and device Active CN115348218B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211273005.2A CN115348218B (en) 2022-10-18 2022-10-18 Queue scheduling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211273005.2A CN115348218B (en) 2022-10-18 2022-10-18 Queue scheduling method and device

Publications (2)

Publication Number Publication Date
CN115348218A CN115348218A (en) 2022-11-15
CN115348218B true CN115348218B (en) 2022-12-27

Family

ID=83956950

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211273005.2A Active CN115348218B (en) 2022-10-18 2022-10-18 Queue scheduling method and device

Country Status (1)

Country Link
CN (1) CN115348218B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116225665B (en) * 2023-05-04 2023-08-08 井芯微电子技术(天津)有限公司 Queue scheduling method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6487212B1 (en) * 1997-02-14 2002-11-26 Advanced Micro Devices, Inc. Queuing structure and method for prioritization of frames in a network switch
CN1979424A (en) * 2005-11-29 2007-06-13 腾讯科技(深圳)有限公司 Method for managing priority queue
CN101470623A (en) * 2007-12-26 2009-07-01 无锡江南计算技术研究所 Queue management method and queue management device, method and system for processing queue message
CN112162875A (en) * 2020-10-12 2021-01-01 上交所技术有限责任公司 High-reliability message transmission method in transaction system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105573711B (en) * 2014-10-14 2019-07-19 深圳市中兴微电子技术有限公司 A kind of data cache method and device
US10719268B2 (en) * 2018-06-29 2020-07-21 Microsoft Technology Licensing, Llc Techniques for safely and efficiently enqueueing and dequeueing data on a graphics processor
CN113377549B (en) * 2021-08-12 2021-12-07 浙江齐安信息科技有限公司 Queue data control method, system and queue data structure

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6487212B1 (en) * 1997-02-14 2002-11-26 Advanced Micro Devices, Inc. Queuing structure and method for prioritization of frames in a network switch
CN1979424A (en) * 2005-11-29 2007-06-13 腾讯科技(深圳)有限公司 Method for managing priority queue
CN101470623A (en) * 2007-12-26 2009-07-01 无锡江南计算技术研究所 Queue management method and queue management device, method and system for processing queue message
CN112162875A (en) * 2020-10-12 2021-01-01 上交所技术有限责任公司 High-reliability message transmission method in transaction system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
对循环队列空与满条件的探讨;贺志芳;《计算机光盘软件与应用》;20120720(第7期);全文 *

Also Published As

Publication number Publication date
CN115348218A (en) 2022-11-15

Similar Documents

Publication Publication Date Title
CN115348218B (en) Queue scheduling method and device
US20030110166A1 (en) Queue management
US8463967B2 (en) Method and device for scheduling queues based on chained list
CN111541749B (en) Data communication method and system of embedded equipment and related equipment
CN111400212A (en) Transmission method and device based on remote direct data access
CN112787956A (en) Method, system, storage medium and application for crowding occupation processing in queue management
EP2171934B1 (en) Method and apparatus for data processing using queuing
US20180365176A1 (en) Shared processing of a packet flow by multiple cores
CN113079113B (en) Data transmission device and data transmission system
CN105049372A (en) Method of expanding message middleware throughput and system thereof
US20130061247A1 (en) Processor to message-based network interface using speculative techniques
US7853713B2 (en) Communication interface device and communication method
CN101997777B (en) Interruption processing method, device and network equipment
US8156265B2 (en) Data processor coupled to a sequencer circuit that provides efficient scalable queuing and method
CN108415779B (en) Method and apparatus for queue management through a host fabric interface
CN111124355A (en) Information processing method and device, readable storage medium and electronic equipment
CA2231949A1 (en) Source and destination initiated interrupt system for message arrival notification
CN102117261A (en) Communication method between inner processors of chip
CN116225665B (en) Queue scheduling method and device
CN116800692B (en) Scheduling method and device of active queue and storage medium
CN112685197B (en) Interface data interactive system
CN116800684B (en) Performance isolation method of RDMA network card transmission queue and RDMA network card
CN117834556A (en) Multi-queue organization and scheduling method, system, storage medium and electronic equipment
KR20060081868A (en) Apparatus for port scheduling using queue transition event vector table and method thereof
CN112312472A (en) Message transmission method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant