CN113836366A - Data traversal method and device based on embedded system - Google Patents

Data traversal method and device based on embedded system Download PDF

Info

Publication number
CN113836366A
CN113836366A CN202110949930.1A CN202110949930A CN113836366A CN 113836366 A CN113836366 A CN 113836366A CN 202110949930 A CN202110949930 A CN 202110949930A CN 113836366 A CN113836366 A CN 113836366A
Authority
CN
China
Prior art keywords
data
space
task
hash
traversing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110949930.1A
Other languages
Chinese (zh)
Inventor
周立功
翁叶冬
魏科
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Zhiyuan Electronics Co Ltd
Original Assignee
Guangzhou Zhiyuan Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Zhiyuan Electronics Co Ltd filed Critical Guangzhou Zhiyuan Electronics Co Ltd
Priority to CN202110949930.1A priority Critical patent/CN113836366A/en
Publication of CN113836366A publication Critical patent/CN113836366A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9014Indexing; Data structures therefor; Storage structures hash tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a data traversal method and device based on an embedded system. According to the technical scheme provided by the embodiment of the application, a data storage object space is created and divided into a data table area and a pre-allocation area, wherein the data storage object space is a unit space set for storing data; traversing the data storage object space, wherein the traversing direction is from the data table area to the pre-allocation area; when one unit space is traversed, task request query is carried out; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse. According to the embodiment of the application, other tasks can be inquired and executed in a traversal process, long-time waiting of other tasks is avoided, and meanwhile, complicated locking and unlocking operations are avoided, so that the efficiency and effectiveness of data traversal are improved.

Description

Data traversal method and device based on embedded system
Technical Field
The embodiment of the application relates to the technical field of data traversal, in particular to a data traversal method and device based on an embedded system.
Background
For establishing a database of an embedded real-time system, the hash structure has high-efficiency searching performance, and the storage efficiency of data can be greatly improved.
In the conventional hash structure, once a data collision occurs, a common way is to make a linked list in the colliding units, so that one hash unit can hold multiple data. When performing a data traversal, a linked list traversal is performed in cells with multiple data. At this time, if the operation such as insertion or deletion is performed on the data being traversed on the linked list, the traversal operation may be damaged.
In an embedded real-time system, a mutual exclusion lock is added in a common solution during hash traversal, so that a user cannot perform operations such as addition and deletion during traversal, if too much data is in a hash table, traversal time is too long, and operations such as insertion and deletion cannot be performed for a long time.
In the hash storage structure, many operations need to depend on traversal, such as clearing a hash table, re-hashing, and the like, and the failure to perform other operations in the traversal process of the database of the embedded real-time system may cause the reduction of data storage and task scheduling efficiency.
Disclosure of Invention
The embodiment of the application provides a data traversal method and device based on an embedded system, which can solve the problem of long waiting time of other operation tasks caused by adding a mutual exclusion lock in a data traversal process, and improve the efficiency and effectiveness of data traversal.
In a first aspect, an embodiment of the present application provides a data traversal method based on an embedded system, including:
creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data;
traversing the data storage object space, wherein the traversing direction is from the data table area to the pre-allocation area;
when one unit space is traversed, task request query is carried out;
if the task request is inquired, executing the task, and continuously traversing after executing the task;
and if the task request cannot be inquired, continuing to traverse.
Further, the data is hash structure data, and the data traversal method based on the embedded system specifically includes:
creating a hash storage object space, wherein the hash storage object space is divided into a hash table area and a pre-allocation area, and the hash storage object space is a unit space set for storing data;
traversing the hash storage object space, wherein the traversing sequence direction is from the hash table area to the pre-allocation area;
when one unit space is traversed, task request query is carried out;
if the task request is inquired, executing the task, and continuously traversing after executing the task;
and if the task request cannot be inquired, continuing to traverse.
Further, the task request comprises a data adding task and a data deleting task;
if the task request is inquired, executing the task, and continuously traversing after executing the task, specifically:
if the data adding task is inquired, judging whether hash collision exists in the hash table area after data is added, wherein the hash collision is the collision occurring when the data to be added is added to the unit space and the data to be added already exists in the unit space of the data to be added;
if no hash conflict exists, adding the data to be added to the hash table area;
if the hash conflict exists, adding the data to be added to the pre-distribution area, and linking the area to be distributed into the hash table area;
and if the task of deleting the data is inquired, directly deleting the data in the corresponding unit space.
Further, creating an iterator object, wherein a cache space exists in the iterator object;
storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end;
and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Further, the data is any one of hash structure data, list structure data and array structure data.
Further, creating an iterator object, wherein a cache space exists in the iterator object;
storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end;
and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Further, the data storage object space is divided into a data table area and a pre-allocation area, and specifically includes:
and dividing the data storage object space into a data table area and a pre-allocation area, wherein the space of the pre-allocation area is 2 times of the space of the data table area.
In a second aspect, an embodiment of the present application provides an embedded system-based data traversing apparatus, including: the storage object space creating module is used for creating a data storage object space, the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data;
the traversal module is used for traversing the data storage object space, and the traversal direction is from the data table area to the pre-allocation area; when one unit space is traversed, task request query is carried out, and the unit space stores corresponding data information; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Further, the storage object space creating module is further configured to create a hash storage object space, where the hash storage object space is divided into a hash table area and a pre-allocation area, and the hash storage object space is a unit space set for storing data;
further, the traversal module is further configured to traverse the hash storage object space, where a traversal sequence direction is from the hash table region to the pre-allocation region; when one unit space is traversed, task request query is carried out; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Further, the data traversing device based on the embedded system further comprises a task request query module, wherein the task request query module is used for the task request including data adding task and data deleting task; if the task request is inquired, executing the task, and continuously traversing after executing the task, specifically: if the data adding task is inquired, judging whether hash collision exists in the hash table area after data is added, wherein the hash collision is the collision occurring when the data to be added is added to the unit space and the data to be added already exists in the unit space of the data to be added; if no hash conflict exists, adding the data to be added to the hash table area; if the hash conflict exists, adding the data to be added to the pre-distribution area, and linking the area to be distributed into the hash table area; and if the task of deleting the data is inquired, directly deleting the data in the corresponding unit space.
Further, the data traversing device based on the embedded system further comprises an iterator module, wherein the iterator module is used for creating an iterator object, and a cache space exists in the iterator object; storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end; and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Further, the data is any one of hash structure data, list structure data and array structure data.
Further, the iterator module is configured to create an iterator object, where a cache space exists in the iterator object; storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end; and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Further, the storage object space creating module is further configured to divide the data storage object space into a data table area and a pre-allocation area, where the pre-allocation area space is 2 times of the data table area space.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the embedded system-based data traversal method of the first aspect.
In a fourth aspect, embodiments of the present application provide a storage medium containing computer-executable instructions for performing the embedded system-based data traversal method as described in the first aspect when executed by a computer processor.
In the traversing process, the task request is queried every time one unit space is traversed, if the task request is queried, the traversal is continued after the task is executed, and if the task request is not queried, the traversal is continued. By adopting the technical means, other tasks can be inquired and executed in one traversal process, long-time waiting of other tasks is avoided, and meanwhile, complicated locking and unlocking operations are avoided, so that the efficiency and effectiveness of data traversal are improved.
Drawings
Fig. 1 is a flowchart of a data traversal method based on an embedded system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of creating a storage space according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a hash collision free method according to an embodiment of the present application;
fig. 4 is a schematic diagram of a hash collision according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a traversal direction provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a data traversing apparatus based on an embedded system according to a second embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, specific embodiments of the present application will be described in detail with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some but not all of the relevant portions of the present application are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
According to the data traversal method and device based on the embedded system, in the traversal process, task request query is carried out every time one unit space is traversed, if the task request is queried, traversal is carried out after the task is executed, and if the task request is not queried, traversal is carried out continuously. Therefore, the task is inquired and executed in a traversal process, and the complex locking and unlocking operation is avoided, so that the efficiency and the effectiveness of data traversal are improved. Compared with the traditional data traversal mode, the mutual exclusion lock is usually added in the traversal process, so that the user cannot perform operations such as addition and deletion when performing traversal. If the traversed data is large, the traversal time is long, operations such as addition and deletion cannot be executed for a long time, the performance of the task is reduced, and if each traversed unit is subjected to independent locking and unlocking operations, a large amount of extra overhead is caused. Therefore, the data traversal method based on the embedded system is provided to solve the problem that the waiting time of other operation tasks is long due to the fact that mutual exclusion is added in the existing data traversal process.
The first embodiment is as follows:
fig. 1 is a flowchart of a data traversal method based on an embedded system according to an embodiment of the present disclosure, where the data traversal method based on an embedded system provided in this embodiment may be executed by a data traversal device based on an embedded system, the data traversal device based on an embedded system may be implemented in a software and/or hardware manner, and the data traversal device based on an embedded system may be formed by two or more physical entities or may be formed by one physical entity. Generally, the data traversing device based on the embedded system can be an intelligent terminal device and the like.
Referring to fig. 1, the data traversal method based on the embedded system specifically includes:
s101, creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data.
Specifically, the data is any one of hash structure data, list structure data, and array structure data.
Specifically, the data storage object space is divided into a data table area and a pre-allocation area, and the pre-allocation area space is 2 times of the data table area space.
Further, referring to fig. 2, the data is hash structure data, a hash storage object space is created, the hash storage object space is divided into a hash table area 1 and a pre-allocation area 2, and the hash storage object space is a unit space set for storing the data. When a hash data storage object is created, 3 times of hash data table capacity space is preset, wherein 1 time of the hash data table capacity space is a hash table area 1 space, and 2 times of the hash data table capacity space is a pre-allocation area 2 space.
S102, traversing the data storage object space, wherein the traversing direction is from a data table area to a pre-allocation area; when one unit space is traversed, task request query is carried out; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Specifically, the data is hash structure data, the hash storage object space is traversed, and the traversal sequence direction is from a hash table area 1 to a pre-allocation area 2; when one unit space is traversed, task request query is carried out; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Specifically, the task request includes a data adding task and a data deleting task; if the data adding task is inquired, judging whether hash collision exists in the hash table area after data is added, wherein the hash collision is the collision occurring when the data to be added is added to the unit space and the data to be added already exists in the unit space of the data to be added; if no hash conflict exists, adding the data to be added to the hash table area; if the hash conflict exists, adding the data to be added to the pre-distribution area, and linking the area to be distributed into the hash table area; and if the task of deleting the data is inquired, directly deleting the data in the corresponding unit space.
Specifically, referring to fig. 3, when the query task request is a data adding task request, the data adding task is to add data a and data B to the hash structure; and when no data exists in the unit space of the hash table area corresponding to the data A and the data B to be added, no hash conflict exists, and the data A and the data B to be added are directly stored in the hash table area 1. When the data a already exists in the unit space of the hash table area corresponding to the data C to be added, the hash collision is a situation, the data C to be added cannot be stored in the position of the unit space where the data a corresponding to the hash table area is located, the data C to be added is added to the unit space in the pre-allocation area 2, and the area 2 to be allocated is linked into the hash table area 1.
Illustratively, the embedded real-time system is a multi-task system, allows the key value database to be realized in a background task mode, and can convert traversal, addition and other operations into a task request mode for carrying out. And creating a corresponding task when the database is started, waiting for executing a task request instruction of the user side, executing a corresponding task request if the task request instruction is inquired, and blocking internal operations such as waiting or executing data refreshing and the like if the task request instruction is not inquired. When the database background task executes traversal operation, in order to prevent the traversal process from being too long, whether other task requests exist is inquired after one unit is traversed, if other task requests exist, the execution task is inserted, the task is executed, after the execution task is completed, traversal is continued, and if no other task requests exist, traversal is continued. By the method, other task requests can be inserted and executed in a traversal process, so that complicated locking and unlocking operations are avoided, and the traversal work efficiency is improved. The method allows other tasks such as adding and deleting data of the data to be executed in a short time during hash traversal, avoids long-time waiting of other tasks, and optimizes the access performance of the data in a real-time system; performance consumption caused by individually executing the lock/unlock operation on each traversal unit in order to yield execution of the CPU during traversal is avoided.
Further, referring to FIG. 4, the traversal direction goes from the data table region 1 to the pre-allocation region 2; and performing task request query every time one unit space is traversed. When traversal is executed, traversal is performed according to an array structure mode, each data unit can be traversed, and the hash structure is unordered, so that the hash structure data traversal mode and the array structure data traversal mode are not different from each other from the user perspective, the integrity of a linked list is not required to be maintained when traversal is performed in the array structure mode, and unpredictable results cannot be caused when insertion and deletion of data are executed. Because the pre-allocation zone space is pre-allocated, the space does not need to be allocated from the hash table zone memory heap when hash collision occurs, thereby avoiding external fragmentation caused by frequent application and release of the memory.
Further, a recording task is newly established before a traversal task starts, the recording task is used for recording the relative change position section of the task request for executing other addition or deletion, and data of the relative change position section of the task request for executing other addition or deletion is inquired again to check the accuracy of the traversal data.
Illustratively, referring to FIG. 4, a recording task is created before the traversal task begins to record the relative change location segments where other task requests to perform additions or deletions occurred. For example, after traversing the spatial data C, an adding task is executed, the added data is between the unit spaces where the data a and the data C are located, the position section between the unit spaces where the data a and the data C are located is recorded by the recording task, and after traversing all the unit spaces, the data in the position section between the unit spaces where the data a and the data C are located is recorded and queried, so as to check the accuracy of the traversed data.
Further, the data is any one of hash structure data, list structure data and array structure data. Creating an iterator object, wherein a cache space exists in the iterator object; storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end; and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Specifically, data traversal usually provides a callback function, and a user callback is executed when each data unit is traversed, but since the database is operated by a single background task, if a user is unfamiliar with the mechanism, too many time-consuming operations are executed in the callback function, the efficiency of the whole data is reduced. Therefore, the data acquisition of the user can be realized in an iterator traversal mode. When a user uses an iterator to acquire data, an iterator object is created, and a cache space exists in the iterator object; and calling an interface for obtaining data by the iterator, storing the key value pairs in the traversed unit space into a cache space in the iterator object, and then returning to wait for the next time when the user obtains data by using the iterator. When a user acquires data in the iterator, the key value pairs in the cache space in the iterator object are preferably searched and acquired, if the key value pairs in the cache space are acquired by the user, the traversal is continued from the last unit space of the previous traversal, and the key value pair data in the unit space obtained through the traversal is stored in the cache space of the iterator object. The method optimizes the performance consumption caused by locking operation by using the iterator traversal mode, and can obtain a plurality of data by one locking access database due to the pre-allocation of a buffer area, thereby reducing the frequency of locking access. In addition, the data of the embedded system often needs to provide list structure data, array structure data and the like besides hash structure data, and the iterator can provide a uniform traversal mode to reduce the complexity of the interface.
In the traversal process, task request query is carried out every time one unit space is traversed, if the task request is queried, the traversal is carried out after the task is executed, and if the task request is not queried, the traversal is continued. By adopting the technical means, other tasks can be inquired and executed in one traversal process, long-time waiting of other tasks is avoided, and meanwhile, complicated locking and unlocking operations are avoided, so that the efficiency and effectiveness of data traversal are improved.
Example two:
on the basis of the foregoing embodiment, fig. 5 is a schematic structural diagram of a data traversing apparatus based on an embedded system according to a second embodiment of the present application. Referring to fig. 6, the data traversing apparatus based on an embedded system provided in this embodiment specifically includes: a storage object space creation module 21 and a traversal module 22.
The storage object space creating module 22 is configured to create a data storage object space, where the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data;
the traversal module 23 is configured to traverse the data storage object space, where the traversal direction is from the data table area to the pre-allocation area; when one unit space is traversed, task request query is carried out, and the unit space stores corresponding data information; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Further, the storage object space creating module 22 is further configured to create a hash storage object space, where the hash storage object space is divided into a hash table area and a pre-allocation area, and the hash storage object space is a unit space set for storing data;
further, the traversal module 23 is further configured to traverse the hash storage object space, where a traversal order direction is from the hash table area to the pre-allocation area; when one unit space is traversed, task request query is carried out; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Further, the data traversing device based on the embedded system further comprises a task request query module, wherein the task request query module is used for the task request including data adding task and data deleting task; if the task request is inquired, executing the task, and continuously traversing after executing the task, specifically: if the data adding task is inquired, judging whether hash collision exists in the hash table area after data is added, wherein the hash collision is the collision occurring when the data to be added is added to the unit space and the data to be added already exists in the unit space of the data to be added; if no hash conflict exists, adding the data to be added to the hash table area; if the hash conflict exists, adding the data to be added to the pre-distribution area, and linking the area to be distributed into the hash table area; and if the task of deleting the data is inquired, directly deleting the data in the corresponding unit space.
Further, the data traversing device based on the embedded system further comprises an iterator module, wherein the iterator module is used for creating an iterator object, and a cache space exists in the iterator object; storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end; and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Further, the data is any one of hash structure data, list structure data and array structure data.
Further, the iterator module is configured to create an iterator object, where a cache space exists in the iterator object; storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end; and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
Further, the storage object space creating module 22 is further configured to divide the data storage object space into a data table area and a pre-allocation area, where the pre-allocation area space is 2 times of the data table area space.
In the traversal process, task request query is carried out every time one unit space is traversed, if the task request is queried, the traversal is carried out after the task is executed, and if the task request is not queried, the traversal is continued. By adopting the technical means, other tasks can be inquired and executed in one traversal process, long-time waiting of other tasks is avoided, and meanwhile, complicated locking and unlocking operations are avoided, so that the efficiency and effectiveness of data traversal are improved.
The data traversing device based on the embedded system provided by the second embodiment of the application can be used for executing the data traversing method based on the embedded system provided by the first embodiment, and has corresponding functions and beneficial effects.
Example three:
an embodiment of the present application provides an electronic device, and with reference to fig. 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 may be one or more, and the number of memories in the electronic device may be one or more. The processor, memory, communication module, input device, and output device of the electronic device may be connected by a bus or other means.
The memory 32 is a computer readable storage medium, and can be used for storing software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the embedded system-based data traversal method according to any embodiment of the present application (for example, a storage object space creation module and a traversal module in the embedded system-based data traversal apparatus). The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system and an application program required by at least one function; the storage data area may store data created according to use of the device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The communication module 33 is used for data transmission.
The processor 31 executes various functional applications of the device and data processing by running software programs, instructions and modules stored in the memory, that is, implements the embedded system-based data traversal method described above.
The input device 34 may be used to receive entered numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus. The output device 35 may include a display device such as a display screen.
The electronic device provided by the above can be used to execute the data traversal method based on the embedded system provided by the first embodiment, and has corresponding functions and beneficial effects.
Example four:
embodiments of the present application also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform an embedded system-based data traversal method, including: creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data; traversing the data storage object space, wherein the traversing direction is from the data table area to the pre-allocation area; when one unit space is traversed, task request query is carried out; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
Storage medium-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk, or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Lanbas (Rambus) RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network (such as the internet). The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations, e.g., in different computer systems connected by a network. The storage medium may store program instructions (e.g., embodied as a computer program) that are executable by one or more processors.
Of course, the storage medium provided in the embodiments of the present application contains computer-executable instructions, and the computer-executable instructions are not limited to the embedded system-based data traversal method described above, and may also perform related operations in the embedded system-based data traversal method provided in any embodiment of the present application.
The data traversing device, the storage medium, and the electronic device based on the embedded system provided in the above embodiments may execute the data traversing method based on the embedded system provided in any embodiment of the present application, and reference may be made to the data traversing method based on the embedded system provided in any embodiment of the present application without detailed technical details described in the above embodiments.
The foregoing is considered as illustrative of the preferred embodiments of the invention and the technical principles employed. The present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the claims.

Claims (10)

1. A data traversal method based on an embedded system is characterized by comprising the following steps:
creating a data storage object space, wherein the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data;
traversing the data storage object space, wherein the traversing direction is from the data table area to the pre-allocation area;
when one unit space is traversed, task request query is carried out;
if the task request is inquired, executing the task, and continuously traversing after executing the task;
and if the task request cannot be inquired, continuing to traverse.
2. The embedded system-based data traversal method according to claim 1, wherein the data is hash structure data, and the embedded system-based data traversal method specifically comprises:
creating a hash storage object space, wherein the hash storage object space is divided into a hash table area and a pre-allocation area, and the hash storage object space is a unit space set for storing data;
traversing the hash storage object space, wherein the traversing sequence direction is from the hash table area to the pre-allocation area;
when one unit space is traversed, task request query is carried out;
if the task request is inquired, executing the task, and continuously traversing after executing the task;
and if the task request cannot be inquired, continuing to traverse.
3. The embedded system-based data traversal method of claim 2, wherein the task request comprises an add data task and a delete data task;
if the task request is inquired, executing the task, and continuously traversing after executing the task, specifically:
if the data adding task is inquired, judging whether hash collision exists in the hash table area after data is added, wherein the hash collision is the collision occurring when the data to be added is added to the unit space and the data to be added already exists in the unit space of the data to be added;
if no hash conflict exists, adding the data to be added to the hash table area;
if the hash conflict exists, adding the data to be added to the pre-distribution area, and linking the area to be distributed into the hash table area;
and if the task of deleting the data is inquired, directly deleting the data in the corresponding unit space.
4. The embedded system-based data traversal method of claim 2, wherein an iterator object is created, wherein a cache space exists in the iterator object;
storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end;
and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
5. The embedded system-based data traversal method according to claim 1, wherein the data is any one of hash structure data, list structure data, and array structure data.
6. The embedded system-based data traversal method of claim 5, wherein an iterator object is created, wherein a cache space exists in the iterator object;
storing the key value pairs in the traversed unit space into a cache space in the iterator object so as to obtain traversed data by a user end;
and if all the key value pair data in the iterator object cache space are acquired by the user side, continuing to traverse after the last unit space traversed last time, and storing the key value pair data in the unit space obtained by traversing into the iterator object cache space.
7. The data traversal method based on the embedded system as claimed in claim 1, wherein the data storage object space is divided into a data table region and a pre-allocation region, specifically:
and dividing the data storage object space into a data table area and a pre-allocation area, wherein the space of the pre-allocation area is 2 times of the space of the data table area.
8. A data traversing device based on an embedded system is characterized by comprising:
the storage object space creating module is used for creating a data storage object space, the data storage object space is divided into a data table area and a pre-allocation area, and the data storage object space is a unit space set for storing data;
the traversal module is used for traversing the data storage object space, and the traversal direction is from the data table area to the pre-allocation area; when one unit space is traversed, task request query is carried out, and the unit space stores corresponding data information; if the task request is inquired, executing the task, and continuously traversing after executing the task; and if the task request cannot be inquired, continuing to traverse.
9. An electronic device, comprising:
a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A storage medium containing computer-executable instructions for performing the method of any one of claims 1-7 when executed by a computer processor.
CN202110949930.1A 2021-08-18 2021-08-18 Data traversal method and device based on embedded system Pending CN113836366A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110949930.1A CN113836366A (en) 2021-08-18 2021-08-18 Data traversal method and device based on embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110949930.1A CN113836366A (en) 2021-08-18 2021-08-18 Data traversal method and device based on embedded system

Publications (1)

Publication Number Publication Date
CN113836366A true CN113836366A (en) 2021-12-24

Family

ID=78960774

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110949930.1A Pending CN113836366A (en) 2021-08-18 2021-08-18 Data traversal method and device based on embedded system

Country Status (1)

Country Link
CN (1) CN113836366A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020059054A1 (en) * 2000-06-02 2002-05-16 Bade Stephen L. Method and system for virtual prototyping
US20050066095A1 (en) * 2003-09-23 2005-03-24 Sachin Mullick Multi-threaded write interface and methods for increasing the single file read and write throughput of a file server
CN107368362A (en) * 2017-06-29 2017-11-21 上海阅文信息技术有限公司 A kind of multithreading/multi-process for disk read-write data is without lock processing method and system
CN111177245A (en) * 2019-12-25 2020-05-19 中国平安财产保险股份有限公司 Key value traversal method of Redis cluster, server and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020059054A1 (en) * 2000-06-02 2002-05-16 Bade Stephen L. Method and system for virtual prototyping
US20050066095A1 (en) * 2003-09-23 2005-03-24 Sachin Mullick Multi-threaded write interface and methods for increasing the single file read and write throughput of a file server
CN107368362A (en) * 2017-06-29 2017-11-21 上海阅文信息技术有限公司 A kind of multithreading/multi-process for disk read-write data is without lock processing method and system
CN111177245A (en) * 2019-12-25 2020-05-19 中国平安财产保险股份有限公司 Key value traversal method of Redis cluster, server and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
厉海燕, 赵志国: "优先级继承协议在Linux中的实现", 计算机工程与设计, no. 06, 28 June 2005 (2005-06-28), pages 1411 - 1415 *
马申斌等: "基于多核框架实时信号处理的内存管理", 工业控制计算机, vol. 30, no. 3, 31 December 2017 (2017-12-31), pages 50 - 51 *

Similar Documents

Publication Publication Date Title
US11372890B2 (en) Distributed database transaction protocol
KR102392944B1 (en) Data backup methods, storage media and computing devices
EP3185143B1 (en) Decentralized transaction commit protocol
US10268743B2 (en) Distributed database transaction protocol
US9881041B2 (en) Multiple RID spaces in a delta-store-based database to support long running transactions
TWI549060B (en) Access methods and devices for virtual machine data
JP4612710B2 (en) Transaction parallel control method, database management system, and program
US20070214167A1 (en) Method for fast bulk loading data into a database while bypassing exit routines
WO2018001135A1 (en) Method for processing database transaction, client and server
US20180218023A1 (en) Database concurrency control through hash-bucket latching
WO2017161540A1 (en) Data query method, data object storage method and data system
CN108762915B (en) Method for caching RDF data in GPU memory
CN115617571A (en) Data backup method, device, system, equipment and storage medium
CN105446936A (en) Distributed hash table method based on HTM and one-way RDMA operation
US20060224949A1 (en) Exclusion control method and information processing apparatus
US11288263B2 (en) Change service for shared database object
CN113836366A (en) Data traversal method and device based on embedded system
CN115114289A (en) Data query method and device and electronic equipment
JP3180336B2 (en) Data access method using multilayer buffer
CN112559457A (en) Data access method and device
CN117056363B (en) Data caching method, system, equipment and storage medium
US11874767B2 (en) Memory partitions for processing entities
JP2787107B2 (en) Buffer control system and device
CN117786164A (en) Method and device for data export in distributed protogram database
JPH0456344B2 (en)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination