Shared linked list management method, apparatus and device

By using a shared linked list management method, the cache unit management linked list and the package management linked list share nodes, which solves the problem of high resource consumption in cache unit and package linked list management and improves management efficiency.

CN115757206BActive Publication Date: 2026-02-03FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211394248.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-08
Publication Date
2026-02-03
Estimated Expiration
2042-11-08

AI Technical Summary

Technical Problem

Existing technologies suffer from the problem of consuming a large amount of management resources in cache unit management and packet linked list management.

Method used

By configuring a cache unit management linked list, where the tail node is an invalid value and the other nodes are the addresses of the next cache unit, when writing a data packet, a cache unit is requested and a packet management linked list is built; when reading a data packet, the cache unit is released and restored to the cache unit management linked list, thus realizing node sharing.

Benefits of technology

This reduces resource consumption for managing cache units and packet lists, thus improving management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757206B_ABST
    Figure CN115757206B_ABST
Patent Text Reader

Abstract

The application provides a shared linked list management method, device and equipment. The method comprises the following steps: configuring a cache unit management linked list; when a data packet is written, applying a cache unit for the data packet, taking out a node corresponding to the applied cache unit from the cache unit management linked list, and constructing a packet management linked list of the data packet according to the taken-out node; when a data packet is read, releasing a cache unit corresponding to the data packet, and restoring a node corresponding to the released cache unit to the cache unit management linked list. Through the application, the node is shared by the cache unit management linked list and the packet management linked list, and the management resources required for managing the cache unit and the packet linked list are greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data storage technology, and in particular to a shared linked list management method, apparatus, and device. Background Technology

[0002] When the system cache is large, reducing the granularity of the cache can effectively improve cache utilization. Cache granularity refers to dividing the entire cache space into several basic cache units. The size of each cache unit represents the granularity, and each data packet occupies one or more cache units. The smaller the granularity, the more finely the cache space is divided, and the less cache space can be wasted.

[0003] However, as the granularity of caching decreases, the number of cache units that need to be managed increases for the same cache capacity. In addition, when a data packet occupies multiple cache units, in order to maintain the integrity of the entire packet, it is necessary to associate all cache units of the data packet, that is, to use a packet linked list.

[0004] Currently, cache unit management and packet list management are designed independently. As the cache size increases, cache unit management and packet list management will consume a lot of management resources. Summary of the Invention

[0005] The main objective of this invention is to provide a shared linked list management method, apparatus, and device, which aims to solve the technical problem that cache unit management and package linked list management consume a large amount of management resources in the prior art.

[0006] In a first aspect, the present invention provides a shared linked list management method, the shared linked list management method comprising:

[0007] Configure a cache unit management linked list, where the tail node of the cache unit management linked list contains an invalid value, and the contents of other nodes are the addresses of the next cache unit corresponding to this node;

[0008] When writing a data packet, a cache unit is requested for the data packet, the node corresponding to the requested cache unit is taken out from the cache unit management list, and the packet management list of the data packet is constructed based on the taken-out node;

[0009] When reading a data packet, the cache unit corresponding to the data packet is released, and the node corresponding to the released cache unit is restored to the cache unit management list.

[0010] Optionally, the step of requesting a buffer unit for the data packet when writing the data packet includes:

[0011] When writing a data packet, check whether the content of the first node in the cache unit management list is invalid. If it is not invalid, request the cache unit corresponding to the first node for the data packet to be written, and update the first node in the cache unit management list to the node corresponding to the content of the first node.

[0012] Check if the end of the data packet has been written;

[0013] If not written, return to the step of checking whether the content of the first node in the cache unit management list is invalid, until the end of the data packet has been written.

[0014] Optionally, the contents of the nodes in the packet management chain of the data packet, except for the last node, are the addresses of their respective next requested cache units.

[0015] Optionally, after the step of constructing the packet management linked list of the data packet based on the retrieved node, the method further includes:

[0016] Generate and store packet description information for the data packet, the packet description information including the address of the first buffer unit allocated for the data packet and the byte length of the data packet.

[0017] Optionally, the step of releasing the cache unit corresponding to the data packet when reading the data packet and restoring the node corresponding to the released cache unit to the cache unit management linked list includes:

[0018] When reading a data packet, obtain the packet description information of the data packet;

[0019] Based on the packet description information, read packet data from the first cache unit requested for the data packet, and update the tail node of the cache unit management list to be the node corresponding to the first cache unit requested for the data packet;

[0020] Check if the end of the data packet has been read;

[0021] If not read, then read the packet data from the next cache unit requested for the packet, and update the tail node of the cache unit management list to be the node corresponding to the next cache unit requested for the packet, wherein the next requested cache unit is determined based on the content of the node corresponding to the previous requested cache unit.

[0022] Return to the step of checking whether the end of the data packet has been read, until the end of the data packet has been read.

[0023] Optionally, the content of the last node in the packet management chain of the data packet is the check value of the data packet, which is obtained by performing a preset calculation on the addresses of all cache units applied for for the data packet.

[0024] Optionally, after the step of reading the end of the data packet, the method further includes:

[0025] The addresses of all read cache units are used to perform a preset calculation to obtain the verification value to be verified;

[0026] Detect whether the verification value to be verified is consistent with the content of the node corresponding to the last read cache unit;

[0027] If they match, then the data packet was read correctly.

[0028] Optionally, the shared linked list management method further includes:

[0029] Set the state of each node in the initial cache unit management list to the idle state, set the state of the node corresponding to the requested cache unit to the occupied state, and set the state of the node corresponding to the released cache unit to the idle state.

[0030] When the node corresponding to the cache unit to be requested is in an occupied state, it is determined that there is an error in releasing it;

[0031] If the node corresponding to the cache unit to be released is in an idle state, it is determined that there is an error in the request.

[0032] Secondly, the present invention also provides a shared linked list management device, the shared linked list management device comprising:

[0033] The configuration module is used to configure the cache unit management linked list;

[0034] The application module is used to apply for a cache unit for the data packet when writing the data packet, retrieve the node corresponding to the applied cache unit from the cache unit management list, and construct the packet management list of the data packet based on the retrieved node;

[0035] The release module is used to release the cache unit corresponding to the data packet when reading the data packet, and restore the node corresponding to the released cache unit to the cache unit management list.

[0036] Thirdly, the present invention also provides a shared linked list management device, the shared linked list management device including a processor, a memory, and a shared linked list management program stored in the memory and executable by the processor, wherein when the shared linked list management program is executed by the processor, it implements the steps of the shared linked list management method as described above.

[0037] In this invention, a cache unit management linked list is configured. The tail node of the linked list contains an invalid value, while the contents of other nodes are the addresses of the next cache unit corresponding to that node. When a data packet is written, a cache unit is requested for the data packet. The node corresponding to the requested cache unit is removed from the cache unit management linked list, and a packet management linked list for the data packet is constructed based on the removed node. When a data packet is read, the cache unit corresponding to the data packet is released, and the node corresponding to the released cache unit is restored to the cache unit management linked list. Through this invention, when a data packet is written to a cache unit, the node corresponding to the requested cache unit constitutes the packet management linked list for that data packet. When a cache unit is released, the node corresponding to the released cache unit is restored to the cache unit management linked list. This achieves node sharing between the cache unit management linked list and the packet management linked list, significantly reducing the management resources required for managing cache units and the packet linked list. Attached Figure Description

[0038] Figure 1 This is a flowchart illustrating an embodiment of the shared linked list management method of the present invention;

[0039] Figure 2 This is a schematic diagram of a cache unit managing a linked list in one embodiment of the shared linked list management method of the present invention;

[0040] Figure 3 This is a schematic diagram of the process for requesting a cache unit in one embodiment of the shared linked list management method of the present invention;

[0041] Figure 4 This is a schematic diagram illustrating the coexistence of cache unit management list and package management list in one embodiment of the shared linked list management method of the present invention;

[0042] Figure 5 for Figure 1 A detailed flowchart of step S30;

[0043] Figure 6 This is a schematic diagram of cache unit managing a linked list in another embodiment of the shared linked list management method of the present invention;

[0044] Figure 7 This is a schematic diagram of the functional modules of an embodiment of the shared linked list management device of the present invention.

[0045] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0046] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0047] In a first aspect, embodiments of the present invention provide a shared linked list management device, which includes a processor, a memory, and a shared linked list management program stored in the memory and executable by the processor. The processor can call the shared linked list management program stored in the memory and execute the shared linked list management method provided in the embodiments of the present invention.

[0048] Secondly, embodiments of the present invention provide a shared linked list management method.

[0049] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the shared linked list management method of the present invention. Figure 1 As shown, the shared linked list management methods include:

[0050] Step S10: Configure the cache unit management linked list, wherein the content of the tail node in the cache unit management linked list is invalid, and the content of other nodes is the address of the next cache unit corresponding to the current node;

[0051] In this embodiment, a corresponding cache unit management list is configured based on the granularity of the cache space partitioning. For example, the cache space is divided into cache units A to G, with addresses ADDR_A, ADDR_B, ADDR_C, ADDR_D, ADDR_E, ADDR_F, and ADDR_G respectively; the storage order among the seven cache units is cache unit A, cache unit B, cache unit C, cache unit D, cache unit F, cache unit G, and cache unit E. The resulting cache unit management list is as follows: Figure 2 As shown, refer to Figure 2 , Figure 2 This is a schematic diagram of a cache unit managing a linked list in one embodiment of the shared linked list management method of the present invention, as shown below. Figure 2 As shown, based on the storage order among the 7 cache units, the content of node A is the address ADDR_B of the next cache unit corresponding to node A, i.e., cache unit B; the content of node B is the address ADDR_C of the next cache unit corresponding to node B, i.e., cache unit C; the content of node C is the address ADDR_D of the next cache unit corresponding to node C, i.e., cache unit D; the content of node D is the address ADDR_F of the next cache unit corresponding to node D, i.e., cache unit F; the content of node F is the address ADDR_G of the next cache unit corresponding to node F, i.e., cache unit G; the content of node G is the address ADDR_E of the next cache unit corresponding to node G, i.e., cache unit E; node E is the tail node in the cache unit management linked list, so the content of node E is invalid.

[0052] As can be seen, when no data has been written to any of the cache units corresponding to the cache unit management linked list, the shared linked list is the cache unit management linked list.

[0053] It is easy to understand that the description uses 7 cache units here for ease of description. In reality, the cache space contains a large number of cache units, but the way to configure the cache unit management list is the same as the above embodiment, and will not be repeated here.

[0054] Step S20: When writing a data packet, apply for a cache unit for the data packet, retrieve the node corresponding to the applied cache unit from the cache unit management list, and construct the packet management list of the data packet based on the retrieved node;

[0055] In this embodiment, Figure 2 For example, when writing data packet 1, a cache unit is requested for that data packet. For instance, cache unit A is requested first, and the packet data of data packet 1 is written to cache unit A. Then, it is determined whether data packet 1 has been completely written. If not, cache unit B is requested next, and the remaining packet data of data packet 1 is written to cache unit B. Then, it is determined whether data packet 1 has been completely written. If the writing is complete, nodes A and B corresponding to the requested cache units A and B are retrieved from the cache unit management list, and packet management list 1 for data packet 1 is constructed based on nodes A and B. That is, when no data is written to cache units A and B, nodes A and B belong to the cache unit management list; when data is written to cache units A and B, nodes A and B belong to packet management list 1 for data packet 1. This achieves that nodes A and B are shared by the cache unit management list and packet management list 1, without the need to set corresponding nodes A and B for the cache unit management list and packet management list 1 separately.

[0056] Furthermore, in one embodiment, reference is made to Figure 3 , Figure 3 This is a schematic diagram illustrating the process of requesting a cache unit in one embodiment of the shared linked list management method of the present invention. Figure 3 As shown, the step of requesting a buffer unit for the data packet when writing the data packet includes:

[0057] When writing a data packet, check if the content of the first node in the cache unit management list is invalid. If it is not invalid, request the cache unit corresponding to the first node for writing the packet data, and update the first node in the cache unit management list to the node corresponding to the content of the first node. Check if the end of the data packet has been written. If not, return to the step of checking if the content of the first node in the cache unit management list is invalid, until the end of the data packet has been written.

[0058] In this embodiment, Figure 2 For example, when writing a data packet, if the content of the first node (i.e., node A) in the cache unit management linked list is ADDR_B, then the cache unit A corresponding to node A is requested to provide the packet data for writing the data packet, and the first node in the cache unit management linked list is updated to the node B corresponding to the content ADDR_B of the first node.

[0059] Determine whether the packet tail has been written. If not, return to the step of checking whether the content of the first node in the cache unit management list is invalid. It is easy to understand that at this time, the first node in the cache unit management list is node B. Then, request the cache unit B corresponding to node B to write the packet data of the data packet and update the node C corresponding to the content ADDR_C of the first node in the cache unit management list.

[0060] Determine whether the end of the data packet has been written. If not, return to the step of checking whether the content of the first node in the cache unit management list is invalid, until the end of the data packet has been written.

[0061] It is easy to understand that if the content of the first node in the cache unit management list is invalid, it means that the cache unit has been exhausted.

[0062] Furthermore, in one embodiment, the contents of the nodes in the packet management chain of the data packet, except for the last node, are the addresses of their respective next requested cache units.

[0063] In this embodiment, assuming that after updating the first node in the cache unit management linked list to the first node C, and it is detected that the packet tail has been written, then the nodes A and B corresponding to the requested cache unit A and cache unit B are retrieved from the cache unit management linked list, and a packet management linked list for the data packet is constructed based on the retrieved nodes A and B. The content of each node in the packet management linked list, except for the last node, is the address of its respective next requested cache unit. (Refer to...) Figure 4 , Figure 4 This is a schematic diagram illustrating the coexistence of a cache unit management list and a packet management list in one embodiment of the shared linked list management method of the present invention. The content of the last node in the packet management list is set according to actual needs, such as being set to an invalid value, a check value, or empty. Figure 4 As shown, when data is written to the cache unit corresponding to the cache unit management list, the shared list includes the cache unit management list and the package management list.

[0064] It should be noted that when new data packets are written subsequently, the latest cache unit management list is used as the basis, and cache units are requested for the new data packets and the corresponding packet management list for the new data packets is constructed in the manner corresponding to the above embodiments. This will not be elaborated here.

[0065] Step S30: When reading a data packet, release the cache unit corresponding to the data packet and restore the node corresponding to the released cache unit to the cache unit management list.

[0066] In this embodiment, in conjunction with the above embodiments, when the data packet read at this time is the data packet written above, the cache units A and B corresponding to the data packet are released, and the nodes A and B corresponding to the released cache units A and B are restored to the cache unit management linked list.

[0067] It's easy to understand that when a cache unit is requested, the corresponding node immediately becomes invalid in the cache unit management list, and the invalidated node remains idle until the corresponding cache unit is released. During the period when the invalidated node is idle, the management resources allocated to it are wasted. However, in this application, when a cache unit is requested, the corresponding node is used to construct the packet management list for the data packets corresponding to the requested cache unit, thus avoiding the waste of management resources.

[0068] In this embodiment, a cache unit management linked list is configured. When a data packet is written, a cache unit is requested for the data packet, the node corresponding to the requested cache unit is retrieved from the cache unit management linked list, and a packet management linked list for the data packet is constructed based on the retrieved node. When a data packet is read, the cache unit corresponding to the data packet is released, and the node corresponding to the released cache unit is restored to the cache unit management linked list. Through this embodiment, when a data packet is written to a cache unit, the node corresponding to the requested cache unit constitutes the packet management linked list for that data packet. When a cache unit is released, the node corresponding to the released cache unit is restored to the cache unit management linked list. This achieves the sharing of nodes between the cache unit management linked list and the packet management linked list, greatly reducing the management resources required for managing cache units and packet linked lists.

[0069] Furthermore, in one embodiment, after step S20, the method further includes:

[0070] Generate and store packet description information for the data packet, the packet description information including the address of the first buffer unit allocated for the data packet and the byte length of the data packet.

[0071] In this embodiment, packet description information of the data packet is generated based on the address of the first cache unit requested for the data packet and the byte length of the data packet, and stored in a preset storage area.

[0072] Furthermore, in one embodiment, reference is made to Figure 5 , Figure 5 for Figure 1 A detailed flowchart of step S30. (See attached diagram.) Figure 5 As shown, step S30 includes:

[0073] When reading a data packet, obtain the packet description information of the data packet; according to the packet description information, read the packet data from the first cache unit applied for for the data packet, and update the tail node of the cache unit management list to be the node corresponding to the first cache unit applied for for the data packet; check whether the packet tail of the data packet has been read; if not, read the packet data from the next cache unit applied for for the data packet, and update the tail node of the cache unit management list to be the node corresponding to the next cache unit applied for for the data packet, wherein the next applied cache unit is determined according to the content of the node corresponding to the previous applied cache unit; return to the step of checking whether the packet tail of the data packet has been read, until the packet tail of the data packet has been read.

[0074] In this embodiment, when the data packet being read is the data packet written in the above embodiment, the first cache unit requested by the data packet can be determined as cache unit A according to its packet description information. Then, the packet data is read from cache unit A, and the tail node of the cache unit management list is updated from node E to node A. The content of node E is then updated to the address of cache unit A, and the content of node A is updated to an invalid value.

[0075] Check if the end of the data packet has been read; if not, read the packet data from the next buffer unit (i.e., buffer unit B) allocated for the data packet, and update the tail node of the buffer unit management list from node A to node B. Then, the content of node A is updated to the address of buffer unit B, and the content of node B is updated to an invalid value. At this point, the buffer unit management list is as follows: Figure 6 As shown, refer to Figure 6 , Figure 6 This is a schematic diagram of cache unit managing the linked list in another embodiment of the shared linked list management method of the present invention.

[0076] Furthermore, in one embodiment, the content of the last node in the packet management chain of the data packet is the check value of the data packet, which is obtained based on a preset calculation of the addresses of all cache units applied for for the data packet.

[0077] In this embodiment, the content of the last node in the packet management list of the data packet is the checksum of the data packet, that is... Figure 4 The content of node B is the checksum of the data packet. The checksum is obtained by performing a pre-defined calculation on the addresses of all buffer units allocated for the data packet. Figure 4 For example, the checksum value is obtained by performing a preset operation on the address of cache unit A and the address of cache unit B. This preset operation can be a checksum operation, a hash operation, etc. There are no restrictions on the preset operation; it can be selected based on actual needs.

[0078] Furthermore, in one embodiment, after the step of reading until the end of the data packet has been read, the method further includes:

[0079] A preset calculation is performed on the addresses of all read cache units to obtain a verification value to be verified; it is then checked whether the verification value to be verified is consistent with the content of the node corresponding to the last read cache unit; if they are consistent, the data packet is determined to be read correctly.

[0080] In this embodiment, for example, a data packet is written to cache unit D, cache unit F, and cache unit G. The content in node G is obtained based on a preset calculation of ADDR_D, ADDR_F, and ADDR_G. In order to verify whether the data packet is read correctly, a preset calculation is needed to obtain a verification value to be verified for the addresses of all cache units read when reading the data packet. Then, the verification value to be verified is compared with the content of the node corresponding to the last read cache unit. If they match, it means that the data packet was read from cache unit D, cache unit F, and cache unit G, and the data packet is read correctly.

[0081] It should be noted that if there is a discrepancy, it indicates an error in the data packet reading, and the read data packet will be discarded. This embodiment implements error detection for data reading operations.

[0082] Furthermore, in one embodiment, the shared linked list management method further includes:

[0083] Set the state of each node in the initial cache unit management list to the idle state, set the state of the node corresponding to the requested cache unit to the occupied state, and set the state of the node corresponding to the released cache unit to the idle state.

[0084] When the node corresponding to the cache unit to be requested is in an occupied state, it is determined that there is an error in releasing it;

[0085] If the node corresponding to the cache unit to be released is in an idle state, it is determined that there is an error in the request.

[0086] In this embodiment, the initial cache unit management list is a cache unit management list in its initial state. Since the corresponding cache units are not occupied, the state of each node in the initial cache unit management list is set to the idle state, that is, the node corresponding to the cache unit that has not been written to should be in the idle state.

[0087] When writing data, the status of the node corresponding to the cache unit to be requested is checked. If its status is occupied, it means that there is an error when releasing the cache unit, so it is determined that there is an error in the release.

[0088] The state of the node corresponding to the requested cache unit is set to occupied state. That is, the state of the node corresponding to the cache unit that has been written to should be occupied. When reading data, the state of the node corresponding to the cache unit to be released is checked. If its state is idle, it means that there was an error when requesting the cache unit, so it is determined that there was an error in the request.

[0089] In addition, the node corresponding to the released cache unit will be restored to the cache unit management list, and the state of the node corresponding to the released cache unit will be set to the idle state.

[0090] The node status can be achieved by adding a status flag. This embodiment implements the verification function of the shared linked list.

[0091] Thirdly, embodiments of the present invention also provide a shared linked list management device.

[0092] In one embodiment, reference is made to Figure 7 , Figure 7 This is a schematic diagram of the functional modules of an embodiment of the shared linked list management device of the present invention. Figure 7 As shown, the shared linked list management device includes:

[0093] Configuration module 10 is used to configure the cache unit management linked list;

[0094] The application module 20 is used to apply for a cache unit for the data packet when writing the data packet, retrieve the node corresponding to the applied cache unit from the cache unit management list, and construct the packet management list of the data packet based on the retrieved node;

[0095] The release module 30 is used to release the cache unit corresponding to the data packet when reading the data packet, and restore the node corresponding to the released cache unit to the cache unit management list.

[0096] Furthermore, in one embodiment, the application module 20 is used for:

[0097] When writing a data packet, check whether the content of the first node in the cache unit management list is invalid. If it is not invalid, request the cache unit corresponding to the first node for the data packet to be written, and update the first node in the cache unit management list to the node corresponding to the content of the first node.

[0098] Check if the end of the data packet has been written;

[0099] If not written, return to the step of checking whether the content of the first node in the cache unit management list is invalid, until the end of the data packet has been written.

[0100] Furthermore, in one embodiment, the contents of the nodes in the packet management chain of the data packet, except for the last node, are the addresses of their respective next requested cache units.

[0101] Furthermore, in one embodiment, the shared linked list management device further includes a storage module for:

[0102] Generate and store packet description information for the data packet, the packet description information including the address of the first buffer unit allocated for the data packet and the byte length of the data packet.

[0103] Furthermore, in one embodiment, the release module 30 is used for:

[0104] When reading a data packet, obtain the packet description information of the data packet;

[0105] Based on the packet description information, read packet data from the first cache unit requested for the data packet, and update the tail node of the cache unit management list to be the node corresponding to the first cache unit requested for the data packet;

[0106] Check if the end of the data packet has been read;

[0107] If not read, then read the packet data from the next cache unit requested for the packet, and update the tail node of the cache unit management list to be the node corresponding to the next cache unit requested for the packet, wherein the next requested cache unit is determined based on the content of the node corresponding to the previous requested cache unit.

[0108] Return to the step of checking whether the end of the data packet has been read, until the end of the data packet has been read.

[0109] Furthermore, in one embodiment, the content of the last node in the packet management chain of the data packet is the check value of the data packet, which is obtained based on a preset calculation of the addresses of all cache units applied for for the data packet.

[0110] Furthermore, in one embodiment, the shared linked list management device further includes a verification module, used for:

[0111] The addresses of all read cache units are used to perform a preset calculation to obtain the verification value to be verified;

[0112] Detect whether the verification value to be verified is consistent with the content of the node corresponding to the last read cache unit;

[0113] If they match, then the data packet was read correctly.

[0114] Furthermore, in one embodiment, the shared linked list management device further includes a state management module, used for:

[0115] Set the state of each node in the initial cache unit management list to the idle state, set the state of the node corresponding to the requested cache unit to the occupied state, and set the state of the node corresponding to the released cache unit to the idle state.

[0116] When the node corresponding to the cache unit to be requested is in an occupied state, it is determined that there is an error in releasing it;

[0117] If the node corresponding to the cache unit to be released is in an idle state, it is determined that there is an error in the request.

[0118] The functions of each module in the above-mentioned shared linked list management device correspond to the steps in the above-mentioned shared linked list management method embodiment, and their functions and implementation processes will not be described in detail here.

[0119] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0120] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0122] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A shared linked list management method, characterized in that, The shared linked list management method includes: Configure a cache unit management linked list, where the tail node of the cache unit management linked list contains an invalid value, and the contents of other nodes are the addresses of the next cache unit corresponding to this node; When writing a data packet, check if the content of the first node in the cache unit management list is invalid. If it is not invalid, request the cache unit corresponding to the first node for writing the packet data, and update the first node in the cache unit management list to the node corresponding to the content of the first node. Check if the end of the data packet has been written. If not, return to the step of checking if the content of the first node in the cache unit management list is invalid, until the end of the data packet has been written. Remove the node corresponding to the requested cache unit from the cache unit management list, and construct the packet management list of the data packet based on the removed node. The content of each node in the packet management list of the data packet, except for the last node, is the address of the next requested cache unit. When reading a data packet, the cache unit corresponding to the data packet is released, and the node corresponding to the released cache unit is restored to the cache unit management list.

2. The shared linked list management method as described in claim 1, characterized in that, After the step of constructing the packet management linked list of the data packet based on the retrieved nodes, the method further includes: Generate and store packet description information for the data packet, the packet description information including the address of the first buffer unit allocated for the data packet and the byte length of the data packet.

3. The shared linked list management method as described in claim 2, characterized in that, The step of releasing the cache unit corresponding to the data packet when reading the data packet and restoring the node corresponding to the released cache unit to the cache unit management linked list includes: When reading a data packet, obtain the packet description information of the data packet; Based on the packet description information, read packet data from the first cache unit requested for the data packet, and update the tail node of the cache unit management list to be the node corresponding to the first cache unit requested for the data packet; Check if the end of the data packet has been read; If not read, then read the packet data from the next cache unit requested for the packet, and update the tail node of the cache unit management list to be the node corresponding to the next cache unit requested for the packet, wherein the next requested cache unit is determined based on the content of the node corresponding to the previous requested cache unit. Return to the step of checking whether the end of the data packet has been read, until the end of the data packet has been read.

4. The shared linked list management method as described in claim 3, characterized in that, The last node in the packet management list of the data packet contains the checksum of the data packet, which is obtained by performing a preset calculation on the addresses of all cache units applied for for the data packet.

5. The shared linked list management method as described in claim 4, characterized in that, Following the step of reading the end of the data packet, the method further includes: The addresses of all read cache units are used to perform a preset calculation to obtain the verification value to be verified; Detect whether the verification value to be verified is consistent with the content of the node corresponding to the last read cache unit; If they match, then the data packet was read correctly.

6. The shared linked list management method as described in any one of claims 1 to 5, characterized in that, The shared linked list management method also includes: Set the state of each node in the initial cache unit management list to the idle state, set the state of the node corresponding to the requested cache unit to the occupied state, and set the state of the node corresponding to the released cache unit to the idle state. When the node corresponding to the cache unit to be requested is in an occupied state, it is determined that there is an error in releasing it; If the node corresponding to the cache unit to be released is in an idle state, it is determined that there is an error in the request.

7. A shared linked list management device, characterized in that, The shared linked list management device includes: The configuration module is used to configure the cache unit management linked list; The application module is used to check whether the content of the first node in the cache unit management linked list is invalid when writing a data packet. If it is not invalid, the module applies for the cache unit corresponding to the first node to provide the packet data for writing the data packet, and updates the first node in the cache unit management linked list to the node corresponding to the content of the first node. The module also checks whether the end of the data packet has been written. If it has not been written, the module returns to the step of checking whether the content of the first node in the cache unit management linked list is invalid until the end of the data packet has been written. The module then retrieves the node corresponding to the applied cache unit from the cache unit management linked list and constructs the packet management linked list of the data packet based on the retrieved node. The content of each node in the packet management linked list of the data packet, except for the last node, is the address of the next applied cache unit. The release module is used to release the cache unit corresponding to the data packet when reading the data packet, and restore the node corresponding to the released cache unit to the cache unit management list.

8. A shared linked list management device, characterized in that, The shared linked list management device includes a processor, a memory, and a shared linked list management program stored in the memory and executable by the processor, wherein when the shared linked list management program is executed by the processor, it implements the steps of the shared linked list management method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Memory management method and system

    CN106681829A

  • Data caching method and network equipment

    CN113343045A