A data traversal method and device based on embedded system

By querying and executing task requests during the data traversal process in the embedded system, the waiting time caused by the mutex lock is avoided, the data traversal efficiency is improved, and the long task waiting time during the hash structure traversal process in the embedded real-time system is solved. problem.

CN113836366BActive Publication Date: 2024-10-25GUANGZHOU ZHIYUAN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110949930.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-18
Publication Date
2024-10-25
Estimated Expiration
2041-08-18

AI Technical Summary

Technical Problem

In embedded real-time systems, the use of mutex locks during the data traversal process of hash structures results in long waiting times for other operation tasks, affecting the efficiency of data storage and task scheduling.

Method used

During the data traversal process, the task request is queried after each unit space is traversed. If the task request is queried, the task will be executed and the traversal will continue. If the task request cannot be queried, the traversal will continue. This avoids cumbersome adding and unlocking operations and pre- Allocate cache space to optimize data retrieval.

Benefits of technology

It improves the efficiency and effectiveness of data traversal, avoids long waiting for other tasks, and optimizes the data access performance in real-time systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113836366B_ABST
    Figure CN113836366B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data traversal method and device based on an embedded system. The technical solution provided by the embodiment of the present application creates a data storage object space, the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data; the data storage object space is traversed, and the traversal direction is from the data table area to the pre-allocated area; after each traversal of a unit space, a task request query is performed; if a task request is found, the task is executed, and the traversal continues after the task is executed; if no task request is found, the traversal continues. The embodiment of the present application can query and execute other tasks in a traversal process, avoiding long waiting times for other tasks, and avoiding cumbersome locking and unlocking operations, thereby improving the efficiency and effectiveness of data traversal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data traversal technology, and more particularly to a data traversal method and device based on an embedded system. Background Art

[0002] For building a database for an embedded real-time system, the hash structure has efficient search performance and can greatly improve data storage efficiency.

[0003] In a traditional hash structure, once a data conflict occurs, a common method is to create a linked list in the conflicting unit so that one hash unit can accommodate multiple data. When performing data traversal, the linked list must be traversed in the unit with multiple data. At this time, if operations such as inserting or deleting are performed on the data being traversed on the linked list, the traversal operation may be damaged.

[0004] In embedded real-time systems, the usual solution is to add a mutex lock during hash traversal, so that users cannot perform operations such as adding and deleting during traversal. If there is too much data in the hash table, the traversal time will be too long, making it impossible to perform operations such as insertion and deletion for a long time.

[0005] In the hash storage structure, many operations rely on traversal, such as clearing the hash table, rehashing, etc. However, during the traversal process, the database of the embedded real-time system cannot perform other operations, which will lead to a decrease in data storage and task scheduling efficiency. Summary of the invention

[0006] The embodiment of the present application provides a data traversal method and device based on an embedded system, which can solve the problem that adding a mutex lock during the data traversal process causes a long waiting time for other operation tasks, thereby improving the efficiency and effectiveness of data traversal.

[0007] In a first aspect, an embodiment of the present application provides a data traversal method based on an embedded system, comprising:

[0008] Creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data;

[0009] Traverse the data storage object space from the data table area to the pre-allocated area;

[0010] After traversing each unit space, a task request query is performed;

[0011] If a task request is found, the task is executed and the traversal continues after the task is executed;

[0012] If no task request is found, continue traversing.

[0013] Furthermore, the data is hash structure data, and the data traversal method based on the embedded system is specifically:

[0014] Creating a hash storage object space, wherein the hash storage object space is divided into a hash table area and a pre-allocated area, and the hash storage object space is a unit space set for storing data;

[0015] Traverse the hash storage object space, and the traversal order direction is from the hash table area to the pre-allocated area;

[0016] After traversing each unit space, a task request query is performed;

[0017] If a task request is found, the task is executed and the traversal continues after the task is executed;

[0018] If no task request is found, continue traversing.

[0019] Further, the task request includes adding data tasks and deleting data tasks;

[0020] If a task request is found, the task is executed, and the traversal continues after the task is executed, specifically:

[0021] If a task of adding data is found, it is determined whether there is a hash conflict when adding data to the hash table area. The hash conflict is a conflict that occurs when adding data to the unit space where data to be added already exists.

[0022] If there is no hash conflict, the data to be added is added to the hash table area;

[0023] If there is a hash conflict, the data to be added is added to the pre-allocated area, and the area to be allocated is linked to the hash table area;

[0024] If a data deletion task is found, the data in the corresponding unit space will be deleted directly.

[0025] Further, an iterator object is created, wherein the iterator object has a cache space;

[0026] The key-value pairs in the traversed unit space are stored in the cache space in the iterator object so that the user end can obtain the traversed data;

[0027] If all the key-value pair data in the iterator object cache space have been obtained by the user end, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the traversed unit space will be stored in the cache space of the iterator object.

[0028] Furthermore, the data is any one of hash structure data, list structure data and array structure data.

[0029] Further, an iterator object is created, wherein the iterator object has a cache space;

[0030] The key-value pairs in the traversed unit space are stored in the cache space in the iterator object so that the user end can obtain the traversed data;

[0031] If all the key-value pair data in the iterator object cache space have been obtained by the user end, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the traversed unit space will be stored in the cache space of the iterator object.

[0032] Furthermore, the data storage object space is divided into a data table area and a pre-allocated area, specifically:

[0033] The data storage object space is divided into a data table area and a pre-allocated area, and the space of the pre-allocated area is twice the space of the data table area.

[0034] In a second aspect, an embodiment of the present application provides a data traversal device based on an embedded system, comprising: a storage object space creation module, used to create a data storage object space, the data storage object space is divided into a data table area and a pre-allocated area, the data storage object space is a unit space set for storing data;

[0035] The traversal module is used to traverse the data storage object space, and the traversal direction is from the data table area to the pre-allocated area; after each traversal of a unit space, a task request query is performed, and the unit space stores the corresponding data information; if the task request is queried, the task is executed, and the traversal continues after the task is executed; if the task request is not queried, the traversal continues.

[0036] Furthermore, the storage object space creation module is also used to create a hash storage object space, the hash storage object space is divided into a hash table area and a pre-allocated area, and the hash storage object space is a unit space set for storing data;

[0037] Furthermore, the traversal module is also used to traverse the hash storage object space, and the traversal order is from the hash table area to the pre-allocated area; after traversing each unit space, a task request query is performed; if a task request is found, the task is executed, and the traversal continues after the task is executed; if no task request is found, the traversal continues.

[0038] Furthermore, the data traversal device based on the embedded system also includes a task request query module, and the task request query module is used for the task requests including adding data tasks and deleting data tasks; if the task request is queried, the task is executed, and the traversal continues after the task is executed, specifically: if the task of adding data is queried, it is determined whether there is a hash conflict in adding data to the hash table area, and the hash conflict is that there is already data in the unit space of the data to be added, and the conflict occurs when the data to be added is added to the unit space; if there is no hash conflict, the data to be added is added to the hash table area; if there is a hash conflict, the data to be added is added to the pre-allocated area, and the area to be allocated is linked to the hash table area; if the task of deleting data is queried, the data in the corresponding unit space is directly deleted.

[0039] Furthermore, the data traversal device based on the embedded system also includes an iterator module, which is used to create an iterator object, and there is a cache space in the iterator object; the key-value pairs in the traversed unit space are stored in the cache space in the iterator object for the user end to obtain the traversal data; if all the key-value pair data in the cache space of the iterator object are obtained by the user end, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the unit space obtained by the traversal will be stored in the cache space of the iterator object.

[0040] Furthermore, the data is any one of hash structure data, list structure data and array structure data.

[0041] Furthermore, the iterator module is used to create an iterator object, which has a cache space; the key-value pairs in the traversed unit space are stored in the cache space of the iterator object so that the user terminal can obtain the traversal data; if all the key-value pair data in the cache space of the iterator object have been obtained by the user terminal, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the unit space obtained by the traversal will be stored in the cache space of the iterator object.

[0042] Furthermore, the storage object space creation module is also used to divide the data storage object space into a data table area and a pre-allocated area, and the space of the pre-allocated area is twice the space of the data table area.

[0043] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0044] memory and one or more processors;

[0045] The memory is used to store one or more programs;

[0046] When the one or more programs are executed by the one or more processors, the one or more processors implement the data traversal method based on the embedded system as described in the first aspect.

[0047] In a fourth aspect, an embodiment of the present application provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to execute the data traversal method based on an embedded system as described in the first aspect.

[0048] In the embodiment of the present application, during the traversal process, after each traversal of a unit space, a task request query is performed. If a task request is found, the task is executed and the traversal continues. If no task request is found, the traversal continues. By adopting the above technical means, other tasks can be queried and executed during a traversal process, avoiding long waiting time for other tasks and tedious unlocking and unlocking operations, thereby improving the efficiency and effectiveness of data traversal. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is a flow chart of a data traversal method based on an embedded system provided in Embodiment 1 of the present application;

[0050] Figure 2 This is a schematic diagram of creating a storage space provided in Example 1 of the present application;

[0051] Figure 3 This is a schematic diagram of no hash conflict provided in Example 1 of the present application;

[0052] Figure 4 This is a schematic diagram of a hash conflict provided in Example 1 of the present application;

[0053] Figure 5 This is a schematic diagram of the traversal direction provided in Example 1 of the present application;

[0054] Figure 6 It is a structural diagram of a data traversal device based on an embedded system provided in Embodiment 2 of the present application;

[0055] Figure 7 It is a structural schematic diagram of an electronic device provided in Example 3 of the present application. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0057] The data traversal method and device based on embedded system provided by the present application are aimed at performing task request query after each unit space is traversed during the traversal process, and continuing the traversal after the task request is queried, and continuing the traversal if the task request is not queried. In this way, the query and execution of tasks in a traversal process are realized, and cumbersome locking and unlocking operations are avoided, thereby improving the efficiency and effectiveness of data traversal. Compared with the traditional data traversal method, it is usually to add a mutex lock in the traversal process so that the user cannot perform operations such as adding and deleting when performing the traversal. If the traversed data is large, it will cause a long traversal time, so that operations such as adding and deleting cannot be performed for a long time, and the performance of the task is reduced. If a separate locking and unlocking operation is performed on each unit of the traversal, it will cause a large amount of additional overhead. Based on this, the data traversal method based on embedded system of the present application embodiment is provided to solve the problem of long waiting time for other operation tasks caused by adding mutexes in the existing data traversal process.

[0058] Embodiment 1:

[0059] Figure 1 A flowchart of a data traversal method based on an embedded system provided in the first embodiment of the present application is given. The data traversal method based on an embedded system provided in this embodiment can be executed by a data traversal device based on an embedded system. The data traversal device based on an embedded system can be implemented by software and / or hardware. The data traversal device based on an embedded system can be composed of two or more physical entities, or can be composed of one physical entity. Generally speaking, the data traversal device based on an embedded system can be a smart terminal device, etc.

[0060] Reference Figure 1 , the data traversal method based on the embedded system specifically includes:

[0061] S101. Create a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data.

[0062] Specifically, the data is any one of hash structure data, list structure data and array structure data.

[0063] Specifically, the data storage object space is divided into a data table area and a pre-allocated area, and the space of the pre-allocated area is twice the space of the data table area.

[0064] Further, see Figure 2 , the data is hash structure data, a hash storage object space is created, the hash storage object space is divided into hash table area 1 and pre-allocated area 2, and the hash storage object space is a unit space set for storing data. When creating a hash data storage object, first preset 3 times the hash data table capacity space, of which 1 times the hash data table capacity space is the hash table area 1 space, and 2 times the hash data table capacity space is the pre-allocated area 2 space.

[0065] S102, traverse the data storage object space, and the traversal direction is from the data table area to the pre-allocated area; after traversing each unit space, perform a task request query; if a task request is found, perform the task, and continue traversal after executing the task; if no task request is found, continue traversal.

[0066] Specifically, the data is hash structure data, and the hash storage object space is traversed, and the traversal order is from hash table area 1 to pre-allocated area 2; after each unit space is traversed, a task request query is performed; if a task request is found, the task is executed, and the traversal continues after the task is executed; if no task request is found, the traversal continues.

[0067] Specifically, the task request includes a task of adding data and a task of deleting data; if a task of adding data is queried, it is determined whether there is a hash conflict in adding data to the hash table area, and the hash conflict is that there is already data in the unit space of the data to be added, and a conflict occurs when the data to be added is added to the unit space; if there is no hash conflict, the data to be added is added to the hash table area; if there is a hash conflict, the data to be added is added to the pre-allocated area, and the area to be allocated is linked to the hash table area; if a task of deleting data is queried, the data in the corresponding unit space is directly deleted.

[0068] Specifically, refer to Figure 3, when the task request is found to be a data adding task request, the adding task is to add data A and data B to the hash structure; when there is no data in the unit space of the hash table area corresponding to the data A and B to be added, there is no hash conflict, and the data A and B to be added are directly stored in the hash table area 1. When data A already exists in the unit space of the hash table area corresponding to the data C to be added, it is a hash conflict, and the data C to be added cannot be stored in the unit space corresponding to the hash table area where the data A is located, then the data C to be added is added to the unit space in the pre-allocated area 2, and the area 2 to be allocated is linked to the hash table area 1.

[0069] Exemplarily, the embedded real-time system is a multi-task system, which allows the key-value database to be implemented in the form of background tasks, and can convert traversal, addition and other operations into task requests. When the database is started, a corresponding task is created to wait for the task request instruction of the user end to be executed. If the task request instruction is queried, the corresponding task request is executed. If the task request is not queried, the internal operations such as waiting or data refresh are blocked. When the database background task performs the traversal operation, in order to prevent the traversal process from being too long, each time a unit is traversed, it is queried whether there are other task requests. If other task requests are queried, the execution task is inserted to execute the task. After the execution task is completed, the traversal continues. If no other task requests are queried, the traversal continues. Through the above method, other task requests can be inserted in a traversal process, avoiding cumbersome unlocking operations and improving the work efficiency of the traversal. When the hash traversal is performed, the execution of other short-term tasks such as adding and deleting data is allowed, avoiding long waiting for other tasks, and optimizing the access performance of data in the real-time system; avoiding the performance consumption caused by the separate unlocking operation of each traversal unit in order to allow the CPU to execute during the traversal.

[0070] Further, refer to Figure 4 , the traversal direction is from data table area 1 to pre-allocated area 2; after traversing each unit space, a task request query is performed. When executing the traversal, the traversal is performed in the array structure manner, so each data unit can be traversed. The hash structure itself is unordered, so from the user's perspective, there is no difference between the hash structure data traversal and the array structure data traversal. The array structure traversal does not need to maintain the integrity of the linked list during the traversal, and inserting and deleting data will not lead to unpredictable consequences. Since the pre-allocated area space is pre-allocated, it is no longer necessary to allocate space from the hash table area memory heap when a hash conflict occurs, thereby avoiding external fragmentation caused by frequent requests for memory release.

[0071] Furthermore, a new recording task is created before a traversal task starts. The recording task records the relative change position segments where other addition or deletion task requests have occurred. The data of the relative change position segments where other addition or deletion task requests have occurred are re-queried to verify the accuracy of the traversal data.

[0072] For example, refer to Figure 4 Before the traversal task starts, a new recording task is created to record the relative change position segment where other addition or deletion task requests have occurred. For example, after traversing spatial data C, an addition task is executed, and the added data is between the unit spaces where data A and data C are located. Then, the position segment between the unit spaces where data A and data C are located is recorded through the recording task. After all unit spaces are traversed, the data in the position segment between the unit spaces where data A and data C are located is queried to verify the accuracy of the traversal data.

[0073] Furthermore, the data is any one of hash structure data, list structure data and array structure data. An iterator object is created, and a cache space exists in the iterator object; the key-value pairs in the traversed unit space are stored in the cache space in the iterator object, so that the user end can obtain the traversed data; if all the key-value pair data in the cache space of the iterator object are obtained by the user end, the traversal continues from the last unit space of the previous traversal, and the key-value pair data in the unit space obtained by the traversal is stored in the cache space of the iterator object.

[0074] Specifically, data traversal usually provides a callback function, and executes the user callback when traversing each data unit. However, since the database is run as a single background task, if the user is not familiar with the mechanism and performs too many time-consuming operations in the callback function, the overall data efficiency will be reduced. In this way, the user can obtain data through the iterator traversal method. When the user uses the iterator to obtain data, an iterator object is created, and there is a cache space in the iterator object; the interface for obtaining data from the iterator is called, and the key-value pairs in the traversed unit space are stored in the cache space in the iterator object, and then returned, waiting for the user to use the iterator to obtain data next time. When the user obtains data in the iterator, it is first searched and obtained from the cache space in the iterator object. If the key-value pairs in the cache space have been obtained by the user, then continue to traverse from the last unit space of the previous traversal, and store the key-value pair data in the unit space obtained by the traversal in the cache space of the iterator object. The iterator traversal method optimizes the performance consumption caused by the locking operation. Because it pre-allocates a buffer, multiple data can be obtained by accessing the database with a lock, which reduces the frequency of lock access. Because the buffer is unique to the iterator and not managed by the database, the key-value pair access in the buffer does not need to be locked. In addition, in addition to hash structure data, embedded system data often needs to provide list structure data, array structure data, etc. Iterators can provide a unified traversal method to reduce the complexity of the interface.

[0075] In the above process, after each unit space is traversed, a task request query is performed. If a task request is found, the task is executed and the traversal continues. If no task request is found, the traversal continues. By adopting the above technical means, other tasks can be queried and executed during a traversal process, avoiding long waiting time for other tasks and tedious unlocking and unlocking operations, thereby improving the efficiency and effectiveness of data traversal.

[0076] Embodiment 2:

[0077] Based on the above embodiments, Figure 5 This is a schematic diagram of the structure of a data traversal device based on an embedded system provided in the second embodiment of the present application. Figure 6 The data traversal device based on the embedded system provided in this embodiment specifically includes: a storage object space creation module 21 and a traversal module 22.

[0078] The storage object space creation module 22 is used to create a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data;

[0079] The traversal module 23 is used to traverse the data storage object space, and the traversal direction is from the data table area to the pre-allocated area; after each traversal of a unit space, a task request query is performed, and the unit space stores the corresponding data information; if the task request is queried, the task is executed, and the traversal continues after the task is executed; if the task request is not queried, the traversal continues.

[0080] Furthermore, the storage object space creation module 22 is also used to create a hash storage object space, the hash storage object space is divided into a hash table area and a pre-allocated area, and the hash storage object space is a unit space set for storing data;

[0081] Furthermore, the traversal module 23 is also used to traverse the hash storage object space, and the traversal order direction is from the hash table area to the pre-allocated area; after traversing each unit space, a task request query is performed; if a task request is found, the task is executed, and the traversal continues after the task is executed; if no task request is found, the traversal continues.

[0082] Furthermore, the data traversal device based on the embedded system also includes a task request query module, and the task request query module is used for the task requests including adding data tasks and deleting data tasks; if the task request is queried, the task is executed, and the traversal continues after the task is executed, specifically: if the task of adding data is queried, it is determined whether there is a hash conflict in adding data to the hash table area, and the hash conflict is that there is already data in the unit space of the data to be added, and the conflict occurs when the data to be added is added to the unit space; if there is no hash conflict, the data to be added is added to the hash table area; if there is a hash conflict, the data to be added is added to the pre-allocated area, and the area to be allocated is linked to the hash table area; if the task of deleting data is queried, the data in the corresponding unit space is directly deleted.

[0083] Furthermore, the data traversal device based on the embedded system also includes an iterator module, which is used to create an iterator object, and there is a cache space in the iterator object; the key-value pairs in the traversed unit space are stored in the cache space in the iterator object for the user end to obtain the traversal data; if all the key-value pair data in the cache space of the iterator object are obtained by the user end, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the unit space obtained by the traversal will be stored in the cache space of the iterator object.

[0084] Furthermore, the data is any one of hash structure data, list structure data and array structure data.

[0085] Furthermore, the iterator module is used to create an iterator object, which has a cache space; the key-value pairs in the traversed unit space are stored in the cache space of the iterator object so that the user terminal can obtain the traversal data; if all the key-value pair data in the cache space of the iterator object have been obtained by the user terminal, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the unit space obtained by the traversal will be stored in the cache space of the iterator object.

[0086] Furthermore, the storage object space creation module 22 is further used to divide the data storage object space into a data table area and a pre-allocated area, and the space of the pre-allocated area is twice the space of the data table area.

[0087] In the above process, after each unit space is traversed, a task request query is performed. If a task request is found, the task is executed and the traversal continues. If no task request is found, the traversal continues. By adopting the above technical means, other tasks can be queried and executed during a traversal process, avoiding long waiting time for other tasks and tedious unlocking and unlocking operations, thereby improving the efficiency and effectiveness of data traversal.

[0088] The data traversal device based on an embedded system provided in the second embodiment of the present application can be used to execute the data traversal method based on an embedded system provided in the first embodiment above, and has corresponding functions and beneficial effects.

[0089] Embodiment three:

[0090] Embodiment 3 of the present application provides an electronic device, referring to Figure 6 The electronic device includes: a processor 31, a memory 32, a communication module 33, an input device 34 and an output device 35. The number of processors in the electronic device can be one or more, and the number of memories in the electronic device can be one or more. The processor, memory, communication module, input device and output device of the electronic device can be connected via a bus or other means.

[0091] The memory 32, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the data traversal method based on the embedded system described in any embodiment of the present application (for example, the storage object space creation module and the traversal module in the data traversal device based on the embedded system). The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0092] The communication module 33 is used for data transmission.

[0093] The processor 31 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory, that is, realizes the above-mentioned data traversal method based on the embedded system.

[0094] The input device 34 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 35 may include a display device such as a display screen.

[0095] The electronic device provided above can be used to execute the data traversal method based on the embedded system provided in the above embodiment 1, and has corresponding functions and beneficial effects.

[0096] Embodiment 4:

[0097] An embodiment of the present application also provides a storage medium containing computer executable instructions, which are used to execute a data traversal method based on an embedded system when executed by a computer processor. The data traversal method based on an embedded system includes: creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data; traversing the data storage object space, and the traversal direction is from the data table area to the pre-allocated area; after each unit space is traversed, a task request query is performed; if a task request is queried, the task is executed, and the traversal continues after the task is executed; if no task request is found, the traversal continues.

[0098] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.

[0099] Of course, the storage medium containing computer executable instructions provided in an embodiment of the present application, whose computer executable instructions are not limited to the data traversal method based on the embedded system as described above, can also execute related operations in the data traversal method based on the embedded system provided in any embodiment of the present application.

[0100] The data traversal device based on the embedded system, storage medium and electronic device provided in the above embodiments can execute the data traversal method based on the embedded system provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the data traversal method based on the embedded system provided in any embodiment of the present application.

[0101] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A data traversal method based on an embedded system, characterized in that: include: Creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data; Traverse the data storage object space from the data table area to the pre-allocated area; After each unit space is traversed, a task request query is performed, and the task request includes adding data tasks and deleting data tasks; If a task request is found, the task is executed to add or delete data to the cell space in the data table area or the pre-allocated area, and the traversal is continued after the task is executed; If no task request is found, continue traversing.

2. The data traversal method based on embedded system according to claim 1, characterized in that: The data is hash structure data, and the data traversal method based on the embedded system is specifically as follows: Creating a hash storage object space, wherein the hash storage object space is divided into a hash table area and a pre-allocated area, and the hash storage object space is a unit space set for storing data; Traverse the hash storage object space, and the traversal order direction is from the hash table area to the pre-allocated area; After traversing each unit space, a task request query is performed; If a task request is found, the task is executed and the traversal continues after the task is executed; If no task request is found, continue traversing.

3. The data traversal method based on embedded system according to claim 2, characterized in that: The task request includes adding data tasks and deleting data tasks; If a task request is found, the task is executed, and the traversal continues after the task is executed, specifically: If a task of adding data is found, it is determined whether there is a hash conflict when adding data to the hash table area. The hash conflict is a conflict that occurs when adding data to the unit space where data to be added already exists. If there is no hash conflict, the data to be added is added to the hash table area; If there is a hash conflict, the data to be added is added to the pre-allocated area, and the area to be allocated is linked to the hash table area; If a data deletion task is found, the data in the corresponding unit space will be deleted directly.

4. The data traversal method based on embedded system according to claim 2, characterized in that: Creating an iterator object, wherein the iterator object has a cache space; The key-value pairs in the traversed unit space are stored in the cache space in the iterator object so that the user end can obtain the traversed data; If all the key-value pair data in the iterator object cache space have been obtained by the user end, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the traversed unit space will be stored in the cache space of the iterator object.

5. The data traversal method based on embedded system according to claim 1, characterized in that: The data is any one of hash structure data, list structure data and array structure data.

6. The data traversal method based on embedded system according to claim 5, characterized in that: Creating an iterator object, wherein the iterator object has a cache space; The key-value pairs in the traversed unit space are stored in the cache space in the iterator object so that the user end can obtain the traversed data; If all the key-value pair data in the iterator object cache space have been obtained by the user end, the traversal will continue from the last unit space of the previous traversal, and the key-value pair data in the traversed unit space will be stored in the cache space of the iterator object.

7. The data traversal method based on embedded system according to claim 1, characterized in that: The data storage object space is divided into a data table area and a pre-allocated area, specifically: The data storage object space is divided into a data table area and a pre-allocated area, and the space of the pre-allocated area is twice the space of the data table area.

8. A data traversal device based on an embedded system, characterized in that: include: A storage object space creation module, used to create a data storage object space, the data storage object space is divided into a data table area and a pre-allocated area, and the data storage object space is a unit space set for storing data; A traversal module is used to traverse the data storage object space, and the traversal direction is from the data table area to the pre-allocated area; After traversing each unit space, a task request query is performed, and the task request includes adding data tasks and deleting data tasks. The unit space stores corresponding data information; if the task request is queried, the task is executed to add or delete data in the unit space in the data table area or the pre-allocated area, and the traversal is continued after the task is executed; if the task request is not queried, the traversal is continued.

9. An electronic device, characterized in that: include: memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to perform the method according to any one of claims 1 to 7.