Data access method, system, device and medium based on linear space linked list
By adopting a data access method based on linear spatial linked list in the intrusion detection system, using two-way linked lists and hash tables for data management, the problems of memory fragmentation and system overhead are solved, and efficient and secure data storage and processing are achieved. Real-time detection of complex cyber attacks.
Patent Information
- Application Number
- CN202411045149.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-08-01
AI Technical Summary
The existing intrusion detection system is prone to memory fragmentation problems when processing large amounts of network data, resulting in system performance degradation. The existing memory management mechanism relies on functions such as malloc, which increases system overhead.
The data access method based on linear spatial linked list is adopted, and by building a bidirectional linked list and hash table, dynamic allocation and management of data is realized, memory fragmentation is avoided, and storage efficiency is improved through data compression and batch processing.
It effectively avoids memory fragmentation, improves system performance and storage space utilization, reduces system overhead, realizes fast and secure data access, and is suitable for real-time detection of complex network attacks.
Smart Images

Figure CN118568310B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer network technology, and in particular to a data access method, system, device and medium based on a linear space linked list. Background Art
[0002] Intrusion Detection System (IDPS) is an important network security means used to monitor network activities, identify and prevent potential malicious attacks. Among them, the host-based intrusion detection system (HIDS) detects internal threats by analyzing the host's system logs, audit records and other information. However, with the continuous development of network attack technology, the detection capability of HIDS has been challenged. Therefore, researchers began to explore new detection methods, such as network-based intrusion detection system (NIDS), which can realize real-time detection of network attacks by analyzing network traffic. In the field of data storage technology, in order to achieve effective analysis of network traffic, NIDS needs to store and process a large amount of network data.
[0003] Existing solutions mainly use the operating system's memory management mechanism, such as malloc and other functions, to achieve dynamic allocation and release of data. In addition, some solutions try to improve memory usage efficiency by optimizing memory management strategies, such as paging management, virtual memory management, etc. However, when processing large amounts of data, existing technologies may cause memory fragmentation problems, thereby affecting system performance. In addition, when implementing effective management of linked lists, existing memory management mechanisms often need to rely on functions such as malloc, which may increase system overhead in some cases. Therefore, how to achieve effective management of linked lists without using functions such as malloc is still a problem worth studying.
[0004] Therefore, there is an urgent need for a data access method, system, device and medium based on a linear space linked list, which can avoid memory fragmentation, make full use of memory space, improve system performance, save storage space and improve system operation efficiency. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a data access method, system, device and medium based on a linear space linked list, which can avoid memory fragmentation, make full use of memory space, improve system performance, save storage space and improve system operation efficiency.
[0006] The present invention provides a data access method based on a linear space linked list, comprising the following steps:
[0007] A bidirectional linked list is constructed based on a linear space; wherein the bidirectional linked list includes a plurality of linked list nodes, each of which includes a data field and a pointer field, the pointer field includes a predecessor node pointer, a successor node pointer, and a data length variable, the predecessor node pointer points to a previous linked list node of a current linked list node, the successor node pointer points to a subsequent linked list node of the current linked list node, the value of the data length variable is the data length of the data to be stored, and the memory space size of the data field is consistent with the value of the data length variable;
[0008] Set the key-value pairs of the hash table based on the doubly linked list to establish a hash table;
[0009] Data storage and data reading are performed based on a hash table and a bidirectional linked list; wherein the stored data is compressed data.
[0010] The present invention also provides a data access system based on a linear space linked list, which is used to execute any of the above-mentioned data access methods based on a linear space linked list, and the system includes the following modules:
[0011] A linked list construction unit is used to construct a bidirectional linked list based on a linear space; wherein the bidirectional linked list includes a plurality of linked list nodes, each of which includes a data field and a pointer field, the pointer field includes a predecessor node pointer, a successor node pointer, and a data length variable, the predecessor node pointer points to the previous linked list node of the current linked list node, the successor node pointer points to the next linked list node of the current linked list node, the value of the data length variable is the data length of the variable-length data stored in the data field, and the memory space size of the data field is consistent with the value of the data length variable;
[0012] A hash table construction unit, connected to the linked list construction unit, is used to set the key-value pairs of the hash table based on the bidirectional linked list to establish the hash table;
[0013] The processing unit is connected to the linked list construction unit and the hash table construction unit, and is used for storing and reading data based on the hash table and the bidirectional linked list; wherein the stored data is compressed data.
[0014] The embodiments of the present invention have the following technical effects:
[0015] The present invention improves the linked list structure and allocates the corresponding memory space size according to the data length variable, so that the linked list can realize dynamic allocation of memory space without relying on other functions, optimizes memory management, avoids memory fragmentation, makes full use of memory space, and improves system performance; constructs a hash table based on the linked list, and directly locates the position of the corresponding linked list node through the hash table according to the data keyword, so as to realize fast access to data, without traversing each node of the linked list and comparing and searching one by one, thereby improving the operation efficiency of the system; the design of reading data from a bidirectional linked list or writing data to a bidirectional linked list through a hash table takes into account the security and reliability of the data, and can effectively prevent the loss or tampering of the data; at the same time, the scheme saves storage space and improves memory utilization by compressing and storing the data; by setting a threshold, batch processing is performed on the data, and batch data is stored at one time, thereby avoiding the problem of occupying a large amount of system resources caused by frequent memory application and release, reducing system overhead, and further improving the operation efficiency of the system, thereby providing strong support for the IDPS function and coping with complex network attacks.
[0016] This technical solution can be widely used in various scenarios that require storage and processing of network data, such as network monitoring, network attack detection, data analysis, etc., meeting the market demand for efficient, secure, and low-cost data storage and processing, and can be widely used in application fields such as computer network security, data storage, and efficient memory management. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a flow chart of a data access method based on a linear space linked list provided by an embodiment of the present invention;
[0019] Figure 2 It is a schematic diagram of the structure of a bidirectional linked list provided by an embodiment of the present invention;
[0020] Figure 3 It is a logic diagram of a method for storing data based on a hash table and a bidirectional linked list provided by an embodiment of the present invention;
[0021] Figure 4 It is a schematic diagram of searching for the position of a linked list node corresponding to compressed data in a bidirectional linked list according to a hash table provided by an embodiment of the present invention;
[0022] Figure 5 It is a logic diagram of a method for acquiring data based on a hash table and a bidirectional linked list provided by an embodiment of the present invention;
[0023] Figure 6 It is a structural schematic diagram of a data access system based on a linear space linked list provided by an embodiment of the present invention;
[0024] Figure 7 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0026] In the prior art, functions such as malloc are usually used to realize dynamic allocation and release of data. However, functions such as malloc usually allocate memory blocks based on the granularity of the system memory allocator. If the size of the allocated memory block is not an integer multiple of the requested size, unused space may be left in the memory block, forming internal fragmentation. Moreover, functions such as malloc are non-continuous allocations, and the operating system may not always allocate memory from continuous memory areas. As time goes by, different memory blocks may be scattered in the memory, resulting in external fragmentation. Frequent memory allocation and release may cause memory fragments to gradually accumulate, making large blocks of continuous memory difficult to find, affecting program performance. In addition, the existing linked list node search method is generally a traversal search, which requires one-by-one comparison and search, resulting in low system operation efficiency.
[0027] In view of the above problems, the present invention proposes a data access method based on a linear space linked list. Figure 1 is a flow chart of a data access method based on a linear space linked list provided by an embodiment of the present invention, see Figure 1 , specifically including:
[0028] S1. Construct a doubly linked list based on linear space.
[0029] Specifically, Figure 2 is a schematic diagram of a bidirectional linked list provided by an embodiment of the present invention, see Figure 2, the bidirectional linked list includes several linked list nodes, each of which includes a data field and a pointer field. The pointer field includes a predecessor node pointer, a successor node pointer, and a data length variable. The predecessor node pointer points to the previous linked list node of the current linked list node, and the successor node pointer points to the next linked list node of the current linked list node. The value of the data length variable is the data length of the data to be stored, and the memory space size of the data field is consistent with the value of the data length variable. Among them, the linear space is a continuous memory space. In the computer memory, a continuous address space is pre-allocated for storing data structures, that is, the bidirectional linked list of this scheme. This continuous structure can improve the efficiency of data access, and the length of the bidirectional linked list can be dynamically adjusted according to actual needs. Among them, the data to be stored can be the raw data (RAW data) of variable-length Ethernet (ETH), or any data in other formats, which is not limited here. The design of the linked list structure takes into account random access and efficient storage of data, which can effectively avoid the problem of memory fragmentation and improve the performance of the system.
[0030] S2. Set the key-value pairs of the hash table based on the bidirectional linked list to establish a hash table.
[0031] S21. Use the first n bytes of each linked list node in the bidirectional linked list as keywords, calculate through a hash function, obtain a hash code of the linked list node, and use the hash code as the key corresponding to the linked list node in the hash table.
[0032] Specifically, n can be set as needed. For example, the first 4 bytes of each linked list node in the bidirectional linked list can be calculated through a hash function to obtain a hash code of the linked list node, and the hash code is used as the corresponding key of the linked list node in the hash table.
[0033] In some embodiments, several bytes at any specified position may be selected as keywords, which is not limited here.
[0034] S22. Use the address of the linked list node as the corresponding value of the linked list node in the hash table.
[0035] S23. Determine the key-value pair of each linked list node according to the key and value corresponding to each linked list node in the hash table, and establish a hash table.
[0036] Furthermore, if two different linked list nodes produce the same hash code (called a conflict), the hash code conflict problem can be solved by using the chain address method or the open addressing method.
[0037] S3, based on hash table and bidirectional linked list, data storage and data reading.
[0038] The stored data is compressed data.
[0039] Specifically, Figure 3 is a logic diagram of a method for storing data based on a hash table and a bidirectional linked list provided by an embodiment of the present invention, see Figure 3 , based on hash tables and bidirectional linked lists, data storage includes:
[0040] S31a. Initialize a doubly linked list.
[0041] S32a, storing the received data into the cache space.
[0042] S33a, adding a header to the data in the cache and encapsulating it to obtain encapsulated data.
[0043] Specifically, taking RAW format ETH data as an example, for the complete access of ETH data, since the completely encapsulated data cannot be captured at the ETH layer, it is necessary to save the last encapsulated packet header before the system calls the network device driver to complete the transmission and reception. The packet header may include fields such as the destination media access control address, the source media access control address, and the type. The data at the TCPIP to ETH level needs to be processed and encapsulated once to obtain complete RAW format data, and data access and subsequent use are performed based on the complete RAW format ETH data obtained after encapsulation.
[0044] In some embodiments, the data to be accessed does not need to be encapsulated by adding a header, or the data to be accessed is the acquired data itself, and then step S33a does not need to be executed.
[0045] S34a, compressing the encapsulated data to obtain compressed data.
[0046] Specifically, the GZip compression algorithm is used to compress the data in the cache space, including:
[0047] Data preprocessing: Convert the received data into a byte stream and add GZip file header information.
[0048] Among them, the GZip file header information includes magic number, compression method, etc.
[0049] Compression processing: Use the DEFLATE compression algorithm to compress the preprocessed data.
[0050] Add checksum: Calculate the CRC32 checksum of the original received data and the compressed data, and add the checksum to the end of the GZip file; calculate the length of the original received data, and add the length of the original received data to the end of the GZip file.
[0051] Output result: Output the final compressed data.
[0052] Among them, the Gzip compression algorithm is a lossless compression algorithm, which is based on the DEFLATE compression algorithm. The Gzip compression algorithm encapsulates the DEFLATE compression algorithm and obtains compressed data in the Gzip format through the DEFLATE compression algorithm.
[0053] S35a: Determine whether the amount of compressed data in the cache space reaches a preset threshold.
[0054] The preset threshold can be set according to the actual situation. Because the IO operation and data processing process consume a lot of resources, the batch processing method can reduce frequent input and output operations, improve the overall processing efficiency, and is more suitable for processing large amounts of data.
[0055] S36a. If the amount of compressed data in the cache space reaches a preset threshold, the compressed data is processed in batches based on the hash function and the hash table, and the compressed data is stored in a bidirectional linked list.
[0056] Wherein, each linked list node in the bidirectional linked list stores one piece of the compressed data.
[0057] Specifically, Figure 4 is a schematic diagram of searching for the position of the corresponding linked list node of the compressed data in the bidirectional linked list according to the hash table provided by an embodiment of the present invention, see Figure 4 , based on hash functions and hash tables, batch processing of compressed data, and storing of compressed data in a bidirectional linked list specifically includes:
[0058] Based on the hash function, the hash code of the compressed data is calculated according to the keyword of each compressed data.
[0059] Among them, when the keywords of two different compressed data generate the same hash code, the chain address method or open addressing method can also be used to solve the hash code conflict problem.
[0060] According to the hash code of the compressed data and the hash table, find the position of the linked list node corresponding to the compressed data in the doubly linked list.
[0061] If there is a linked list node corresponding to the compressed data in the hash table, the compressed data is stored in the corresponding linked list node.
[0062] If there is no linked list node corresponding to the compressed data in the hash table, a new linked list node is created, the key-value pair of the new linked list node is stored in the hash table, and the compressed data is stored in the new linked list node according to the hash table.
[0063] Furthermore, the data length of the compressed data is obtained, and the value of the data length variable in the new linked list node is determined according to the data length.
[0064] Allocate memory space for the data field in the new linked list node according to the value of the data length variable.
[0065] Store the compressed data in the data field of the new linked list node.
[0066] S37a: If the amount of compressed data in the cache space does not reach the preset threshold, continue to receive the next set of data.
[0067] Specifically, Figure 5 is a logic diagram of a method for acquiring data based on a hash table and a bidirectional linked list provided by an embodiment of the present invention, see Figure 5 , based on hash tables and bidirectional linked lists, data reading is performed, including:
[0068] S31b. Input the keyword of the required data into the hash table.
[0069] S32b. Based on the hash function, the keyword of the required data is calculated to obtain a hash code of the required data.
[0070] S33b, locating the position of the corresponding linked list node in the bidirectional linked list according to the hash code of the required data and the hash table.
[0071] S34b. If there is a corresponding linked list node in the bidirectional linked list, read the data in the corresponding linked list node.
[0072] S35b. If there is no corresponding linked list node in the bidirectional linked list, a null value is returned.
[0073] The present invention improves the linked list structure and allocates the corresponding memory space size according to the data length variable, so that the linked list can realize dynamic allocation of memory space without relying on other functions, optimizes memory management, avoids memory fragmentation, makes full use of memory space, and improves system performance; constructs a hash table based on the linked list, and directly locates the position of the corresponding linked list node through the hash table according to the data keyword, so as to realize fast access to data, without traversing each node of the linked list and comparing and searching one by one, thereby improving the operation efficiency of the system; the design of reading data from the bidirectional linked list or writing data to the bidirectional linked list through the hash table takes into account the security and reliability of the data, and can effectively prevent the loss or tampering of the data; at the same time, the scheme saves storage space and improves memory utilization by compressing and storing the data; by setting a threshold, batch processing is performed on the data, and batch data is stored at one time, so as to avoid the problem of occupying a large amount of system resources caused by frequent memory application and release, reduce system overhead, and further improve the operation efficiency of the system, thereby providing strong support for the IDPS function and coping with complex network attacks.
[0074] This technical solution can be widely used in various scenarios that require storage and processing of network data, such as network monitoring, network attack detection, data analysis, etc., meeting the market demand for efficient, secure, and low-cost data storage and processing, and can be widely used in application fields such as computer network security, data storage, and efficient memory management.
[0075] Figure 6 is a schematic diagram of the structure of a data access system based on a linear space linked list provided by an embodiment of the present invention, the system is used to execute a data access method based on a linear space linked list described in the above embodiment, such as Figure 6 As shown, the system includes the following modules:
[0076] A linked list construction unit is used to construct a bidirectional linked list based on a linear space; wherein the bidirectional linked list includes a number of linked list nodes, each of which includes a data field and a pointer field, the pointer field includes a predecessor node pointer, a successor node pointer, and a data length variable, the predecessor node pointer points to the previous linked list node of the current linked list node, the successor node pointer points to the next linked list node of the current linked list node, the value of the data length variable is the data length of the variable-length data stored in the data field, and the memory space size of the data field is consistent with the value of the data length variable.
[0077] The hash table construction unit is connected to the linked list construction unit and is used to set the key-value pairs of the hash table based on the bidirectional linked list to establish the hash table.
[0078] The processing unit is connected to the linked list construction unit and the hash table construction unit, and is used for storing and reading data based on the hash table and the bidirectional linked list; wherein the stored data is compressed data.
[0079] Figure 7 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 500 includes one or more processors 501 and a memory 502 .
[0080] The processor 501 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 500 to perform desired functions.
[0081] The memory 502 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 501 may run the program instructions to implement a data access method based on a linear space linked list and / or other desired functions of any embodiment of the present application described above. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.
[0082] In one example, the electronic device 500 may further include: an input device 503 and an output device 504, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 503 may include, for example, a keyboard, a mouse, etc. The output device 504 may output various information to the outside, including early warning prompt information, braking force, etc. The output device 504 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.
[0083] Of course, to simplify, Figure 7 Only some of the components related to the present application in the electronic device 500 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 500 may also include any other appropriate components.
[0084] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute a data access method based on a linear space linked list provided in any embodiment of the present application.
[0085] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0086] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes a data access method based on a linear space linked list provided in any embodiment of the present application.
[0087] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0088] It should be noted that the terms used in the present invention are only for describing specific embodiments, rather than limiting the scope of the present application. As shown in the present specification, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of more restrictions, the elements defined by the sentence "include one..." do not exclude the presence of other identical elements in the process, method or device including the elements.
[0089] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. A data access method based on a linear space linked list, characterized in that: The steps include: A bidirectional linked list is constructed based on a linear space; wherein the linear space is a pre-allocated continuous address space for storing a data structure; wherein the bidirectional linked list includes a plurality of linked list nodes, each of which includes a data field and a pointer field, wherein the pointer field includes a predecessor node pointer, a successor node pointer, and a data length variable, wherein the predecessor node pointer points to a previous linked list node of a current linked list node, and the successor node pointer points to a subsequent linked list node of the current linked list node, wherein the value of the data length variable is the data length of the data to be stored, and the memory space size of the data field is consistent with the value of the data length variable; Setting the key-value pairs of the hash table based on the bidirectional linked list to establish a hash table; Based on the hash table and the bidirectional linked list, data storage and data reading are performed; wherein the stored data is compressed data.
2. The data access method based on linear space linked list according to claim 1, characterized in that: The step of setting the key-value pairs of the hash table based on the bidirectional linked list to establish the hash table includes: The first n bytes of each linked list node in the bidirectional linked list are used as keywords, and a hash code of the linked list node is obtained by calculation through a hash function, and the hash code is used as the key corresponding to the linked list node in the hash table; Using the address of the linked list node as the corresponding value of the linked list node in the hash table; The key-value pairs of each linked list node are determined according to the corresponding keys and values of each linked list node in the hash table, and a hash table is established.
3. The data access method based on linear space linked list according to claim 2 is characterized in that: The data storage based on the hash table and the bidirectional linked list specifically includes: Initializing the bidirectional linked list; Storing the received data in the cache space; Adding a header to the data in the cache space and encapsulating the data to obtain encapsulated data; Compressing the encapsulated data to obtain compressed data; Determining whether the amount of the compressed data in the cache space reaches a preset threshold; If the amount of the compressed data in the cache space reaches a preset threshold, the compressed data is batch processed based on the hash function and the hash table, and the compressed data is stored in the bidirectional linked list; wherein each linked list node in the bidirectional linked list stores one piece of the compressed data; If the amount of the compressed data in the cache space does not reach the preset threshold, continue to receive the next set of data.
4. The data access method based on linear space linked list according to claim 3 is characterized in that: If the amount of the compressed data in the cache space reaches a preset threshold, the compressed data is batch processed based on the hash function and the hash table, and the compressed data is stored in the bidirectional linked list, specifically including: Based on the hash function, respectively calculating the hash code of the compressed data according to the keyword of each piece of the compressed data; According to the hash code of the compressed data and the hash table, searching for the position of the linked list node corresponding to the compressed data in the bidirectional linked list; If there is a linked list node corresponding to the compressed data in the hash table, storing the compressed data in the corresponding linked list node; If there is no linked list node corresponding to the compressed data in the hash table, a new linked list node is created, the key-value pair of the new linked list node is stored in the hash table, and the compressed data is stored in the new linked list node according to the hash table.
5. The data access method based on linear space linked list according to claim 4 is characterized in that: If there is no linked list node corresponding to the compressed data in the hash table, creating a new linked list node, storing the key-value pair of the new linked list node in the hash table, and storing the compressed data in the new linked list node according to the hash table includes: Acquire the data length of the compressed data, and determine the value of the data length variable in the new linked list node according to the data length; Allocate memory space for the data field in the new linked list node according to the value of the data length variable; The compressed data is stored in the data field of the new linked list node.
6. The data access method based on linear space linked list according to claim 3 is characterized in that: The compressing the data in the cache space to obtain compressed data includes: The GZip compression algorithm is used to compress the data in the cache space, including: Data preprocessing: convert the received data into a byte stream and add GZip file header information; Compression processing: Use the DEFLATE compression algorithm to compress the preprocessed data; Add checksum: calculate the CRC32 checksum of the original received data and the compressed data, and add the checksum to the end of the GZip file; calculate the length of the original received data, and add the length of the original received data to the end of the GZip file; Output result: Output the final compressed data.
7. The data access method based on linear space linked list according to claim 2, characterized in that: Based on the hash table and the bidirectional linked list, data reading is performed, specifically including: Entering a keyword of the required data into the hash table; Based on the hash function, the keyword of the required data is calculated to obtain a hash code of the required data; Locate the position of the corresponding linked list node in the bidirectional linked list according to the hash code of the required data and the hash table; If the corresponding linked list node exists in the bidirectional linked list, read the data in the corresponding linked list node; If the corresponding linked list node does not exist in the bidirectional linked list, a null value is returned.
8. A data access system based on a linear space linked list, characterized in that: The system includes the following modules: A linked list construction unit, used for constructing a bidirectional linked list based on a linear space; wherein the linear space is a pre-allocated continuous address space for storing a data structure; wherein the bidirectional linked list includes a plurality of linked list nodes, each of which includes a data field and a pointer field, wherein the pointer field includes a predecessor node pointer, a successor node pointer, and a data length variable, wherein the predecessor node pointer points to a previous linked list node of a current linked list node, and the successor node pointer points to a subsequent linked list node of the current linked list node, and the value of the data length variable is the data length of the variable-length data stored in the data field, and the memory space size of the data field is consistent with the value of the data length variable; A hash table construction unit, connected to the linked list construction unit, for setting key-value pairs of the hash table based on the bidirectional linked list to establish a hash table; A processing unit is connected to the linked list construction unit and the hash table construction unit, and is used to store and read data based on the hash table and the bidirectional linked list; wherein the stored data is compressed data.
9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the data access method based on the linear space linked list as described in any one of claims 1 to 7 by calling the program or instruction stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute the data access method based on a linear space linked list as described in any one of claims 1 to 7.
