Queue management method and device and electronic equipment

By setting operation type priorities and using linked list management, the problems of low cache utilization and slow data dequeue rate in queue management are solved, achieving efficient data processing and bandwidth improvement.

CN120973485APending Publication Date: 2025-11-18RUIJIE NETWORKS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411433342.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-05-16
Filing Date
2024-10-14
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Existing queue management solutions suffer from low cache utilization and low continuous data dequeue rate, especially when the number of queues increases, which leads to bandwidth limitations of the entire device.

Method used

By setting the priority of operation types, the target operation is selected from the set of operations to be executed, and the target operation is executed based on the operation type, including write operations, read operations and update operations. Update operations are processed first, multiple queues are managed using linked lists, and the next-hop pointer is updated in advance to improve the efficiency of data dequeueing.

Benefits of technology

It enables efficient data enqueueing and dequeueing operations, meets the needs of high-speed data processing, reduces cache capacity requirements and user costs, and improves queue access efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120973485A_ABST
    Figure CN120973485A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a queue management method and device and electronic equipment, relates to the technical field of data transmission, and is used for solving the technical problem of relatively low queue access efficiency in a queue management scheme in the related technology. The method comprises the following steps: selecting a target operation from at least one to-be-executed operation included in a to-be-executed operation set based on the priority of a set operation type; the operation type is the operation type of the to-be-executed operation in the to-be-executed operation set, and the operation type comprises a write operation, a read operation and an update operation; the updating operation is used for updating a next-hop pointer of a current read pointer of a specified queue; at least one to-be-executed operation included in the to-be-executed operation set is determined based on at least one obtained operation instruction; the at least one operation instruction is triggered for any one queue in a plurality of queues managed by a queue chain table; and executing the target operation based on the operation type of the target operation.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Cross-references to related applications

[0002] This application claims priority to Chinese Patent Application No. 202410606163.8, filed on May 16, 2024, entitled "Queue Management Method, Apparatus and Electronic Equipment", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of data transmission technology, and in particular to a queue management method, apparatus and electronic device. Background Technology

[0004] In all technological fields of modern computer systems, data processing is a critical task, and queue management is a crucial component of data processing. For example, in network management, queue management is a fundamental management function used to control the sending and receiving of data packets. Similarly, in high-performance computing devices, queue management is an indispensable function for managing large numbers of computational tasks. In practice, the main function of queue management is to determine the enqueue and dequeue order of data based on specific algorithms or rules, and then perform enqueue and dequeue operations on the data based on this determined order.

[0005] In related technologies, queue management can typically be implemented through the following two methods:

[0006] The first queue management scheme allocates a fixed space for each queue, and data is cached and enters each queue in a first-in-first-out (FIFO) manner for enqueue and dequeue operations.

[0007] The second queue management scheme uses a linked list shared cache. A linked list is a non-contiguous, non-sequential storage structure where the logical order of data elements is achieved through pointers linking them together. Because linked list structures can fully utilize computer memory space and enable flexible dynamic memory management, this scheme can improve cache utilization when there are many queues.

[0008] However, the first queue management scheme suffers from low cache utilization, and as the number of queues increases dramatically, the required cache capacity also increases, directly raising costs. The second queue management scheme, due to the characteristics of its linked list structure, may experience a low rate of continuous data dequeueing. Furthermore, with continuously increasing bandwidth demands, without a proper synchronization mechanism, queue access efficiency may be low, impacting the bandwidth of the entire device employing this queue management scheme. Summary of the Invention

[0009] This application provides a queue management method, apparatus, and electronic device to solve the technical problem of low queue access efficiency in related art queue management schemes.

[0010] In a first aspect, embodiments of this application provide a queue management method, including:

[0011] Based on the priority of the set operation types, a target operation is selected from at least one operation to be executed in the set of operations to be executed; the operation type is the operation type of the operation to be executed in the set of operations to be executed, and the operation type includes write operation, read operation and update operation; the update operation is used to update the next-hop pointer of the current read pointer of the specified queue; the at least one operation to be executed in the set of operations to be executed is determined based on at least one operation instruction obtained; the at least one operation instruction is triggered for any one of the multiple queues managed by the queue linked list;

[0012] The target operation is executed based on the operation type of the target operation.

[0013] In one possible implementation, the update operation has the highest priority; the step of selecting a target operation from at least one pending operation included in the set of pending operations based on the priority of the set of pending operations includes: when the set of pending operations includes a pending update operation of type update, the pending update operation is selected as the target operation; when the set of pending operations does not include a pending update operation, a pending read operation of type read or a pending write operation of type write is selected sequentially by polling as the target operation.

[0014] In one possible implementation, the operation instruction includes a write instruction for describing the data block information (BD); the write operation to be executed, which is a write operation, is determined according to the following method: generating the write operation to be executed based on the obtained write instruction; wherein the write instruction is used to instruct the BD information to be written to a first queue, and the BD information is used to represent the storage address and size of the specified data block that has been stored; the write operation to be executed includes the queue identifier of the first queue and the BD information.

[0015] In one possible implementation, executing the target operation based on the operation type of the target operation includes: when the operation type of the target operation is a write operation, determining the queue identifier of the target queue based on the target operation; obtaining at least one linked list parameter of the target queue based on the queue identifier and the operation type; the linked list parameter includes the current write pointer and the pointer count corresponding to the current write pointer; when the pointer count is the maximum pointer count of the current write pointer, requesting a new pointer from the pointer pool as the next-hop pointer of the current write pointer, writing the BD information into the target queue based on the next-hop pointer, and updating the pointer order in the next-hop cache; the next-hop cache is used to store the order among the various called pointers in the pointer pool; when the pointer count is not the maximum pointer count of the current write pointer, writing the BD information into the target queue based on the obtained current write pointer and the pointer count corresponding to the current write pointer; and updating the current write pointer and the pointer count corresponding to the current write pointer.

[0016] In one possible implementation, the operation instruction includes a read instruction; the method further includes: when the current dequeueable data volume of the second queue is greater than zero, determining the number of read instructions to be generated based on the current dequeueable data volume and a preset granularity; the read instruction is used to read the BD information of the second queue; generating at least one read instruction according to the number of instructions generated, and updating the current dequeueable data volume based on the number of instructions generated and the granularity; the read operation to be executed, which is of the operation type of read operation, is determined according to the following method: generating at least one read operation to be executed based on the at least one read instruction; the read operation to be executed includes the queue identifier of the second queue.

[0017] In one possible implementation, executing the target operation based on the operation type of the target operation includes: when the operation type of the target operation is a read operation, determining the queue identifier of the target queue based on the target operation; obtaining at least one linked list parameter of the target queue based on the queue identifier and the operation type; the linked list parameter includes the current read pointer, the pointer count corresponding to the current read pointer, and the next-hop pointer; when the pointer count corresponding to the current read pointer is the maximum pointer count of the current read pointer, reading the BD information of the target queue based on the next-hop pointer, and updating the current read pointer and the pointer count corresponding to the current read pointer based on the next-hop pointer; when the pointer count is not the maximum pointer count of the current read pointer, reading the BD information of the target queue based on the current read pointer and the pointer count corresponding to the current read pointer, and updating the pointer count corresponding to the current read pointer.

[0018] In one possible implementation, the linked list parameter further includes: a current write pointer; after obtaining at least one linked list parameter of the target queue based on the queue identifier and the operation type, the method further includes: when the current write pointer is different from the current read pointer and the count corresponding to the current read pointer is 1, generating an update instruction based on the current write pointer; the update instruction is used to indicate that the next hop pointer of the current read pointer of the target queue is the current write pointer.

[0019] In one possible implementation, after reading the BD information of the target queue, the method further includes: updating the current dequeueable data volume of the target queue based on the data volume difference between the granularity and the read BD information.

[0020] In one possible implementation, the operation instruction includes an update instruction, and the update operation to be executed, which is an update operation of type update, is determined by the following method: generating an update operation to be executed based on the obtained update instruction; the update operation to be executed includes a queue identifier of a third queue and next-hop pointer information of the third queue.

[0021] In one possible implementation, executing the target operation based on the operation type of the target operation includes: when the operation type of the target operation is an update operation, determining the queue identifier of the target queue based on the target operation; obtaining at least one linked list parameter of the target queue based on the queue identifier and the operation type; the linked list parameter includes a next-hop pointer; and updating the next-hop pointer based on the next-hop pointer information indicated by the target operation.

[0022] Secondly, embodiments of this application provide a queue management device, including:

[0023] An arbitration module is used to select a target operation from at least one pending operation in a set of pending operations based on the priority of a set of operation types. The operation types are the operation types of the pending operations in the set of pending operations, including write operations, read operations, and update operations. The update operation is used to update the next-hop pointer of the current read pointer of a specified queue. The at least one pending operation in the set of pending operations is determined based on at least one obtained operation instruction. The at least one operation instruction is triggered for any one of multiple queues managed through a queue linked list.

[0024] The queue linked list management module is used to execute the target operation based on the operation type of the target operation.

[0025] In one possible implementation, the update operation has the highest priority; when the arbitration module selects a target operation from at least one pending operation included in the set of pending operations based on the priority of the set of operation types, it is specifically used as follows: when the set of pending operations includes pending update operations of type update, the pending update operation is selected as the target operation; when the set of pending operations does not include pending update operations, a pending read operation of type read or a pending write operation of type write is selected sequentially by polling as the target operation.

[0026] In one possible implementation, the operation instruction includes a write instruction for describing the data block information (BD); the write operation to be executed, which is a write operation, is determined by the arbitration module according to the following method: generating the write operation to be executed based on the acquired write instruction; wherein, the write instruction is used to instruct the BD information to be written to a first queue, and the BD information is used to represent the storage address and size of the specified data block that has been stored; the write operation to be executed includes the queue identifier of the first queue and the BD information.

[0027] In one possible implementation, the queue list management module, based on the operation type of the target operation, specifically performs the following when executing the target operation: when the operation type of the target operation is a write operation, it determines the queue identifier of the target queue based on the target operation; based on the queue identifier and the operation type, it obtains at least one list parameter of the target queue; the list parameter includes the current write pointer and the pointer count corresponding to the current write pointer; when the pointer count is equal to the maximum pointer count of the current write pointer, it requests a new pointer from the pointer pool as the next-hop pointer of the current write pointer, writes the BD information into the target queue based on the next-hop pointer, and updates the pointer order in the next-hop cache; the next-hop cache is used to store the order among the various called pointers in the pointer pool; when the pointer count is not equal to the maximum pointer count of the current write pointer, it writes the BD information into the target queue based on the obtained current write pointer and the pointer count corresponding to the current write pointer; and updates the current write pointer and the pointer count corresponding to the current write pointer.

[0028] In one possible implementation, the operation instruction includes a read instruction; the read instruction generation module is used to: when the current dequeueable data volume of the second queue is greater than zero, determine the number of read instructions to be generated based on the current dequeueable data volume and a preset granularity; the read instruction is used to read the BD information of the second queue; generate at least one read instruction according to the number of instructions generated, and update the current dequeueable data volume based on the number of instructions generated and the granularity; the pending read operation of the operation type is determined by the arbitration module according to the following method: generating at least one pending read operation based on the at least one read instruction; the pending read operation includes the queue identifier of the second queue.

[0029] In one possible implementation, the queue list management module, when executing the target operation based on the operation type of the target operation, specifically performs the following: when the operation type of the target operation is a read operation, it determines the queue identifier of the target queue based on the target operation; based on the queue identifier and the operation type, it obtains at least one list parameter of the target queue; the list parameter includes the current read pointer, the pointer count corresponding to the current read pointer, and the next-hop pointer; when the pointer count corresponding to the current read pointer is the maximum pointer count of the current read pointer, it reads the BD information of the target queue based on the next-hop pointer, and updates the current read pointer and the pointer count corresponding to the current read pointer based on the next-hop pointer; when the pointer count is not the maximum pointer count of the current read pointer, it reads the BD information of the target queue based on the current read pointer and the pointer count corresponding to the current read pointer, and updates the pointer count corresponding to the current read pointer.

[0030] In one possible implementation, the linked list parameters further include: a current write pointer; after the queue linked list management module obtains at least one linked list parameter of the target queue based on the queue identifier and the operation type, it is further configured to: when the current write pointer is different from the current read pointer and the count corresponding to the current read pointer is 1, generate an update instruction based on the current write pointer; the update instruction is used to indicate that the next hop pointer of the current read pointer of the target queue is the current write pointer.

[0031] In one possible implementation, after the queue list management module reads the BD information of the target queue, the compensation calculation module is used to: update the current dequeueable data volume of the target queue based on the data volume difference between the granularity and the read BD information.

[0032] In one possible implementation, the operation instruction includes an update instruction, and the update operation to be executed, which is an update operation of type update, is determined by the arbitration module according to the following method: when the update instruction is obtained, the update operation to be executed is generated based on the update instruction; the update operation to be executed includes the queue identifier of the third queue and the next-hop pointer information of the third queue.

[0033] In one possible implementation, when the queue list management module executes the target operation based on the operation type of the target operation, it is specifically configured to: when the operation type of the target operation is an update operation, determine the queue identifier of the target queue based on the target operation; obtain at least one list parameter of the target queue based on the queue identifier and the operation type; the list parameter includes a next-hop pointer; and update the next-hop pointer based on the next-hop pointer information indicated by the target operation.

[0034] Thirdly, embodiments of this application provide an electronic device, including:

[0035] Memory, used to store computer instructions;

[0036] A processor, connected to the memory, is configured to execute computer instructions in the memory, and, in executing the computer instructions, implement the method as described in any one of the first aspects.

[0037] Fourthly, embodiments of this application provide a computer-readable storage medium, comprising:

[0038] The computer-readable storage medium stores computer instructions that, when executed on a computer, cause the computer to perform the method as described in any one of the first aspects.

[0039] The beneficial effects of this application are as follows:

[0040] This application provides a queue management method, apparatus, and electronic device. The method includes: selecting a target operation from at least one operation to be executed in a set of operations to be executed based on the priority of a set of operation types; and executing the target operation based on the operation type of the target operation.

[0041] This method uses operation sets to execute target operations based on the corresponding operation flow for each operation type. Therefore, it eliminates the need for complex read / write synchronization mechanisms, avoiding the low queue access efficiency and impact on overall machine bandwidth caused by strict read / write synchronization in related technologies. This makes data enqueueing and dequeueing operations more efficient, meeting the demands of high-speed data processing.

[0042] Furthermore, the queue management method provided in this application embodiment can update the next-hop pointer of the queue in advance through update operations. In this way, when a row is read in a read operation, the next read address can be updated directly without interrupting the operation to query the next hop, thereby improving the dequeue efficiency of data.

[0043] Furthermore, this application embodiment can manage multiple queues through a queue linked list, and there is no limit to the number of queues. Therefore, based on the above-mentioned beneficial effects, this application embodiment can also effectively manage cache capacity and reduce user costs when the number of queues increases sharply.

[0044] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of this application or in the conventional art, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application.

[0046] Figure 1 This is a schematic diagram illustrating an application scenario of the queue management method provided in the embodiments of this application;

[0047] Figure 2 An exemplary flowchart of a queue management method provided in an embodiment of this application;

[0048] Figure 3 This is a schematic diagram of the read instruction generation process provided in an embodiment of this application;

[0049] Figure 4 A flowchart illustrating the write operation execution method provided in an embodiment of this application;

[0050] Figure 5 A schematic diagram of the next-hop cache provided in the embodiments of this application;

[0051] Figure 6 A flowchart illustrating the read operation execution method provided in an embodiment of this application;

[0052] Figure 7 A schematic diagram of the queue management process provided in the embodiments of this application;

[0053] Figure 8 A schematic diagram of a queue management device provided in an embodiment of this application;

[0054] Figure 9This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.

[0056] The terms "first" and "second" in the embodiments of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more; the embodiments of this application do not impose any limitations.

[0057] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.

[0058] In related technologies, queue management can typically be implemented through the following two methods:

[0059] The first queue management scheme allocates a fixed space for each queue, and data is cached and enters each queue using a FIFO (First-In, First-Out) approach for enqueue and dequeue operations.

[0060] The second queue management scheme uses a linked list shared cache. A linked list is a non-contiguous, non-sequential storage structure where the logical order of data elements is achieved through pointers linking them together. Because linked list structures can fully utilize computer memory space and enable flexible dynamic memory management, this scheme can improve cache utilization when there are many queues.

[0061] However, the first queue management scheme suffers from low cache utilization, and as the number of queues increases dramatically, the required cache capacity also increases, directly raising costs. The second queue management scheme, due to the characteristics of its linked list structure, may experience a low rate of continuous data dequeueing. Furthermore, with continuously increasing bandwidth demands, without a proper synchronization mechanism, queue access efficiency may be low, impacting the bandwidth of the entire device employing this queue management scheme.

[0062] In view of this, embodiments of this application provide a queue management method, apparatus, and electronic device. In this method, a target operation can be selected from at least one operation to be executed in a set of operations to be executed based on the priority of a set of operation types, and the target operation can be executed based on the operation type of the target operation.

[0063] This method utilizes operation sets to execute target operations based on the corresponding operation flow for each operation type. Therefore, it eliminates the need for complex read / write synchronization mechanisms, avoiding the low queue access efficiency and impact on overall bandwidth caused by strict read / write synchronization in related technologies. This makes data enqueueing and dequeueing operations more efficient, meeting the demands of high-speed data processing. Furthermore, the queue management method provided in this application can update the next-hop pointer of the queue in advance through update operations. This allows for direct updating of the next read address after a row is read, without interrupting the operation to query the next hop, thereby improving data dequeueing efficiency. In addition, this application embodiment can manage multiple queues through a queue linked list, without limiting the number of queues. Therefore, based on the above advantages, this application embodiment can also effectively manage cache capacity and reduce user costs when the number of queues increases dramatically.

[0064] See Figure 1 This is a schematic diagram illustrating an application scenario of the queue management method provided in the embodiments of this application, such as... Figure 1 As shown, the queue management method can be applied to the queue management device 110, which can be applied to the network device 100. In addition to the queue management device 110, the network device 100 may also include a packet processing device 120, a storage medium 130, and M ports. The network device 100 can be a switch or router, etc., and M is a positive integer.

[0065] The queue management device 110 can receive block descriptions (BDs) sent by the message processing device 120, and then store the received BDs in a corresponding queue using the queue management method provided in this embodiment. After queue management, the queue-managed BDs can also be fed back to the message processing device 120. The block description is a description of a stored message, including the length and storage address of the stored message. The queue-managed BDs can include the target queue corresponding to the BD after queue management, and related information such as the write position in the target queue.

[0066] The message processing device 120 can extract queue identification information from received messages, request a storage address for the message, and store the message in the storage medium 130 based on the requested storage address. After storage, it can send BD information representing the storage address and data length of the message to the queue management device 110 so that the queue management device 110 can perform queue management. The message processing device 120 can also read messages from the storage medium 130 and output the read messages through any one of ports 1-M.

[0067] Storage medium 130 is used to implement data storage in network devices, such as the storage of received packets. Storage medium 130 can be a high-speed random access memory or a non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0068] It should be noted that the above Figure 1 The application scenario shown is only one example. The queue management device 110 can also be applied to other devices, and this application embodiment does not limit it.

[0069] See Figure 2 This is an exemplary flowchart of a queue management method provided in an embodiment of this application. This method can be applied to... Figure 1 The queue management device shown may include the following processes S201-S202:

[0070] S201, based on the priority of the set operation type, select the target operation from at least one operation to be executed included in the set of operations to be executed.

[0071] The operation type refers to the type of operation to be executed in the set of operations to be executed. The operation types include write operations, read operations, and update operations. The update operation is used to update the next-hop pointer of the current read pointer of the specified queue.

[0072] One possible implementation is that update operations have the highest priority, while write and read operations have equal priority. Therefore, when selecting a target operation from the set of operations to be executed based on the set priority of the operation type, the queue management device can first determine whether the set of operations to be executed includes an update operation. If it does, the update operation is selected as the target operation; otherwise, a fair round-robin method is used to select either a read operation or a write operation as the target operation.

[0073] Among them, the above-mentioned pending update operations are characterized as: pending operations of the operation type of update operation in the pending operation set; the above-mentioned pending read operations are characterized as: pending operations of the operation type of read operation in the pending operation set; and the above-mentioned pending write operations are characterized as: pending operations of the operation type of write operation in the pending operation set.

[0074] Specifically, when selecting either a read operation or a write operation as the target operation through fair round-robin, the set of operations to be executed may include both read and write operations. The two operations can take turns fairly based on the time they were added to the set. That is, after selecting a read operation as the target operation, a write operation can be selected as the target operation.

[0075] For example, if the set of operations to be executed does not include pending update operations, but includes pending read operations (RD1, RD2, and RD3) and pending write operations (WR1, WR2, and WR3), then the target operations can be selected in the following order: RD1, WR1, RD2, WR2, RD3, WR3. If, during the selection of target operations in the above order, an pending update operation (UPD1) is added to the set of operations to be executed, then UPD1 is executed first, and the selection process continues in the above order. That is, if WR1 is selected as the target operation and then UPD1 is added to the set of operations to be executed, then UPD1 will be selected as the target operation in the next selection. Then, if the set of operations to be executed no longer includes pending update operations, then RD2 will be selected as the target operation.

[0076] In one example, if the set of operations to be executed does not include pending update operations and pending write operations, then pending read operations can be selected as target operations in order of their addition to the set. Similarly, if the set of operations to be executed does not include pending update operations and pending read operations, then pending write operations can be selected as target operations in order of their addition to the set.

[0077] Optionally, S201 can select the target operation from the operations to be executed included in the set of operations to be executed through a three-in-one arbitration method. Therefore, S201 can be implemented through the arbitration module.

[0078] In some embodiments, the set of operations to be executed includes at least one operation to be executed, determined based on at least one obtained operation instruction, which is triggered for any one of multiple queues managed by a queue linked list. The queue linked list is a shared list of multiple queues, allowing multiple queues to share a cache. It should be noted that the number of queues managed by the queue linked list can be set according to actual conditions or experience, and this application does not limit it in this regard.

[0079] In some embodiments, at least one operation instruction may be triggered on the same queue or on different queues.

[0080] For example, the acquired operation instruction may include operation instruction A, operation instruction B, and operation instruction C, and the queue linked list may manage queue 1, queue 2, and queue 3. In one possible scenario, operation instruction A is triggered on queue 1, operation instruction B is triggered on queue 2, and operation instruction C is triggered on queue 3. In another possible scenario, operation instructions A and B may be triggered on queue 1, and operation instruction C may be triggered on queue 2. In yet another possible scenario, operation instructions A, B, and C may all be triggered on queue 1.

[0081] In one possible implementation, the operation instructions may include write instructions, read instructions, and update instructions for the BD.

[0082] In some embodiments, the write instruction may be generated by the queue management device when it receives BD information, and is used to instruct the BD information to be written to the first queue. The write instruction may include the queue identifier of the first queue and the BD information. The BD information may include the storage address and size of the corresponding data block, and there is a one-to-one correspondence between the BD information and the data block.

[0083] The BD information received by the queue management device can be sent to the queue management device by the preceding stage after storing a certain data block, so that the queue management device can store the received BD information.

[0084] For example, the BD information may include the starting address and number of bytes of the data block's storage. "Front-level" can refer to the front-level module or device of the queue management device. For example, in... Figure 1 In the application scenario shown, the front-end can refer to a message processing device. However, in other application scenarios, the front-end can also be a module used for data storage.

[0085] In one possible implementation, the queue management device can generate a write operation to be executed based on the acquired write instruction, wherein the write operation to be executed includes the queue identifier of the first queue and the BD information to be written to the first queue.

[0086] Optionally, when the queue management device generates a write operation to be executed based on the acquired write instruction, it may do so by generating the write operation to be executed based on the acquired write instruction.

[0087] Optionally, when the queue management device generates a write operation to be executed based on the acquired write instruction, it can also generate the write operation to be executed based on the write instructions cached in the operation instruction set. The operation instruction set can be obtained by caching the operation instruction each time it is acquired.

[0088] In some embodiments, see Figure 3 This is a schematic diagram of a read instruction generation process provided in an embodiment of this application. The process may include:

[0089] S301, periodically maintains the amount of data that can be dequeued from the second queue.

[0090] The second queue can be any one of multiple queues managed by a queue linked list. The second queue can be the same as or different from the first queue.

[0091] In some embodiments, the amount of data that can be dequeued can be represented by credit points. The credit points for each queue can be periodically maintained according to the pre-configured dequeue rate information of that queue. For example, assuming the period is 1ms and the dequeue rate of queue 1 is 1000 bytes / ms, then queue 1 can generate 1000 credit points every millisecond. The period duration can be set according to requirements, such as 1us, 10us, etc., which is not limited in this application.

[0092] In addition, each queue includes a maximum dequeueable data volume. When the dequeueable data volume of a queue reaches the maximum dequeueable data volume, no more dequeueable data will be generated. Taking the dequeueable data volume as represented by credit points as an example, assuming the maximum credit points are 100,000, if the current credit points of queue 1 are detected to be 100,000, no more credit points will be generated in the next cycle. If the current credit points of queue 1 are detected to be less than the maximum credit points, credit points will continue to be generated in the next cycle.

[0093] S302, is the current number of data that can be dequeued greater than 0?

[0094] In real time, determine whether the current dequeueable data volume of the target queue is greater than 0. The current dequeueable data volume is the dequeueable data volume at the current moment. If the current dequeueable data volume of the target queue is greater than 0, execute S303; otherwise, execute S301.

[0095] The current amount of data that can be dequeued can also be represented by the current credit points in the queue. It should be noted that S301 is executed periodically, while S302 is executed continuously. Therefore, S302 can be executed before S301. This application does not restrict the execution order between S301 and S302.

[0096] S303 determines the number of read commands to be generated based on the current amount of data that can be dequeued and the preset granularity.

[0097] The read command is used to read the BD information of the second queue. Specifically, the number of read commands generated can be determined based on the quotient of the current amount of data that can be dequeued and a preset granularity. For example, if the amount of data that can be dequeued is represented by credit points, and the current credit points of queue 2 are C, then the number of read commands generated, N = C / granularity, and rounded down if not divisible, to ensure that the number of read commands generated is a non-negative integer.

[0098] It should be noted that the granularity can be set according to the size of the BD. The larger the BD, the larger the granularity can be set. Generally, it can be set to 16K or 8K, etc. This application does not limit this.

[0099] S304, is the number of generated greater than 0?

[0100] If the number of read instructions generated is greater than 0, execute S305; otherwise, return to execute S301.

[0101] S305, generate at least one read instruction according to the number of instructions generated.

[0102] For example, assuming the number of commands to be generated is 5, then 5 read commands will be generated.

[0103] S306, update the current amount of data that can be dequeued based on the number of data generated and the granularity.

[0104] In other words, after generating a read instruction, the amount of dequeuable data that has been used to generate the read instruction can be deducted from the current amount of dequeuable data.

[0105] After generating a read instruction, the current amount of data that can be dequeued can be updated according to C' = CN * granularity, where C' is the updated amount of data that can be dequeued, C is the amount of data that can be dequeued before generating the read instruction, and N is the number of read instructions generated as determined by S303.

[0106] For example, if the amount of data that can be dequeued is represented by credit points with a granularity of 16K, before generating a read instruction, the current credit point of queue 1 is 90K. If 5 read operation instructions are generated this time, the current credit point value can be updated to C' = 90K - 5 * 16K = 10K.

[0107] In one possible implementation, when the queue management device receives at least one generated read instruction, it can generate at least one read operation to be executed based on the generated read instruction. Each read instruction corresponds one-to-one with a read operation to be executed, and the read operation to be executed includes the queue identifier of the second queue.

[0108] In another possible implementation, when the queue management device receives at least one generated read instruction, it can add the at least one read instruction to the operation instruction set for caching. Then, the queue management device can generate the corresponding read operation to be executed based on the cached read instructions in the operation instruction set.

[0109] In one possible implementation, since the read instruction is generated by estimating the amount of data that can be dequeued from the queue, after at least one read operation to be executed, the amount of data that can be dequeued from the corresponding queue can be calibrated based on the actual amount of data read. That is, the current amount of data that can be dequeued from the corresponding queue is updated based on the difference in data volume between the granularity and the read BD information.

[0110] Specifically, when the granularity is greater than the read BD information, the current dequeueable data volume can be replenished based on the difference in data volume between the two; when the granularity is less than the read BD information, the current dequeueable data volume can be deducted based on the difference in data volume between the two; when the granularity is equal to the read BD information, it can be determined that the current dequeueable data volume of the corresponding queue is accurate and no update is required.

[0111] For example, assuming the granularity is 16K, through Figure 3 The process shown generates five read instructions for reading BD information from queue 1, and in S201, five read operations to be executed are generated based on these five read instructions. After these five read operations are executed as target operations, the actual data volume of BD information read from queue 1 is 13K, 16K, 12K, 17K, and 11K respectively. The difference between the granularity and the data volume of the read BD information is 16K*5-(13K+16K+12K+17K+11K)=11K. Therefore, the current dequeueable data volume of queue 1 can be updated to C”=C+11K, where C is the current dequeueable data volume when performing the calibration operation.

[0112] It should be noted that the calibration operation can be performed separately for each read operation after it has been executed. Alternatively, the calibration operation can be performed uniformly for at least one read operation after at least one read operation has been executed. This application does not limit the scope of the calibration operation.

[0113] Based on the above scheme, by calibrating the amount of data that can be dequeued, the control accuracy of the total amount of data to be dequeued can be improved. In read operations, by pre-generating read instructions and calibrating the amount of data that can be dequeued, read operations can be executed continuously without waiting for the read operation result to return before calculating whether the next read operation needs to be generated. Therefore, the queue management method provided in this application embodiment can improve the overall bandwidth for storage media with different latency.

[0114] In one possible implementation, the update instruction is generated during the execution of a target operation of type read. Upon receiving the generated update instruction, an update operation to be executed can be generated based on the update instruction. This update operation includes the queue identifier of the third queue and the next-hop pointer information of the third queue.

[0115] In another possible implementation, when the generated update instruction is obtained, it can be cached in the operation instruction set. Then, the queue management device can generate the corresponding update operation to be executed based on the update instruction cached in the operation instruction set.

[0116] It should be noted that since the update instruction is generated during the execution of the read operation, the method for generating the update instruction will be explained in detail in the subsequent read operation execution method, and will not be repeated here.

[0117] In one possible implementation, the queue management device can generate corresponding operations to be executed based on the operation instructions cached in the operation instruction set. The generation order can be determined based on the priority of the instruction type. The instruction types include write instructions, read instructions, and update instructions, with update instructions having the highest priority, and read and write instructions having the same priority. The operation instructions included in the operation instruction set are all operation instructions for which no operations to be executed have yet been generated.

[0118] For example, suppose no new operation instructions have been obtained, but the instruction set includes one update instruction, two write instructions (write instruction 1 and write instruction 2), and two read instructions (read instruction 1 and read instruction 2). Since the update instruction has the highest priority, it can be generated as an update operation to be executed first. Then, in a fair round-robin manner, write instruction 1 can be generated as write operation 1 to be executed first, then read instruction 1 as read operation 1 to be executed, write instruction 2 as write operation 2 to be executed, and then read instruction 2 as read operation 2 to be executed. Alternatively, read instruction 1 can be generated as read operation 1 to be executed first, then write instruction 1 as write operation 1 to be executed, then read instruction 2 as read operation 2 to be executed, and then write instruction 2 as write operation 2 to be executed.

[0119] Optionally, the operation instruction set can store at least one operation instruction separately according to instruction type. For example, the operation instruction set may include a write instruction subset, a read instruction subset, and an update instruction subset. After obtaining at least one operation instruction, the write instruction can be added to the write instruction subset, the read instruction can be added to the read instruction subset, and the update instruction can be added to the update instruction subset.

[0120] In some embodiments, after generating at least one operation to be executed by the above method, at least one operation to be executed can be added to the set of operations to be executed.

[0121] Optionally, the set of operations to be executed can be stored separately according to operation type. For example, the set of operations to be executed may include a subset of write operations, a subset of read operations, and a subset of update operations. After obtaining at least one operation to be executed, the write operations to be executed can be added to the write operation subset, the read operations to be executed can be added to the read operation subset, and the update operations to be executed can be added to the update operation subset. S202, based on the operation type of the target operation, execute the target operation.

[0122] Execute the target operation according to the execution flow corresponding to the operation type of the target operation.

[0123] Based on the above scheme, this application embodiment uses an operation set approach to decompose complex queue linked list operations into read, write, and update operations. Compared to queue management schemes in related technologies, the design is simpler, eliminating the need for strict read-write synchronization, thus making data enqueue and dequeue operations more efficient. Simultaneously, updating the next jump of the current pointer through update operations achieves pre-reading, further improving the dequeue rate and ultimately realizing high-performance queue management.

[0124] The execution flow of the target operation will be described below according to the operation type.

[0125] In one possible implementation, see Figure 4 This is a flowchart illustrating the write operation execution method provided in this application embodiment. When the target operation type is a write operation, it can be performed as follows: Figure 4 The process shown executes the target operation, which includes:

[0126] S401, Based on the target operation, determine the queue identifier of the target queue.

[0127] Use the queue identifier of the first queue carried in the target operation as the queue identifier of the target queue.

[0128] S402, based on the queue identifier and operation type, obtain at least one linked list parameter of the target queue.

[0129] Among the various linked list parameters included in the queue linked list, based on the queue identifier and operation type, at least the linked list parameters related to the write operation of the target queue can be obtained. These linked list parameters related to the write operation can include the current write pointer and the pointer count corresponding to it. The current write pointer can be its pointer identifier, and the pointer count indicates the position where the BD information was written in the memory space corresponding to the current write pointer during the last write operation. The pointer count can be from 0 to P, where P represents a preset maximum pointer count, and P is a positive integer. For example, if the obtained current write pointer is pointer A and the obtained pointer count is 3, it means that during the last write operation, the BD information was written to the 4th position in the memory space corresponding to pointer A.

[0130] In one possible implementation, see Table 1, which is a linked list parameter table provided in the embodiments of this application. Table 1 shows the various linked list parameters included in the queue linked list, as well as the corresponding interpretations of each linked list parameter.

[0131] Table 1 Linked List Parameter Table

[0132]

[0133] Specifically, `fq_ptr_valid` takes the value 0 or 1. A value of 0 indicates that the current queue's linked list is invalid, while a value of 1 indicates that the current queue's linked list is valid. The current queue is the queue corresponding to the queue identifier carried by the target operation. For example, after the electronic device containing the queue management device boots up, or when all the buffers in the current queue's linked list are read out, the current queue's linked list will be marked as invalid. When the current queue's linked list is invalid, all other linked list parameters of the current queue are also invalid. That is, when `fq_ptr_valid = 0`, all other linked list parameters in Table 1 are invalid, meaning there is no need to further confirm the other linked list parameters of the current queue's linked list.

[0134] The value of fq_fst_rd is either 0 or 1. After an electronic device containing a queue management device is powered on, the counter used to record the pointer count corresponding to the current read pointer will increment by a reset value of 0. In order to distinguish between the reset value 0 and the pointer count 0, fq_fst_rd is added to indicate whether the position where the pointer count of the current read pointer is 0 has been read. When it is 1, it means that the position where the pointer count is 0 has not been read, and when it is 0, it means that the position where the pointer count is 0 has been read. By confirming the value of fq_fst_rd, it can be avoided that data is read from the position where the pointer count is 0 after reset.

[0135] The parameter value of `fq_next_ptr` represents the pointer identifier of the next-hop pointer, the parameter value of `fq_rd_ptr` represents the pointer identifier of the current read pointer, and the parameter value of `fq_wr_ptr` represents the pointer identifier of the current write pointer. The range of values ​​for these three linked list parameters depends on the size of the configured pointer pool. For example, if the pointer pool contains 1024 pointers, the range of values ​​for these three linked list parameters would be 0 to 1023. It should be noted that the parameter value of `fq_next_ptr` can also be empty when no next-hop pointer has been allocated.

[0136] The parameter values ​​of `fq_rd_cnt` represent the pointer count corresponding to the current read pointer, `fq_wr_cnt` represent the pointer count corresponding to the current write pointer, and `fq_bd_cnt` represent the total number of BD information cached in the current queue. The range of values ​​for these three linked list parameters depends on the number of data stores corresponding to a pointer row, i.e., the preset maximum pointer count. Assuming the number of data stores corresponding to a pointer row is 32, the maximum pointer count is 31, and the range of values ​​for the three linked list parameters is 0 to 31.

[0137] Optionally, the obtained target queue may include at least one linked list parameter, or all linked list parameters shown in Table 1 corresponding to the target queue, and may also include other parameters related to the queue linked list not shown in Table 1. This application does not limit this.

[0138] Based on the linked list parameters shown in Table 1, when executing S402, the current write pointer obtained is the parameter value of fq_wr_ptr of the target queue, and the pointer count corresponding to the current write pointer obtained is the parameter value of fq_wr_cnt of the target queue.

[0139] Optionally, when executing S402, the queue management device can also obtain the parameter value of fq_ptr_valid, and continue to execute S403 when fq_ptr_valid = 1, and skip S403 and directly execute S404 when fq_ptr_valid = 0.

[0140] It should be noted that the parameter values ​​of at least one linked list parameter obtained are all the parameter values ​​after the previous execution of the target operation.

[0141] S403, whether the pointer count is the maximum pointer count of the current write pointer.

[0142] Determine if the pointer count is the maximum pointer count of the current write pointer. If the pointer count is the maximum pointer count of the current write pointer, execute S404; if the pointer count is not the maximum pointer count of the current write pointer, execute S407.

[0143] S404 requests a new pointer from the pointer pool to serve as the next-hop pointer for the current write pointer.

[0144] When the pointer count is the maximum pointer count of the current write pointer, it means that when the target operation of the previous operation type was a write operation, it had already written to the last row of the linked list, that is, the memory space corresponding to the current write pointer has been filled. Then a new pointer can be requested from the pointer pool as the next jump pointer of the current write pointer.

[0145] S405, based on the next-hop pointer, writes the BD information to the target queue.

[0146] Write the BD information to the 0th position of the next-hop pointer in the target queue. For example, if the next-hop pointer is pointer C, then the BD information can be written to the 0th position of pointer C.

[0147] Specifically, the queue management device can set fq_wr_ptr to the currently allocated next-hop pointer and set fq_wr_cnt to 0. Then, it calculates the write address of the BD information based on {fq_wr_ptr, fq_wr_cnt}, and writes the BD information to the target queue according to the write address.

[0148] S406, Update the pointer order in the next-hop cache.

[0149] Specifically, when the write pointer is on a newline, the value in the next-hop cache, which is indexed by the address fq_wrt_ptr obtained in S402, is updated to the next-hop pointer obtained in S404.

[0150] The next-hop cache is used to store the order of the pointers that have been called in the pointer pool.

[0151] See Figure 5 This is a schematic diagram of the next-hop cache provided in an embodiment of this application. Figure 5 As shown, cached content can be cached according to address indices. For example, the cached content corresponding to pointer A is pointer B, the cached content corresponding to pointer B is pointer C, the cached content corresponding to pointer C is pointer D, and so on. Furthermore, each cached content can use the pointer identifier of the next-hop pointer as its content value. For example, the content value of "the next hop of pointer A is pointer B" is B, the content value of "the next hop of pointer B is pointer C" is C, and so on.

[0152] S407, based on the obtained current write pointer and the pointer count corresponding to the current write pointer, write the BD information into the target queue.

[0153] Assuming the current write pointer is B and the pointer count corresponding to the current write pointer is 3, the BD information can be written to the next position of pointer B in the target queue, which is the position corresponding to pointer count 4 in pointer B.

[0154] Specifically, the queue management device can increment the value of fq_wr_cnt by 1. Then, it calculates the write address of the BD information based on {fq_wr_ptr, fq_wr_cnt}, and writes the BD information to the target queue according to the write address.

[0155] S408, Update the current write pointer and the pointer count corresponding to the current write pointer.

[0156] Based on the position where the BD information is written to the target queue, update the current write pointer and the pointer count corresponding to the current write pointer. That is, if the previous step was S406, the current write pointer is updated according to the next-hop pointer, and the pointer count corresponding to the current write pointer is set to 0. If the previous step was S407, there is no need to update the current write pointer, and the pointer count corresponding to the current write pointer is incremented by 1.

[0157] For example, assuming a next-hop pointer C is allocated, the linked list parameter values ​​are updated to fq_wr_ptr = C and fq_wr_cnt = 0. If no next-hop pointer is allocated, and the current write pointer obtained by S402 is B, with a pointer count of 3, then the linked list parameter values ​​are updated to fq_wr_ptr = B and fq_wr_cnt = 3 + 1 = 4.

[0158] In one possible implementation, after updating the current write pointer and the pointer count corresponding to the current write pointer, when fq_wr_ptr moves to the next line of fq_rd_ptr, fq_next_ptr can be updated to the allocated next-hop pointer, that is, the updated fq_wr_ptr.

[0159] In one possible implementation, if the execution Figure 4 In the process shown, if it is the first write operation, then fq_rd_ptr can be made to point to the next-hop pointer that was requested, and fq_rd_cnt can be assigned the value 0.

[0160] In one possible implementation, see Figure 6 This is a flowchart illustrating the read operation execution method provided in this application embodiment. When the target operation type is a read operation, it can be performed as follows: Figure 6 The process shown executes the target operation, which includes:

[0161] S601, based on the target operation, determine the queue identifier of the target queue.

[0162] Use the queue identifier of the second queue carried in the target operation as the queue identifier of the target queue.

[0163] S602, based on the queue identifier and operation type, obtain at least one linked list parameter of the target queue.

[0164] Among the various linked list parameters included in the queue linked list, based on the queue identifier and operation type, at least the linked list parameters related to the read operation of the target queue can be obtained. These linked list parameters related to the read operation can include the current read pointer, the pointer count corresponding to the current read pointer, and the next-hop pointer. That is, fq_rd_ptr, fq_rd_cnt, and fq_next_ptr in the linked list parameter table shown in Table 1.

[0165] In one possible implementation, the linked list parameter related to the read operation may also include the current write pointer. When the current write pointer is different from the current read pointer, and the count corresponding to the current read pointer is 1, an update instruction is generated based on the current write pointer. This update instruction indicates that the next-hop pointer of the target queue's current read pointer is the current write pointer.

[0166] In other words, when the current read pointer and the current write pointer are not on the same line and fq_rd_cnt = 1, an update instruction is generated. This update instruction indicates that the fq_next_ptr of the target queue is updated to the content value in the next-hop cache with fq_wr_ptr as the address index.

[0167] For example, assuming the current target operation is a read operation on queue 1, and fq_wr_ptr = B, then using "B" as the address index, determine... Figure 5 The content value corresponding to "B" in the next-hop cache shown. Because... Figure 5 If the cached content corresponding to "B" is "the next jump of pointer B is pointer C", then we can determine that the value of the content corresponding to "B" is C, and therefore the next jump pointer information included in the generated update instruction is C. Furthermore, since the current target operation is a read operation on queue 1, we can also determine that when generating the update instruction, the queue identifier of queue 1 will be used as the queue identifier of the third queue. Based on this, the generated update instruction can be used to assign the value C to fq_next_ptr of queue 1.

[0168] Based on the above scheme, in order to avoid the problem that the read operation needs to be interrupted to determine the next jump pointer at the end of each line, thus preventing continuous read operations, the embodiments of this application can generate an update instruction when the read operation reads a new line to update the next jump pointer of the current read pointer in a timely manner. This allows the read operation to directly perform the read operation of the next line at the end of each line based on the updated next jump pointer, thereby improving the dequeue efficiency.

[0169] In one possible implementation, the queue management device can also obtain `fq_ptr_valid` and determine whether the current read pointer is valid based on the value of `fq_ptr_valid`. When `fq_ptr_valid = 0`, it indicates that the current queue list is invalid, and the current read pointer is also invalid. At this time, an invalid BD indication signal can be output, and the process ends. Here, invalid BD means that the current queue list has no content to read, so the read content is invalid BD information. When `fq_ptr_valid = 1`, it indicates that the current queue list is valid, and S603 can continue to be executed.

[0170] Optionally, at least one linked list parameter of the target queue can be obtained, or all linked list parameters shown in Table 1 corresponding to the target queue can be included. In addition, other parameters related to the queue linked list that are not shown in Table 1 may also be included, and this application does not limit this.

[0171] S603, whether the pointer count is the maximum pointer count of the current read pointer.

[0172] Determine whether the pointer count corresponding to the current read pointer is the maximum pointer count of the current read pointer. If the pointer count corresponding to the current read pointer is the maximum pointer count of the current read pointer, execute S604; if the pointer count is not the maximum pointer count of the current read pointer, execute S606.

[0173] S604, based on the next-hop pointer, reads the BD information of the target queue.

[0174] Specifically, the read address can be calculated based on {fq_next_ptr, fq_rd_cnt}, then the BD information of the target queue can be read according to the read address, and the pointer corresponding to fq_rd_ptr can be reclaimed. Since the read address is a new row, fq_rd_cnt is fixed to 0 when calculating the read address in S604.

[0175] S605 updates the current read pointer and the pointer count corresponding to the current read pointer based on the next-hop pointer.

[0176] Based on the parameter value of fq_next_ptr, update the parameter value of fq_rd_ptr and update fq_rd_cnt to 0. For example, assuming fq_next_ptr = D, and fq_rd_ptr = C obtained by S602, then the updated fq_rd_ptr = D.

[0177] S606 reads the BD information of the target queue based on the current read pointer and the pointer count corresponding to the current read pointer.

[0178] Specifically, the read address can be calculated based on {fq_rd_ptr, fq_rd_cnt + (fq_fst_rd ? 0:1)}, and then the BD information of the target queue can be read according to the read address. Here, (fq_fst_rd ? 0:1) indicates that the parameter value of fq_fst_rd is used as a condition, and different return values ​​are selected based on the condition. When fq_fst_rd = 1, (fq_fst_rd ? 0:1) = 0; when fq_fst_rd = 0, (fq_fst_rd ? 0:1) = 1.

[0179] S607, Update the pointer count corresponding to the current read pointer.

[0180] Update the parameter value of fq_rd_cnt based on the value of {fq_rd_cnt+(fq_fst_rd?0:1)}.

[0181] See Figure 7 This is a schematic diagram of the queue management process provided in an embodiment of this application. Figure 7 As shown, multiple queues managed through a linked list can include queues 0 through Q. A pointer pool is used for pointer maintenance and management; each pointer corresponds to a memory space, and each pointer has a pointer identifier and a pointer count. The pointer identifier is used to distinguish different pointers, for example... Figure 7 A, B, and C shown are pointer identifiers; the pointer count is used to identify the position in the corresponding memory space. For example, when the pointer count corresponding to the current read pointer is 3, it means that the 4th position in the memory space corresponding to the current read pointer was read during the last read operation.

[0182] exist Figure 7 In the example shown, A is the current read pointer, C is the current write pointer, and B is the next jump pointer. That is, when the memory space corresponding to A is finished being read, the next read operation needs to jump to B to continue execution. Pointers are allocated through write operations and reclaimed (also called released) through read operations. Figure 7 The pointer count corresponding to C is P, indicating that the memory space corresponding to C was written out during the previous write operation. Therefore, when performing the write operation this time, a pointer needs to be allocated first (for example, allocated to D). Then, the write address for this operation is calculated based on D, and the write operation is performed. Figure 5 The next-hop cache shown stores "the next hop of pointer C is pointer D".

[0183] In one possible implementation, during the execution of a target operation of type read, if the obtained linked list parameter values ​​determine that the queue linked list is valid and that the queue caches BD information, and the linked list parameter values ​​satisfy any one of the following three conditions, then proceed with... Figure 7 The pointer shown is recycled:

[0184] In the first scenario, when a read operation catches up with a write operation, the current read pointer is reclaimed after the current row corresponding to the current read pointer has been read.

[0185] Specifically, when fq_rd_ptr = fq_wr_ptr, fq_rd_cnt+1 = fq_wr_cnt, and fq_bd_cnt = 1, fq_rd_ptr is reclaimed.

[0186] In the second scenario, when the write operation and the read operation are not on the same line, the current read pointer is reclaimed after reading the line corresponding to the current read pointer.

[0187] Specifically, when fq_rd_ptr ≠ fq_wr_ptr and fq_rd_cnt = P, fq_rd_ptr is reclaimed. Here, P is the preset maximum pointer count.

[0188] Scenario 3: When read and write operations are on adjacent lines, for example... Figure 7 The row corresponding to pointer B and the row corresponding to pointer C are shown. The last read BD information was located at position P of pointer B. That is, pointer B is reclaimed through case two, while the write operation stops at position 0 of C. Then, the read operation will read position 0 of pointer C, and pointer C should be reclaimed at this time.

[0189] Specifically, if fq_next_ptr = fq_wr_ptr, fq_wr_cnt = 0, fq_rd_cnt = P, and fq_bd_cnt = 1, then fq_next_ptr is recycled.

[0190] Based on the above scheme, since the read, write and update operations of this application are performed in a pipelined serial manner internally, and the process is simple and clear, and the recycling conditions described in the above three pointer recycling cases are relatively strict and there will be no omission of conditions, the problem of internal cache leakage and unrecoverable failure due to repeated recycling of internal pointers in related technologies can be avoided.

[0191] In one possible implementation, when the target operation is an update operation, the target operation can be executed as follows: Based on the target operation, determine the queue identifier of the target queue. Based on the queue identifier and the operation type, obtain at least one linked list parameter of the target queue. The obtained linked list parameter may include a next-hop pointer. Then, the next-hop pointer can be updated based on the next-hop pointer information indicated by the target operation.

[0192] For example, if the next-hop pointer information of the target operation instruction is pointer D, then the updated target queue's fq_next_ptr is determined to be D.

[0193] Based on the above solutions, since the queue management method provided in this application can adapt to any number of queues and storage bandwidth, this application can effectively manage queues with different numbers of queues and different storage bandwidths without modifying the hardware of the electronic device. Secondly, the queue management method provided in this application is not sensitive to the storage medium, so it can effectively manage queues with different storage media without modifying the software of the electronic device. Furthermore, the queue management method provided in this application is not sensitive to the enqueue / dequeue algorithm of the preceding stage, thus exhibiting strong fault tolerance. Even if an error occurs in the enqueue / dequeue algorithm of the preceding stage, it will not affect the normal operation of the queue management method of this application, thereby improving the stability and reliability of the computer system.

[0194] Based on the aforementioned beneficial effects of this application, it can be seen that the queue management method provided by the embodiments of this application has strong versatility and therefore has broad market demand.

[0195] Based on the same concept as the above method, see [link to relevant documentation]. Figure 8 This application provides a queue management device 800 that can execute the steps of the above-described method; to avoid repetition, these steps will not be described in detail here. The device 800 includes an arbitration module 810 and a queue linked list management module 820. In one scenario:

[0196] Arbitration module 810 is used to select a target operation from at least one pending operation in a set of pending operations based on the priority of a set of operation types. The operation type is the operation type of the pending operations in the set of pending operations, including write operations, read operations, and update operations. The update operation is used to update the next-hop pointer of the current read pointer of a specified queue. The at least one pending operation in the set of pending operations is determined based on at least one obtained operation instruction. The at least one operation instruction is triggered for any one of multiple queues managed through a queue linked list.

[0197] The queue linked list management module 820 is used to execute the target operation based on the operation type of the target operation.

[0198] In one possible implementation, the update operation has the highest priority; when the arbitration module 810 selects a target operation from at least one pending operation included in the set of pending operations based on the priority of the set of operation types, it is specifically used as follows: when the set of pending operations includes pending update operations of type update, the pending update operation is selected as the target operation; when the set of pending operations does not include pending update operations, a pending read operation of type read or a pending write operation of type write is selected sequentially by polling as the target operation.

[0199] In one possible implementation, the arbitration module 810 may further include an update operation cache 811, a write operation cache 812, and a read operation cache 813. The update operation cache 811, write operation cache 812, and read operation cache 813 can constitute a set of operations to be executed. The update operation cache 811 is used to cache update operations to be executed, the write operation cache 812 is used to cache write operations to be executed, and the read operation cache 813 is used to cache read operations to be executed. Based on the priority of the set operation types, when selecting a target operation from the set of operations to be executed, the arbitration module 810 uses the following method: if the update operation cache 811 includes update operations to be executed, it selects the update operations to be executed as the target operation; if the update operation cache 811 does not include update operations to be executed, it selects write operations to be executed sequentially from the write operation cache 812 or read operations to be executed from the read operation cache 813 in a round-robin manner as the target operation.

[0200] In one possible implementation, the operation instruction includes a write instruction for describing the data block information (BD); the write operation to be executed, which is a write operation, is determined by the arbitration module 810 according to the following method: based on the acquired write instruction, a write operation to be executed is generated: wherein the write instruction is used to instruct the BD information to be written to a first queue, and the BD information is used to represent the storage address and size of the specified data block that has been stored; the write operation to be executed includes the queue identifier of the first queue and the BD information.

[0201] In one possible implementation, the queue list management module 820, based on the operation type of the target operation, specifically performs the following when executing the target operation: when the operation type of the target operation is a write operation, it determines the queue identifier of the target queue based on the target operation; based on the queue identifier and the operation type, it obtains at least one list parameter of the target queue; the list parameter includes the current write pointer and the pointer count corresponding to the current write pointer; when the pointer count is equal to the maximum pointer count of the current write pointer, it requests a new pointer from the pointer pool as the next-hop pointer of the current write pointer, writes the BD information into the target queue based on the next-hop pointer, and updates the pointer order in the next-hop cache; the next-hop cache is used to store the order among the various called pointers in the pointer pool; when the pointer count is not equal to the maximum pointer count of the current write pointer, it writes the BD information into the target queue based on the obtained current write pointer and the pointer count corresponding to the current write pointer; and updates the current write pointer and the pointer count corresponding to the current write pointer.

[0202] In one possible implementation, the operation instruction includes a read instruction; the read instruction generation module 830 is configured to: when the current dequeueable data volume of the second queue is greater than zero, determine the number of read instructions to be generated based on the current dequeueable data volume and a preset granularity; the read instruction is used to read the BD information of the second queue; generate at least one read instruction according to the number of instructions generated, and update the current dequeueable data volume based on the number of instructions generated and the granularity; the pending read operation of the operation type is determined by the arbitration module 810 according to the following method: generating at least one pending read operation based on the at least one read instruction; the pending read operation includes the queue identifier of the second queue.

[0203] In one possible implementation, when the queue list management module 820 executes the target operation based on the operation type of the target operation, it is specifically configured to: when the operation type of the target operation is a read operation, determine the queue identifier of the target queue based on the target operation; obtain at least one list parameter of the target queue based on the queue identifier and the operation type; the list parameter includes the current read pointer, the pointer count corresponding to the current read pointer, and the next-hop pointer; when the pointer count corresponding to the current read pointer is the maximum pointer count of the current read pointer, read the BD information of the target queue based on the next-hop pointer, and update the current read pointer and the pointer count corresponding to the current read pointer based on the next-hop pointer; when the pointer count is not the maximum pointer count of the current read pointer, read the BD information of the target queue based on the current read pointer and the pointer count corresponding to the current read pointer, and update the pointer count corresponding to the current read pointer.

[0204] In one possible implementation, the linked list parameters further include: a current write pointer; after the queue linked list management module 820 obtains at least one linked list parameter of the target queue based on the queue identifier and the operation type, it is further configured to: when the current write pointer is different from the current read pointer, and the count corresponding to the current read pointer is 1, generate an update instruction based on the current write pointer; the update instruction is used to indicate that the next hop pointer of the current read pointer of the target queue is the current write pointer.

[0205] In one possible implementation, after the queue list management module 820 reads the BD information of the target queue, the compensation calculation module 840 is used to update the current dequeueable data volume of the target queue based on the data volume difference between the granularity and the read BD information.

[0206] In one possible implementation, the operation instruction includes an update instruction, and the update operation to be executed, which is an update operation of type update, is determined by the arbitration module 810 according to the following method: when the update instruction is obtained, the update operation to be executed is generated based on the update instruction; the update operation to be executed includes the queue identifier of the third queue and the next-hop pointer information of the third queue.

[0207] In one possible implementation, when the queue list management module 820 executes the target operation based on the operation type of the target operation, it is specifically configured to: when the operation type of the target operation is an update operation, determine the queue identifier of the target queue based on the target operation; obtain at least one list parameter of the target queue based on the queue identifier and the operation type; the list parameter includes a next-hop pointer; and update the next-hop pointer based on the next-hop pointer information indicated by the target operation.

[0208] Based on the same concept as the above method, see [link to relevant documentation]. Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device includes at least one processor 902 and a memory 901 connected or coupled to the at least one processor 902. In addition, the electronic device may also include a communication interface 903. The electronic device can interact with other devices through the communication interface 903.

[0209] For example, the communication interface 903 can be a transceiver, circuit, bus, module, pin, or other type of communication interface. When the electronic device is a chip-based device or circuit, the communication interface 903 in the electronic device can also be an input / output circuit, capable of inputting information (or receiving information) and outputting information (or sending information). The processor can be an integrated processor, a microprocessor, an integrated circuit, or a logic circuit, and the processor can determine the output information based on the input information.

[0210] The coupling in this application embodiment is an indirect coupling or communication connection between devices, units, or modules, which can be electrical, mechanical, or other forms, used for information exchange between devices, units, or modules. The processor 902 may operate in conjunction with the memory 901 and the communication interface 903. This application does not limit the specific connection medium between the processor 902, the memory 901, and the communication interface 903.

[0211] Optional, see Figure 9 The processor 902, the memory 901, and the communication interface 903 are interconnected via a bus. This bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0212] In this embodiment, memory 901, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 901 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory 901 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. Memory 901 in this embodiment may also be a circuit or any other device capable of implementing storage functions for storing instructions, computer programs, and / or data.

[0213] In this embodiment, the processor 902 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this embodiment. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the queue management method disclosed in this embodiment can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0214] By designing and programming the processor 902, the code corresponding to the queue management method described in the foregoing embodiments can be embedded into the chip, so that the chip can execute the steps of the aforementioned queue management method when running. How to design and program the processor 902 is a well-known technique to those skilled in the art, and will not be described in detail here.

[0215] In one or more embodiments, memory 901 stores instructions that can be executed by at least one processor 902, which can implement the steps of any of the above methods by calling the instructions stored in memory 901 or a computer program.

[0216] This application also provides a computer-readable storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the steps of any of the above methods.

[0217] Based on the same inventive concept, this application also provides a computer program product, which includes computer program code. When the computer program code is run on a computer, it causes the computer to execute any of the queue management methods discussed above. Since the principle by which the above-described computer program product solves the problem is similar to that of the queue management method, the implementation of the above-described computer program product can be referred to the implementation of the method, and repeated details will not be described again.

[0218] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0219] While specific embodiments of this application have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of this application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of this application, and all such changes and modifications fall within the scope of protection of this application. Although preferred embodiments of this application have been described, those skilled in the art, once they understand the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0220] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A queue management method, characterized in that, include: Based on the priority of the set operation types, a target operation is selected from at least one operation to be executed in the set of operations to be executed; the operation type is the operation type of the operation to be executed in the set of operations to be executed, and the operation type includes write operation, read operation and update operation; the update operation is used to update the next-hop pointer of the current read pointer of the specified queue; the at least one operation to be executed in the set of operations to be executed is determined based on at least one operation instruction obtained; the at least one operation instruction is triggered for any one of the multiple queues managed by the queue linked list; The target operation is executed based on the operation type of the target operation.

2. The method according to claim 1, characterized in that, The update operation has the highest priority; the selection of a target operation from at least one pending operation included in the set of pending operations based on the priority of the set of operation types includes: When the set of operations to be executed includes an update operation of type update, the update operation to be executed is taken as the target operation.

3. The method according to claim 1 or 2, characterized in that, The operation instructions include write instructions for the data block information description (BD); the write operation to be executed, which is of the write operation type, is determined according to the following method: Based on the obtained write instructions, generate the write operations to be executed; The write instruction is used to instruct the BD information to be written to the first queue. The BD information is used to indicate the storage address and size of the specified data block that has been stored. The write operation to be performed includes the queue identifier of the first queue and the BD information.

4. The method according to claim 3, characterized in that, The operation based on the target operation type, executing the target operation, includes: When the target operation is a write operation, the queue identifier of the target queue is determined based on the target operation; Based on the queue identifier and the operation type, obtain at least one linked list parameter of the target queue; the linked list parameter includes the current write pointer and the pointer count corresponding to the current write pointer; When the pointer count reaches the maximum pointer count of the current write pointer, a new pointer is requested from the pointer pool as the next-hop pointer of the current write pointer. Based on the next-hop pointer, the BD information is written to the target queue, and the pointer order in the next-hop cache is updated. The next-hop cache is used to store the order of each called pointer in the pointer pool. When the pointer count is not equal to the maximum pointer count of the current write pointer, the BD information is written into the target queue based on the obtained current write pointer and the pointer count corresponding to the current write pointer; Update the current write pointer and the pointer count corresponding to the current write pointer.

5. The method according to claim 1 or 2, characterized in that, The operation instructions include a read instruction; the method further includes: When the current amount of data that can be dequeued in the second queue is greater than zero, the number of read instructions generated is determined based on the current amount of data that can be dequeued and the preset granularity; the read instructions are used to read the BD information of the second queue. According to the number of generated data, at least one read instruction is generated, and the current dequeueable data volume is updated based on the number of generated data and the granularity. The read operation to be executed, which is of type read, is determined according to the following method: Based on the at least one read instruction, at least one read operation to be executed is generated; the read operation to be executed includes the queue identifier of the second queue.

6. The method according to claim 5, characterized in that, The operation based on the target operation type, executing the target operation, includes: When the target operation is a read operation, the queue identifier of the target queue is determined based on the target operation; Based on the queue identifier and the operation type, obtain at least one linked list parameter of the target queue; the linked list parameter includes the current read pointer, the pointer count corresponding to the current read pointer, and the next jump pointer; When the pointer count corresponding to the current read pointer is the maximum pointer count of the current read pointer, the BD information of the target queue is read based on the next jump pointer, and the current read pointer and the pointer count corresponding to the current read pointer are updated based on the next jump pointer; When the pointer count is not the maximum pointer count of the current read pointer, the BD information of the target queue is read based on the current read pointer and the pointer count corresponding to the current read pointer, and the pointer count corresponding to the current read pointer is updated.

7. The method according to claim 6, characterized in that, The linked list parameters also include: the current write pointer; After obtaining at least one linked list parameter of the target queue based on the queue identifier and the operation type, the method further includes: When the current write pointer is different from the current read pointer, and the count corresponding to the current read pointer is 1, an update instruction is generated based on the current write pointer; the update instruction is used to indicate that the next hop pointer of the current read pointer of the target queue is the current write pointer.

8. The method according to claim 6, characterized in that, After reading the BD information of the target queue, the method further includes: Based on the difference in data volume between the granularity and the read BD information, the current dequeueable data volume of the target queue is updated.

9. The method according to claim 1 or 2, characterized in that, The operation instructions include update instructions, and the update operation to be executed, which is of the update operation type, is determined according to the following method: Based on the obtained update instruction, an update operation to be executed is generated; the update operation to be executed includes the queue identifier of the third queue and the next hop pointer information of the third queue.

10. The method according to claim 9, characterized in that, The operation based on the target operation type, executing the target operation, includes: When the target operation is an update operation, the queue identifier of the target queue is determined based on the target operation; Based on the queue identifier and the operation type, obtain at least one linked list parameter of the target queue; the linked list parameter includes a next-hop pointer; The next-hop pointer is updated based on the next-hop pointer information of the target operation instruction.

11. A queue management device, characterized in that, include: The arbitration module is used to select a target operation from at least one operation to be executed in the set of operations to be executed, based on the priority of the set operation type. The operation type is the operation type of the operations to be executed in the set of operations to be executed, and the operation type includes write operation, read operation and update operation; the update operation is used to update the next-hop pointer of the current read pointer of the specified queue; the set of operations to be executed includes at least one operation to be executed based on at least one operation instruction obtained; the at least one operation instruction is triggered for any one of the multiple queues managed by the queue linked list; The queue linked list management module is used to execute the target operation based on the operation type of the target operation.

12. An electronic device, characterized in that, include: Memory, used to store computer instructions; A processor, connected to the memory, is configured to execute computer instructions in the memory, and, in executing the computer instructions, implement the method as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, include: The computer-readable storage medium stores computer instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 10.