Data processing methods and apparatus, storage media and electronic equipment

By introducing a list of undisabled and disabled pointer records and a dangerous pointer manager into dynamic arrays, the data corruption and ABA problem of dynamic arrays in multi-threaded environments are solved, achieving efficient memory management and data semantic correctness.

CN116257359BActive Publication Date: 2026-11-17HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310225628.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-09
Publication Date
2026-11-17
Estimated Expiration
2043-03-09

AI Technical Summary

Technical Problem

In a multi-threaded environment, concurrent read and write operations on dynamic arrays can easily lead to data corruption. Existing technologies cannot guarantee the semantic correctness of data, and lock-free arrays suffer from the ABA problem and memory reclamation difficulties in high-concurrency scenarios.

Method used

By introducing a list of undisabled and disabled pointer records into a dynamic array, we ensure that incomplete write operations are executed before subsequent processing, and use a dangerous pointer manager to manage memory to prevent different threads from reusing freed memory addresses.

Benefits of technology

It ensures the semantic correctness of dynamic arrays in high-concurrency scenarios, avoids data corruption, improves memory management efficiency, and solves the ABA problem and memory reclamation difficulties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257359B_ABST
    Figure CN116257359B_ABST
Patent Text Reader

Abstract

This invention provides a data processing method and apparatus, a storage medium, and an electronic device. The method includes: when processing data in a dynamic array, first processing the incomplete write operations recorded in the read descriptor data, and then performing subsequent processing. This ensures the correctness of data semantics when multiple threads process the dynamic array, avoids data corruption, and ensures that different threads reading the same pointer address will not release memory by using a list of undeactivated pointer records and a list of deactivated pointer records. This ensures that different threads do not reuse previously released memory addresses when processing the array, thereby avoiding the ABA problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a data processing method and apparatus, storage medium and electronic device. Background Technology

[0002] With the development of computer technology, in order to improve data processing efficiency, systems typically support multiple threads processing data simultaneously, thereby achieving high concurrency. After achieving high concurrency, a situation may arise where multiple threads process the data of a single array. In this case, thread 1 may wait to execute due to blocking, slow resource acquisition, or other issues, preventing the write operation to the array from being performed. Meanwhile, while thread 1 is waiting, thread 2 may operate on the array, changing its data. This can easily lead to data corruption when thread 1 finishes waiting and performs its write operation on the array. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a data processing method and apparatus, a storage medium and an electronic device. When processing an array, the present invention first performs any incomplete write operations on the array, and then processes the array, thereby ensuring the semantic correctness of the data in the array and avoiding data corruption.

[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0005] A data processing method, comprising:

[0006] When an insertion request for a dynamic array is received from the caller, the address currently pointed to by the descriptor pointer of the dynamic array is determined as the first pointer address;

[0007] Determine the first descriptor data corresponding to the first pointer address, and store the first pointer address in a preset list of undisabled pointer records;

[0008] After executing the incomplete write operation recorded in the first descriptor data, memory is allocated for the inserted data provided by the caller, and the insertion position of the inserted data is determined.

[0009] Based on the inserted data and the insertion position, generate second descriptor data and a second pointer address for the second descriptor data, and store the second pointer address in the list of undisabled pointer records;

[0010] When the address pointed to by the descriptor pointer is updated to the second pointer address, the first pointer address is moved from the list of undisabled pointer records to a preset list of disabled pointer records, and the second pointer address is removed from the list of undisabled pointer records. Then, the write operation is performed on the data recorded at the address pointed to by the updated descriptor pointer.

[0011] A data processing apparatus, comprising:

[0012] The first determining unit is used to determine the address currently pointed to by the descriptor pointer of the dynamic array as the first pointer address when it receives an insertion request sent by the caller for the dynamic array;

[0013] The second determining unit is used to determine the first descriptor data corresponding to the first pointer address, and to store the first pointer address into a preset list of undisabled pointer records;

[0014] An execution unit is configured to, after executing the incomplete write operation recorded in the first descriptor data, allocate memory for the inserted data provided by the caller, and determine the insertion position of the inserted data;

[0015] The generation unit is used to generate second descriptor data and a second pointer address of the second descriptor data based on the inserted data and the insertion position, and store the second pointer address in the list of undisabled pointer records;

[0016] The removal unit is configured to, when the address pointed to by the descriptor pointer is updated to the second pointer address, move the first pointer address from the list of undisabled pointer records to a preset list of disabled pointer records, remove the second pointer address from the list of undisabled pointer records, and perform a write operation on the data recorded at the address pointed to by the updated descriptor pointer.

[0017] A storage medium comprising stored instructions, wherein, when the instructions are executed, the device in which the storage medium resides executes the data processing method described above.

[0018] An electronic device includes a memory and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors using the data processing method described above.

[0019] Compared with the prior art, the present invention has the following advantages:

[0020] This invention provides a data processing method and apparatus, a storage medium, and an electronic device. The method includes: when receiving an insertion request sent by a caller to a dynamic array, determining a first pointer address based on the address currently pointed to by the descriptor pointer of the dynamic array, determining first descriptor data based on the first pointer address, and adding the first pointer address to an undisabled pointer record list; after executing the incomplete write operation recorded in the first descriptor data, generating second descriptor data and a second pointer address for the second descriptor data provided by the caller, storing the second pointer address in the undisabled pointer record list, updating the second pointer address to the address pointed to by the descriptor pointer, adding the first pointer address to a disabled pointer record list, removing the second pointer address from the undisabled pointer record list, and then executing the write operation recorded in the data at the address pointed to by the updated descriptor pointer. Therefore, when processing an array, the incomplete write operations recorded in the array are executed first, and then the subsequent operations are performed on the array. This ensures the semantic correctness of the data processing in the array and effectively avoids data corruption. Furthermore, by using a list of undeactivated pointer records and a list of deactivated pointer records during the processing, different threads reading the same pointer address will not release memory. This ensures that different threads will not reuse previously released memory addresses when processing the array, thus avoiding the ABA problem. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0022] Figure 1 Example diagram of a scenario for the ABA problem in existing technologies;

[0023] Figure 2 A flowchart of a data processing method provided by the present invention;

[0024] Figure 3 This is a schematic diagram of the internal data storage structure of a dynamic array provided in an embodiment of the present invention;

[0025] Figure 4 The UML diagram of the data structure of the dynamic array provided in the embodiments of the present invention;

[0026] Figure 5 A diagram illustrating the implementation principle of the danger pointer provided in this embodiment of the invention;

[0027] Figure 6Example diagram of the dangerous pointer memory management data structure provided in the embodiments of the present invention;

[0028] Figure 7 This is a flowchart of a method for determining and allocating memory for inserted data provided by the caller, as provided in an embodiment of the present invention.

[0029] Figure 8 A flowchart for bucket-based memory allocation operations is provided as another embodiment of the present invention;

[0030] Figure 9 This is a flowchart of a method for performing an incomplete write operation provided in an embodiment of the present invention;

[0031] Figure 10 This is a flowchart of a method for deleting data in a dynamic array according to an embodiment of the present invention;

[0032] Figure 11 A flowchart illustrating a method for deleting data from a dynamic array, as provided in another embodiment of the present invention;

[0033] Figure 12 A flowchart of a method for inserting data into a dynamic array according to another embodiment of the present invention;

[0034] Figure 13 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present invention;

[0035] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0036] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0037] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0038] As can be seen from the background technology, when the system achieves high concurrency, it is easy for thread 2 to operate on the array that thread 1 is about to write while thread 1 is waiting to execute, causing the data to change. When thread 1 resumes and performs the array write operation, the data is prone to being disordered.

[0039] The array mentioned in the background technology is a commonly used data structure. It is a collection of elements of the same type, stored in a contiguous block of memory, and used to implement high-performance queues, asynchronous processing to improve performance, etc. An array can have one producer and one consumer (read-write), or multiple producers and multiple consumers (read-write). Regardless of the read-write or read-write mode, in a multi-threaded environment, concurrent reads and writes to the same element of the array may occur. Concurrent reads and writes can cause data corruption, preventing the array from functioning correctly.

[0040] To address concurrent read / write issues, locks are typically introduced, such as pthread mutexes or lower-level atomic locks. While locks solve the problem, they introduce performance degradation. The more concurrent operations on an array, the greater the performance degradation, potentially rendering the array unsuitable for performance requirements. To address this, the concept of lock-free arrays (one-read-one-write) was introduced, allowing concurrent array operations without locks. This approach offers high performance but is only suitable for one-read-one-write concurrency. Further modifications led to multiple-read-one-write, one-read-multiple-write, or multiple-read-multiple-write modes. Some implementations actually use low-level atomic locks, offering slightly better performance than pthread mutexes, but concurrency performance issues persist. They are not truly lock-free arrays, and some implementations do not achieve true concurrency, leading to data corruption during concurrent operations.

[0041] For lock-free data structures, current technical solutions mainly employ linked lists or circular buffers. These implementations do not support efficient random access to elements, and they do not support dynamic allocation of new available memory when the data storage space cannot meet new demands. Furthermore, most mainstream lock-free queue implementations currently use CAS instructions alone at the underlying level, which cannot detect the A->B->A state change during synchronization. This leads to the ABA problem, which can be referenced... Figure 1 The diagram illustrates a scenario of the ABA problem. As shown, thread 1 cannot detect that thread 2 uses the CAS instruction to replace A with C, and then replaces C with A. In the end, thread 1 still reads A, resulting in semantic flaws in the implementation. Therefore, a new data structure is needed to achieve semantically correct and more efficient multi-threaded concurrent synchronization.

[0042] To address the aforementioned issues, this invention provides a data processing method and apparatus, a storage medium, and an electronic device. When processing data, this invention requires that any incomplete write operations recorded in the descriptor data of a dynamic array be completed before subsequent operations are executed. Executing incomplete write operations first ensures the correctness of the data semantics in the array, thereby avoiding data corruption. Furthermore, this invention also provides a data structure that supports lock-free concurrent write operations and dynamically allocates memory, solving two problems related to the difficulty of synchronizing lock-free data structures: the ABA problem and the memory reclamation problem. The ABA problem can be understood as the problem of incorrect synchronization semantics. This provides better concurrent write speed and more efficient memory reclamation performance in high-concurrency scenarios.

[0043] This invention can be used in a wide variety of general-purpose or special-purpose computing environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor devices, distributed computing environments including any of the above devices, etc.

[0044] Reference Figure 2 The following is a flowchart of a data processing method provided by the present invention, which is described in detail below:

[0045] S101. When an insertion request for a dynamic array is received from the caller, the address currently pointed to by the descriptor pointer of the dynamic array is determined as the first pointer address.

[0046] It should be noted that when the system receives an insertion request for the dynamic array from the caller, the system starts a thread to call the dynamic array's insertion interface to implement the logic corresponding to the insertion request. Specifically, the thread determines the address currently pointed to by the dynamic array's descriptor pointer as the first pointer address.

[0047] It should be noted that the dynamic array mentioned in this invention is a dynamic two-level array, which consists of an array of pointers. The first element of the array points to a contiguous memory block that can hold 2 elements, the second element points to a contiguous memory block that can hold 4 elements, the third element points to a contiguous memory block that can hold 8 elements, and the nth element points to a contiguous memory block that can hold 2... n A contiguous block of memory for each element, and so on. (See reference...) Figure 3 This diagram illustrates the internal data storage structure of a dynamic array provided in an embodiment of the present invention. In the diagram, bucket 0 represents the first element of the array, and bucket 0 points to 0-0 and 0-1, which are contiguous memory blocks capable of holding two elements. Bucket 1 represents the second element of the array, and bucket 1 points to 1-0, 1-1, 1-2, and 1-3, which are contiguous memory blocks capable of holding four elements. Bucket N represents the (N-1)th element of the array, pointing to a contiguous memory block capable of holding two elements. n A contiguous block of memory containing one element, and so on, without further examples here.

[0048] It should be noted that the dynamic array used in this invention supports dynamic expansion and can calculate the internal bucket number corresponding to the nth element and the actual memory offset address within the bucket in constant time, thereby enabling random access to array elements and avoiding element movement operations during array expansion, thus making it easier to implement lock-free expansion operations.

[0049] Reference Figure 4 This is a UML diagram of the data structure of a dynamic array provided in an embodiment of the present invention. Figure 4 The following explains the various parts of the structure. The dynamic array is the one described above; this dynamic array is a lock-free array. Internal Storage Array: This is the internal storage array that involves implementation details. Its initial capacity is 8, and each element stores the address of the first element of each second-level array. Descriptor: This is the abstract base class for write operation descriptors, recording the basic information needed to perform a write operation, including the array size. Write Operation Descriptor: This records the specific information needed for a write operation, including the array size, write position, original value, write value, and whether the operation was successful. Dangerous Pointers: This is responsible for the lifecycle management of the descriptor data structure, including allocation and deallocation. Dangerous Pointer Manager: This maintains the external API for dangerous pointers. HP Thread Local Data: Each thread reading / writing the dynamic array stores the usage of dangerous pointers using the `thread_local_storage` method. The `thread_local_storage` method can be implemented using the C++11 `thread_local` keyword.

[0050] HP in the thread-local data is a list of HP pointers, also known as a list of dangerous pointers. This list stores pointers used by a single thread and is implemented using an array. k is the maximum storage capacity for storing the list of pointers used by a single thread. Retired is the list of Retired pointers, also known as a list of deactivated pointers. The Retired list is a list of pointers whose memory is to be released after a single thread has finished using them. rnode: one of the nodes in the list of dangerous pointers stored internally by the dangerous pointer.

[0051] S102. Determine the first descriptor data corresponding to the first pointer address, and store the first pointer address into a preset list of undisabled pointer records.

[0052] It should be noted that after determining the first descriptor data corresponding to the first pointer address, the thread stores the first pointer address in a preset list of undisabled pointer records. This list of undisabled pointer records is the HP list mentioned above, i.e., the list of dangerous pointers. Furthermore, the list of undisabled pointer records is stored in the thread's thread dangerous pointer manager, which also includes a list of disabled pointers, i.e., the Retired list.

[0053] Each thread has its own thread dangerous pointer manager, and each thread's thread dangerous pointer manager can be managed through the dangerous pointer manager.

[0054] Reference Figure 5 The diagram illustrates the implementation principle of dangerous pointers provided in this embodiment of the invention. The dangerous pointers in the diagram are the HP list mentioned above, which represents a list of pointers used by a certain read / write thread that may be read and written by multiple different threads at the same time, posing a risk of concurrency. The list of pointers to be released is the Retired list, which represents the list of pointers to be deleted.

[0055] Reference Figure 6 The figure shows an example diagram of the dangerous pointer memory management data structure provided in an embodiment of the present invention. As shown in the figure, there are thread dangerous pointer managers in threads 0 to P-1. Each thread dangerous pointer manager contains an HP list and a Retired list. Each thread dangerous pointer manager is managed by a dangerous pointer manager.

[0056] Preferably, the address of the descriptor data is stored in the descriptor pointer. The address stored in the descriptor pointer corresponds to a data structure stored on the heap, which can be called a descriptor data structure.

[0057] A descriptor data structure will only record one write operation. Preferably, the recorded write operation is an incomplete write operation. Furthermore, when no write operation is recorded in the descriptor data structure, the content of the descriptor data structure is empty.

[0058] S103. After executing the incomplete write operation recorded in the first descriptor data, determine the memory allocation for the inserted data provided by the caller, and determine the insertion position of the inserted data.

[0059] It should be noted that before executing any incomplete write operations recorded in the first descriptor data, it can be determined whether any incomplete write operations are recorded in the first descriptor data. If an incomplete write operation is recorded, then the recorded incomplete write operation is executed. Furthermore, if no incomplete write operations are recorded in the first descriptor data, then the content regarding incomplete write operations in the first descriptor data is empty. It should be noted that the method to determine whether an incomplete write operation is recorded in the first descriptor data can be determined by the content recorded in the complete field of the write operation recorded in the first descriptor data. When the complete field of the write operation is recorded as incomplete, it can be determined that the write operation recorded in the first descriptor data is incomplete.

[0060] Preferably, if the first descriptor data does not record any incomplete write operations, then memory allocation and the insertion position of the inserted data can be determined directly for the data provided by the caller. The inserted data here can be information related to the write operation that the thread needs to perform.

[0061] It should be noted that the inserted data is the parameter passed by the caller through the insertion interface AIP, and the insertion position of the inserted data is the insertion position required by the caller. This insertion position is the address of the descriptor data to be generated later.

[0062] Preferably, in determining the memory allocation provided by the caller for the inserted data, it is necessary to determine the bucket to which the inserted data belongs, and the location of the inserted data within that bucket. Preferably, the location determined here is the address where the content of the inserted data will be stored.

[0063] Reference Figure 7 The following is a flowchart of a method for determining and allocating memory for inserted data provided by a caller, as provided in an embodiment of the present invention. The details are as follows:

[0064] S201. Determine the bucket to which the inserted data belongs and obtain the memory address pointer of the bucket.

[0065] First, calculate the bucket to which the inserted data belongs. Further, determine the offset position of the inserted data within that bucket. Preferably, when calculating the bucket to which the inserted data belongs, first determine the bucket number, and then determine the bucket corresponding to that number as the bucket to which the inserted data belongs.

[0066] After determining the bucket to which the inserted data belongs, it is necessary to determine whether the bucket has been allocated memory. To determine whether the bucket has been allocated memory, it is necessary to use the memory address pointer of the bucket.

[0067] S202. Determine if the memory address pointer is null; if it is determined that the memory address pointer is not null, execute S203; if it is determined that the memory address pointer is null, execute S204.

[0068] S203. Determine the memory pointed to by the memory address pointer and designate that memory as the allocated memory for the bucket.

[0069] When the memory address pointer is not null, it means that memory has been allocated for the bucket, and this memory is the allocated memory for the bucket.

[0070] S204. Determine the memory size of the bucket and the memory block corresponding to the memory size.

[0071] When the memory address pointer is null, it can be determined that no memory has been allocated for the bucket, and memory needs to be allocated to the bucket at this time. When allocating memory for a bucket, the memory size of the bucket needs to be determined first. Preferably, the memory size of the bucket is twice the memory size of the previous bucket. For example, if the memory size of the previous bucket is 1MB, then the memory size of the current bucket is 2MB.

[0072] Identify the memory block corresponding to the memory size. At this point, the memory capacity of the memory block is equal to the memory size of the bucket, and the memory block is a contiguous memory block.

[0073] S205. Update the memory address pointer based on the address information of the memory block. When the memory address pointer is successfully updated, determine that the memory block is the allocated memory of the bucket.

[0074] The CAS instruction is used to update the memory address pointer, that is, to update the address information of the memory block to the memory address pointer. When the memory address pointer is updated successfully, the memory block is the allocated memory for the bucket; when the memory address pointer is updated unsuccessfully, the memory block is released. Furthermore, when the CAS instruction executes successfully and returns true, it is determined that the memory address pointer has been updated successfully.

[0075] It should be noted that the memory allocated by buckets consists of contiguous memory blocks.

[0076] When it is determined that no memory has been allocated for a given bucket, this invention also provides another memory allocation process, which can be found in the following reference: Figure 8 The figure is a flowchart of a bucket-based memory allocation operation provided in another embodiment of the present invention, which is described in detail below:

[0077] S301, Calculate the memory size of the buckets.

[0078] Preferably, the memory size of the bucket is twice the memory size of the previous bucket.

[0079] S302, memory blocks allocated in buckets on the heap.

[0080] The memory block has the same capacity as the S301's memory.

[0081] S303, Call the CAS instruction to update the bucket pointer.

[0082] S304. Determine whether the bucket pointer has been updated successfully. If it is unsuccessful, execute S305; if it is successful, end the process.

[0083] S305. Release the memory block from step S302.

[0084] This invention allocates memory blocks in buckets, thereby ensuring that each bucket has corresponding storage space so that data can be stored in the allocated memory blocks subsequently.

[0085] S104. Generate second descriptor data and second pointer address of second descriptor data based on the inserted data and the insertion position, and store the second pointer address in the list of undisabled pointer records.

[0086] It should be noted that the insertion position here is the insertion position required by the caller. The generated second descriptor data contains descriptive information about the write operation in the inserted data, such as the bucket to which the write operation belongs, the specific insertion position in that bucket, and the specific value written.

[0087] It should be noted that the second pointer address is the address where the second descriptor data is stored.

[0088] S105. When the address pointed to by the descriptor pointer is updated to the address of the second pointer, the first pointer address is moved from the list of unused pointer records to the preset list of unused pointer records, and the second pointer address is removed from the list of unused pointer records. Then, the write operation is performed on the data recorded at the address pointed to by the updated descriptor pointer.

[0089] The CAS CPU instruction updates the address pointed to by the descriptor pointer. By executing the CAS instruction, the CPU updates the address pointed to by the descriptor pointer to the address of the second pointer. When the CAS instruction returns the corresponding success code, the address pointed to by the descriptor pointer is successfully updated to the address of the second pointer.

[0090] When the address pointed to by the descriptor pointer is updated to the address of the second pointer, the address of the first pointer can be moved from the list of unused pointer records to the list of disabled pointer records so that the memory block pointed to by the address of the first pointer can be released later.

[0091] It should be noted that after updating the address pointed to by the descriptor pointer to the second pointer address, moving the first pointer address from the list of unused pointer records to the list of disabled pointer records, and removing the second pointer address from the list of unused pointer records, a write operation can be performed on the data recorded at the address pointed to by the updated descriptor pointer.

[0092] Furthermore, when the address pointed to by the descriptor pointer is not updated to the second pointer address, the second pointer address needs to be added to the disabled pointer record list, and the first pointer address in the not disabled pointer record list needs to be released. Furthermore, when the thread has not stopped working, or when a new thread starts working based on an insertion request, execution can begin from the step of determining the address currently pointed to by the descriptor pointer of the dynamic array as the first pointer address.

[0093] In the method provided by this embodiment of the invention, when an insertion request sent by a caller to a dynamic array is received, a first pointer address is determined based on the address currently pointed to by the descriptor pointer of the dynamic array, and first descriptor data is determined based on the first pointer address. The first pointer address is then placed in the list of undisabled pointer records. After executing the incomplete write operation recorded in the first descriptor data, second descriptor data and a second pointer address of the second descriptor data are generated for the insertion data provided by the caller. The second pointer address is then stored in the list of undisabled pointer records. After updating the second pointer address to the address pointed to by the descriptor pointer, the first pointer address is placed in the list of disabled pointer records. Then, the second pointer address is removed from the list of undisabled pointer records. Finally, the write operation recorded in the data at the address pointed to by the updated descriptor pointer is executed. Therefore, when processing an array, the incomplete write operations recorded in the array are executed first, and then the subsequent operations are performed on the array. This ensures the semantic correctness of the data processing in the array and effectively avoids data corruption. Furthermore, by using a list of undeactivated pointer records and a list of deactivated pointer records during the processing, different threads reading the same pointer address will not release memory. This ensures that different threads will not reuse previously released memory addresses when processing the array, thus avoiding the ABA problem.

[0094] Reference Figure 9 The following is a flowchart of a method for performing an incomplete write operation according to an embodiment of the present invention, which is described in detail below:

[0095] S401. It is determined that there are incomplete write operations.

[0096] S402, Calculate the bucket to which the write operation belongs.

[0097] S403. Calculate the write position of the write operation in the corresponding bucket.

[0098] S404, Read the write information from the write operation descriptor.

[0099] S405. Use the CAS command to update the write information to the write location.

[0100] S406. Mark the write operation descriptor as completed.

[0101] When it is determined that an incomplete write operation is recorded in the descriptor data, the write operation needs to be executed. The process for executing the write operation is as shown in S402 to S406. It should be noted that the bucket to which the write operation belongs is calculated, then the write position of the write operation in that bucket is determined, then the write information in the write operator of the write operation is determined, and the write information is the information to be written to the write position of the bucket. Finally, the CAS instruction is executed to write the write information to the write position.

[0102] Preferably, the process of executing an incomplete write operation can also be as follows: reading the record information of the incomplete write operation recorded in the first descriptor data; determining the write bucket and the write position in the bucket based on the record information; updating the write information in the record information to the memory corresponding to the write position, and marking the write operation as complete. It should be noted that the record information can be the write operation descriptor information of the write operation.

[0103] It should be noted that the process of performing write operations mentioned in this invention can refer to the above-described process.

[0104] By performing a write operation, data can be written into the array, thereby enabling data processing within the array.

[0105] Reference Figure 10 The following is a flowchart of a method for deleting data in a dynamic array according to an embodiment of the present invention, which is described in detail below:

[0106] S501. Receive the deletion request sent by the caller for the dynamic array.

[0107] After receiving a deletion request from the caller, the corresponding process can be activated to implement the data processing logic for the deletion request. Specifically, the corresponding data processing logic can be implemented by calling the interface in the array that corresponds to the deletion request.

[0108] S502. Determine the address currently pointed to by the descriptor pointer of the dynamic array as the address of the third pointer.

[0109] S503. Determine the third descriptor data corresponding to the third pointer address, and store the third pointer address into a preset list of undisabled pointer records.

[0110] It should be noted that the address of the third pointer here may be the same as or different from that of the first pointer.

[0111] S504. After executing the incomplete write operation recorded in the third descriptor data, determine the data to be deleted in the dynamic array, and remove the deleted data from the dynamic array to obtain a new dynamic array.

[0112] For details on the process of executing incomplete write operations, please refer to the content described above, which will not be repeated here.

[0113] When determining the data to be deleted in a dynamic array, first determine the bucket number and offset position, then determine the target bucket based on the bucket number, and finally read the last element of the secondary array of the target bucket based on the offset position, and use this element as the data to be deleted.

[0114] It should be noted that deleting data from a dynamic array can be done by reading the data from the dynamic array and then obtaining a new dynamic array.

[0115] S505. Generate fourth descriptor data and the fourth pointer address of the fourth descriptor data based on the new dynamic array, and store the fourth pointer address in the list of undisabled pointer records.

[0116] It should be noted that the size of the new dynamic array is equal to the size of the original dynamic array minus 1. Here, the original dynamic array is the dynamic array that still contains the deleted data.

[0117] The generated fourth descriptor data contains the size of the new dynamic array.

[0118] S506. When the address pointed to by the descriptor pointer is updated to the address of the fourth pointer, the address of the third pointer is moved from the list of never-deactivated pointer records to the list of deactivated pointer records, and the address of the fourth pointer is removed from the list of never-deactivated pointer records, and the deleted data is returned.

[0119] Preferably, when the address pointed to by the descriptor pointer is not updated to the address of the fourth pointer, the address of the fourth pointer is stored in the list of disabled pointer records; the address of the third pointer in the list of not disabled pointer records is released. Furthermore, when a thread has not stopped working, or when a thread starts working based on a deletion request, execution can begin from when the address currently pointed to by the descriptor pointer of the dynamic array is determined to be the address of the third pointer.

[0120] In the method provided by this invention, a list of undisabled pointers and a list of disabled pointers are used when performing a deletion operation. The list of undisabled pointers can be used to store memory objects that a thread is accessing and does not want to be released. This ensures that when different threads concurrently read and write descriptor data of dynamic arrays, they will not reuse memory addresses that have already been released, thus avoiding the ABA problem.

[0121] Reference Figure 11 The following is a flowchart of a method for deleting data in a dynamic array according to another embodiment of the present invention, which is described in detail below:

[0122] S601. Determine the address currently pointed to by the descriptor pointer of the dynamic array as the address of the third pointer, and determine the third descriptor data corresponding to the address of the third pointer.

[0123] S602. Store the address of the third pointer into the preset list of undisabled pointer records.

[0124] S603, Execute the incomplete write operation recorded in the third descriptor data.

[0125] S604. Read the last element from the dynamic array.

[0126] It should be noted that the last element read from the dynamic array is the last element of the inner secondary array read from the dynamic array based on the calculated bucket number and offset position.

[0127] S605. Determine the array after reading the last element as the new dynamic array, and generate the fourth descriptor data and the fourth pointer address of the fourth descriptor data according to the size of the new dynamic array.

[0128] S606. Add the address of the fourth pointer to the HP list.

[0129] S607. Use the CAS instruction to update the address pointed to by the descriptor pointer.

[0130] S608. Determine whether the address pointed to by the descriptor pointer has been successfully updated. If the update is successful, execute S609; if the update is unsuccessful, execute S612.

[0131] S609. Add the address of the third pointer to the Retired list.

[0132] S610, Remove the fourth pointer address from the HP list.

[0133] S611, Returns the last element read.

[0134] S612. Add the address of the fourth pointer to the Retired list.

[0135] S613. Remove the third pointer address from the HP list.

[0136] It should be noted that after removing the third pointer address from the HP list, if the thread has not yet ended, execution can return to S601; preferably, when a new thread starts working, it should also start from S601.

[0137] This invention also uses the Retired list and HP list when deleting data, which can ensure that when different threads concurrently read and write the descriptor data of the dynamic array, they will not reuse the heap memory address that has been previously released, thereby avoiding the ABA problem caused by different threads sharing memory blocks that have been marked for reclamation and reuse, and preventing data corruption.

[0138] Reference Figure 12 The following is a flowchart of a method for inserting data into a dynamic array according to another embodiment of the present invention, which is described in detail below:

[0139] S701. Determine the address currently pointed to by the descriptor pointer of the dynamic array as the first pointer address, and determine the first descriptor data corresponding to the first pointer address.

[0140] S702. Store the address of the first pointer into a preset list of undisabled pointer records.

[0141] S703, Execute the incomplete write operation recorded in the first descriptor data.

[0142] S704. Calculate the bucket to which the insertion operation belongs and its position within the bucket.

[0143] S705. Determine whether memory has been allocated for the bucket. If no memory has been allocated, execute S706; if memory has been allocated, execute S707.

[0144] S706 allocates memory for buckets.

[0145] S707. Generate the second descriptor data and the second pointer address of the second descriptor data based on the inserted element and the insertion position.

[0146] S708. Add the address of the second pointer to the HP list.

[0147] S709. Use the CAS instruction to update the address pointed to by the descriptor pointer.

[0148] S710. Determine whether the address pointed to by the descriptor pointer has been successfully updated. If the update is successful, execute S711; if the update is unsuccessful, execute S714.

[0149] S711. Add the address of the first pointer to the Retired list.

[0150] S712, Remove the second pointer address from the HP list.

[0151] S713. Perform the write operation contained in the data at the address pointed to by the updated descriptor pointer.

[0152] S714. Add the address of the second pointer to the Retired list.

[0153] S715, Release the first pointer address from the HP list.

[0154] It should be noted that after releasing the first pointer address from the HP list, execution can return to S701.

[0155] For instructions on inserting data, please refer to the relevant explanations above; they will not be repeated here.

[0156] The data processing solution provided in this invention proposes a data structure that supports lock-free dynamic expansion, namely a dynamic array. Compared with the lock-free queue design using a circular buffer, the two-level array provided in this invention supports dynamic expansion. When the array expands, multiple threads requesting expansion maintain their own independent heap memory blocks. Once it is found that the new space has been allocated by other threads, the allocated heap memory block of the current thread is released, thereby achieving lock-free dynamic expansion of the array. This invention also proposes a descriptor data as a write proxy. It should be noted that the descriptor data of this invention can also be called a descriptor data structure. The insertion / deletion operations of the dynamic array are submitted to the descriptor data structure, which acts as a proxy layer to record the latest submitted write operation, thus solving the concurrent write problem when the array dynamically expands and re-allocates additional memory space. Furthermore, the data change operations recorded by the descriptor data structure are implemented through lock-free writing using the CPU's CAS instruction. Compared with the conventional blocking synchronization mechanism using mutexes or read-write locks, there is no situation where multiple threads consume CPU time idling, thus achieving higher concurrent write efficiency.

[0157] This invention also provides a wait-free memory management mechanism for descriptor data structures. By introducing dangerous pointers to manage the dynamic release of memory for the aforementioned descriptor data structures, a higher-level wait-free memory reclamation management mechanism is provided than the traditional non-blocking reference counting method (lock-free). Therefore, it can provide better concurrent write speed and more efficient memory reclamation performance in high-concurrency scenarios.

[0158] This invention solves the ABA problem caused by CAS instruction synchronization in general lock-free implementations. By using a dangerous pointer read / write management interface and thread-local storage characteristics, it ensures that the same descriptor data structure read by different threads will not be released from memory. This guarantees that when different threads concurrently read and write the descriptor data structure of a dynamic array, they will not reuse previously released heap memory addresses, thus avoiding the ABA problem caused by different threads sharing memory blocks marked for reclamation and reuse.

[0159] The data processing solution provided by this invention offers a thread-safe, lock-free dynamic array and a dangerous pointer manager. A descriptor data structure is defined within the lock-free dynamic array, and the dangerous pointer manager is used to manage memory when threads perform read and write operations on dynamic data. The descriptor data structure solves the problem of dynamic expansion of the lock-free array, while the dangerous pointer memory management method enables a non-blocking, multi-read / multi-write, and dynamically expandable thread-safe array, providing higher concurrent write performance than conventional dynamic arrays using synchronized read-write locks.

[0160] Compared to conventional lock-free queues implemented using CAS instructions, this invention provides random access and dynamic resizing features not supported by traditional queues. It offers higher concurrent write performance and a more efficient memory management mechanism than conventional dynamic arrays using synchronized read-write locks.

[0161] Based on the above two points, this invention provides a set of APIs for external dynamic array element data operations by encapsulating descriptor data structures and dangerous pointer memory management mechanisms, specifically as follows:

[0162] 1) Read operation: Used to return the element at the i-th position of the array;

[0163] 2) Write operation: Used to modify the element at the i-th position of the array;

[0164] 3) Random access operation (At): Accesses the Nth element of the array;

[0165] 4) Insertion operation (Push_back): Inserts a new element from the end of the array;

[0166] 5) Deletion operation (Pop_back): Removes a new element from the end of the array and returns the value of that element;

[0167] 6) Reservation operation: Provides the array with enough additional storage space to accommodate N arrays;

[0168] 7) Read array size operation (Size): Get the size of the array.

[0169] It should be noted that the internal memory management of the Push_back and Pop_back operation descriptor data structures introduces a Hazard Pointer. The UML diagram of the Hazard Pointer data structure integrated into the descriptor can be found in [reference needed]. Figure 4 In a dynamic array, each thread performing read / write operations on array elements must use a dangerous pointer manager data structure. This dangerous pointer manager uses thread-local storage variables to achieve independent atomic read / write operations between threads. Its implementation principle is as follows: Figure 5As shown. The specific implementation scheme is as follows: the dangerous pointer manager for each array element read / write thread consists of a dangerous pointer record array HP of size K and a deactivated dangerous pointer record array Retired of size R. The specific internal data structure of the dangerous pointer manager is as follows. Figure 6 As shown.

[0170] The specific memory data release process of the dangerous pointer manager is as follows:

[0171] a) Use thread-local data to store a list of shared memory (data structure elements) currently in use and a list of shared memory to be deleted, denoted as HP and Retired respectively.

[0172] b) Each thread stores the memory objects it is accessing that it does not want to be freed in the HP list, and retrieves them after use.

[0173] c) When any thread deletes a memory object, add the object to the Retired list.

[0174] d) When the number of elements in the Retired list reaches the threshold K, scan the HP list and Retired, and release elements that exist in the Retired list but not in the HP list.

[0175] In the above description, the HP list is single-write and multiple-read, while the Retired list is single-write and single-read. Therefore, the implementation of the above process operation only relies on atomic read and write, and does not use any heavyweight CAS synchronization primitives. As a result, the operation process is wait-free, which is more efficient than the lock-free implementation based on CAS instructions.

[0176] The specific definitions of each API are provided below. The internal allocation of new buckets (AllocBucket) and the internal write operation (CompleteWrite) are internal operations dependent on the dynamic array implementation details. In the following algorithms, First_Bucket_Size represents the size of the first bucket, with a default value of 8; HighestBit represents the position of the highest bit of the integer; ^, &, and . represent dereferencing, address-of, and member access operations of the pointer object, respectively. HP.insert inserts the specified pointer element from the HP list (), HP.remove removes the specified pointer element from the HP list, Retired.insert inserts the specified pointer element from the Retired list, and Retired.remove removes the specified pointer element from the Retired list.

[0177] The following is the pseudocode for the API interface for reading elements at a specified position:

[0178] Reading elements from a vector: Readvector, i

[0179] return At(vector, i)^

[0180] The above content is only one example of the algorithm pseudocode for reading elements at a specified position API interface, and this invention will not provide examples of each one.

[0181] The following is the pseudocode for the algorithm of writing elements at a specified position in the API interface:

[0182] Write a specified element to vector i, elem

[0183] return At(vector,i)^←elem

[0184] The above content is only one example of the algorithm pseudocode for writing to the API interface of a specified position element, and this invention will not provide examples of each one.

[0185] The following is the pseudocode for the API operation to access an element at a specified location:

[0186] Accessing the element at a specified position At Vector,i

[0187] pos←pos+First_Bucket_Size

[0188] hibit←HighestBit(pos)

[0189] idx←pos xor 2 hibit

[0190] retrun&vector.memory[hibit-HighestBit(First_Bucket_Size)][idx]

[0191] The above content is only one example of the algorithm pseudocode for accessing the API interface operation of a specified position element, and this invention will not provide examples of each one.

[0192] The following is the pseudocode for the push_back API interface for inserting new elements:

[0193] Inserting a new element: push_backvector, elem

[0194]

[0195] The above content is merely one example of the pseudocode algorithm for the `push_back` API interface for inserting new elements; this invention will not provide examples of all such instances. It should be noted that the specific process for the `push_back` API interface for inserting new elements can be found in [link to documentation]. Figure 12 The relevant explanations are as described above and will not be repeated here.

[0196] The following is the pseudocode of the algorithm that performs the write operation inside the array:

[0197] Internal write operation: CompleteWrite vector, writeop

[0198]

[0199] The above content is merely one example of the pseudocode algorithm for completing write operations within an array; this invention will not provide examples of all such algorithms. It should be noted that the process for completing write operations within an array can be found by referring to... Figure 9 The relevant details can be found in the explanation above, and will not be repeated here.

[0200] The following is the pseudocode for the pop_back API interface, which pops the last element:

[0201] Pop the last element of the vector.

[0202]

[0203] The above is merely one example of the pseudocode algorithm for completing the write operation within the array; this invention will not provide examples of all such algorithms. It should be noted that the process for popping the last Chinese element can be found in [reference needed]. Figure 11 The relevant explanations can be found in the above text, and will not be repeated here.

[0204] The following is the pseudocode for the array resizing API:

[0205] Resizing the Reserve vector, size

[0206]

[0207] The above content is only one example of the algorithm pseudocode of the array expansion API interface, and this invention will not provide examples of each one.

[0208] The following is the pseudocode for the internal new bucket allocation operation:

[0209] Internal allocation of new buckets: AllocBucketvector, bucket

[0210]

[0211] The above content is only one example of the pseudocode of the internal new bucket allocation algorithm, and this invention will not provide examples of each one.

[0212] The following is the pseudocode for the API interface for obtaining array size:

[0213] Get the size of the array: Size vector

[0214]

[0215] The above content is only one example of the algorithm pseudocode for the API interface for obtaining array size, and this invention will not provide examples of each one.

[0216] and Figure 1 Corresponding to the method shown, the present invention also provides a data processing apparatus, which can be configured in a system for supporting... Figure 1 The specific implementation of the method shown.

[0217] Reference Figure 13 The following is a schematic diagram of the structure of a data processing device provided in an embodiment of the present invention, and is described in detail below:

[0218] The first determining unit 801 is used to determine the address currently pointed to by the descriptor pointer of the dynamic array as the first pointer address when it receives an insertion request sent by the caller for the dynamic array;

[0219] The second determining unit 802 is used to determine the first descriptor data corresponding to the first pointer address, and to store the first pointer address into a preset list of undisabled pointer records.

[0220] The execution unit 803 is configured to, after executing the incomplete write operation recorded in the first descriptor data, allocate memory for the inserted data provided by the caller, and determine the insertion position of the inserted data;

[0221] The generation unit 804 is used to generate second descriptor data and a second pointer address of the second descriptor data based on the inserted data and the insertion position, and store the second pointer address in the list of undisabled pointer records;

[0222] The removal unit 805 is used to move the first pointer address from the list of undisabled pointer records to a preset list of disabled pointer records, and remove the second pointer address from the list of undisabled pointer records when the address pointed to by the descriptor pointer is updated to the second pointer address, and to perform a write operation on the data recorded at the address pointed to by the updated descriptor pointer.

[0223] In another embodiment of the present invention, the execution unit 803 of the device includes:

[0224] The first determining subunit is used to determine the bucket to which the inserted data belongs and to obtain the memory address pointer of the bucket;

[0225] The judgment subunit is used to determine whether the memory address pointer is null;

[0226] The second determining subunit is used to determine the memory pointed to by the memory address pointer when it is determined that the memory address pointer is not null, and to determine the memory as the allocated memory of the bucket.

[0227] The third determining subunit is used to determine the memory size of the bucket and the memory block corresponding to the memory size when the memory address pointer is determined to be null.

[0228] The fourth determining subunit is used to update the memory address pointer based on the address information of the memory block. When the memory address pointer is successfully updated, the memory block is determined to be the allocated memory of the bucket.

[0229] In another embodiment of the present invention, the device further includes:

[0230] The first storage unit is used to put the second pointer address into the deactivated pointer record list when the address pointed to by the descriptor pointer has not been updated to the second pointer address;

[0231] The first release unit is used to release the first pointer address in the list of undeactivated pointer records.

[0232] In another embodiment of the present invention, the execution unit 803 of the device includes:

[0233] The read subunit is used to read the record information of incomplete write operations recorded in the first descriptor data;

[0234] The fifth determining subunit is used to determine the write bucket based on the recorded information, and to determine the write position in the write bucket;

[0235] The update subunit is used to update the write information in the record information to the memory corresponding to the write position, and mark the write operation as complete.

[0236] In another embodiment of the present invention, the device further includes:

[0237] A receiving unit is used to receive a deletion request sent by the caller for the dynamic array;

[0238] The third determining unit is used to determine the address currently pointed to by the descriptor pointer of the dynamic array as the address of the third pointer;

[0239] The fourth determining unit is used to determine the third descriptor data corresponding to the third pointer address, and to store the third pointer address into a preset list of undisabled pointer records;

[0240] The deletion unit is used to determine the data to be deleted in the dynamic array after performing the incomplete write operation recorded in the third descriptor data, and delete the data to be deleted from the dynamic array to obtain a new dynamic array;

[0241] The second storage unit is used to generate fourth descriptor data and the fourth pointer address of the fourth descriptor data based on the new dynamic array, and to store the fourth pointer address into the list of undisabled pointer records.

[0242] The moving unit is configured to, when the address pointed to by the descriptor pointer is updated to the address of the fourth pointer, move the third pointer address from the list of undisabled pointer records to the list of disabled pointer records, remove the fourth pointer address from the list of undisabled pointer records, and return the deleted data.

[0243] In another embodiment of the present invention, the device further includes:

[0244] The third storage unit is used to store the fourth pointer address into the deactivated pointer record list when the address pointed to by the descriptor pointer has not been updated to the fourth pointer address.

[0245] The second release unit is used to release the third pointer address in the list of undisabled pointer records.

[0246] A storage medium comprising stored instructions, wherein, when the instructions are executed, the device in which the storage medium resides executes the data processing method described above.

[0247] An electronic device includes a memory and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors using the data processing method described above.

[0248] This invention also provides a storage medium, which includes stored instructions, wherein the execution of the instructions controls the device where the storage medium is located to perform the above-described data processing method.

[0249] This invention also provides an electronic device, the structural schematic of which is shown below. Figure 14As shown, it specifically includes a memory 901 and one or more instructions 902, wherein one or more instructions 902 are stored in the memory 901 and configured to be executed by one or more processors 903 to perform the above-mentioned data processing method.

[0250] The specific implementation processes and derivative methods of the above embodiments are all within the protection scope of this invention.

[0251] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0252] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0253] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method, characterized in that, include: When an insertion request for a dynamic array is received from the caller, the address currently pointed to by the descriptor pointer of the dynamic array is determined as the first pointer address; Determine the first descriptor data corresponding to the first pointer address, and store the first pointer address in a preset list of undisabled pointer records; After reading the write information of the incomplete write operations recorded in the first descriptor data and writing the data to the corresponding storage location of the dynamic array based on the write information, memory is allocated for the inserted data provided by the caller, and the insertion position of the inserted data is determined. Based on the inserted data and the insertion position, generate second descriptor data and a second pointer address for the second descriptor data, and store the second pointer address in the list of undisabled pointer records; When the address pointed to by the descriptor pointer is updated to the second pointer address, the first pointer address is moved from the list of undisabled pointer records to a preset list of disabled pointer records, and the second pointer address is removed from the list of undisabled pointer records. Then, the write operation is performed on the data recorded at the address pointed to by the updated descriptor pointer.

2. The method according to claim 1, characterized in that, The step of determining memory allocation for the inserted data provided by the caller includes: Determine the bucket to which the inserted data belongs, and obtain the memory address pointer of the bucket; Determine whether the memory address pointer is null; When it is determined that the memory address pointer is not null, the memory pointed to by the memory address pointer is determined and the memory is determined as the allocated memory of the bucket; When it is determined that the memory address pointer is null, the memory size of the bucket is determined, and the memory block corresponding to the memory size is determined; The memory address pointer is updated based on the address information of the memory block. When the memory address pointer is successfully updated, the memory block is determined to be the allocated memory of the bucket.

3. The method according to claim 1, characterized in that, Also includes: When the address pointed to by the descriptor pointer is not updated to the second pointer address, the second pointer address is added to the deactivated pointer record list; Release the first pointer address in the list of undeactivated pointer records.

4. The method according to claim 1, characterized in that, The step of reading the write information of incomplete write operations recorded in the first descriptor data, and writing the data to the corresponding storage location of the dynamic array based on the write information, includes: Read the record information of incomplete write operations recorded in the first descriptor data; Based on the recorded information, the write bucket is determined, and the write position within the write bucket is determined; The write information in the recorded information is updated to the memory corresponding to the write location, and the write operation is marked as complete.

5. The method according to claim 1, characterized in that, Also includes: Receive the deletion request sent by the caller for the dynamic array; The address currently pointed to by the descriptor pointer of the dynamic array is determined as the address of the third pointer; Determine the third descriptor data corresponding to the third pointer address, and store the third pointer address in a preset list of undisabled pointer records; After executing the incomplete write operation recorded in the third descriptor data, the data to be deleted is determined in the dynamic array, and the deleted data is removed from the dynamic array to obtain a new dynamic array; The fourth descriptor data and the fourth pointer address of the fourth descriptor data are generated based on the new dynamic array, and the fourth pointer address is stored in the list of undisabled pointer records. When the address pointed to by the descriptor pointer is updated to the address of the fourth pointer, the address of the third pointer is moved from the list of undisabled pointer records to the list of disabled pointer records, and the address of the fourth pointer is removed from the list of undisabled pointer records, and the deleted data is returned.

6. The method according to claim 5, characterized in that, Also includes: When the address pointed to by the descriptor pointer is not updated to the address of the fourth pointer, the address of the fourth pointer is stored in the list of disabled pointer records; Release the third pointer address in the list of undeactivated pointer records.

7. A data processing apparatus, characterized in that, include: The first determining unit is used to determine the address currently pointed to by the descriptor pointer of the dynamic array as the first pointer address when it receives an insertion request sent by the caller for the dynamic array; The second determining unit is used to determine the first descriptor data corresponding to the first pointer address, and to store the first pointer address into a preset list of undisabled pointer records; The execution unit is used to read the write information of the incomplete write operation recorded in the first descriptor data, and write the data into the corresponding storage location of the dynamic array based on the write information, and then determine the memory allocation for the insertion data provided by the caller, and determine the insertion position of the insertion data. The generation unit is used to generate second descriptor data and a second pointer address of the second descriptor data based on the inserted data and the insertion position, and store the second pointer address in the list of undisabled pointer records; The removal unit is configured to, when the address pointed to by the descriptor pointer is updated to the second pointer address, move the first pointer address from the list of undisabled pointer records to a preset list of disabled pointer records, remove the second pointer address from the list of undisabled pointer records, and perform a write operation on the data recorded at the address pointed to by the updated descriptor pointer.

8. The apparatus according to claim 7, characterized in that, The execution unit includes: The first determining subunit is used to determine the bucket to which the inserted data belongs and to obtain the memory address pointer of the bucket; The judgment subunit is used to determine whether the memory address pointer is null; The second determining subunit is used to determine the memory pointed to by the memory address pointer when it is determined that the memory address pointer is not null, and to determine the memory as the allocated memory of the bucket. The third determining subunit is used to determine the memory size of the bucket and the memory block corresponding to the memory size when the memory address pointer is determined to be null. The fourth determining subunit is used to update the memory address pointer based on the address information of the memory block. When the memory address pointer is successfully updated, the memory block is determined to be the allocated memory of the bucket.

9. A storage medium, characterized in that, The storage medium includes stored instructions, wherein, when the instructions are executed, the device containing the storage medium is controlled to perform the data processing method as described in any one of claims 1-6.

10. An electronic device, characterized in that, It includes a memory, and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors as described in any one of claims 1-6.