Device and method for managing storage space, and computing equipment
The multi-granularity storage space management device designed through hardware circuits solves the problems of long paths and high delays in memory space management, achieves fast and efficient space allocation and recycling, and improves the performance and efficiency of the computing system.
Patent Information
- Application Number
- CN202210853748.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-07-20
AI Technical Summary
Memory space management in the existing technology has problems such as long paths, high delays, and complex structures. It is also difficult to achieve parallel operations of space recycling and allocation, which limits the improvement of operating efficiency.
A device for managing storage space is designed through hardware circuits, including an initialization module and a space management module. It uses multi-granularity storage unit indexes for space allocation and recycling, reducing the number of storage unit indexes and data transmission resource occupation.
It achieves fast and efficient memory space management, improves the running speed and overall performance of the computing system, reduces processor resource usage, and optimizes storage space management efficiency.
Smart Images

Figure CN117472792B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular, to a storage space management device, a computing device, and a storage space management method. Background Art
[0002] With the development of computer technology, more and more computing devices have appeared in people's lives, work and study. Generally speaking, in these computing devices, there are various forms of processors, controllers or microcontrollers. When they run applications to achieve certain functions, they need to request a certain amount of space from the memory. When the application ends, the corresponding space can be released. This involves the management of memory space.
[0003] At present, memory space management is generally implemented through software, that is, the CPU (central processing unit) or MCU (Microcontroller Unit) runs the memory management strategy and issues instructions, which are then processed by the hardware system and read and write operations to the memory through the bus. In this type of software-implemented memory management solution, there are usually problems such as long paths, high latency, and complex structures. Summary of the invention
[0004] In view of this, the present disclosure provides an apparatus for managing storage space, a method for managing storage space, and a computing device, which can alleviate, mitigate, or even eliminate the above-mentioned problems.
[0005] According to one aspect of the present disclosure, there is provided a device for managing storage space, comprising: a first interface connected to an external request source and configured to receive a space management request from the external request source; a second interface connected to a memory, the memory comprising a storage space; an initialization module configured to: after the device is powered on, write a plurality of storage unit indexes in a first storage area of the storage space via the second interface, wherein each storage unit index is used to represent a storage unit in a second storage area of the storage space, each storage unit in the second storage area has a preset size in a preset size set, the preset size set comprising at least two unequal preset sizes; and a space management module configured to: based on the space management request, manage the storage unit indexes in the first storage area via the second interface.
[0006] In some embodiments, writing a plurality of storage unit indexes in a first storage area of a storage space includes: writing at least one storage unit index in each sub-area of the first storage area, so that all storage unit indexes in each sub-area correspond to a preset size.
[0007] In some embodiments, the space management module includes: a space counting module, configured to receive a space management request when the space counting module is in an idle state, and split the space management request into one or more sub-management requests, wherein each sub-management request corresponds to a preset size in the preset size set.
[0008] In some embodiments, the space management request includes a space allocation request and a space reclamation request, and wherein splitting the space management request into one or more sub-management requests includes: in response to the space management request being a space reclamation request, splitting the space reclamation request into one or more sub-reclamation requests according to the storage unit index corresponding to the space requested to be reclaimed by the space reclamation request, wherein each sub-reclamation request corresponds to a preset size in a preset size set; in response to the space management request being a space allocation request, splitting the space allocation request into one or more sub-allocation requests according to the size of the space requested to be allocated by the space allocation request, wherein each sub-allocation request corresponds to a preset size in a preset size set.
[0009] In some embodiments, the space management module also includes: a space allocation module, configured to receive a sub-allocation request from the space counting module, and based on the sub-allocation request, read one or more storage unit indexes from the first storage area via the second interface; a space recovery module, configured to receive a sub-recovery request from the space counting module, and based on the sub-recovery request, write the corresponding storage unit index to the first storage area via the second interface.
[0010] In some embodiments, the space allocation module includes at least two sub-allocation modules, each sub-allocation module corresponds to a preset size in a preset size set, and is configured to receive a sub-allocation request corresponding to the corresponding preset size; the space recovery module includes at least two sub-recovery modules, each sub-recovery module corresponds to a preset size in a preset size set, and is configured to receive a sub-recovery request corresponding to the corresponding preset size.
[0011] In some embodiments, each sub-allocation module is configured to read a storage unit index from a first storage area based on a received sub-allocation request via a second interface and according to a position pointed to by a first pointer corresponding to the sub-allocation module; and wherein each sub-recycling module is configured to write a storage unit index to the first storage area based on a received sub-recycling request via a second interface and according to a position pointed to by a second pointer corresponding to the sub-recycling module.
[0012] In some embodiments, splitting a space allocation request into one or more sub-allocation requests includes: in response to the space allocation request, the space requested for allocation can be completely split into a combination of one or more storage units, wherein each of the split storage units has a preset size from the preset size set, splitting the space requested for allocation by the space allocation request to determine the number of storage units having each preset size, and minimizing the number of split storage units.
[0013] In some embodiments, splitting the space allocation request into one or more sub-allocation requests also includes: in response to the available number of storage units of each preset size being greater than or equal to the number of storage units of that preset size determined by splitting, sending one or more sub-allocation requests in sequence based on the one or more storage units after the split, wherein each sub-allocation request corresponds to a preset size in a preset size set and includes the number of storage units of that preset size determined by splitting.
[0014] In some embodiments, splitting the space allocation request into one or more sub-allocation requests further includes: in response to the existence of an available number of storage units of a preset size being less than the number of storage units of the preset size determined by splitting, reporting information indicating an error.
[0015] In some embodiments, splitting a space allocation request into one or more sub-allocation requests further includes: in response to the space allocation request, the space requested for allocation cannot be completely split into a combination of one or more storage units, wherein each of the split storage units has a preset size from a preset size set, reporting information indicating an error.
[0016] In some embodiments, the space counting module includes at least two index counters, each index counter corresponds to a preset size in a preset size set, and the space counting module is further configured to: based on the number of storage unit indexes involved in one or more sub-recycling requests after the split, change the corresponding one or more index counters in a first direction; based on the number of storage unit indexes involved in one or more sub-allocation requests after the split, change the corresponding one or more index counters in a second direction, and the second direction is opposite to the first direction.
[0017] In some embodiments, the device also includes: an address register, configured to store address modification data for the starting address and / or ending address of one or more sub-areas in the first storage area based on user input, and send the address modification data to the initialization module and / or the space management module after the device is powered on.
[0018] According to another aspect of the present disclosure, a computing device is provided, comprising the apparatus for managing storage space according to the embodiments in the aforementioned aspects.
[0019] According to another aspect of the present disclosure, a method for managing storage space is provided, comprising: after powering on a device, writing a plurality of storage cell indexes in a first storage area of the storage space, wherein each storage cell index is used to represent a storage cell in a second storage area of the storage space, each storage cell in the second storage area has a preset size in a preset size set, the preset size set including at least two mutually unequal preset sizes; receiving a space management request from an external request source; and managing the storage cell indexes in the first storage area based on the space management request.
[0020] The device for managing storage space provided by the present disclosure allows memory management to be implemented in hardware, which helps to avoid the problems of long paths and high delays caused by software methods, thereby helping to improve the management efficiency of storage space, and further helping to improve the operating speed of the entire computing system. At the same time, implementing memory management with the help of a separate hardware device can release the resources of the processor, controller or microcontroller, help to achieve the optimal configuration of its resources, and thus help to improve the overall performance of the computing system. Specifically, the device for managing storage space provided by the present disclosure can receive a space management request from an external request source through a hardware interface, and manage the storage space (such as allocation and recycling) by managing the storage unit index in the first storage area. This can achieve quick management of memory space. In addition, by dividing the second storage area into storage units with different preset sizes, it is allowed to schedule storage units with different preset sizes according to the different sizes of the storage space involved in the space management request, thereby allowing storage space management to be implemented with fewer storage unit indexes, which helps to reduce the occupancy of data transmission lines and helps to further improve the efficiency of storage space management.
[0021] These and other aspects of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0023] Figure 1 A schematic diagram showing an exemplary memory management architecture in the related art;
[0024] Figure 2 Schematically illustrates an example block diagram of a storage space management system according to some embodiments of the present disclosure;
[0025] Figure 3A and 3B Schematically illustrates a storage space partitioning scheme according to some embodiments of the present disclosure;
[0026] Figure 4 Schematically illustrates an example structure of a storage space index according to some embodiments of the present disclosure;
[0027] Figure 5A Schematically shows another example block diagram of a storage space management system according to some embodiments of the present disclosure;
[0028] Figure 5B An example block diagram of an apparatus for managing storage space according to some embodiments of the present disclosure is schematically shown;
[0029] Figure 6 schematically illustrates an example state machine for a space counting module according to some embodiments of the present disclosure;
[0030] Figure 7 Schematically illustrates an example block diagram of a space counting module according to some embodiments of the present disclosure;
[0031] Figure 8 An example scheme for managing a storage unit index by means of a first pointer and a second pointer is schematically shown;
[0032] Fig. 9 schematically illustrates an example state machine for a sub-allocation module according to some embodiments of the present disclosure;
[0033] Fig.10 Schematically illustrates an example block diagram of a sub-allocation module according to some embodiments of the present disclosure;
[0034] Fig.11 schematically illustrates an example state machine for a sub-recycling module according to some embodiments of the present disclosure;
[0035] Fig.12 Schematically illustrates an example block diagram of a sub-recycling module according to some embodiments of the present disclosure;
[0036] Fig.13 Schematically illustrates an example block diagram of a request classification module according to some embodiments of the present disclosure;
[0037] Fig.14 An example block diagram of a computing device according to some embodiments of the present disclosure is schematically shown;
[0038] Fig.15 An example flowchart of a space management method according to some embodiments of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the drawings in the embodiments of the present disclosure. It should be understood that the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0040] Figure 1 FIG. 1 is a schematic diagram of a memory management architecture 100 in the related art. Figure 1 As shown, in the related art, the memory 110 can be directly managed by the processor 120 or a similar structure via the bus 130. Exemplarily, when the processor 120 needs to write data to the memory space, it can determine the available space according to the internally stored memory space management strategy, and then issue an instruction to write data to the corresponding memory space, which can be processed by hardware and sent to the memory 110 via the bus 130 to implement data writing. Data reading, deletion and other processes can be implemented similarly. However, the applicant found that there are the following disadvantages in performing memory management in this way: first, it is necessary to occupy the resources of the processor (or controller, microcontroller, etc.) to perform space allocation, recycling and other operations, which is not conducive to the efficient use of its resources; second, the allocation and recycling of memory space is implemented by software, and the hardware needs to process the instructions, and then read and write operations are performed in the memory space through the bus, which has the characteristics of long path, high delay, and complex structure; third, it is difficult to achieve parallel operations of space recycling and space allocation by managing memory in software, which limits the improvement of operation efficiency; and so on.
[0041] Based on the above considerations, the applicant has proposed a solution for implementing memory management through hardware circuits, which helps to solve or alleviate the above-mentioned problems.
[0042] Figure 2 An example block diagram of a storage space management system 200 according to some embodiments of the present disclosure is schematically shown. The storage space management system 200 includes a device 210 for managing storage space, which can receive a space management request from an external request source 220 and process the received space management request to manage the storage space in a memory 230. Exemplarily, the memory 230 can be various memories used as memory, such as a double data rate (DDR) synchronous dynamic random access memory, or other types of memories. Exemplarily, the external request source 220 can be any device that can initiate a space management request, such as a CPU, an MCU, etc.
[0043] like Figure 2As shown, the device 210 may include a first interface 211, a second interface 212, an initialization module 213 and a space management module 214. The first interface 211 may be connected to the external request source 220, for example, through a dedicated line or a public line (such as a bus), and is used to realize the communication between the external request source 220 and the device 210, for example, to realize data communication through a handshake. The first interface 211 may be configured to receive a space management request from the external request source 220, and may be configured to feed back the management result from the space management module to the external request source 220, and the management result may be, for example, information indicating the storage unit index of the allocated space, space allocation failure, space recovery success, etc. The second interface 212 may be configured to be connected to the memory 230, and is used to realize the communication between the memory 230 and the device 210, for example, a read or write request from the device 210 may be sent to the memory 230, and data from the memory 230 may be fed back to the device 210, etc.
[0044] The initialization module 213 may be configured to write a plurality of storage unit indexes in the first storage area of the storage space of the memory 230 via the second interface 212 after the device 210 is powered on, wherein each storage unit index is used to characterize a storage unit in the second storage area of the storage space, and each storage unit in the second storage area has a preset size in a preset size set, and the preset size set includes at least two mutually unequal preset sizes. Exemplarily, when the hardware circuit is powered on and reset, the initialization module 213 may first write the storage unit index into the first storage area of the memory 230, and the first storage area may be a pre-specified area, and its size and position may be adjusted as needed. When all storage unit indexes are written, the device 210 may start to respond to the space management request from the external request source 220, and thereafter the initialization module 213 may no longer work until the hardware circuit is powered off and restarted after the next power-on. Exemplarily, when the initialization module 213 completes the above-mentioned index writing operation, it may send a signal to the front-stage circuit (such as the request classification module or other circuit module described below) to inform the front-stage circuit that it can start receiving the space management request.
[0045] For example, Figure 3AA schematic diagram of a storage space 300 is shown. As shown in the figure, the storage space 300 may include a first storage area 310 and a second storage area 320. Optionally, the storage space 300 may also include other storage areas 330 reserved for other uses. The second storage area 320 may be divided into a plurality of storage units, each of which may have a preset size in a preset size set. The preset size set may be set according to specific requirements, for example, may be set to include one or more of 2MB, 512 KB, 128 KB, 64 KB, 16 KB, 4 KB, or may also include other preset sizes. The first storage area 310 may be written with a plurality of storage unit indexes, each of which may represent a storage unit in the second storage area 320. For example, when the size of the second storage area is 8Gb, assuming that 4 Gb storage space is divided into 2 MB granularity, 2 GB storage space is divided into 512 KB granularity, 1 GB storage space is divided into 128 KB granularity, 512 MB storage space is divided into 64 KB granularity, 256 MB storage space is divided into 16 KB granularity, and 256 MB storage space is divided into 4KB granularity, then it can be divided into 2048 2 MB storage units, 4096 512 KB storage units, 8192 128 KB storage units, 8192 64 KB storage units, 16384 16 KB storage units, and 65536 4 KB storage units. If a 4-byte storage unit index is assigned to each storage unit, the storage unit index corresponding to the 2 MB storage unit requires 8 KB for storage, the storage unit index corresponding to the 512 KB storage unit requires 16 KB for storage, the storage unit index corresponding to 8192 128 KB storage units requires 32 KB for storage, the storage unit index corresponding to the 64 KB storage unit requires 32 KB for storage, the storage unit index corresponding to the 16 KB storage unit requires 64 KB for storage, and the storage unit index corresponding to the 4 KB storage unit requires 256 KB for storage. Therefore, the size of the first storage area can be 408 KB.
[0046] In some embodiments, at least one storage unit index may be written in each sub-region of the first storage region, so that all storage unit indexes in each sub-region correspond to a preset size. Figure 3BAs shown, the first storage area 310 can be divided into sub-areas 311, 312, etc., and each sub-area can only write storage unit indexes corresponding to the same preset size. Taking the example described above as an example, the first storage area can be divided into 6 sub-areas, which store storage unit indexes corresponding to storage units of 2 MB, 512 KB, 128 KB, 64 KB, 16 KB, and 4 KB, respectively. This can further facilitate the management of storage units of different preset sizes (or different granularities).
[0047] In some embodiments, in order to identify storage unit indexes corresponding to different preset sizes, an identifier indicating the preset size may be included in each storage unit index. Figure 4 As shown, the storage unit index 400 can be divided into an identifier part 410 and a unit index part 420. The identifier part 410 can be used to store an identifier indicating a preset size, and the unit index part 420 can be used to store an index value of a storage unit having a corresponding preset size. For example, in the example described above with 6 preset sizes of 2 MB, 512 KB, 128 KB, 64 KB, 16 KB, and 4 KB, and with 4 bytes representing the storage unit index, for each storage unit index, the preset size can be represented by the upper 3 bits, for example, 000 can represent 4 KB, 001 can represent 16 KB, 010 can represent 64 KB, 011 can represent 128 KB, 100 can represent 512 KB, and 101 can represent 2 MB, and the remaining 29 bits represent a specific index value.
[0048] The space management module 214 may be configured to manage the storage unit index in the first storage area in the memory 230 via the second interface 212 based on the space management request. Exemplarily, the space management module 214 may read the storage unit index from the first storage area or write the storage unit index to it based on the space management request to complete the allocation and recycling of the corresponding storage unit in the second storage area.
[0049] Exemplarily, the storage space device 210 can be implemented as various types of hardware circuits, such as formed as an integrated circuit, packaged as a chip structure, etc., so that it can be used according to needs, such as being soldered to corresponding pins of a circuit board or inserted into corresponding sockets of a circuit board, etc.
[0050] Through device 210, the storage space of memory 230 (for example, internal memory such as DDR) can be managed by hardware, which can avoid the disadvantages of software management and provide a more convenient management method, which is conducive to improving space management efficiency and saving processing resources of main control units such as CPU or MCU, thereby improving the operating efficiency of the entire computing system and optimizing the resource allocation of the entire computing system.
[0051] In addition, the device 210 can divide the storage space in the memory into storage units with multiple granularities for management. Compared with the single-granularity division method, it helps to reduce the storage space occupied by the storage unit index, reduce the data transmission resources required for reading and writing the storage unit index, and improve the reading and writing efficiency, thereby further improving the storage space management efficiency. Specifically, still taking the division of the 8 GB storage space mentioned above as an example, when divided with a single granularity, in order to ensure that the storage space can be reasonably and effectively allocated, it can only be divided with a smaller granularity. For example, when the 8 GB storage space is divided with a 4 KB granularity, it will need to be divided into a total of 2097152 storage units, thereby requiring a total of 2097152 storage unit indexes. Still assuming that each storage unit index is stored in the first storage area with 4 bytes, the size of the first storage area will need to reach 8MB. Obviously, the size of the first storage area at this time is much larger than the size of the first storage area in the solution according to the embodiment of the present disclosure. In other words, compared with the single-granularity partitioning method, the multi-granularity partitioning method in the embodiment of the present disclosure can reduce the consumption of storage space, so that more space in the memory can be allocated to the external request source for use. Further, since the number of storage unit indexes required to be written by the initialization module is greatly reduced, the required writing time will also be greatly reduced, that is, the writing process of the storage unit index can be completed more quickly, so that the space management request can be processed more quickly after the device is powered on. In addition, during the processing of the space management request, that is, during the management of the storage unit index, compared with the single-granularity method, the multi-granularity method in the embodiment of the present disclosure can also improve the read and write efficiency of the storage unit index. Specifically, taking a request involving the management of 2 MB storage space as an example, if it is managed in a 4 KB single-granularity method, a total of 512 storage unit indexes need to be read / written; if it is managed in the multi-granularity method mentioned above, it may only be necessary to read / write 1 storage unit index corresponding to the 2 MB storage unit. It can be seen that the latter can greatly reduce the number of storage unit indexes required to be read and written, thereby helping to reduce the read and write time. For further example, when the reading and writing of the storage unit index is completed through the bus, for the former, if the bus burst length is 128, a total of 4 read / write requests need to be triggered; for the latter, the bus burst length can be set to 1. It can be seen that the latter can greatly reduce the bus occupancy time.
[0052] FIG5 schematically shows an example block diagram of a storage space management system 500 according to some embodiments of the present disclosure. Figure 2 The storage space management system 500 includes a device 510 for managing storage space, an external request source 520 and a memory 530, wherein the external request source 520 and the memory 530 are similar to Figure 2 The external request source 220 and the memory 230 in the apparatus 510 are not described in detail here. The apparatus 510 includes an initialization module 512, which is similar to Figure 2 The initialization module 213 in FIG. 5 is not described in detail here. In addition, for the sake of brevity, the first interface and the second interface are omitted in FIG. 5 .
[0053] As shown in FIG5 , in some embodiments, the space management module may include a space counting module 513. The space counting module 513 may be configured to receive a space management request when in an idle state, and split the received space management request into one or more sub-management requests, wherein each sub-management request corresponds to a preset size in a preset size set. Exemplarily, the space counting module 513 may directly receive a space management request from an external request source 520 via the first interface, or may also receive a space management request from an external request source 520 via other circuit modules (e.g., the request classification module 511 described below). The space counting module 513 may split the space management request according to one or more preset sizes in the preset size set, and transmit the split sub-management request to a lower-level circuit module for further processing. Thus, the process of processing a space management request from an external request source based on a multi-granularity storage unit can be conveniently implemented. Moreover, by splitting the space management request into one or more sub-management requests involving only single-granularity storage units, it can facilitate the integration of the solution provided by the embodiment of the present disclosure with the single-granularity storage space management solution, thereby allowing the device provided by the embodiment of the present disclosure to be more conveniently modified based on the circuit design of the single-granularity solution.
[0054] In some embodiments, the space management request may include a space allocation request and a space reclamation request. Thus, when receiving a space management request, the space counting module may determine whether the space management request is a space allocation request or a space reclamation request, for example, by an identifier related to space allocation or space reclamation in the request or by other means.
[0055] If the space management request is a space reclamation request, the space reclamation request may be split into one or more sub-reclaiming requests based on the storage unit index corresponding to the space requested to be reclaimed by the space reclamation request, wherein each sub-reclaiming request may correspond to a preset size in a preset size set. Exemplarily, the space reclamation request may include one or more storage unit indexes, or may include data related to one or more storage unit indexes. The space counting module may generate one or more sub-reclaiming requests based on the one or more storage unit indexes obtained from the space reclamation request, and each sub-reclaiming request may be used to request the reclamation of a storage unit index of a preset size.
[0056] If the space management request is a space allocation request, the space allocation request can be split into one or more sub-allocation requests according to the size of the space requested to be allocated by the space allocation request, wherein each sub-allocation request can correspond to a preset size in a preset size set. Exemplarily, the space allocation request may include the size of the space requested to be allocated, or may include data related to the size of the space requested to be allocated. The space counting module can split the space requested to be allocated based on the preset size in the preset size set, so that the space requested to be allocated can be split into one or more storage units with the same or different preset sizes, thereby splitting the space allocation request into one or more sub-allocation requests, each of which can be used to request the allocation of a storage unit index of a preset size.
[0057] In some embodiments, when splitting a space allocation request, in order to avoid circuit processing errors, it can be pre-determined whether the space allocation request can be completely split. If the space requested to be allocated by the space allocation request can be completely split into a combination of one or more storage units, wherein each storage unit after the split has a preset size in a preset size set, then the space requested to be allocated by the space allocation request can be split to determine the number of storage units with each preset size, and the number of storage units after the split is minimized. Conversely, if the space requested to be allocated by the space allocation request cannot be completely split into a combination of one or more storage units, wherein each storage unit after the split has a preset size in a preset size set, then information indicating an error can be reported. Exemplarily, taking the example of dividing the storage space with 2 MB, 512 KB, 128 KB, 64 KB, 16 KB, and 4 KB granularity as described above, it can be determined whether the space requested for allocation by the space allocation request satisfies the rule of A*2MB + B*512KB + C*128KB+ D*64KB + E*16KB+F*4KB, where A, B, C, D, E, and F are all integers greater than or equal to zero. If satisfied, it can be considered that the space allocation request can be completely split, and if not satisfied, it can be considered that the space allocation request cannot be completely split. In the case of complete splitting, A, B, C, D, E, and F represent the required number of storage units of each preset size. Optionally, when splitting the space allocation request, in order to further reduce the number of storage unit indexes required to be read and improve reading efficiency, the number of storage units after splitting can be minimized as much as possible. For example, in the above example, the value of A+B+C+D+E+F can be minimized.
[0058] In some embodiments, in order to avoid processing errors of lower-level circuits, after determining that the space allocation request can be completely split, it is also possible to pre-judge whether the available number of storage units of each preset size (i.e., the number of storage unit indexes that can be currently allocated) is greater than or equal to the number of corresponding storage units after the split. If the available number of storage units of each preset size is greater than or equal to the number of storage units of the preset size determined by splitting, then one or more sub-allocation requests can be sent in sequence based on one or more storage units after the split, wherein each sub-allocation request corresponds to a preset size in the preset size set and includes the number of storage units of the preset size determined by splitting. If there is a preset size whose available number of storage units is less than the number of storage units of the preset size determined by splitting, information indicating an error can be reported. Continuing with the example described above, assuming that a space allocation request can be completely split into A 2 MB storage units, B 512 KB storage units, C 128 KB storage units, D 64 KB storage units, E 16 KB storage units, and F 4 KB storage units, if any one or more of the following situations occur, then information indicating an error is reported: the available number of 2 MB storage units is less than A, the available number of 512 KB storage units is less than B, the available number of 128 KB storage units is less than C, the available number of 64 KB storage units is less than D, the available number of 16 KB storage units is less than E, and the available number of 4 KB storage units is less than F. If none of the above situations occur, then one or more sub-allocation requests may be sent in sequence based on the one or more storage units after the split. Exemplarily, one or more sub-allocation requests may be sent in sequence according to the order of storage units from large to small or from small to large or other order.
[0059] In some embodiments, in order to record the available number of storage units of each preset size, the space counting module may include at least two index counters, each of which may correspond to a preset size in the preset size set. Figure 5BAs shown, the space counting module 513 may include index counters 5131-1 to 5131-N, where N is an integer greater than or equal to 2. In such an embodiment, the space counting module may also be configured to: based on the number of storage unit indexes involved in the one or more sub-reclaiming requests after the splitting, change the corresponding one or more index counters in the first direction; based on the number of storage unit indexes involved in the one or more sub-allocation requests after the splitting, change the corresponding one or more index counters in the second direction, wherein the second direction is opposite to the first direction. Continuing with the example of dividing 8 GB storage space into six granularities of 2 MB, 512 KB, 128 KB, 64 KB, 16 KB, and 4 KB as described above, 6 index counters may be set, corresponding to 2 MB, 512 KB, 128 KB, 64 KB, 16 KB, and 4 KB, respectively. When the space allocation request is split, based on the number of storage units of each preset size obtained by the splitting, the corresponding index counter may be reduced by a corresponding amount; for the space recovery request, based on the number of storage units of each preset size involved, the corresponding index counter may be increased by a corresponding amount. Alternatively, the opposite may be performed, that is, for a space allocation request, the index counter increases, and for a space recovery request, the index counter decreases. It should be understood that each index counter may have a maximum value and a minimum value. Exemplarily, the minimum value may be zero, and the maximum value may be the total number of storage units of the corresponding preset size. Thus, the available number of storage units of each preset size may be determined based on the index counter, and then it may be determined whether the available number of storage units of each preset size is greater than or equal to the number of storage units of the preset size determined by splitting according to the embodiments described above.
[0060] Exemplarily, after the space allocation request or the space recovery request is split and sent to the subsequent circuit module or synchronously therewith, the corresponding index counter can be updated. After all sub-recovery requests or sub-allocation requests are transmitted, the space counting module 513 can be restored to an idle state. In addition, after an error is reported because the space allocation request cannot be completely split or because the available number of storage units of one or more preset sizes cannot meet the required number, the space counting module 513 can also be restored to an idle state. After restoring the idle state, the space counting module 513 can receive a new space management request.
[0061] Exemplarily, the space counting module 513 may be composed of Figure 6 The state machine 600 is shown to control.
[0062] like Figure 6As shown, when no space allocation request is received, the state machine 600 can be in the IDLE state, that is, the idle state mentioned above. When a space management request is received, it can be determined whether the space management request is a space allocation request or a space recovery request. If it is a space recovery request, a corresponding sub-recovery request is generated and output to the subsequent circuit module (such as the space recovery module described below) in sequence to recover the corresponding storage unit index and update the corresponding index counter. When all sub-recovery requests are output, it can be restored to the IDLE state. If it is a space allocation request, it can be determined whether the space requested to be allocated by the space allocation request can be completely split into a combination of storage units with a preset size. If it cannot be completely split, an error can be reported and then restored to the IDLE state. If it can be completely split, the space allocation request is split, and it is determined whether the available number of storage units of each preset size involved meets the required number. If not, an error can be reported and then restored to the IDLE state. If it meets, the sub-allocation request can be output to the subsequent circuit module in sequence to allocate the corresponding storage unit index and update the corresponding index counter. When all sub-allocation requests are output, it can be restored to the IDLE state. Various operations involved in the state machine 600 have been described in the various embodiments of the space counting module 513 described with reference to FIG. 5 , and will not be repeated here.
[0063] In some embodiments, the space counting module 513 can Figure 7 The circuit structure shown or other similar structures can be used to implement it.
[0064] like Figure 7 As shown, the space counting module 513 may include a counter circuit 5131, a request classification circuit 5132 and a corresponding logic circuit 5133. The counter circuit 5131 may include one or more index counters mentioned above. The request classification circuit 5132 may be used to determine whether the received space management request is a space allocation request or a space recovery request. The corresponding logic circuit 5133 may perform operations such as splitting, transmitting, and updating the index counter of the space allocation request and the space recovery request according to the various embodiments described above. Alternatively or additionally, the space counting module may also include other circuits, as long as the functions of the space allocation module described in the various embodiments described above can be implemented.
[0065] Back to Figure 5A ,like Figure 5A As shown, the space management module may further include a space allocation module 514 and a space recycling module 515 .
[0066] The space allocation module 514 may be configured to receive a sub-allocation request from the space counting module 513, and based on the received sub-allocation request, read one or more storage unit indexes from the first storage area via the second interface. Exemplarily, the read storage unit indexes are fed back to the external request source, for example, via a pre-stage circuit such as the space counting module 513 to the external request source 520. In some embodiments, as Figure 5B As shown, the space allocation module 514 may include at least two sub-allocation modules 5141-1 to 5141-N, where N is an integer greater than or equal to 2. Each of the sub-allocation modules 5141-1 to 5141-N may correspond to a preset size in the preset size set, and is configured to receive a sub-allocation request corresponding to the corresponding preset size. Therefore, in general, the number of sub-allocation modules may be consistent with the number of types of preset sizes in the preset size set, that is, consistent with the number of index counters. Optionally, each of the sub-allocation modules 5141-1 to 5141-N may be configured to read the storage unit index from the first storage area based on the received sub-allocation request, via the second interface, according to the position pointed to by the first pointer corresponding to the sub-allocation module. Exemplarily, the sub-allocation module may read the corresponding storage unit index by sending an index read request to the memory 530, and the index read request may include a first pointer and the number of indexes to be read. When the number of storage unit indexes corresponding to the sub-allocation request is large, the storage unit indexes may be read in multiple batches.
[0067] The space recycling module 515 may be configured to receive a sub-recycling request from the space counting module 513, and based on the received sub-recycling request, write the corresponding storage unit index to the first storage area via the second interface. Exemplarily, after writing all the storage unit indexes to be recycled to the first storage area in the memory, the space recycling module 515 may feedback information indicating that the recycling is complete to the external request source, for example, via a pre-stage circuit such as the space counting module 513 to the external request source 520. In some embodiments, as Figure 5BAs shown, the space recovery module 515 includes at least two sub-recovery modules 5151-1 to 5151-N, where N is an integer greater than or equal to 2. Each of the sub-recovery modules 5151-1 to 5151-N can correspond to a preset size in the preset size set, and can be configured to receive a sub-recovery request corresponding to the corresponding preset size. Therefore, similarly, in general, the number of sub-recovery modules can be consistent with the number of types of preset sizes in the preset size set, that is, consistent with the number of sub-allocation modules and index counters. Optionally, each of the sub-recovery modules 5151-1 to 5151-N can be configured to write a storage unit index to the first storage area based on the received sub-recovery request, via the second interface, according to the position pointed to by the second pointer corresponding to the sub-recovery module. Exemplarily, the sub-recovery module can write the corresponding storage unit index by sending an index write request to the memory 530, and the index write request can include a second pointer and the index to be written. When the number of storage unit indexes corresponding to the sub-recovery request is large, the storage unit index can be written in multiple batches.
[0068] By setting up a separate space allocation module and a space recovery module to manage various sub-allocation requests and various sub-recovery requests respectively, and using two or more groups of first pointers and second pointers to manage the reading and writing of storage unit indexes corresponding to various preset sizes in the first storage area, space allocation requests and space recovery requests from external request sources can be processed more efficiently and orderly. This helps to further improve the efficiency of storage space management.
[0069] For example, Figure 8 An example scheme 800 is schematically shown in which a sub-allocation module and a sub-recycling module corresponding to a preset size manage the reading and writing process of a storage unit index in a corresponding sub-area of a first storage area by means of a set of first pointers and second pointers. As shown in sub-figure A, when the device is powered on, the first pointer and the second pointer can be initialized to point to the same position in the sub-area 810, for example, both point to the minimum address of the sub-area 810, or can also point to other positions. As shown in sub-figure B, when the sub-allocation request is processed by the sub-allocation module, a certain number of storage unit indexes from the sub-area 810 are read, and the first pointer will be offset downward, for example, pointing to the position of the next storage unit index that can be read. As shown in sub-figure C, when the sub-recycling request is processed by the sub-recycling module, the corresponding storage unit index will be written to the sub-area 810, and the second pointer will be offset downward, for example, pointing to the position of the next writable storage unit index. As shown in sub-figure D, when the first pointer and / or the second pointer are offset to the maximum address of the sub-area 810, they will wrap back to the starting position. The above description is only exemplary, and the first pointer and the second pointer can also be offset in other ways with the reading and writing of the storage unit index.
[0070] Exemplarily, each sub-allocation module in the space allocation module may be composed of Fig. 9 The state machine 900 shown is used to control. Fig. 9 As shown, when no sub-allocation request is received, the state machine 900 can be in an IDLE state, that is, an idle state. When a sub-allocation request is received, a storage unit index can be read from the first storage area, for example, a storage unit index can be read from a sub-area corresponding to a corresponding preset size, and the read storage unit index can be stored in a local index queue. Subsequently, when the local index queue is not empty, a storage unit index can be allocated, that is, the storage unit index in the local index queue is fed back to the external request source until all storage unit indexes are fed back and the IDLE state is restored again. Optionally, especially when the space counting module does not determine whether the number of storage units of each preset size meets the allocation requirement, after receiving a sub-allocation request, each sub-allocation module can also first determine whether the number of storage units of the corresponding preset size meets the requirement of this sub-allocation request, that is, whether the number of currently available storage units is greater than or equal to the number of storage units involved in this sub-allocation request. If so, the storage unit index reading operation can be performed as described above; if not, information indicating that the space allocation failed can be fed back to the external request source, and the state jumps to the IDLE state.
[0071] In some embodiments, each sub-allocation module in the space allocation module can be Fig.10 The circuit structure shown or other similar structures can be used to implement it.
[0072] like Fig.10 As shown, the sub-allocation module 1000 may include a read address maintenance circuit 1010, a bus data sorting circuit 1020, a response processing circuit 1030, and a FIFO 1040. The read address maintenance circuit 1010 may be based on the above reference Figure 8The first pointer is managed in the manner described. The bus data sorting circuit 1020 can process the received sub-allocation request to generate a control signal that complies with the corresponding bus protocol. The control signal can, for example, include the index read request for the storage space index mentioned above, and the control signal can be sent to the memory (such as DDR memory, etc.) via the corresponding bus structure. FIFO 1040 can act as a local index queue of the sub-allocation module mentioned above, and is used to cache the storage unit index from the memory. Exemplarily, the memory can send a corresponding data signal to the sub-allocation module 1000 in response to the control signal, and the data signal can include one or more storage unit indexes corresponding to the index read request. And exemplarily, when all storage unit indexes have been sent, the memory can send a response signal to the sub-allocation module 1000 indicating that the processing of this index read request has been completed (or that the storage unit index has been sent). The response processing module 1030 may receive the response signal, and based on the response signal, feed back a completion signal to the external request source, for example, feed back a completion signal to the external request source via an upper circuit module, and the completion signal may include at least one of the following information: information indicating that the processing of this space allocation request is complete, a storage unit index read from the memory, etc. Alternatively or additionally, the sub-allocation module 1000 may also include other circuits, as long as the functions of the space allocation module described in the various embodiments above can be implemented.
[0073] Exemplarily, each sub-recycling module in the space recycling module can be composed of Fig.11 The state machine 1100 shown is used to control. Fig.11 As shown, when no sub-recycling request is received, the state machine 1100 can be in the IDLE state. When a sub-recycling request is received, a write operation for the storage unit index can be initiated. Exemplarily, the storage unit index involved in the sub-recycling request can be written to the local index queue first, and then an index write request can be generated based on the storage unit index in the local index queue. Then a write operation for the memory can be initiated, that is, the storage unit index in the local index queue is written to the first storage area in the memory by sending an index write operation, for example, writing a sub-area corresponding to the corresponding preset size, until all storage unit indexes are written, and then the IDLE state is restored again.
[0074] In some embodiments, each sub-recycling module of the space recycling module can be Fig.12 The circuit structure shown or other similar structures can be used to implement it.
[0075] like Fig.12As shown, the sub-recycling module 1200 may include a write address maintenance circuit 1210, a bus data sorting circuit 1220, a response processing circuit 1230, and a FIFO 1240. The write address maintenance circuit 1210 may be based on the above reference Figure 8 The second pointer is managed in the manner described. The bus data sorting circuit 1220 can process the received sub-recycling request to generate a control signal and a data signal that comply with the corresponding bus protocol. The control signal can, for example, include the index write request for the storage space index mentioned above, and the data signal can include the storage unit index to be written to the first storage area of the memory, and the control signal and the data signal can be sent to the memory (e.g., DDR memory, etc.) via the corresponding bus structure. The FIFO 1240 can act as a local index queue of the sub-recycling module mentioned above, and is used to cache the storage unit index associated with the received sub-recycling request, that is, the storage unit index requested to be recycled by the sub-recycling request. Exemplarily, the memory can perform an index write operation in response to the control signal and the data signal, and send a corresponding response signal to the sub-allocation module 1200 after the writing is completed. The response processing module 1230 can receive the response signal, and based on the response signal, feedback a completion signal to the superior circuit module (e.g., the space counting module), and the completion signal can include information indicating that the processing of this sub-recycling request has been completed. Alternatively or additionally, the sub-allocation module 1200 may also include other circuits as long as the functions of the space allocation module described in the various embodiments above can be implemented.
[0076] It should be understood that the pointer management method, state machine and internal circuit structure described above about the sub-allocation module and the sub-recycling module are only exemplary. In fact, other methods can also be adopted to implement the sub-allocation module and the sub-recycling module.
[0077] Back to Figure 5A and 5B In some embodiments, the device 510 for managing storage space may further include a request classification module 511. The request classification module 511 may be configured to store the space allocation request in the first queue when the space management request is a space allocation request, and to store the space recovery request in the second queue when the space management request is a space recovery request. Thus, the space management requests from the external request source may be classified and stored to achieve independent management of the two. In addition, the first queue and the second queue may store the received space allocation requests and space recovery requests, so that when the external request source initiates multiple requests, the back pressure on the external request source may be reduced, thereby improving the system efficiency.
[0078] For example, Fig.13 An example block diagram of a request classification module 511 according to some embodiments of the present disclosure is schematically shown. Fig.13 As shown, the request classification module 511 may include a first queue 5111 (or referred to as an allocation queue) and a second queue 5112 (or referred to as a recycling queue). Exemplarily, the first queue 5111 and the second queue 5112 may be implemented by a FIFO (First Input First Output) memory, respectively. Exemplarily, the request classification module 511 may receive a space management request from an external request source 520 via a first interface in a handshake manner, and then may store a space allocation request in the received space management request to the first queue 5111, and store a space recycling request in the received space management request to the second queue 5112. Optionally, the request classification module 511 may be connected to the first interface, or may include the first interface. Exemplarily, when the space counting module of the subsequent stage is in an idle state, the request with the earliest storage time (i.e., the first written) in the first queue and / or the second queue may be transferred to the space counting module. For example, the request with the earliest storage time in the first queue and the second queue may be transferred to the space counting module, or the requests in the first queue and the second queue may be transferred to the space counting module in turn, and so on.
[0079] Optionally, due to the limited FIFO storage space, a pre-full threshold can be set for the first queue 5111 and the second queue 5112. When the number of space allocation requests stored in the first queue 5111 reaches the corresponding pre-full threshold (or referred to as the first threshold), the first queue 5111 can perform pre-full back pressure and no longer receive space allocation requests from external request sources; when the number of space recovery requests stored in the second queue 5112 reaches the corresponding pre-full threshold (or referred to as the second threshold), the second queue 5112 can perform pre-full back pressure and no longer receive space recovery requests from external request sources. Alternatively, when the number of requests stored in either the first queue 5111 or the second queue 5112 reaches the corresponding pre-full threshold, that is, when the number of space allocation requests in the first queue 5111 reaches the first threshold or the number of space recovery requests in the second queue 5112 reaches the second threshold, the request classification module 511 can back pressure the previous stage and no longer receive space management requests from the external request source 520. The back pressure mechanism can prevent the request classification module 511 from receiving space allocation requests and / or space reclaiming requests that exceed its storage capacity, thereby avoiding processing errors.
[0080] Back to Figure 5A and 5B In some embodiments, the apparatus 510 may further include a bus 516, which may connect the initialization module and the space management module to the second interface. Figure 5AAs shown, bus 516 can be connected to initialization module 512, space allocation module 514 and space recovery module 515, so that these modules can interact with memory 530 via a second interface (not shown) of device 500. Exemplarily, bus 516 can be a standard NOC (Network on Chip) bus, or other types of buses can be used to implement it. In addition, optionally, bus 516 can also be connected to other modules related or unrelated to various modules described in the present disclosure.
[0081] In order to facilitate the configuration of the device for managing the storage space, in some embodiments, the device 510 may also include an address register or be connected to an address register (not shown). The address register may be configured to store address modification data for the start address and / or end address of one or more sub-areas in the first storage area based on user input, and send the stored address modification data to the initialization module and / or the space management module after the device 510 is powered on. In this way, the user can be allowed to modify the start address or end address of each sub-area in the first storage area through software or other means according to actual needs, which helps to increase the configuration flexibility of the device for managing the storage space.
[0082] In addition, in some embodiments, the device 510 may also receive a storage unit index to be written into the first storage area from an external register. This allows the user to more flexibly adjust the partitioning method of the storage units in the second storage area, which also helps to increase the configuration flexibility of the device for managing storage space.
[0083] In some embodiments of the present disclosure, a computing device is further provided, which may include the apparatus for managing storage space described above, such as apparatus 210, 510. Schematically, Fig.14An example block diagram of a computing device 1400 is shown. As shown, the computing device 1400 may include a device 1410 for managing storage space, which may perform storage space management functions as described in various embodiments above. The computing device 1400 may also include a processor or controller 1420, which may be implemented as a CPU, MCU or similar structure, and may be used to perform various processing or control operations. The computing device 1400 may also include a memory 1430, which may be used to store data, such as various program data required by the processor or controller 1420 when executing an application or data used or generated during the execution of the application. The memory 1430 is implemented as a single memory, for example, or may be implemented as a combination of two or more memories. For example, the memory 1430 may include one or more internal memories, such as a DDR memory or an SDRAM memory used as a memory. The device 1410, the processor / controller 1420 and the memory 1430 may be connected together through a communication line 1440, and data transmission between each other is realized. By way of example, the communication line 1440 may be a bus (such as an AXI bus, etc.) or other types of communication lines, or may be a combination thereof.
[0084] In some embodiments of the present disclosure, a method for managing storage space is also provided. Fig.15 An example flow diagram of a method 1500 for managing storage space is shown.
[0085] like Fig.15 As shown, in step 1510, after the device is powered on, multiple storage unit indexes are written in the first storage area of the storage space, wherein each storage unit index is used to represent a storage unit in the second storage area of the storage space, and each storage unit in the second storage area has a preset size in a preset size set, and the preset size set includes at least two unequal preset sizes; in step 1520, a space management request can be received from an external request source; in step 1530, the storage unit indexes in the first storage area can be managed based on the space management request.
[0086] The method 1500 may have the same or similar embodiments as the aforementioned apparatus for managing storage space, and may have the same or similar technical effects as the aforementioned apparatus for managing storage space. For the sake of brevity, it will not be described in detail here.
[0087] In the description of the present disclosure, the directions or positional relationships indicated by the terms "up", "down", "left", "right", etc. are based on the directions or positional relationships shown in the accompanying drawings and are only for the convenience of describing the present disclosure rather than requiring that the present disclosure must be constructed and operated in a specific direction. Therefore, they should not be understood as limitations on the present disclosure.
[0088] In the description of this specification, the description with reference to the terms "one embodiment", "another embodiment", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory. In addition, it should be noted that in this specification, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0089] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0090] In the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or a communication; it can be a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0091] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A device for managing storage space, comprising: A first interface, connected to an external request source and configured to receive a space management request from the external request source; A second interface is connected to a memory outside the device, wherein the memory includes a storage space; an initialization module configured to: after the device is powered on, write a plurality of storage unit indexes in the first storage area of the storage space via the second interface, wherein each storage unit index is used to represent a storage unit in the second storage area of the storage space, each storage unit in the second storage area has a preset size in a preset size set, and the preset size set includes at least two preset sizes that are not equal to each other; a space management module configured to: manage storage unit indexes in the first storage area via the second interface based on the space management request, Wherein, the space management module includes: The space counting module is configured to receive a space management request when the space counting module is in an idle state, and split the space management request into one or more sub-management requests, wherein each sub-management request corresponds to a preset size in the preset size set.
2. The device according to claim 1, wherein: Writing a plurality of storage unit indexes in the first storage area of the storage space comprises: At least one storage unit index is written in each sub-area of the first storage area, so that all storage unit indexes in each sub-area correspond to a preset size.
3. The device according to claim 1, wherein: The space management request includes a space allocation request and a space reclamation request, and wherein splitting the space management request into one or more sub-management requests includes: In response to the space management request being a space reclamation request, splitting the space reclamation request into one or more sub-reclamation requests according to a storage unit index corresponding to the space requested to be reclaimed by the space reclamation request, wherein each sub-reclamation request corresponds to a preset size in the preset size set; In response to the space management request being a space allocation request, the space allocation request is split into one or more sub-allocation requests according to the size of the space requested to be allocated by the space allocation request, wherein each sub-allocation request corresponds to a preset size in the preset size set.
4. The device according to claim 3, wherein: The space management module also includes: a space allocation module configured to receive a sub-allocation request from the space counting module, and read one or more storage unit indexes from the first storage area via the second interface based on the sub-allocation request; The space recycling module is configured to receive a sub-recycling request from the space counting module, and based on the sub-recycling request, write a corresponding storage unit index to the first storage area via the second interface.
5. The device according to claim 4, wherein: The space allocation module includes at least two sub-allocation modules, each sub-allocation module corresponds to a preset size in the preset size set and is configured to receive a sub-allocation request corresponding to the corresponding preset size; The space recycling module includes at least two sub-recycling modules, each sub-recycling module corresponds to a preset size in the preset size set and is configured to receive a sub-recycling request corresponding to the corresponding preset size.
6. The device according to claim 5, wherein: Each sub-allocation module is configured to read a storage unit index from the first storage area via the second interface according to a position pointed to by a first pointer corresponding to the sub-allocation module based on the received sub-allocation request; and Each sub-recycling module is configured to write a storage unit index into the first storage area via the second interface based on the received sub-recycling request and according to the position pointed to by the second pointer corresponding to the sub-recycling module.
7. The device according to claim 3, wherein: The step of splitting the space allocation request into one or more sub-allocation requests comprises: In response to the space allocation request, the space requested for allocation can be completely split into a combination of one or more storage units, wherein each of the split storage units has a preset size from the preset size set, and the space requested for allocation by the space allocation request is split to determine the number of storage units with each preset size, and the number of split storage units is minimized.
8. The device according to claim 7, wherein: The splitting of the space allocation request into one or more sub-allocation requests further comprises: In response to the fact that the available number of storage units of each preset size is greater than or equal to the number of storage units of that preset size determined by splitting, one or more sub-allocation requests are sent in sequence based on the one or more storage units after the split, wherein each sub-allocation request corresponds to a preset size in the preset size set and includes the number of storage units of that preset size determined by splitting.
9. The device according to claim 8, wherein: The splitting of the space allocation request into one or more sub-allocation requests further comprises: In response to the existence of an available number of storage units of a preset size being less than the number of storage units of the preset size determined by splitting, information indicating an error is reported.
10. The device according to claim 7, wherein: The splitting of the space allocation request into one or more sub-allocation requests further comprises: In response to the space allocation request, the space requested for allocation cannot be completely split into a combination of one or more storage units, wherein each of the split storage units has a preset size in the preset size set, information indicating an error is reported.
11. The device according to claim 3, wherein: The space counting module includes at least two index counters, each index counter corresponds to a preset size in the preset size set, and The space counting module is further configured to: Based on the number of storage unit indexes involved in the split one or more sub-recycling requests, change the corresponding one or more index counters in a first direction; Based on the number of storage unit indexes involved in the split one or more sub-allocation requests, the corresponding one or more index counters are changed in a second direction, where the second direction is opposite to the first direction.
12. The apparatus according to claim 2, further comprising: The address register is configured to store address modification data for the starting address and / or ending address of one or more sub-areas in the first storage area based on user input, and send the address modification data to the initialization module and / or the space management module after the device is powered on.
13. A computing device, comprising the apparatus for managing storage space according to any one of claims 1-12.
14. A method for managing storage space, comprising: After the device is powered on, a plurality of storage unit indexes are written in a first storage area of the storage space, wherein each storage unit index is used to represent a storage unit in a second storage area of the storage space, each storage unit in the second storage area has a preset size in a preset size set, the preset size set includes at least two mutually unequal preset sizes, and the storage space is a storage space outside the device; Receive space management requests from external request sources; managing storage unit indexes in the first storage area based on the space management request, Wherein, managing the storage unit index in the first storage area based on the space management request includes: The space management request is split into one or more sub-management requests, wherein each sub-management request corresponds to a preset size in the preset size set.
Citation Information
Patent Citations
Access method and device of multipath storage device and mobile terminal
CN107608914A
Cache manager and control component
CN113032293A
