Method, device and equipment for recycling and storing capability table data item, and storage medium
Patent Information
- Application Number
- CN202211686349.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2042-12-27
AI Technical Summary
[0005]本申请提供一种能力表数据项的回收及存储方法、装置、设备、存储介质,用以解决实时操作系统每当获取到能力数据时,因需要遍历能力表中的数据项,并将能力数据保存至内容为空的数据项中,导致能力数据保存速度低下的问题
[0054]This application provides a method, apparatus, device, and storage medium for recycling and storing data items in a capability table. By creating a recycling table to record the index information of empty items in the capability table, it is possible to obtain empty items in the capability table through the recycling items in the recycling table and save the data to the empty items, thereby improving the efficiency of identifying empty items in the capability table and thus increasing the speed of saving data to the capability table.
Smart Images

Figure CN115934345B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for retrieving and storing capability table data items. Background Technology
[0002] A capability table is a large array used in real-time operating systems (RTOS). Each data item in the capability table is used to store capability data. Capability data is a token that allows the owner to access entities (devices such as USB flash drives, cameras, etc.) or objects (files, directories, network ports, memory, etc.) in the computer system.
[0003] When a computer system sends capability data to a real-time operating system (RTOS), it means that the ROS can access an entity in the computer based on the capability data. Therefore, the ROS needs to continuously store the capability data in the data items of the capability table from the time it receives the capability data to the time it completes the access to the entity. After the ROS completes the access to the entity, it releases the capability data in the data item that stores the capability data, making the data item empty.
[0004] However, the inventors discovered that whenever a real-time operating system stores capability data into a capability table, it needs to traverse the capability table to find empty data items and save the capability data into empty data items, resulting in slow capability data saving speed. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for reclaiming and storing capability table data items, in order to solve the problem that the real-time operating system needs to traverse the data items in the capability table and save the capability data to empty data items whenever it obtains capability data, resulting in low capability data saving speed.
[0006] Firstly, this application provides a method for retrieving data items from a capability table, comprising:
[0007] Create a recycling table with a recycling pointer; wherein the recycling table has at least one recycling entry; the recycling entry is used to store the index information of empty entries in the capability table; the recycling pointer is used to indicate a recycling entry that can store the index information of one of the empty entries; the capability table is an array used to store capability data, and the capability table has at least one data entry used to store the capability data; the empty entry is a data entry in the capability table that has released memory and / or is an empty data entry.
[0008] If it is confirmed that there is a vacant item in the capability table, then the index information of the vacant item is entered into the corresponding recycling item in the recycling table by the recycling pointer.
[0009] In the above scheme, creating a recycling table with recycling pointers includes:
[0010] Create at least one recycle item, and link the recycle items sequentially to form a linked list. The recycle item that stores index information in the linked list is the first item, and the empty recycle item is the second item.
[0011] Create a head pointer in the linked list; wherein the head pointer is used to indicate the first item at the beginning of at least one first item in the linked list;
[0012] A recycling pointer is created in the linked list; wherein the recycling pointer is used to indicate the first second item in at least one second item of the linked list; the first second item is used to store the index information of the empty item;
[0013] The linked list containing the head pointer and the recycling pointer is designated as the recycling table.
[0014] In the above scheme, creating a recycling table with recycling pointers includes:
[0015] Create a first-in-first-out queue with at least one reclaimed item; wherein, the reclaimed item that stores index information in the first-in-first-out queue is the first item, and the empty reclaimed item is the second item;
[0016] Create a head pointer in the first-in-first-out queue; wherein the head pointer is used to indicate the first item that is at the head of at least one first item in the first-in-first-out queue;
[0017] A retrieval pointer is created in the first-in-first-out queue; wherein the retrieval pointer is used to indicate the first second item in at least one second item of the first-in-first-out queue; the first second item is used to store the index information of an empty item;
[0018] Set the first-in-first-out queue with the head pointer and the recycling pointer as the recycling table.
[0019] In the above scheme, if it is confirmed that there is a vacant item in the capability table, then the index information of the vacant item is entered into the corresponding recycling item in the recycling table by the recycling pointer, including:
[0020] If it is confirmed that there is a data item for releasing memory in the capability table, then the data item for releasing memory is set as the first empty item, and the index information of the first empty item is set as the first index. The first index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the first index is converted into the first item.
[0021] If it is confirmed that the recycling table does not have a first item, then the empty data item in the capability table is set as a second empty item, and the index information of the second empty item is set as a second index. The second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the second index is converted into the first item.
[0022] Adjust the recycling pointer so that it points to the first item in at least one of the second items in the recycling table.
[0023] In the above scheme, creating a recycling table with recycling pointers includes:
[0024] Create a first-in-last-out queue with at least one reclaimed item; wherein, the reclaimed item that stores index information in the first-in-last-out queue is the first item, and the empty reclaimed item is the second item;
[0025] A recycling pointer is created in the last-in-first-out queue; wherein the recycling pointer is used to indicate the last item in at least one first item of the last-in-first-out queue; the second item next to the last first item is used to store the index information of an empty item;
[0026] Set the last-in-first-out queue with the recycling pointer as the recycling table.
[0027] In the above scheme, if it is confirmed that there is a vacant item in the capability table, then the index information of the vacant item is entered into the corresponding recycling item in the recycling table by the recycling pointer, including:
[0028] If it is confirmed that there is a data item for releasing memory in the capability table, then the data item for releasing memory is set as the first empty item, and the index information of the first empty item is set as the first index. The recycling pointer is adjusted to indicate the second item next to the first item located at the end. The first index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the first index is converted into the first item.
[0029] If it is confirmed that the first item is not in the recycling table, then the empty data item in the capability table is set as the second empty item, and the index information of the second empty item is set as the second index. The recycling pointer is adjusted to indicate the second item next to the first item located at the end. The second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the second index is converted into the first item.
[0030] Secondly, this application provides a method for storing capability table data items, including:
[0031] Receive capability data; wherein, the capability data is data information used to store in the capability table;
[0032] The recycling table is obtained in the recycling method of the above capability table data items, and the acquisition index information of a recycling item in the recycling table is set as the target index;
[0033] The capability data is saved to the data item in the capability table corresponding to the target index.
[0034] In the above scheme, setting the retrieved index information in a reclaimed item of the reclaimed table as the target index includes:
[0035] Identify the head pointer in the recycling table;
[0036] The index information in the first item indicated by the head pointer is set as the target index, the target index is extracted from the first item, and the target index in the first item is deleted so that the first item becomes the second item; wherein, the recycling item that stores the index information in the recycling table is the first item, and the empty recycling item is the second item;
[0037] Adjust the head pointer so that it points to the first item at the beginning of at least one of the first items in the recycling table.
[0038] In the above scheme, setting the retrieved index information in a reclaimed item of the reclaimed table as the target index includes:
[0039] Identify the recycling pointer in the recycling table;
[0040] The index information in the first item indicated by the recycling pointer is set as the target index, the target index is extracted from the first item, and the target index in the first item is deleted so that the first item becomes the second item; wherein, the recycling item that stores the index information in the recycling table is the first item, and the empty recycling item is the second item;
[0041] Adjust the recycling pointer so that it points to the last item in at least one of the first items in the recycling table.
[0042] Thirdly, this application provides a device for retrieving capability table data items, comprising:
[0043] A recycling table creation module is used to create a recycling table with a recycling pointer; wherein, the recycling table has at least one recycling entry; the recycling entry is used to store the index information of empty entries in the capability table; the recycling pointer is used to indicate a recycling entry that can store the index information of one of the empty entries; the capability table is an array used to store capability data, and the capability table has at least one data entry used to store the capability data; the empty entry is a data entry in the capability table that has a memory-released data entry and / or is an empty data entry;
[0044] The vacant item recycling module is used to, if it is confirmed that there is a vacant item in the capability table, enter the index information of the vacant item into the recycling pointer in the corresponding recycling item in the recycling table.
[0045] Fourthly, this application provides a storage device for capability table data items, comprising:
[0046] The data input module is used to receive capability data;
[0047] The index identification module is used to obtain the recycling table in the recycling device of the above-mentioned capability table data items, and to set the acquisition index information in a recycling item of the recycling table as the target index;
[0048] The data storage module is used to save the capability data to the data item in the capability table corresponding to the target index.
[0049] Fifthly, this application provides a computer device, including: a processor and a memory communicatively connected to the processor;
[0050] The memory stores computer-executed instructions;
[0051] The processor executes the computer execution instructions stored in the memory to implement the above-described method for retrieving capability table data items and the method for storing capability table data items.
[0052] Sixthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the above-described method for reclaiming capability table data items and the method for storing capability table data items.
[0053] In a seventh aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for retrieving capability table data items and method for storing capability table data items.
[0054] This application provides a method, apparatus, device, and storage medium for recycling and storing data items in a capability table. By creating a recycling table to record the index information of empty items in the capability table, it is possible to obtain empty items in the capability table through the recycling items in the recycling table and save the data to the empty items, thereby improving the efficiency of identifying empty items in the capability table and thus increasing the speed of saving data to the capability table.
[0055] By creating a recycling pointer to indicate empty recycling entries in the recycling table, the index of empty entries in the capability table can be directly saved to the recycling entries according to the indication of the recycling pointer, without having to traverse all recycling entries in the recycling table to save the index information to the empty recycling entries, thus improving the recycling efficiency of the index information of empty entries.
[0056] By recording the index information of the empty item in the empty item into the corresponding recycling item in the recycling table if the recycling pointer is confirmed to have an empty item in the capability table, the index information of the data items releasing memory and / or empty data items in the capability table can be quickly identified and saved to the recycling item for future use in saving capability data, thereby improving the recycling efficiency of data items in the capability table and the data saving efficiency. Attached Figure Description
[0057] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0058] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0059] Figure 2 A flowchart of Embodiment 1 of a method for retrieving capability table data items provided in this application;
[0060] Figure 3 In Embodiment 1 of a method for reclaiming data items in a capability table provided by this application, a schematic diagram of the structure of the reclamation table and the capability table in a preferred embodiment is shown.
[0061] Figure 4 A schematic diagram of the structure of the recovery table and the capability table in another preferred embodiment of a method for recovering capability table data items provided in this application, according to Embodiment 1.
[0062] Figure 5 In Embodiment 1 of a method for reclaiming data items in a capability table provided by this application, a schematic diagram of the structure of the reclamation table and the capability table is shown in a preferred embodiment.
[0063] Figure 6A flowchart of Embodiment 2 of a method for storing capability table data items provided in this application;
[0064] Figure 7 A schematic diagram of the program module for a capability table data item recycling device provided by the present invention;
[0065] Figure 8 A schematic diagram of a program module for a storage device for capability table data items provided by the present invention;
[0066] Figure 9 This is a schematic diagram of the hardware structure of the computer device in the computer device of the present invention.
[0067] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0068] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0069] Please see Figure 1 The specific application scenario of this application is as follows:
[0070] A first server 3, which runs a method for recycling capability table data items, and a second server 4, which runs a method for storing capability table data items, are interconnected. The first server 3 and the second server 4 are installed in a real-time operating system 5. The real-time operating system 5 is connected to a computer system 6 and is used to receive capability data sent by the computer system 6 and access entities in the computer system 6 based on the capability data.
[0071] First server 3 creates a recycling table with recycling pointers; if first server 3 confirms that there are empty entries in the capability table, it enters the index information of the empty entries into the recycling entries corresponding to the recycling pointers in the recycling table.
[0072] The second server 4 receives capability data; the second server 4 obtains the recycling table from the first server 3, and sets the acquisition index information of a recycling item in the recycling table as the target index; the second server 4 saves the capability data to the data item in the capability table corresponding to the target index.
[0073] The technical solution of this application and how the technical solution of this application solves the problems of the prior art will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0074] Example 1:
[0075] Please see Figure 2 This application provides a method for reclaiming data items in a capability table, comprising:
[0076] S101: Create a capability recycle table with a recycling pointer; wherein the recycle table has at least one recycling entry; the recycling entry is used to store the index information of vacant entries in the capability table; the recycling pointer is used to indicate a recycling entry that can store the index information of a vacant entry; the capability table is an array used to store capability data, and the capability table has at least one data entry for storing capability data; a vacant entry is a data entry in the capability table that has a memory-released entry and / or is a vacant data entry;
[0077] In this step, a recycling table is created to record the index information of empty items in the capability table. This allows the empty items in the capability table to be retrieved through the recycling items in the recycling table, and the data to be saved to the empty item. This improves the efficiency of identifying empty items in the capability table and thus increases the speed of saving data to the capability table.
[0078] By creating a recycling pointer to indicate empty recycling entries in the recycling table, the index of empty entries in the capability table can be directly saved to the recycling entries according to the indication of the recycling pointer, without having to traverse all recycling entries in the recycling table to save the index information to the empty recycling entries, thus improving the recycling efficiency of the index information of empty entries.
[0079] In this embodiment, the index information is address information representing the location of a data item in the capability table, or index identification information serving as a unique identifier for a data item in the capability table. Capability data is a token that allows the owner to access entities (devices such as USB flash drives, cameras, etc.) or objects (files, directories, network ports, memory, etc.) in a computer system.
[0080] In a preferred embodiment, please refer to Figure 3 Create a recycling table with recycling pointers, including:
[0081] Create at least one reclaimed item and link the reclaimed items sequentially to form a linked list; the reclaimed item that stores index information in the linked list is the first item, and the empty reclaimed item is the second item;
[0082] Create a head pointer in the linked list; where the head pointer is used to indicate the first item at the beginning of at least one of the first items in the linked list;
[0083] Create a vacancy pointer in the linked list; wherein the vacancy pointer is used to indicate the first second item in at least one second item of the linked list; the first second item is used to store the index information of an empty item;
[0084] Set the linked list with a head pointer and a garbage pointer as the garbage list.
[0085] In this example, at least one reclaimed item is created, and the reclaimed items are arranged sequentially. In two adjacent reclaimed items, the address of the reclaimed item in the next position is written into the reclaimed item in the previous position, so that the two adjacent reclaimed items are related. By associating all two adjacent reclaimed items, a linked list is obtained. A linked list is a non-contiguous and non-sequential storage structure in physical storage units. The logical order of data elements is achieved through the linking order of pointers in the linked list. A linked list consists of a series of nodes (each element in the linked list is called a node), and nodes can be dynamically generated at runtime. Each node includes two parts: a data field that stores the data element and a pointer field that stores the address of the next node. Compared with the sequential structure of a linear list, the operation is more complex. Since it does not have to be stored in order, the linked list can achieve a complexity of O(1) when inserting, which is much faster than the sequential list of another linear list. However, searching for a node or accessing a node with a specific number requires O(n) time, while the corresponding time complexities of a linear list and a sequential list are O(logn) and O(1), respectively.
[0086] By creating a head pointer in the linked list, index information that can be retrieved at any time is indicated, so that capability data can be saved to the data item corresponding to that index information.
[0087] By creating a recycling pointer in the linked list, index information obtained from empty entries in the capability table can be saved at any time.
[0088] Therefore, by creating a recycling table with a header pointer and a recycling pointer, it is possible to quickly obtain index information from the recycling table, which is used to save capability data to the data item in the capability table corresponding to the index information, and to quickly identify the index information of data items that release memory and / or empty data items in the capability table, and save them to the recycling item so that they can be used to save capability data next time, thereby improving the recycling efficiency of data items in the capability table and the data saving efficiency.
[0089] In another preferred embodiment, please refer to Figure 4 Create a recycling table with recycling pointers, including:
[0090] Create a first-in-first-out queue with at least one reclaimed item; wherein, the reclaimed item that stores index information in the first-in-first-out queue is the first item, and the empty reclaimed item is the second item;
[0091] Create a head pointer in the first-in-first-out queue; wherein the head pointer is used to indicate the first item that is at the head of at least one first item in the first-in-first-out queue;
[0092] Create a retrieval pointer in the first-in-first-out queue; wherein the retrieval pointer is used to indicate the first second item in at least one second item of the first-in-first-out queue; the first second item is used to store the index information of an empty item;
[0093] Set the first-in-first-out queue with a head pointer and a recycling pointer as the recycling table.
[0094] In this example, a first-in-first-out (FIFO) queue with at least one reclaimed item is created. FIFO is a traditional sequential execution method in computers, where the first instruction to enter completes and exits before the next instruction is executed. Instructions are the program code that the computer uses in response to user actions.
[0095] Therefore, index information can be stored in an orderly manner directly through a first-in-first-out queue without building a linked list, which improves the efficiency of building the recycling table.
[0096] By creating a head pointer in the first-in-first-out queue, index information that can be retrieved at any time is indicated, so that capability data can be saved to the data item corresponding to that index information.
[0097] By creating a recycling pointer in the first-in-first-out queue, index information obtained from empty entries in the capability table can be saved at any time.
[0098] Therefore, by creating a recycling table with a header pointer and a recycling pointer, it is possible to quickly obtain index information from the recycling table, which is used to save capability data to the data item in the capability table corresponding to the index information, and to quickly identify the index information of data items that release memory and / or empty data items in the capability table, and save them to the recycling item so that they can be used to save capability data next time, thereby improving the recycling efficiency of data items in the capability table and the data saving efficiency.
[0099] In yet another preferred embodiment, please refer to Figure 5 Create a recycling table with recycling pointers, including:
[0100] Create a last-in-first-out (LIFO) queue with at least one reclaimed item; wherein, the reclaimed item that stores index information in the LIFO queue is the first item, and the empty reclaimed item is the second item;
[0101] Create a recycling pointer in the Last-In-Last-Out (LIFO) queue; wherein the recycling pointer is used to indicate the last first item in at least one of the first items in the LIFO queue; the second item next to the last first item is used to store the index information of an empty item;
[0102] Set the last-in-last-out queue with a recycling pointer as the recycling table.
[0103] This example creates a Last-In-First-Out (LIFO) queue with at least one reclaimed item. A stack is an abstract data type frequently used in computer science. Objects in a stack have a property: the last object placed on the stack is always the first object removed. This property is commonly called a Last-In-First-Out (LIFO) queue. Several operations are defined for a stack. The two most important are PUSH and POP. The PUSH operation adds an element to the top of the stack. The POP operation, conversely, removes an element from the top of the stack and reduces the stack size by one.
[0104] Therefore, index information can be stored in an ordered manner directly by using a last-in-last-out queue, without the need to build a linked list, thus improving the efficiency of building the recycling table.
[0105] By creating a retrieval pointer in the Last-In-First-Out (LIFO) queue, index information that can be retrieved at any time is indicated, so that capability data can be saved to the data item corresponding to that index information. Simultaneously, the retrieval pointer in the LIFO queue also indicates index information that can be saved at any time from empty entries in the capability table.
[0106] Therefore, by creating a recycling table with a header pointer and a recycling pointer, it is possible to quickly obtain index information from the recycling table, which is used to save capability data to the data item in the capability table corresponding to the index information, and to quickly identify the index information of data items that release memory and / or empty data items in the capability table, and save them to the recycling item so that they can be used to save capability data next time, thereby improving the recycling efficiency of data items in the capability table and the data saving efficiency.
[0107] S102: If there are empty entries in the capability table, the index information of the empty entries is entered into the corresponding recycling entry in the recycling table by the recycling pointer.
[0108] In this step, if it is confirmed that there are empty items in the capability table, the index information of the empty items is entered into the corresponding recycling item in the recycling table by the recycling pointer. This enables the rapid identification of the index information of data items that are releasing memory and / or empty data items in the capability table, and saves them to the recycling item so that they can be used to save capability data next time. This improves the recycling efficiency of data items in the capability table and the data saving efficiency.
[0109] In a preferred embodiment, if it is confirmed that there are empty entries in the capability table, the index information of the empty entries is entered into the corresponding recycling entry in the recycling table by the recycling pointer, including:
[0110] If the capability table contains a data item for releasing memory, then set the data item for releasing memory as the first empty item, set the index information of the first empty item as the first index, save the first index to the second item in the recycling table corresponding to the recycling pointer, and convert the second item containing the first index into the first item.
[0111] If it is confirmed that the first item is not in the recycling table, then the empty data item in the capability table is set as the second empty item, and the index information of the second empty item is set as the second index. The second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item with the second index is converted into the first item.
[0112] Adjust the recycling pointer so that it points to the first of at least one of the second entries in the recycling table.
[0113] In this example, if a data item releasing memory is detected in the capability table, the index information of that data item is obtained in a timely manner and saved to the recycling table. This enables timely capture of data items releasing memory in the capability table and saves and manages their index information for use in saving the next received capability data, thereby improving the control over the data items in the capability table.
[0114] If the first item is not found in the reclaim table, it means that all currently used data items in the capability table have already stored capability data. Therefore, it is necessary to release the idle data items in the capability table to meet the current capability data storage requirements of the capability table. Therefore, by entering the index information of the idle data items in the capability table into the reclaim table, it is ensured that the reclaim table always has reclaim items whose index information can be extracted to handle the operation of storing capability data into the capability table.
[0115] In a preferred embodiment, if it is confirmed that there are empty entries in the capability table, the index information of the empty entries is entered into the corresponding recycling entry in the recycling table by the recycling pointer, including:
[0116] If the capability table contains a data item for releasing memory, then set the data item for releasing memory as the first empty item, set the index information of the first empty item as the first index, save the first index to the second item in the recycling table corresponding to the recycling pointer, and convert the second item containing the first index into the first item.
[0117] If it is confirmed that the first item is not in the recycling table, then the empty data item in the capability table is set as the second empty item, and the index information of the second empty item is set as the second index. The second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item with the second index is converted into the first item.
[0118] Adjust the recycling pointer so that it points to the first of at least one of the second entries in the recycling table.
[0119] In this example, if a data item releasing memory is detected in the capability table, the index information of that data item is obtained in a timely manner and saved to the recycling table. This enables timely capture of data items releasing memory in the capability table and saves and manages their index information for use in saving the next received capability data, thereby improving the control over the data items in the capability table.
[0120] If the first item is not found in the reclaim table, it means that all currently used data items in the capability table have already stored capability data. Therefore, it is necessary to release the idle data items in the capability table to meet the current capability data storage requirements of the capability table. Therefore, by entering the index information of the idle data items in the capability table into the reclaim table, it is ensured that the reclaim table always has reclaim items whose index information can be extracted to handle the operation of storing capability data into the capability table.
[0121] In this embodiment, the recycling pointer is used to indicate the index information for storing vacant items obtained from the capability table.
[0122] In another preferred embodiment, if it is confirmed that there are empty entries in the capability table, the index information of the empty entries is entered into the corresponding recycling entry in the recycling table by the recycling pointer, including:
[0123] If the capability table is confirmed to have a data item for releasing memory, then the data item for releasing memory is set as the first empty item, and the index information of the first empty item is set as the first index. The recycling pointer is adjusted to indicate the second item next to the first item located at the end. The first index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the first index is converted to the first item.
[0124] If it is confirmed that the first item is not in the recycling table, then the empty data item in the capability table is set as the second empty item, and the index information of the second empty item is set as the second index. The recycling pointer is adjusted to indicate the second item next to the first item at the end, the second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item with the second index is converted to the first item.
[0125] In this example, if a data item releasing memory is detected in the capability table, the index information of that data item is obtained in a timely manner and saved to the recycling table. This enables timely capture of data items releasing memory in the capability table and saves and manages their index information for use in saving the next received capability data, thereby improving the control over the data items in the capability table.
[0126] If the first item is not found in the reclaim table, it means that all currently used data items in the capability table have already stored capability data. Therefore, it is necessary to release the idle data items in the capability table to meet the current capability data storage requirements of the capability table. Therefore, by entering the index information of the idle data items in the capability table into the reclaim table, it is ensured that the reclaim table always has reclaim items whose index information can be extracted to handle the operation of storing capability data into the capability table.
[0127] In this embodiment, the recycling pointer is used to indicate the index information for saving empty items obtained from the capability table, and to indicate the index information for obtaining data items from the recycling table for saving capability data to the capability table.
[0128] Example 2:
[0129] Please see Figure 6 This application provides a method for storing capability table data items, including:
[0130] S201: Receive capability data; where capability data is the data information used to store in the capability table;
[0131] In this step, the computer system receives capability data output to the real-time operating system (RTOS), enabling the implementing operating system running the storage method of capability table data items to access entities in the computer system based on the capability data. In this embodiment, capability data is a token that allows the owner to access entities (devices such as USB flash drives, cameras, etc.) or objects (files, directories, network ports, memory, etc.) in the computer system.
[0132] S202: Obtain the recycling table in the recycling method of the capability table data items, and set the retrieved index information of a recycling item in the recycling table as the target index;
[0133] In a preferred embodiment, setting the retrieved index information from a reclaimed item in the reclaim table as the target index includes:
[0134] Identify the head pointer in the recycling table;
[0135] Set the index information in the first item pointed to by the head pointer as the target index, extract the target index from the first item, and delete the target index in the first item to make the first item become the second item; among them, the item that has index information stored in the recycling table is the first item, and the empty item is the second item;
[0136] Adjust the head pointer so that it points to the first item in at least one of the first items in the recycling table.
[0137] In this example, the index information is quickly obtained from the recycling table by using the head pointer, and the capability data is saved to the data item in the capability table corresponding to the index information based on the index information, which improves the efficiency of capability data saving.
[0138] In another preferred embodiment, setting the retrieved index information in a reclaimed item of the reclaimed table as the target index includes:
[0139] Identify the recycling pointer in the recycling table;
[0140] Set the index information in the first item pointed to by the recycling pointer as the target index, extract the target index from the first item, and delete the target index in the first item to make the first item the second item; where the recycling item that stores the index information in the recycling table is the first item, and the empty recycling item is the second item;
[0141] Adjust the recycling pointer so that it points to the last item in at least one of the first items in the recycling table.
[0142] In this example, the index information is quickly obtained from the recycling table using a recycling pointer, and the capability data is saved to the data item in the capability table corresponding to that index information based on the index information, thus improving the efficiency of capability data saving. At the same time, a single recycling pointer can simultaneously obtain the index information used to save capability data to the data item and save the index information of empty items in the capability table to the recycling table, reducing the complexity of the recycling table.
[0143] S203: Save the capability data to the data item in the capability table corresponding to the target index.
[0144] In this step, the data item in the capability table corresponding to the target index is identified. The target index is the address information that represents the location of the data item in the capability table, or the index identification information that serves as the unique identifier of the data item in the capability table. Therefore, the empty item in the capability table can be quickly found through the target index, and the capability data can be saved to the empty item, thus improving the data saving efficiency.
[0145] Example 3:
[0146] Please see Figure 7 This application provides a device 1 for retrieving data items from a capability table, comprising:
[0147] The recycling table creation module 11 is used to create a recycling table with a recycling pointer; wherein, the recycling table has at least one recycling item; the recycling item is used to store the index information of the empty item in the capability table; the recycling pointer is used to indicate a recycling item that can store the index information of an empty item; the capability table is an array used to store capability data, and the capability table has at least one data item for storing capability data; an empty item is a data item in the capability table that has a data item that has been freed from memory and / or is an empty data item;
[0148] The vacant item recycling module 12 is used to enter the index information of the vacant item into the corresponding recycling item in the recycling table if there is a vacant item in the confirmed capability table.
[0149] Example 4:
[0150] Please see Figure 8 This application provides a storage device 2 for capability table data items, comprising:
[0151] Data input module 21 is used to receive capability data;
[0152] The index identification module 22 is used to obtain the recycling table in the recycling device of the capability table data items, and to set the obtained index information in a recycling item of the recycling table as the target index;
[0153] The data storage module 23 is used to save capability data to the data item in the capability table corresponding to the target index.
[0154] Example 5:
[0155] To achieve the above objectives, this application also provides a computer device 7, including: a processor 72 and a memory 71 communicatively connected to the processor 72; the memory stores computer-executed instructions;
[0156] The processor executes computer execution instructions stored in memory 71 to implement the aforementioned method for retrieving and storing capability table data items. The components of the capability table data item retrieval device and the capability table data item storage device can be distributed across different computer devices. Computer device 7 can be a smartphone, tablet, laptop, desktop computer, rack server, blade server, tower server, or cabinet server (including standalone servers or server clusters composed of multiple application servers), etc. The computer device in this embodiment includes, but is not limited to, memory 71 and processor 72, which are interconnected via a system bus. Figure 9 As shown. It should be noted that, Figure 9Only computer devices with components are shown; however, it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented alternatively. In this embodiment, memory 71 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, memory 71 may be an internal storage unit of the computer device, such as the hard disk or RAM of the computer device. In other embodiments, memory 71 may also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, memory 71 may also include both internal storage units and external storage devices of the computer device. In this embodiment, memory 71 is typically used to store the operating system and various application software installed on the computer device, such as the program code for the capability table data item retrieval device and the capability table data item storage device in Embodiment 3. Furthermore, memory 71 can also be used to temporarily store various types of data that have been output or will be output. Processor 72, in some embodiments, can be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. Processor 72 is typically used to control the overall operation of the computer device. In this embodiment, processor 72 is used to run the program code stored in memory 71 or process data, for example, to run the capability table data item retrieval device and the capability table data item storage device to implement the capability table data item retrieval method and the capability table data item storage method of the above embodiments.
[0157] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application. It should be understood that the processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The memory may include high-speed RAM, and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk, or optical disk, etc.
[0158] To achieve the above objectives, this application also provides a computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., which stores computer-executable instructions. When the program is executed by processor 72, it implements the corresponding functions. The computer-readable storage medium of this embodiment is used to store computer-executable instructions for implementing the method for retrieving and storing capability table data items. When executed by processor 72, it implements the method for retrieving and storing capability table data items of the above embodiment.
[0159] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0160] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.
[0161] This application provides a computer program product, including a computer program, which, when executed by a processor, implements the above-described method for retrieving capability table data items and method for storing capability table data items.
[0162] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0163] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0164] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for retrieving data items from a capability table, characterized in that, include: Create a recycling table with a recycling pointer; wherein the recycling table has at least one recycling entry; the recycling entry is used to store the index information of empty entries in the capability table; the recycling pointer is used to indicate a recycling entry that can store the index information of one of the empty entries; the capability table is an array used to store capability data, and the capability table has at least one data entry used to store the capability data; the empty entry is a data entry in the capability table that has released memory and / or is an empty data entry. If it is confirmed that there is a vacant item in the capability table, then the index information of the vacant item is entered into the corresponding recycling item in the recycling table by the recycling pointer.
2. The method for retrieving capability table data items according to claim 1, characterized in that, The creation of a recycling table with recycling pointers includes: Create at least one recycle item, and link the recycle items sequentially to form a linked list; wherein, the recycle item that stores index information in the linked list is the first item, and the empty recycle item is the second item; Create a head pointer in the linked list; wherein the head pointer is used to indicate the first item at the beginning of at least one first item in the linked list; A recycling pointer is created in the linked list; wherein the recycling pointer is used to indicate the first second item in at least one second item of the linked list; the first second item is used to store the index information of the empty item; The linked list containing the head pointer and the recycling pointer is designated as the recycling table.
3. The method for retrieving capability table data items according to claim 1, characterized in that, The creation of a recycling table with recycling pointers includes: Create a first-in-first-out queue with at least one reclaimed item; wherein, the reclaimed item that stores index information in the first-in-first-out queue is the first item, and the empty reclaimed item is the second item; Create a head pointer in the first-in-first-out queue; wherein the head pointer is used to indicate the first item that is at the head of at least one first item in the first-in-first-out queue; A retrieval pointer is created in the first-in-first-out queue; wherein the retrieval pointer is used to indicate the first second item in at least one second item of the first-in-first-out queue; the first second item is used to store the index information of an empty item; Set the first-in-first-out queue with the head pointer and the recycling pointer as the recycling table.
4. The method for retrieving capability table data items according to any one of claims 2 or 3, characterized in that, If it is confirmed that there is a vacant entry in the capability table, then the index information of the vacant entry is entered into the corresponding vacant entry in the vacant table by the vacant pointer, including: If it is confirmed that there is a data item for releasing memory in the capability table, then the data item for releasing memory is set as the first empty item, and the index information of the first empty item is set as the first index. The first index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the first index is converted into the first item. If it is confirmed that the recycling table does not have a first item, then the empty data item in the capability table is set as a second empty item, and the index information of the second empty item is set as a second index. The second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the second index is converted into the first item. Adjust the recycling pointer so that it points to the first item in at least one of the second items in the recycling table.
5. The method for retrieving capability table data items according to claim 1, characterized in that, The creation of a recycling table with recycling pointers includes: Create a last-in-first-out (LIFO) queue with at least one reclaimed item; wherein, the reclaimed item that stores index information in the LIFO queue is the first item, and the empty reclaimed item is the second item; A recycling pointer is created in the last-in-first-out queue; wherein the recycling pointer is used to indicate the last item in at least one first item of the last-in-first-out queue; the second item next to the last first item is used to store the index information of an empty item; Set the last-in-first-out queue with the recycling pointer as the recycling table.
6. The method for retrieving capability table data items according to claim 5, characterized in that, If it is confirmed that there is a vacant entry in the capability table, then the index information of the vacant entry is entered into the corresponding vacant entry in the vacant table by the vacant pointer, including: If it is confirmed that there is a data item for releasing memory in the capability table, then the data item for releasing memory is set as the first empty item, and the index information of the first empty item is set as the first index. The recycling pointer is adjusted to indicate the second item next to the first item located at the end. The first index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the first index is converted into the first item. If it is confirmed that the first item is not in the recycling table, then the empty data item in the capability table is set as the second empty item, and the index information of the second empty item is set as the second index. The recycling pointer is adjusted to indicate the second item next to the first item located at the end. The second index is saved to the second item in the recycling table corresponding to the recycling pointer, and the second item that saves the second index is converted into the first item.
7. A method for storing data items in a capability table, characterized in that, include: Receive capability data; wherein, the capability data is data information used to store in the capability table; The recycling table is obtained in the recycling method of any of the capability table data items as described in claims 1-6, and the index information of a recycling item in the recycling table is set as the target index; The capability data is saved to the data item in the capability table corresponding to the target index.
8. The method for storing capability table data items according to claim 7, characterized in that, Setting the index information of a recycling item in the recycling table as the target index includes: Identify the head pointer in the recycling table; The index information in the first item indicated by the head pointer is set as the target index, the target index is extracted from the first item, and the target index in the first item is deleted so that the first item becomes the second item; wherein, the recycling item that stores the index information in the recycling table is the first item, and the empty recycling item is the second item; Adjust the head pointer so that it points to the first item at the beginning of at least one of the first items in the recycling table.
9. The method for storing capability table data items according to claim 7, characterized in that, Setting the index information of a recycling item in the recycling table as the target index includes: Identify the recycling pointer in the recycling table; The index information in the first item indicated by the recycling pointer is set as the target index, the target index is extracted from the first item, and the target index in the first item is deleted so that the first item becomes the second item; wherein, the recycling item that stores the index information in the recycling table is the first item, and the empty recycling item is the second item; Adjust the recycling pointer so that it points to the last item in at least one of the first items in the recycling table.
10. A device for retrieving data items from a capability table, characterized in that, include: A recycling table creation module is used to create a recycling table with a recycling pointer; wherein, the recycling table has at least one recycling entry; the recycling entry is used to store the index information of empty entries in the capability table; the recycling pointer is used to indicate a recycling entry that can store the index information of one of the empty entries; the capability table is an array used to store capability data, and the capability table has at least one data entry used to store the capability data; the empty entry is a data entry in the capability table that has a memory-released data entry and / or is an empty data entry; The vacant item recycling module is used to, if it is confirmed that there is a vacant item in the capability table, enter the index information of the vacant item into the recycling pointer in the corresponding recycling item in the recycling table.
11. A storage device for capability table data items, characterized in that, include: The data input module is used to receive capability data; An index identification module is used to obtain the recycling table in the recycling device of the capability table data item as described in claim 10, and to set the index information of a recycling item in the recycling table as the target index; The data storage module is used to save the capability data to the data item in the capability table corresponding to the target index.
12. A computer device, characterized in that, include: A processor and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method for retrieving capability table data items as described in any one of claims 1 to 6, and the method for storing capability table data items as described in any one of claims 7 to 9.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method for retrieving capability table data items as described in any one of claims 1 to 6, and the method for storing capability table data items as described in any one of claims 7 to 9.
Citation Information
Patent Citations
Method and device for allocating internal memory
CN102866954A
Memory reclamation on a computing device
US20160267005A1