Multi-queue information management method and device, electronic equipment and readable storage medium
By obtaining and updating pre-allocated pointers, the inefficiency problem of linked list management of multi-queue information is solved, efficient information writing, reading and releasing is achieved, and storage resources are saved.
Patent Information
- Application Number
- CN202510322814.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-08-01
AI Technical Summary
When using linked lists to manage multi-queue information, the prior art requires additional resources to copy the first and the tail pointers, and it is impossible to determine whether the linked list is empty only through the copied pointers, resulting in inefficiency.
By obtaining the target preallocated pointer, update the preallocated pointer, the tail pointer in the queue context information and the linked list node pointer to avoid copying the first and tail pointers, and directly use the update preallocated pointer to determine whether the linked list is empty.
Simplify the information writing steps, improve writing efficiency, reduce write delay, save storage resources, and determine the status of the linked list through the first and tail pointers to improve read and release efficiency.
Smart Images

Figure CN120407222A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular to artificial intelligence technologies such as big data and cloud services. A method, an apparatus, an electronic device, and a readable storage medium for managing multi-queue information are provided. Background Art
[0002] Existing technologies generally use linked lists to manage multi-queue information. However, when using a conventional linked list solution to manage multi-queue information, there are still some problems. For example, when determining whether a linked list is empty based on queue context information, additional resources are required to copy the head and tail pointers, and the determination cannot be made only through the copied head and tail pointers. Summary of the Invention
[0003] According to a first aspect of the present disclosure, a method for managing multi-queue information is provided, including: obtaining a target pre-allocated pointer according to the queue information of a first target queue to which information to be written belongs; determining a first target linked list node corresponding to the target pre-allocated pointer, and writing the information to be written into the first target linked list node; obtaining an updated pre-allocated pointer from a linked list pointer resource pool, and using the updated pre-allocated pointer to update the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the first target linked list node; wherein the updated pre-allocated pointer is the target pre-allocated pointer used when writing information corresponding to the target queue next time.
[0004] According to a second aspect of the present disclosure, a device for managing multi-queue information is provided, including: an obtaining unit, configured to obtain a target pre-allocated pointer according to the queue information of a first target queue to which information to be written belongs; a first management unit, configured to determine a first target linked list node corresponding to the target pre-allocated pointer, and write the information to be written into the first target linked list node; a second management unit, configured to obtain an updated pre-allocated pointer from a linked list pointer resource pool, and use the updated pre-allocated pointer to update the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the first target linked list node; wherein the updated pre-allocated pointer is the target pre-allocated pointer used when writing information corresponding to the target queue next time.
[0005] According to a third aspect of the present disclosure, an electronic device is provided, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method as described above.
[0006] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method described above.
[0007] According to a fifth aspect of the present disclosure, there is provided a computer program product including a computer program, which implements the method described above when executed by a processor.
[0008] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Description of the Drawings
[0009] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0010] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure;
[0011] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure;
[0012] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure;
[0013] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure;
[0014] Figure 5 is a schematic diagram according to the fifth embodiment of the present disclosure;
[0015] Figure 6 is a block diagram of an electronic device for implementing the multi-queue information management method of the embodiments of the present disclosure. Detailed Embodiments
[0016] The following makes an explanation of the exemplary embodiments of the present disclosure in conjunction with the drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, the description of well-known functions and mechanisms is omitted below.
[0017] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. As Figure 1 shown, the multi-queue information management method of this embodiment specifically includes the following steps:
[0018] S101. Obtain a target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs;
[0019] S102. Determine the first target linked list node corresponding to the target pre-allocation pointer, and write the information to be written into the first target linked list node;
[0020] S103. Obtain an updated pre-allocation pointer from the linked list pointer resource pool, and use the updated pre-allocation pointer to update the pre-allocation pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the first target linked list node; wherein, the updated pre-allocation pointer is the target pre-allocation pointer used when writing information corresponding to the target queue next time.
[0021] In the management method of multi-queue information in this embodiment, when writing information, it is not necessary to copy the head and tail pointers in the queue context information of the corresponding first queue, which avoids occupying additional resources when writing information, and can complete the writing of information by obtaining the pre-allocation pointer (pre_alloc_ptr) corresponding to the corresponding first queue, which can simplify the information writing steps, improve the information writing efficiency, and reduce the information writing delay.
[0022] In this embodiment, the information to be written is the information that a user or an input end wants to store in the linked list, such as an entry; wherein, the linked list includes multiple linked list nodes, and each linked list node includes content corresponding to different information (or entry).
[0023] When this embodiment executes S101 to obtain a target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs, the implementation method that can be adopted is: determine the first target queue to which the information to be written belongs according to the attribute information (such as identification information) of the information to be written; obtain the pre-allocation pointer corresponding to the queue information of the determined first target queue as the target pre-allocation pointer.
[0024] That is to say, this embodiment obtains the target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs. Since different first target queues correspond to different pre-allocation pointers, this embodiment obtains the target pre-allocation pointer according to the queue information, which can improve the accuracy of the obtained target pre-allocation pointer.
[0025] It can be understood that if the information to be written currently corresponds to the first information of the first target queue (i.e., the first write), the target pre-allocation pointer obtained by this embodiment when executing S101 is the initial pre-allocation pointer corresponding to the first target queue.
[0026] If the information to be written currently does not correspond to the first piece of information in the first target queue (i.e., it is not the first write), then the target pre-allocated pointer obtained by this embodiment when executing S101 is the updated pre-allocated pointer obtained from the linked list pointer resource pool after the previous write information.
[0027] In this embodiment, the initial pre-allocated pointer corresponding to the first target queue can be the queue number of the first target queue; that is, when performing the first information write to the first target queue, obtain the queue number of the first target queue as the target pre-allocated pointer, so that there is no need to perform the operation of selecting the pre-allocated pointer from the linked list pointer resource pool, and the acquisition efficiency of the target pre-allocated pointer when performing the first information write can be improved.
[0028] In addition, this embodiment can also use a pre-allocated pointer selected from the linked list pointer resource pool as the initial pre-allocated pointer corresponding to the first target queue; that is, first select the pre-allocated pointer, and then establish the corresponding relationship between the selected pre-allocated pointer and the first target queue.
[0029] After this embodiment executes S101 to obtain the target pre-allocated pointer, it executes S102 to determine the first target linked list node corresponding to the target pre-allocated pointer, and writes the information to be written into the first target linked list node.
[0030] In this embodiment, different pre-allocated pointers correspond to different linked list nodes in the linked list, that is, according to the obtained target pre-allocated pointer, the unique linked list node in the linked list can be determined.
[0031] When this embodiment executes S102 to determine the first target linked list node corresponding to the target pre-allocated pointer, it can first obtain the correspondence table between the pre-allocated pointer and the linked list node preset, and then according to this correspondence table, use the linked list node corresponding to the target pre-allocated pointer in the linked list resource pool as the first target linked list node; where the linked list resource pool includes multiple linked list nodes.
[0032] After this embodiment executes S102 to complete the determination of the first target linked list node, it can write the information to be written into the first target linked list node; in this embodiment, in addition to including the information to be written (or the buffer identification information corresponding to the information to be written), the first target linked list node also includes a next node pointer (next_list_ptr), and this next node pointer is used to point to the next linked list node in the linked list.
[0033] Specifically, when implementing S102 to write the information to be written into the first target linked list node in this embodiment, the implementation method that can be adopted is as follows: obtain the first target buffer identification information corresponding to the target pre-allocated pointer, where different pre-allocated pointers correspond to different buffer identification information; determine the first target storage location in the buffer resource pool according to the obtained first target buffer identification information, and different buffer identification information corresponds to different storage locations in the buffer resource pool; store the information to be written into the buffer resource pool according to the determined first target storage location; write the obtained first target buffer identification information into the first target linked list node.
[0034] That is to say, when writing the information to be written into the first target linked list node in this embodiment, specifically, the first target buffer identification information corresponding to the information to be written is written into the first target linked list node, rather than writing the information to be written itself into the first target linked list node, thereby effectively reducing the size of the linked list, saving the storage resources required by the linked list, and the linked list nodes in the linked list include the first target buffer identification information corresponding to the information to be written, so that when reading the information, the storage location of the information in the buffer resource pool can be determined according to the corresponding buffer identification information, and then the information can be read by accessing the determined storage location.
[0035] In addition, when implementing S102 to write the information to be written into the first target linked list node in this embodiment, the information to be written can also be directly written into the first target linked list node, so that the first target linked list node includes the written information itself.
[0036] After implementing S102 to write the information to be written into the target linked list node in this embodiment, S103 is executed to obtain an updated pre-allocated pointer from the linked list pointer resource pool, and use the updated pre-allocated pointer to update the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information (Q Context) of the first target queue, and the next node pointer in the target linked list node.
[0037] In this embodiment, the linked list pointer resource pool includes multiple different pre-allocated pointers, and different pre-allocated pointers correspond to different linked list nodes in the linked list and different buffer identification information.
[0038] After implementing S102 to complete the writing of the information to be written in this embodiment, a pre-allocated pointer is re-obtained from the linked list pointer resource pool as the updated pre-allocated pointer, and then the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information (Q Context) of the first target queue, and the next node pointer in the first target linked list node are updated using the obtained updated pre-allocated pointer.
[0039] In this embodiment, the queue context information includes a head pointer (hptr) and a tail pointer (tptr). The head pointer is the initial pre-allocation pointer corresponding to the first target queue; when the initial pre-allocation pointer is a queue number, the head pointer in the queue context information is the queue number.
[0040] When this embodiment executes S103, the obtained updated pre-allocation pointer is used to update the pre-allocation pointer corresponding to the first target queue, that is, the current target pre-allocation pointer is replaced with this updated pre-allocation pointer, so that this updated pre-allocation pointer is used as the target pre-allocation pointer when writing information corresponding to the first target queue next time.
[0041] When this embodiment executes S103, the obtained updated pre-allocation pointer is used to update the tail pointer in the queue context information of the first target, so that the head pointer and the tail pointer in the queue context information are different, thereby determining that the linked list is not empty according to the difference between the head and tail pointers, that is, the linked list includes corresponding information.
[0042] It can be understood that when there is no corresponding information written into the linked list, the head and tail pointers in the queue context information of the queue are the same, that is, both are the initial pre-allocation pointers, indicating that the linked list corresponding to this queue is empty. Therefore, this embodiment can determine the state of the linked list according to whether the head and tail pointers in the queue context information are the same, without performing other additional operations for confirmation.
[0043] When this embodiment executes S103, the obtained updated pre-allocation pointer is used to update the next node pointer in the first target linked list node, so that the next node pointer in the first target linked list node can point to the next linked list node corresponding to the updated pre-allocation pointer, thereby reading the information stored in the next linked list node according to this next node pointer.
[0044] After this embodiment completes the update of other pointers according to the updated pointer to be allocated, the writing of the current information to be written is completed. At this time, the head pointer and the tail pointer in the queue context information of the first target are different, indicating that the linked list for storing information is not empty and subsequent information reading can be performed.
[0045] Figure 2 It is a schematic diagram according to the second embodiment of the present disclosure. As Figure 2 shown, this embodiment shows another method for managing multi-queue information, which specifically includes the following steps:
[0046] S201. Obtain the first target queue context information according to the queue information of the second target queue to which the information to be read belongs;
[0047] S202. In response to determining that the head pointer and the tail pointer in the first target queue context information are different, determine a second target linked list node according to the head pointer in the first target queue context information;
[0048] S203. Read the information to be read according to the second target linked list node.
[0049] That is to say, in this embodiment, first, the first target queue context information is obtained according to the information to be read, then the second target linked list node is determined according to the head pointer in the first target queue context information, and finally the information to be read is read according to the second target linked list node. By determining whether the head and tail pointers in the first target queue context information are the same, it is determined whether the linked list is empty. Furthermore, when the linked list is not empty, the information is read according to the second target linked list node determined by the head pointer, which can improve the information reading efficiency and reduce the information reading delay.
[0050] When this embodiment executes S201 to obtain the first target queue context information according to the queue information of the second target queue to which the information to be read belongs, the implementation method that can be adopted is as follows: determine the second target queue to which the information to be read belongs according to the attribute information (such as identification information) of the information to be read; obtain the queue context information corresponding to the determined second target queue as the first target queue context information; where different queues correspond to different queue context information, and the queue context information includes a head pointer and a tail pointer.
[0051] When this embodiment executes S202, determine whether the head pointer and the tail pointer in the first target queue context information are the same. If they are the same, it means that the linked list corresponding to the second target queue is empty and the information cannot be read; if they are different, it means that the linked list corresponding to the second target queue is not empty and the information can be read.
[0052] When this embodiment executes S202 to determine the second target linked list node according to the head pointer in the first target queue context information, the first linked list node corresponding to the second target queue in the linked list can be determined according to the head pointer, and then the second linked list node can be determined according to the next node pointer in the first linked list node, and so on, until the second target linked list node corresponding to the information to be read is determined.
[0053] When this embodiment executes S203 to read the information to be read according to the second target linked list node, the implementation method that can be adopted is as follows: obtain the second target buffer identification information from the second target linked list node; determine the second target storage location in the buffer resource pool according to the obtained second target buffer identification information; read the information to be read from the determined second target storage location.
[0054] That is to say, in this embodiment, information is read according to the buffer identification information in the target linked list node, so that the linked list node does not include the information itself but includes the buffer identification information corresponding to the information, which can reduce the amount of information included in the node in the linked list, thereby achieving the purpose of indexing the buffer resource pool that actually stores the information according to the buffer identification information.
[0055] Figure 3 It is a schematic diagram according to the third embodiment of the present disclosure. As Figure 3 shown, this embodiment shows another method for managing multi-queue information, which specifically includes the following steps:
[0056] S301. Obtain the second target queue context information according to the queue information of the third target queue to which the information to be released belongs;
[0057] S302. In response to determining that the head pointer and the tail pointer in the second target queue context information are not the same, determine the third target linked list node according to the head pointer in the second target queue context information;
[0058] S303. Obtain the next node pointer in the third target linked list node, update the head pointer in the second target queue context information with the next node pointer, and release the original head pointer to the linked list pointer resource pool.
[0059] That is to say, in this embodiment, the information to be released is released by obtaining the next node pointer in the third target linked list node corresponding to the information to be released, and the obtained next node pointer is used to update the head pointer in the second target queue context information, so as to release the original head pointer (that is, the head pointer before the update) to the linked list pointer resource pool, which can improve the release efficiency of the information and reduce the release delay of the information.
[0060] When this embodiment executes S301 to obtain the second target queue context information according to the queue information of the third target queue to which the information to be released belongs, the implementation method that can be adopted is: determine the third target queue to which the information to be released belongs according to the attribute information (such as identification information) of the information to be released; obtain the queue context information corresponding to the determined third target queue as the second target queue context information; where different queues correspond to different queue context information, and the queue context information includes a head pointer and a tail pointer.
[0061] When this embodiment executes S302, first determine whether the linked list is empty according to whether the head pointer and the tail pointer in the second target queue context information are the same, and then, when it is determined that the linked list is not empty, determine the third target linked list node corresponding to the information to be released according to the head pointer in the second target queue context information.
[0062] When this embodiment executes S302 to determine the third target linked list node according to the head pointer in the second target queue context information, it can determine the first linked list node corresponding to the third target queue in the linked list according to the head pointer, and then determine the second linked list node according to the next node pointer in the first linked list node, and so on, until the third target linked list node corresponding to the information to be released is determined.
[0063] When this embodiment executes S303, it uses the next node pointer in the third target linked list node to update the head pointer in the second target queue context information, so that the updated head pointer is the next node pointer in the third target linked list node; at the same time, it further initiates a release request for the pointer, that is, releases the original head pointer to the linked list pointer resource pool.
[0064] In addition, when this embodiment executes S303, in addition to releasing the original head pointer to the linked list pointer resource pool, it will also release the linked list node corresponding to the original head pointer to the linked list resource pool and release the buffer resource corresponding to the buffer identification information in the linked list node to the buffer resource pool.
[0065] In this embodiment, the release operation performed on the information to be released is to remove the linked list node corresponding to the information to be released in the linked list from the linked list. If the information to be released is the only information in the linked list, a chain deletion operation is performed; otherwise, a chain splitting operation is performed. When this embodiment releases the original head pointer in the second target queue context information to the linked list pointer resource pool, it can be considered that the release of the information to be released is completed.
[0066] It can be understood that if the information to be released is the only information currently stored in the linked list, that is, the linked list only includes the third target linked list node corresponding to the information to be released, and the third target queue to which the information to be released belongs only includes the information to be released.
[0067] Before writing the information to be released, the next node pointer in the third target linked list node is the same as the tail pointer in the queue context information (i.e., the second target queue context information) corresponding to the third target queue, and both are the updated pre-allocated pointers obtained from the linked list pointer resource pool after writing the information to be released.
[0068] Therefore, after releasing the information to be released (i.e., removing the third target linked list node corresponding to the information to be released from the linked list), use the next node pointer in the third target linked list node to update the head pointer in the second target queue context information, so that the head pointer in the second target queue context information is the same as the tail pointer (both are the updated pre-allocated pointers obtained from the linked list pointer resource pool after writing the information to be released).
[0069] At this time, the linked list does not include any linked list nodes, and the head pointer and the tail pointer in the second target queue context information are the same. Therefore, according to the same head and tail pointers, it can be determined that the linked list corresponding to the third target queue (the queue corresponding to the second target queue context information) is empty at this time.
[0070] Figure 4 It is a schematic diagram according to the fourth embodiment of the present disclosure. As Figure 4 shown, this embodiment shows a flowchart for implementing information writing through a multi-level indexing method: S401, perform a first-level index in the linked list pointer resource pool according to the queue information of the information to be written to determine the target pre-allocated pointer. The linked list pointer resource pool includes multiple pre-allocated pointers, that is, obtain the target pre-allocated pointer corresponding to the information to be written from the linked list pointer resource pool through the first-level index; S402, perform a second-level index in the linked list resource pool according to the obtained target pre-allocated pointer to determine the target linked list node, and write the buffer identification information corresponding to the information to be written and the next node pointer to the target linked list node. The linked list resource pool includes linked list nodes corresponding to different pre-allocated pointers, that is, obtain the target linked list node corresponding to the target pre-allocated pointer from the linked list resource pool through the second-level index, so as to write the relevant content corresponding to the information to be written to the determined target linked list node; S403, perform a third-level index in the buffer resource pool according to the buffer identification information, and store the information to be written to the storage location corresponding to the buffer identification information. The buffer resource pool includes buffer resources corresponding to different buffer identification information, that is, determine the storage location corresponding to the buffer identification information in the buffer resource pool through the third-level index, and then store the information to be written to the buffer resource pool according to the determined storage location.
[0071] Compared with the prior art that only performs the first-level index and the second-level index, this embodiment additionally adds a third-level index, so that the actual storage location of the information to be written is in the buffer resource pool, rather than in the linked list nodes in the linked list (in the prior art, after determining the target linked list node through the second-level index, directly store the information to be written to the target linked list node, that is, the linked list node includes the information to be written itself, and does not include buffer identification information). Since the size of the buffer identification information is much smaller than the information to be written, this embodiment can greatly reduce the amount of information in the linked list nodes through the three-level indexing method, thereby saving the storage resources required for the linked list.
[0072] Figure 5 It is a schematic diagram according to the fifth embodiment of the present disclosure. As Figure 5 shown, the multi-queue information management device 500 of this embodiment includes:
[0073] An obtaining unit 501, configured to obtain a target pre-allocated pointer according to the queue information of the first target queue to which the information to be written belongs;
[0074] The first management unit 502 is configured to determine a first target linked list node corresponding to the target pre-allocation pointer, and write the information to be written into the first target linked list node;
[0075] The second management unit 503 is configured to obtain an updated pre-allocation pointer from the linked list pointer resource pool, and use the updated pre-allocation pointer to update the pre-allocation pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the first target linked list node; wherein, the updated pre-allocation pointer is the target pre-allocation pointer used for writing information corresponding to the target queue next time.
[0076] In this embodiment, the information to be written is the information that a user or an input end wants to store in the linked list, such as an entry; wherein, the linked list includes multiple linked list nodes, and each linked list node includes contents corresponding to different information (or entries).
[0077] When the obtaining unit 501 obtains the target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs, the implementation manner that can be adopted is: determining the first target queue to which the information to be written belongs according to the attribute information (such as identification information) of the information to be written; obtaining the pre-allocation pointer corresponding to the queue information of the determined first target queue as the target pre-allocation pointer.
[0078] That is to say, the obtaining unit 501 obtains the target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs. Since different first target queues correspond to different pre-allocation pointers, obtaining the target pre-allocation pointer according to the queue information in this embodiment can improve the accuracy of the obtained target pre-allocation pointer.
[0079] It can be understood that if the current information to be written corresponds to the first information of the first target queue (i.e., the first write), the target pre-allocation pointer obtained by the obtaining unit 501 is the initial pre-allocation pointer corresponding to the first target queue.
[0080] If the current information to be written does not correspond to the first information of the first target queue (i.e., not the first write), the target pre-allocation pointer obtained by the obtaining unit 501 is the updated pre-allocation pointer obtained from the linked list pointer resource pool after the previous write of information.
[0081] After the obtaining unit 501 obtains the target pre-allocation pointer in this embodiment, the first management unit 502 determines a first target linked list node corresponding to the target pre-allocation pointer, and writes the information to be written into the first target linked list node.
[0082] In this embodiment, different pre-allocation pointers correspond to different linked list nodes in the linked list, that is, according to the obtained target pre-allocation pointer, the unique linked list node in the linked list can be determined.
[0083] When the first management unit 502 determines the first target linked list node corresponding to the target pre-allocation pointer, it can first obtain the correspondence table between the preset pre-allocation pointer and the linked list node, and then according to this correspondence table, use the linked list node corresponding to the target pre-allocation pointer in the linked list resource pool as the first target linked list node; wherein, the linked list resource pool includes multiple linked list nodes.
[0084] After the first management unit 502 completes the determination of the first target linked list node, it can write the information to be written into the first target linked list node; in this embodiment, in addition to the information to be written (or the buffer identification information corresponding to the information to be written), the first target linked list node also includes a next node pointer (next_list_ptr), and this next node pointer is used to point to the next linked list node in the linked list.
[0085] Specifically, when the first management unit 502 writes the information to be written into the first target linked list node, the implementation method that can be adopted is: obtain the first target buffer identification information corresponding to the target pre-allocation pointer, and different pre-allocation pointers correspond to different buffer identification information; according to the obtained first target buffer identification information, determine the first target storage location in the buffer resource pool, and different buffer identification information corresponds to different storage locations in the buffer resource pool; according to the determined first target storage location, store the information to be written into the buffer resource pool; write the obtained first target buffer identification information into the first target linked list node.
[0086] That is to say, when the first management unit 502 writes the information to be written into the first target linked list node, it specifically writes the first target buffer identification information corresponding to the information to be written into the first target linked list node, rather than writing the information to be written itself into the first target linked list node, thereby effectively reducing the size of the linked list, saving the storage resources required by the linked list, and the linked list nodes in the linked list include the first target buffer identification information corresponding to the information to be written, so that when reading information, the storage location of the information in the buffer resource pool can be determined according to the corresponding buffer identification information, and then accessing the determined storage location can complete the reading of the information.
[0087] In addition, when the first management unit 502 writes the information to be written into the first target linked list node, it can also directly write the information to be written into the first target linked list node, so that the first target linked list node includes the written information itself.
[0088] After the information to be written is written to the target linked list node by the first management unit 502 in this embodiment, the second management unit 503 obtains an updated pre-allocated pointer from the linked list pointer resource pool, and uses the updated pre-allocated pointer to update the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the target linked list node.
[0089] In this embodiment, the linked list pointer resource pool includes a plurality of different pre-allocated pointers, and different pre-allocated pointers correspond to different linked list nodes in the linked list and different buffer identification information.
[0090] After the first management unit 502 finishes writing the information to be written in this embodiment, the second management unit 503 re-obtains a pre-allocated pointer from the linked list pointer resource pool as the updated pre-allocated pointer, and then uses the obtained updated pre-allocated pointer to update the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information (QContext) of the first target queue, and the next node pointer in the first target linked list node.
[0091] In this embodiment, the queue context information includes a head pointer (hptr) and a tail pointer (tptr). The head pointer is the initial pre-allocated pointer corresponding to the first target queue; when the initial pre-allocated pointer is the queue number, the head pointer in the queue context information is the queue number.
[0092] When the second management unit 503 uses the obtained updated pre-allocated pointer to update the pre-allocated pointer corresponding to the first target queue, it replaces the current target pre-allocated pointer with the updated pre-allocated pointer, so that the updated pre-allocated pointer is used as the target pre-allocated pointer when writing information corresponding to the first target queue next time.
[0093] The second management unit 503 uses the obtained updated pre-allocated pointer to update the tail pointer in the queue context information of the first target, so that the head pointer and the tail pointer in the queue context information are different, thereby determining that the linked list is not empty according to the difference between the head and tail pointers, that is, the linked list includes corresponding information.
[0094] It can be understood that when there is no corresponding information written to the linked list, the head and tail pointers in the queue context information of the queue are the same, that is, both are the initial pre-allocated pointer, indicating that the linked list corresponding to the queue is empty. Therefore, in this embodiment, the state of the linked list can be determined according to whether the head and tail pointers in the queue context information are the same, without performing other additional operations for confirmation.
[0095] The second management unit 503 uses the obtained updated pre-allocation pointer to update the next node pointer in the first target linked list node, so that the next node pointer in the first target linked list node can point to the next linked list node corresponding to the updated pre-allocation pointer, and then reads the information stored in the next linked list node according to the next node pointer.
[0096] After this embodiment completes the update of other pointers according to the update pending allocation pointer, the writing of the current information to be written is completed. At this time, the head pointer and the tail pointer in the queue context information of the first target queue are not the same, indicating that the linked list for storing information is not empty and subsequent information reading can be performed.
[0097] The multi-queue information management device 500 of this embodiment may further include a reading unit 504, which is used to perform the following operations: obtain the first target queue context information according to the queue information of the second target queue to which the information to be read belongs; in response to determining that the head pointer and the tail pointer in the first target queue context information are not the same, determine the second target linked list node according to the head pointer in the first target queue context information; read the information to be read according to the second target linked list node.
[0098] That is to say, the reading unit 504 first obtains the first target queue context information according to the information to be read, then determines the second target linked list node according to the head pointer in the first target queue context information, and finally completes the reading of the information to be read according to the second target linked list node. By determining whether the head and tail pointers in the first target queue context information are the same, it is determined whether the linked list is empty. Furthermore, when the linked list is not empty, the information is read according to the second target linked list node determined by the head pointer, which can improve the information reading efficiency and reduce the information reading delay.
[0099] When the reading unit 504 obtains the first target queue context information according to the queue information of the second target queue to which the information to be read belongs, the implementation method that can be adopted is: determine the second target queue to which the information to be read belongs according to the attribute information (such as identification information) of the information to be read; obtain the queue context information corresponding to the determined second target queue as the first target queue context information; where different queues correspond to different queue context information, and the queue context information includes a head pointer and a tail pointer.
[0100] The reading unit 504 determines whether the head pointer and the tail pointer in the first target queue context information are the same. If they are the same, it means that the linked list corresponding to the second target queue is empty and information cannot be read; if they are different, it means that the linked list corresponding to the second target queue is not empty and information can be read.
[0101] When the reading unit 504 determines the second target linked list node according to the head pointer in the first target queue context information, it can determine the first linked list node corresponding to the second target queue in the linked list according to the head pointer, and then determine the second linked list node according to the next node pointer in the first linked list node, and so on, until the second target linked list node corresponding to the information to be read is determined.
[0102] When the reading unit 504 reads the information to be read according to the second target linked list node, the implementation method that can be adopted is: obtain the second target buffer identification information from the second target linked list node; determine the second target storage location in the buffer resource pool according to the obtained second target buffer identification information; read the information to be read from the determined second target storage location.
[0103] That is to say, the reading unit 504 reads the information according to the buffer identification information in the target linked list node, so that the linked list node does not include the information itself but includes the buffer identification information corresponding to the information, which can reduce the amount of information included in the node in the linked list, so as to achieve the purpose of indexing the buffer resource pool where the actual stored information is located according to the buffer identification information.
[0104] The multi-queue information management device 500 of this embodiment may further include a release unit 505, which is used to perform the following operations: obtain the second target queue context information according to the queue information of the third target queue to which the information to be released belongs; in response to determining that the head pointer and the tail pointer in the second target queue context information are different, determine the third target linked list node according to the head pointer in the second target queue context information; obtain the next node pointer in the third target linked list node, update the head pointer in the second target queue context information with the next node pointer, and release the original head pointer to the linked list pointer resource pool.
[0105] That is to say, the release unit 505 releases the information to be released by obtaining the next node pointer in the third target linked list node corresponding to the information to be released, and updates the head pointer in the second target queue context information with the obtained next node pointer, so as to release the original head pointer (that is, the head pointer before the update) to the linked list pointer resource pool, which can improve the release efficiency of the information and reduce the release delay of the information.
[0106] When the release unit 505 obtains the second target queue context information according to the queue information of the third target queue to which the information to be released belongs, the implementation method that can be adopted is: determine the third target queue to which the information to be released belongs according to the attribute information (such as identification information) of the information to be released; obtain the queue context information corresponding to the determined third target queue as the second target queue context information; where different queues correspond to different queue context information, and the queue context information includes a head pointer and a tail pointer.
[0107] The release unit 505 first determines whether the linked list is empty according to whether the head pointer and the tail pointer in the second target queue context information are the same. Then, when it is determined that the linked list is not empty, the release unit 505 determines the third target linked list node corresponding to the information to be released according to the head pointer in the second target queue context information.
[0108] When the release unit 505 determines the third target linked list node according to the head pointer in the second target queue context information, it can determine the first linked list node corresponding to the third target queue in the linked list according to the head pointer, and then determine the second linked list node according to the next node pointer in the first linked list node, and so on, until the third target linked list node corresponding to the information to be released is determined.
[0109] The release unit 505 uses the next node pointer in the third target linked list node to update the head pointer in the second target queue context information, so that the updated head pointer is the next node pointer in the third target linked list node; at the same time, a pointer release request is further initiated, that is, the original head pointer is released to the linked list pointer resource pool.
[0110] In addition, in addition to releasing the original head pointer to the linked list pointer resource pool, the release unit 505 also releases the linked list node corresponding to the original head pointer to the linked list resource pool and releases the buffer resource corresponding to the buffer identification information in the linked list node to the buffer resource pool.
[0111] The release operation performed by the release unit 505 on the information to be released is to remove the linked list node corresponding to the information to be released in the linked list from the linked list. If the information to be released is the only information in the linked list, a chain deletion operation is performed; otherwise, a chain splitting operation is performed. When the release unit 505 releases the original head pointer in the second target queue context information to the linked list pointer resource pool, it can be considered that the release of the information to be released is completed.
[0112] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0113] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0114] Such as Figure 6As shown, it is a block diagram of an electronic device for a method of managing multi-queue information according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0115] As Figure 6 shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 300 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0116] A plurality of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0117] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 executes the various methods and processes described above, such as the method of managing multi-queue information. For example, in some embodiments, the method of managing multi-queue information can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 608.
[0118] In some embodiments, part or all of the computer program may be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the multi-queue information management method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the multi-queue information management method by any other suitable means (e.g., by means of firmware).
[0119] The various implementations of the systems and techniques described herein may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems on a chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0120] The program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable multi-queue information management device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0121] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0122] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for presenting information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0123] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0124] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services (“Virtual Private Server”, or simply “VPS”). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0125] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitation is imposed herein.
[0126] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A method for managing multi-queue information, comprising: Obtaining a target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs; Determining a first target linked list node corresponding to the target pre-allocation pointer, and writing the information to be written into the first target linked list node; Obtaining an updated pre-allocation pointer from a linked list pointer resource pool, and using the updated pre-allocation pointer to update the pre-allocation pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the first target linked list node; wherein, the updated pre-allocation pointer is the target pre-allocation pointer used when writing information corresponding to the target queue next time.
2. The method according to claim 1, wherein, The step of writing the information to be written into the first target linked list node includes: Obtaining first target buffer identification information corresponding to the target pre-allocation pointer; Determining a first target storage location in the buffer resource pool according to the first target buffer identification information; Storing the information to be written into the buffer resource pool according to the first target storage location, and writing the first target buffer identification information into the first target linked list node.
3. The method according to claim 1, wherein, The step of obtaining a target pre-allocation pointer according to the queue information of the first target queue to which the information to be written belongs includes: Determining the first target queue to which the information to be written belongs according to the attribute information of the information to be written; Obtaining a pre-allocation pointer corresponding to the queue information of the first target queue as the target pre-allocation pointer.
4. The method according to claim 3, wherein The step of obtaining a pre-allocation pointer corresponding to the queue information of the first target queue as the target pre-allocation pointer includes: In response to determining that the information to be written is the first information of the first target queue, obtaining an initial pre-allocation pointer according to the queue information; Taking the initial pre-allocation pointer as the target pre-allocation pointer.
5. The method according to claim 1, further comprising Obtaining first target queue context information according to the queue information of the second target queue to which the information to be read belongs; In response to determining that the head pointer and the tail pointer in the first target queue context information are not the same, determining a second target linked list node according to the head pointer in the first target queue context information; Reading the information to be read according to the second target linked list node.
6. The method according to claim 5, wherein The step of reading the information to be read according to the second target linked list node includes: Obtaining second target buffer identification information from the second target linked list node; Determining a second target storage location in the buffer resource pool according to the second target buffer identification information; Reading the information to be read from the second target storage location.
7. The method according to claim 5, wherein The step of obtaining first target queue context information according to the queue information of the second target queue to which the information to be read belongs includes: Determining the second target queue to which the information to be read belongs according to the attribute information of the information to be read; Obtaining queue context information corresponding to the second target queue as the first target queue context information.
8. The method according to claim 1, further comprising Obtain second target queue context information according to the queue information of the third target queue to which the information to be released belongs; In response to determining that the head pointer and the tail pointer in the second target queue context information are different, determine a third target linked list node according to the head pointer in the second target queue context information; Obtain the next node pointer in the third target linked list node, update the head pointer in the second target queue context information with the next node pointer, and release the original head pointer to the linked list pointer resource pool.
9. The method according to claim 8, wherein The obtaining second target queue context information according to the queue information of the third target queue to which the information to be released belongs includes: Determine the third target queue to which the information to be released belongs according to the attribute information of the information to be released; Obtain the queue context information corresponding to the third target queue as the second target queue context information.
10. A multi-queue information management device, comprising: An obtaining unit, configured to obtain a target pre-allocated pointer according to the queue information of the first target queue to which the information to be written belongs; A first management unit, configured to determine a first target linked list node corresponding to the target pre-allocated pointer, and write the information to be written into the first target linked list node; A second management unit, configured to obtain an updated pre-allocated pointer from the linked list pointer resource pool, and update the pre-allocated pointer corresponding to the first target queue, the tail pointer in the queue context information of the first target queue, and the next node pointer in the first target linked list node with the updated pre-allocated pointer; wherein, the updated pre-allocated pointer is the target pre-allocated pointer used when writing information corresponding to the target queue next time.
11. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the method according to any one of claims 1-9.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
13. A computer program product, comprising a computer program, where the computer program, when executed by a processor, implements the method according to any one of claims 1-9.