CN113836366B - Data traversing method and device based on embedded system - Google Patents
Data traversing method and device based on embedded system Download PDFInfo
- Publication number
- CN113836366B CN113836366B CN202110949930.1A CN202110949930A CN113836366B CN 113836366 B CN113836366 B CN 113836366B CN 202110949930 A CN202110949930 A CN 202110949930A CN 113836366 B CN113836366 B CN 113836366B
- Authority
- CN
- China
- Prior art keywords
- data
- space
- traversing
- task
- hash
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000013500 data storage Methods 0.000 claims abstract description 42
- 238000000547 structure data Methods 0.000 claims description 27
- 230000015654 memory Effects 0.000 claims description 26
- 230000008569 process Effects 0.000 abstract description 19
- 239000002609 medium Substances 0.000 description 10
- 230000006870 function Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000012217 deletion Methods 0.000 description 5
- 230000037430 deletion Effects 0.000 description 5
- 230000007717 exclusion Effects 0.000 description 4
- 238000007792 addition Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000003780 insertion Methods 0.000 description 2
- 230000037431 insertion Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000003416 augmentation Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000012120 mounting media Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9014—Indexing; 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 traversing method and device based on an embedded system. According to the technical scheme provided by the embodiment of the application, the data storage object space is divided into the data table area and the pre-allocation area by creating the data storage object space, 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; performing task request inquiry after traversing one unit space; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued. The embodiment of the application can query and execute other tasks in one traversal process, avoids long-time waiting of other tasks, and avoids complicated locking and unlocking operations, thereby improving the efficiency and effectiveness of data traversal.
Description
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 can greatly improve the data storage efficiency.
In a conventional hash structure, once a data collision occurs, it is common to make a linked list in the unit of collision, so that one hash unit can accommodate a plurality of data. When performing data traversal, the traversal of the linked list is performed in a cell having multiple data. At this time, if operations such as insertion or deletion are performed on the data being traversed on the linked list, the traversing operations may be damaged.
In an embedded real-time system, a mutual exclusion lock is added in a common solution manner when hash traversal is performed, so that a user cannot perform operations such as adding and deleting when the traversal is performed, if too much data is in a hash table, the traversal time is too long, and the operations such as inserting and deleting cannot be performed for a long time.
In the hash storage structure, many operations need to rely on traversal, such as clearing hash tables, re-hashing, etc., and the database of the embedded real-time system cannot perform other operations in the traversal process, which results in the reduction of data storage and task scheduling efficiency.
Disclosure of Invention
The embodiment of the application provides a data traversing 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 the data traversing process, and improve the efficiency and effectiveness of data traversing.
In a first aspect, an embodiment of the present application provides a data traversing 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;
Performing task request inquiry after traversing one unit space;
If the task request is inquired, executing the task, and continuing traversing after executing the task;
If the query does not reach the task request, the traversal is continued.
Further, the data is hash structure data, and the data traversing method based on the embedded system specifically comprises the following steps:
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 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;
Performing task request inquiry after traversing one unit space;
If the task request is inquired, executing the task, and continuing traversing after executing the task;
If the query does not reach the task request, the traversal is continued.
Further, the task request comprises a data adding task and a data deleting task;
If the task request is inquired, executing the task, and continuing traversing after executing the task, wherein the task request comprises the following specific steps:
if the task of adding the data is inquired, judging whether hash conflict exists in the hash table area or not, wherein the hash conflict is the conflict which occurs when the data to be added is added to the unit space of the data to be added and the data to be added exists in the unit space;
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 a pre-allocation area, and linking the area to be allocated into a hash table area;
If the task of deleting the data is inquired, the data in the corresponding unit space is directly deleted.
Further, creating an iterator object, wherein a cache space exists in the iterator object;
Storing key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data;
If the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data;
If the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
Further, the data storage object space is divided into a data table area and a pre-allocation area, specifically:
Dividing the data storage object space into a data table area and a pre-allocation area, wherein the pre-allocation area space is 2 times of the data table area space.
In a second aspect, an embodiment of the present application provides a data traversing apparatus based on an embedded system, including: the storage object space creating module is used for 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;
The traversing module is used for traversing the data storage object space, and the traversing direction is from the data table area to the pre-allocation area; performing task request inquiry after traversing one unit space, wherein the unit space stores corresponding data information; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
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 traversing module is further configured to traverse the hash storage object space, where the traversing sequence direction is from the hash table area to the pre-allocation area; performing task request inquiry after traversing one unit space; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
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 adding data tasks and deleting data tasks in the task request; if the task request is inquired, executing the task, and continuing traversing after executing the task, wherein the task request comprises the following specific steps: if the task of adding the data is inquired, judging whether hash conflict exists in the hash table area or not, wherein the hash conflict is the conflict which occurs when the data to be added is added to the unit space of the data to be added and the data to be added exists in the unit space; 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 a pre-allocation area, and linking the area to be allocated into a hash table area; if the task of deleting the data is inquired, the data in the corresponding unit space is directly deleted.
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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data; if the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data; if the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
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 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 is used for storing one or more programs;
The 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 as described in the first aspect.
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 perform the embedded system based data traversal method according to the first aspect.
In the embodiment of the application, the task request inquiry is carried out every time one unit space is traversed in the traversing process, the task is executed and then the traversing is continued if the task request is inquired, and the traversing is continued if the task request is not inquired. By adopting the technical means, the inquiry and execution of other tasks can be carried out in one traversal process, long-time waiting of other tasks is avoided, and 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 traversing method based on an embedded system according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating creation of a memory space according to a first embodiment of the present application;
FIG. 3 is a schematic diagram of a hash collision free system according to a first embodiment of the present application;
FIG. 4 is a schematic diagram of a hash collision according to a first embodiment of the present application;
FIG. 5 is a schematic view of a traversing direction according to a first embodiment of the present application;
fig. 6 is a schematic structural diagram of a data traversing device 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, the following detailed description of specific embodiments of the present application is given 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 thereof. It should be further noted that, for convenience of description, only some, but not all of the matters related to the present application are shown in the accompanying drawings. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently, or at the same time. Furthermore, the order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
According to the data traversing method and device based on the embedded system, in the traversing process, task request inquiry is carried out after one unit space is traversed, if the task request is inquired, task execution is carried out, then traversing is continued, and if the task request is not inquired, traversing is continued. Therefore, the task is inquired and executed in one traversal process, and cumbersome locking and unlocking operations are avoided, so that the efficiency and the effectiveness of data traversal are improved. Compared with the traditional data traversing mode, the method has the advantages that mutual exclusion locks are added in the traversing process, so that users cannot perform operations such as adding and deleting when performing the traversing. If the traversed data are more, the traversing time is longer, so that operations such as adding and deleting cannot be performed for a long time, the performance of the task is reduced, and if each traversed unit is subjected to a separate locking and unlocking operation, a great deal of additional expenditure is caused. Based on the above, the data traversing method based on the embedded system provided by the embodiment of the application is provided to solve the problem of long waiting time of other operation tasks caused by increasing mutual exclusion in the existing data traversing process.
Embodiment one:
fig. 1 is a flowchart of a data traversing method based on an embedded system according to a first embodiment of the present application, where the data traversing method based on an embedded system provided in the present embodiment may be executed by a data traversing device based on an embedded system, where the data traversing device based on an embedded system may be implemented by software and/or hardware, and the data traversing device based on an embedded system may be formed by two or more physical entities or may be formed by one physical entity. In general, the embedded system-based data traversing device may be an intelligent terminal device or the like.
Referring to fig. 1, the data traversing 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, and a hash storage object space is created, wherein the hash storage object space is divided into a hash table area 1 and a pre-allocation area 2, and is a unit space set for storing the data. When the hash data storage object is created, 3 times of hash data table capacity space is preset, wherein 1 time of hash data table capacity space is hash table area 1 space, and 2 times of hash data table capacity space is preassigned 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; performing task request inquiry after traversing one unit space; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
Specifically, the data is hash structure data, the hash storage object space is traversed, and the traversing sequence direction is from the hash table area 1 to the pre-allocation area 2; performing task request inquiry after traversing one unit space; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
Specifically, the task request comprises a data adding task and a data deleting task; if the task of adding the data is inquired, judging whether hash conflict exists in the hash table area or not, wherein the hash conflict is the conflict which occurs when the data to be added is added to the unit space of the data to be added and the data to be added exists in the unit space; 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 a pre-allocation area, and linking the area to be allocated into a hash table area; if the task of deleting the data is inquired, the data in the corresponding unit space is directly deleted.
Specifically, referring to fig. 3, when it is queried that the task request is an add data task request, the add task is to add data a and data B to the hash structure; 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 exists in the unit space of the hash table area corresponding to the data C to be added, the data C to be added cannot be stored in the position of the unit space of the hash table area corresponding to the data A, if the data A exists in the unit space of the hash table area corresponding to the data C to be added, the data C to be added is added into the unit space of the pre-allocation area 2, and the area 2 to be allocated is linked into the hash table area 1.
The embedded real-time system is illustratively a multitasking system, allowing the key-value database to be implemented in a manner that converts traversal, augmentation, etc. operations into task requests using a background task approach. 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 queried, and blocking internal operations such as waiting or executing data refreshing if the task request is not queried. When the background task of the database executes the traversing operation, in order to prevent the overlong traversing process, a unit is searched for whether other task requests exist after each traversing, if so, an executing task is inserted, the executing task is executed, after the executing task is completed, the traversing is continued, and if not, the traversing is continued. By the method, other task requests can be inserted and executed in one traversal process, so that complicated locking and unlocking operations are avoided, and the traversal working efficiency is improved. The execution of other tasks with short time such as adding and deleting data is allowed in Ha Xibian calendar, long-time waiting of other tasks is avoided, and the access performance of the data in a real-time system is optimized; performance consumption caused by independently executing a lock and 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 is from data table area 1 to pre-allocation area 2; and carrying out task request inquiry every time one unit space is traversed. When the traversal is performed, the traversal is performed according to the array structure mode, each data unit can be traversed, the hash structure is unordered, so that the hash structure data traversal and the array structure data traversal are not different from each other from the perspective of a user, the array structure traversal does not need to maintain the integrity of a linked list during the traversal, and the execution of the insertion and deletion of data does not lead to unpredictable results. Because the pre-allocation area space is allocated in advance, the space is not required to be allocated from the hash table area memory heap when the hash conflict occurs, and therefore external fragments caused by frequent application of memory release are avoided.
Further, a record task is newly built before a traversal task starts, wherein the record task is to record the relative change position segment of the task request for executing other addition or deletion, and the data of the relative change position segment of the task request for executing other addition or deletion is queried again to check the accuracy of the traversal data.
Illustratively, referring to FIG. 4, a record task is created to record the relative change location segments where requests to perform other additions or deletions have occurred before the start of the traversal task. For example, after the space data C is traversed, an adding task is performed, and the adding data is between the unit spaces where the data a and the data C are located, then the position section between the unit spaces where the data a and the data C are located is recorded by recording the task, and after the traversing of all the unit spaces is completed, the data in the position section between the recorded unit spaces where the data a and the data C are located is 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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data; if the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
In particular, data traversal typically provides a callback function that executes user callbacks as each data unit is traversed, but since the database is running a single background task, there is a reduction in overall data efficiency if the user is unfamiliar with the mechanism and performs too many time-consuming operations within the callback function. Thus, the user can acquire the data in an iterator traversing mode. When a user uses an iterator to acquire data, creating an iterator object, wherein a cache space exists in the iterator object; and calling an interface of the iterator for acquiring data, storing key value pairs in the traversed unit space into a cache space in the iterator object, and then returning to wait for the user to acquire the data by using the iterator next time. When the user acquires data in the iterator, searching and acquiring the key value pairs in the buffer space in the iterator object preferentially, if the key value pairs in the buffer space are all acquired by the user, continuing to traverse after the last unit space traversed last time, and storing the key value pairs in the unit space obtained by traversing into the buffer space of the iterator object. The iterator traversing mode is used, on one hand, the performance consumption caused by locking operation is optimized, one buffer area is pre-allocated, so that a database can be accessed by locking once to acquire a plurality of data, the locking access frequency is reduced, and the key value pair access in the buffer area is not required to be locked because the buffer area is unique to the iterator and is not managed by the database. In addition, in addition to hash structure data, the data of the embedded system often needs to provide list structure data, array structure data and the like, and the iterator can provide a uniform traversing mode, so that the complexity of an interface is reduced.
In the traversing process, task request inquiry is carried out every time one unit space is traversed, the task is executed and then the traversing is continued if the task request is inquired, and the traversing is continued if the task request is not inquired. By adopting the technical means, the inquiry and execution of other tasks can be carried out in one traversal process, long-time waiting of other tasks is avoided, and complicated locking and unlocking operations are avoided, so that the efficiency and effectiveness of data traversal are improved.
Embodiment two:
On the basis of the above embodiment, fig. 5 is a schematic structural diagram of a data traversing device 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;
A traversing module 23, configured to traverse the data storage object space, where a traversing direction is from the data table area to the pre-allocation area; performing task request inquiry after traversing one unit space, wherein the unit space stores corresponding data information; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
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 traversing module 23 is further configured to traverse the hash object space, where the traversing sequence direction is from the hash table area to the pre-allocation area; performing task request inquiry after traversing one unit space; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
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 adding data tasks and deleting data tasks in the task request; if the task request is inquired, executing the task, and continuing traversing after executing the task, wherein the task request comprises the following specific steps: if the task of adding the data is inquired, judging whether hash conflict exists in the hash table area or not, wherein the hash conflict is the conflict which occurs when the data to be added is added to the unit space of the data to be added and the data to be added exists in the unit space; 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 a pre-allocation area, and linking the area to be allocated into a hash table area; if the task of deleting the data is inquired, the data in the corresponding unit space is directly deleted.
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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data; if the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data; if the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
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 the data table area space.
In the traversing process, task request inquiry is carried out every time one unit space is traversed, the task is executed and then the traversing is continued if the task request is inquired, and the traversing is continued if the task request is not inquired. By adopting the technical means, the inquiry and execution of other tasks can be carried out in one traversal process, long-time waiting of other tasks is avoided, and 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 of the application, and has corresponding functions and beneficial effects.
Embodiment III:
An electronic device according to a third embodiment of the present application, referring to fig. 6, includes: processor 31, memory 32, communication module 33, input device 34 and 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 used as a computer readable storage medium for storing software programs, computer executable programs and modules, and is configured to store program instructions/modules corresponding to the data traversing method of the embedded system according to any embodiment of the present application (e.g., a storage object space creating module and a traversing module in a data traversing device of the embedded system). The memory may mainly include a memory program area and a memory data area, wherein the memory program area may store an operating system, at least one application program required for a function; the storage data area may store data created according to the use of the device, etc. In addition, 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 remotely located with respect to the processor, the remote memory being connectable to the device through 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, i.e. implements the above-described embedded system-based data traversal method.
The input means 34 may be used to receive entered numeric or character information and to generate key signal inputs related to user settings and function control of the device. The output means 35 may comprise a display device such as a display screen.
The electronic device provided by the above embodiment can be used for executing the data traversing method based on the embedded system provided by the above embodiment, and has corresponding functions and beneficial effects.
Embodiment four:
The embodiment of the application also provides a storage medium containing computer executable instructions, which when executed by a computer processor, are used for executing a data traversing method based on an embedded system, the data traversing method based on the embedded system comprises 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; performing task request inquiry after traversing one unit space; if the task request is inquired, executing the task, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
Storage media-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.; nonvolatile 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 second, different 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) executable by one or more processors.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present application is not limited to the data traversing method based on the embedded system as described above, and may also perform the related operations in the data traversing method based on the embedded system 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 foregoing embodiments may execute the data traversing method based on the embedded system provided in any embodiment of the present application, and technical details not described in detail in the foregoing embodiments may refer to the data traversing method based on the embedded system provided in any embodiment of the present application.
The foregoing description is only of the preferred embodiments of the application and the technical principles employed. The present application is not limited to the specific embodiments described herein, but is capable of numerous modifications, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, while the application has been described in connection with the above embodiments, the application is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit of the application, the scope of which is set forth in the following claims.
Claims (10)
1. The data traversing method based on the embedded system is characterized by comprising the following steps of:
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;
Performing task request inquiry after traversing one unit space, wherein the task request comprises a data adding task and a data deleting task;
if the task request is inquired, executing the task to increase or delete the data of the unit space in the data table area or the pre-allocation area, and continuing traversing after executing the task;
If the query does not reach the task request, the traversal is continued.
2. The embedded system-based data traversing method according to claim 1, wherein the data is hash structure data, and the embedded system-based data traversing 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 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;
Performing task request inquiry after traversing one unit space;
If the task request is inquired, executing the task, and continuing traversing after executing the task;
If the query does not reach the task request, the traversal is continued.
3. The embedded system-based data traversal method according to claim 2, wherein the task request comprises adding a data task and deleting a data task;
If the task request is inquired, executing the task, and continuing traversing after executing the task, wherein the task request comprises the following specific steps:
if the task of adding the data is inquired, judging whether hash conflict exists in the hash table area or not, wherein the hash conflict is the conflict which occurs when the data to be added is added to the unit space of the data to be added and the data to be added exists in the unit space;
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 a pre-allocation area, and linking the area to be allocated into a hash table area;
If the task of deleting the data is inquired, the data in the corresponding unit space is directly deleted.
4. The embedded system-based data traversal method according to claim 2, wherein an iterator object is created, wherein a cache space exists in the iterator object;
Storing key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data;
If the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
5. The embedded system-based data traversal method of 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 key value pairs in the traversed unit space into a cache space in the iterator object so as to enable a user side to acquire traversed data;
If the key value data in the buffer space of the iterator object are completely acquired by the user end, continuing to traverse after the last unit space traversed last time, and storing the key value data in the unit space obtained by traversing into the buffer space of the iterator object.
7. The embedded system-based data traversing method according to claim 1, wherein the data storage object space is divided into a data table area and a pre-allocation area, specifically:
Dividing the data storage object space into a data table area and a pre-allocation area, wherein the pre-allocation area space is 2 times of the data table area space.
8. A data traversing device based on an embedded system, comprising:
The storage object space creating module is used for 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;
The traversing module is used for traversing the data storage object space, and the traversing direction is from the data table area to the pre-allocation area; performing task request inquiry after traversing a unit space, wherein the task request comprises a data adding task and a data deleting task, and the unit space stores corresponding data information; if the task request is inquired, executing the task to increase or delete the data of the unit space in the data table area or the pre-allocation area, and continuing traversing after executing the task; if the query does not reach the task request, the traversal is continued.
9. An electronic device, comprising:
a memory and one or more processors;
The memory is used for storing one or more programs;
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
10. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110949930.1A CN113836366B (en) | 2021-08-18 | 2021-08-18 | Data traversing method and device based on embedded system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110949930.1A CN113836366B (en) | 2021-08-18 | 2021-08-18 | Data traversing method and device based on embedded system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113836366A CN113836366A (en) | 2021-12-24 |
CN113836366B true CN113836366B (en) | 2024-10-25 |
Family
ID=78960774
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110949930.1A Active CN113836366B (en) | 2021-08-18 | 2021-08-18 | Data traversing method and device based on embedded system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113836366B (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7613599B2 (en) * | 2000-06-02 | 2009-11-03 | Synopsys, Inc. | Method and system for virtual prototyping |
US7865485B2 (en) * | 2003-09-23 | 2011-01-04 | Emc Corporation | Multi-threaded write interface and methods for increasing the single file read and write throughput of a file server |
CN107368362B (en) * | 2017-06-29 | 2020-10-30 | 上海阅文信息技术有限公司 | Multithreading/multiprocessing lock-free processing method and system for disk read-write data |
CN111177245A (en) * | 2019-12-25 | 2020-05-19 | 中国平安财产保险股份有限公司 | Key value traversal method of Redis cluster, server and storage medium |
-
2021
- 2021-08-18 CN CN202110949930.1A patent/CN113836366B/en active Active
Non-Patent Citations (1)
Title |
---|
基于多核框架实时信号处理的内存管理;马申斌等;工业控制计算机;20171231;第30卷(第3期);50-51, 54页 * |
Also Published As
Publication number | Publication date |
---|---|
CN113836366A (en) | 2021-12-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11003689B2 (en) | Distributed database transaction protocol | |
CN107247808B (en) | Distributed NewSQL database system and picture data query method | |
US9881041B2 (en) | Multiple RID spaces in a delta-store-based database to support long running transactions | |
US7958091B2 (en) | Method for fast bulk loading data into a database while bypassing exit routines | |
KR100862661B1 (en) | Delayed logging method and device | |
US6631366B1 (en) | Database system providing methodology for optimizing latching/copying costs in index scans on data-only locked tables | |
WO2018001135A1 (en) | Method for processing database transaction, client and server | |
EP2797013B1 (en) | Database update execution according to power management schemes | |
US8380663B2 (en) | Data integrity in a database environment through background synchronization | |
WO2016119597A1 (en) | Page querying method and data processing node in oltp cluster database | |
US9785695B2 (en) | Providing multiple concurrent transactions on a single database schema using a single concurrent transaction database infrastructure | |
CN112867999A (en) | Version-based table locking | |
WO2023124422A1 (en) | Data read-write control method and electronic device | |
CN101339527B (en) | Shadow memory backup method and device | |
CN111198660A (en) | B + tree traversal method and device | |
US20180011897A1 (en) | Data processing method having structure of cache index specified to transaction in mobile environment dbms | |
CN113836366B (en) | Data traversing method and device based on embedded system | |
US20170316042A1 (en) | Index page with latch-free access | |
CN115905259B (en) | Pure column type updating method and device supporting row-level concurrency control | |
CN116048428B (en) | Data request processing method, device, storage equipment and readable storage medium | |
CN108984720B (en) | Data query method and device based on column storage, server and storage medium | |
US10303680B2 (en) | Data processing apparatus and data processing method | |
CN112559457A (en) | Data access method and device | |
CN117707607B (en) | Concurrent management system and method for multi-version memory of data | |
WO2024198010A1 (en) | Concurrency control method and apparatus for column-oriented storage database |
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 | ||
CB02 | Change of applicant information |
Country or region after: China Address after: 510000 room 306, 3rd floor, 43 Sicheng Road, software park, Tianhe District, Guangzhou City, Guangdong Province Applicant after: GUANGZHOU ZHIYUAN ELECTRONICS Co.,Ltd. Address before: 510000 room 306, 3rd floor, 43 Sicheng Road, software park, Tianhe District, Guangzhou City, Guangdong Province Applicant before: GUANGZHOU ZHIYUAN ELECTRONICS Co.,Ltd. Country or region before: China |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |