Storage space management method, device, electronic device and storage medium
By using space process mapping tables and address mapping tables in chip design, efficient allocation and recycling of storage space is solved, and the problems of limited and fragmented on-chip storage space are realized, and efficient storage space management is achieved in a multi-process environment.
Patent Information
- Application Number
- CN202311868637.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2043-12-28
AI Technical Summary
In chip design, the on-chip storage space is limited, resulting in disordered allocation and recycling mechanisms of storage space, resulting in fragmentation, and the inability to effectively utilize the remaining space.
By using the spatial process mapping table to record the correspondence between the physical address of the storage space and the identification information of the process, and record the mapping relationship between the logical address and the physical address in the address mapping table, efficient allocation and recycling of the storage space is achieved.
This method can maximize the use of limited storage space, avoid fragmentation, and realize efficient storage space management in multi-process environments.
Smart Images

Figure CN117785732B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a storage space management method, device, electronic device and storage medium. Background Art
[0002] In chip design, due to cost considerations, on-chip storage space is usually limited. Therefore, how to intensively and efficiently manage the limited on-chip cache space becomes a key point in chip design.
[0003] Storage space management usually needs to consider the space allocation and recycling mechanism to allocate corresponding private space to multiple processes as efficiently as possible. When multiple processes work at the same time, the allocation and recycling of space are usually disordered, which will cause the original continuous space to become fragmented and the available space to be discontinuous, so that even if there is enough free space, it cannot be allocated. Summary of the invention
[0004] The present disclosure provides a storage space management technical solution.
[0005] According to one aspect of the present disclosure, a storage space management method is provided, comprising:
[0006] In response to receiving a storage space allocation request from a first process, allocating a target storage space to the first process according to a space-process mapping table, wherein the space-process mapping table is used to record a correspondence between a physical address of the storage space and identification information of the process;
[0007] In the address mapping table, the mapping relationship between the logical address and the physical address of the target storage space is recorded, and the space process mapping table is updated; wherein the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
[0008] In one possible implementation,
[0009] The allocating the target storage space to the first process according to the space process mapping table includes: allocating the target storage space to the first process according to the space process mapping table and a space flag bit corresponding to the storage space in the space process mapping table, wherein the space flag bit is used to mark whether the storage space has been allocated;
[0010] After allocating the target storage space to the first process, the method further includes: updating a space flag corresponding to the target storage space to a first preset value; wherein the first preset value indicates that the storage space has been allocated.
[0011] In a possible implementation manner, after allocating the target storage space to the first process, the method further includes:
[0012] According to the amount of the target storage space, a process space counter corresponding to the first process is updated.
[0013] In a possible implementation, the method further includes:
[0014] In response to receiving at least one storage space release request from at least one second process, the identification information of the at least one second process is cleared in the space process mapping table, and the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process is cleared in the address mapping table.
[0015] In a possible implementation, the method further includes:
[0016] In response to receiving at least one storage space release request from at least one second process, a space flag bit of the storage space corresponding to the at least one second process is updated to a second preset value, wherein the second preset value indicates that the storage space is not allocated.
[0017] In a possible implementation, the method further includes:
[0018] In response to receiving at least one storage space release request from at least one second process, at least one process space counter corresponding to the at least one second process is cleared.
[0019] In a possible implementation, in response to receiving a storage space allocation request from a first process, allocating a target storage space to the first process according to a space-process mapping table includes:
[0020] In response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, the target storage space is allocated to the first process according to the space process mapping table after clearing the identification information of the at least one second process.
[0021] In a possible implementation, in response to receiving at least one storage space release request from at least one second process, clearing identification information of the at least one second process in the space-process mapping table, and clearing a mapping relationship between a logical address and a physical address of a storage space corresponding to the at least one second process in the address mapping table, includes:
[0022] In response to receiving at least one storage space release request from at least one second process, the space release processing module clears the identification information of the at least one second process in the space process mapping table, and clears the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0023] In a possible implementation manner, allocating a target storage space to the first process according to a space-process mapping table includes:
[0024] The target storage space is allocated to the first process according to the space process mapping table through the space request processing module.
[0025] In a possible implementation manner, allocating a target storage space to the first process according to a space-process mapping table includes:
[0026] In response to the amount of unallocated storage space in the space process mapping table satisfying the storage space allocation request from the first process, a target storage space is allocated to the first process.
[0027] In one possible implementation,
[0028] Respond to storage space allocation requests from different processes in order of priority from high to low;
[0029] or,
[0030] When the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously.
[0031] According to one aspect of the present disclosure, there is provided a storage space management device, comprising a space process mapping table, a space request processing module and an address mapping table;
[0032] The space process mapping table is used to: record the correspondence between the physical address of the storage space and the identification information of the process;
[0033] The space request processing module is used to: in response to receiving a storage space allocation request from a first process, allocate a target storage space to the first process according to the space-process mapping table;
[0034] The address mapping table is used to: record the mapping relationship between the logical address and the physical address of the storage space of each process, including recording the mapping relationship between the logical address and the physical address of the target storage space;
[0035] Among them, the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
[0036] In one possible implementation,
[0037] The storage space management device further includes: a space flag bit, which corresponds to the storage space one by one and is used to mark whether the corresponding storage space has been allocated;
[0038] The space request processing module is specifically used to: allocate target storage space to the first process according to the space process mapping table and the space flag corresponding to the storage space in the space process mapping table; update the space flag corresponding to the target storage space to a first preset value, wherein the first preset value indicates that the storage space has been allocated.
[0039] In one possible implementation,
[0040] The storage space management device further includes: a process space counter corresponding to each process one by one, used to record the amount of storage space currently occupied by the corresponding process;
[0041] The space request processing module is further used to: update a process space counter corresponding to the first process according to the amount of the target storage space.
[0042] In one possible implementation,
[0043] The storage space management device also includes: a space release processing module, which is used to respond to receiving at least one storage space release request from at least one second process, clear the identification information of the at least one second process in the space process mapping table, and clear the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0044] In a possible implementation manner, the space release processing module is further used to:
[0045] In response to receiving at least one storage space release request from at least one second process, a space flag bit of the storage space corresponding to the at least one second process is updated to a second preset value, wherein the second preset value indicates that the storage space is not allocated.
[0046] In a possible implementation manner, the space release processing module is further used to:
[0047] In response to receiving at least one storage space release request from at least one second process, at least one process space counter corresponding to the at least one second process is cleared.
[0048] In a possible implementation manner, the space request processing module is specifically used to:
[0049] In response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, the target storage space is allocated to the first process according to the space process mapping table after clearing the identification information of the at least one second process.
[0050] In a possible implementation manner, the space request processing module is specifically used to:
[0051] Respond to storage space allocation requests from different processes in order of priority from high to low;
[0052] or,
[0053] When the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously.
[0054] In a possible implementation manner, the device further includes:
[0055] The free space counter is used to calculate the amount of free storage space according to the space flag bits corresponding to each storage space.
[0056] According to one aspect of the present disclosure, there is provided a storage space management device, comprising:
[0057] an allocation module, configured to allocate a target storage space to the first process in response to receiving a storage space allocation request from the first process according to a space-process mapping table, wherein the space-process mapping table is used to record a correspondence between a physical address of the storage space and identification information of the process;
[0058] A recording and updating module is used to record the mapping relationship between the logical address and the physical address of the target storage space in the address mapping table, and to update the space process mapping table; wherein the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
[0059] In one possible implementation,
[0060] The allocation module is used to allocate target storage space to the first process according to the space process mapping table and the space flag corresponding to the storage space in the space process mapping table, wherein the space flag is used to mark whether the storage space has been allocated;
[0061] The device also includes: a first updating module, used to update the space flag corresponding to the target storage space to a first preset value; wherein the first preset value indicates that the storage space has been allocated.
[0062] In a possible implementation manner, the device further includes:
[0063] The second updating module is used to update the process space counter corresponding to the first process according to the amount of the target storage space.
[0064] In a possible implementation manner, the device further includes:
[0065] A clearing module is used to, in response to receiving at least one storage space release request from at least one second process, clear the identification information of the at least one second process in the space process mapping table, and clear the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0066] In a possible implementation manner, the device further includes:
[0067] The third update module is used to update the space flag of the storage space corresponding to the at least one second process to a second preset value in response to receiving at least one storage space release request from the at least one second process, wherein the second preset value indicates that the storage space is not allocated.
[0068] In a possible implementation manner, the device further includes:
[0069] The clearing module is used to clear at least one process space counter corresponding to the at least one second process in response to receiving at least one storage space release request from the at least one second process.
[0070] In a possible implementation, the allocation module is used to:
[0071] In response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, the target storage space is allocated to the first process according to the space process mapping table after clearing the identification information of the at least one second process.
[0072] In a possible implementation, the clearing module is used to:
[0073] In response to receiving at least one storage space release request from at least one second process, the space release processing module clears the identification information of the at least one second process in the space process mapping table, and clears the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0074] In a possible implementation, the allocation module is used to:
[0075] The target storage space is allocated to the first process according to the space process mapping table through the space request processing module.
[0076] In a possible implementation, the allocation module is used to:
[0077] In response to the amount of unallocated storage space in the space process mapping table satisfying the storage space allocation request from the first process, a target storage space is allocated to the first process.
[0078] In a possible implementation, the allocation module is used to:
[0079] Respond to storage space allocation requests from different processes in order of priority from high to low;
[0080] or,
[0081] When the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously.
[0082] According to one aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute the above method.
[0083] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor.
[0084] According to one aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the above method.
[0085] In an embodiment of the present disclosure, in response to receiving a storage space allocation request from a first process, a target storage space is allocated to the first process according to a space process mapping table, wherein the space process mapping table is used to record the correspondence between the physical address of the storage space and the identification information of the process, and in the address mapping table, the mapping relationship between the logical address and the physical address of the target storage space is recorded, and the space process mapping table is updated, wherein the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table, so that when allocating storage space to the process, it is only necessary to consider whether the remaining storage space is sufficient (that is, whether the amount of the remaining storage space meets the requirements of the process), and the remaining storage space is not required to be continuous. In an embodiment of the present disclosure, a storage space with a non-continuous physical address (that is, a fragmented storage space) can be mapped to a storage space with a continuous logical address, thereby maximizing the use of limited storage space, so that the storage space can be efficiently and intensively managed in a multi-process environment.
[0086] In the disclosed embodiment, one address mapping table is used to record the mapping relationship between the logical address and the physical address of the storage space of all processes, without the need for multiple address mapping tables to respectively record the mapping relationship between the logical address and the physical address of the storage space of multiple processes, thereby saving storage space.
[0087] In addition, in the embodiments of the present disclosure, storage space can be allocated in response to multiple storage space allocation requests of the same process, so that the process can apply for storage space multiple times according to operating needs, which is beneficial to improving the utilization of storage space.
[0088] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
[0089] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0091] Figure 1 A flowchart of a storage space management method provided by an embodiment of the present disclosure is shown.
[0092] Figure 2 A schematic diagram of a storage space management device provided by an embodiment of the present disclosure is shown.
[0093] Figure 3 A schematic diagram showing the storage space allocation and release process of the storage space management method provided in an embodiment of the present disclosure.
[0094] Figure 4 A block diagram of a storage space management device provided by an embodiment of the present disclosure is shown.
[0095] Figure 5 A block diagram of an electronic device 1900 provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0096] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0097] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0098] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0099] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0100] There are the following two storage space management methods in the related art.
[0101] In the first method, for fragmented space management, a space index of a storage space occupied by a data block in a storage device is obtained, wherein the storage space occupied by the data block includes an occupied space of a data segment and at least two fragmented idle spaces isolated by the occupied space; based on the space index, a space utilization state parameter of the storage space occupied by the data block is determined; based on the space index, a target occupied space is determined from the occupied space and the fragmented idle space adjacent to the target occupied space is determined as the idle space to be merged.
[0102] In the second method, indexes are used for storage unit management. Specifically, based on the space allocation request and the allocated number of storage unit indexes, one or more storage unit indexes are obtained by allowing the index generation module to generate storage unit indexes and / or reading storage unit indexes from the first storage area of the storage space via the second interface.
[0103] Among them, in the first method, after the target space data is read out, the adjacent fragmented space can be merged with the read space and then allocated. That is, in the first method, it is still necessary to wait for the non-continuous fragmented space to be sorted into a continuous space before it can be used. In the second method, only one space allocation request or space release request can be processed at a time, and its space index still cannot solve the fragmentation problem, that is, continuous storage space is still required.
[0104] In order to solve the technical problems similar to those described above, the embodiment of the present disclosure provides a storage space management, by responding to a storage space allocation request received from a first process, allocating a target storage space to the first process according to a space process mapping table, wherein the space process mapping table is used to record the correspondence between the physical address of the storage space and the identification information of the process, and in the address mapping table, record the mapping relationship between the logical address and the physical address of the target storage space, and update the space process mapping table, wherein the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table, so that when allocating storage space to the process, it is only necessary to consider whether the remaining storage space is sufficient (that is, whether the amount of the remaining storage space meets the requirements of the process), and the remaining storage space is not required to be continuous. In the embodiment of the present disclosure, the storage space with non-continuous physical addresses (that is, fragmented storage space) can be mapped to the storage space with continuous logical addresses, thereby maximizing the use of limited storage space, so that the storage space can be efficiently and intensively managed in a multi-process environment.
[0105] In the disclosed embodiment, one address mapping table is used to record the mapping relationship between the logical address and the physical address of the storage space of all processes, without the need for multiple address mapping tables to respectively record the mapping relationship between the logical address and the physical address of the storage space of multiple processes, thereby saving storage space.
[0106] In addition, in the embodiments of the present disclosure, storage space can be allocated in response to multiple storage space allocation requests of the same process, so that the process can apply for storage space multiple times according to operating needs, which is beneficial to improving the utilization of storage space.
[0107] The storage space management method provided by the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.
[0108] Figure 1 A flow chart of a storage space management method provided by an embodiment of the present disclosure is shown. In one possible implementation, the execution subject of the storage space management method may be a storage space management device. For example, the storage space management method may be executed by a terminal device or a server or other electronic device. The terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device or a wearable device. In some possible implementations, the storage space management method may be implemented by a processor calling computer-readable instructions stored in a memory. For example Figure 1 As shown, the storage space management method includes steps S11 to S12.
[0109] In step S11, in response to receiving a storage space allocation request from a first process, a target storage space is allocated to the first process according to a space process mapping table, wherein the space process mapping table is used to record the correspondence between the physical address of the storage space and the identification information of the process.
[0110] In step S12, the mapping relationship between the logical address and the physical address of the target storage space is recorded in the address mapping table, and the space process mapping table is updated; wherein the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
[0111] In the disclosed embodiment, the space process mapping table can record the physical address of each storage space. That is, the space process mapping table can record the physical address of the unallocated storage space and the physical address of the allocated storage space. For any storage space, if the storage space is occupied by any process, the identification information of the process occupying the storage space can be recorded in the space process mapping table. For any storage space, if the storage space is not occupied (that is, the storage space is not allocated), the identification information of the process corresponding to the storage space in the space process mapping table can be empty. Therefore, the correspondence between the physical address of the storage space and the identification information of the process can be recorded through the space process mapping table. According to the space process mapping table, it can be determined whether each storage space has been allocated, and the identification information of the corresponding process when the storage space has been allocated. According to the space process mapping table, it can also be determined the number of unallocated storage spaces and which specific storage spaces are unallocated. Among them, the unallocated storage space can also be called free storage space, that is, storage space that can be allocated. The allocated storage space can also be called occupied storage space, non-free storage space, etc., which are not limited here.
[0112] In the embodiment of the present disclosure, when the system starts running, the space process mapping table can be initialized.
[0113] In an embodiment of the present disclosure, the storage space allocation request may represent a request for requesting the allocation of storage space, that is, the storage space allocation request may be used to request the allocation of storage space. In one possible implementation, the storage space allocation request may carry the amount of storage space requested by the first process. In another possible implementation, the storage space allocation request may not carry the amount of storage space requested by the first process. In this implementation, a preset amount of storage space may be allocated to the first process.
[0114] In the embodiment of the present disclosure, the first process may represent any process, the second process hereinafter is a process different from the first process, and different second processes are different processes.
[0115] In an embodiment of the present disclosure, a target storage space may be allocated to the first process according to the space-process mapping table. The target storage space may represent the storage space allocated to the first process in response to the storage space allocation request, that is, the target storage space may represent the storage space allocated to the first process this time. The target storage space may include at least one storage space.
[0116] In one possible implementation, allocating target storage space to the first process according to the space process mapping table includes: allocating target storage space to the first process according to the space process mapping table and a space flag corresponding to the storage space in the space process mapping table, the space flag being used to mark whether the storage space has been allocated; after allocating the target storage space to the first process, the method further includes: updating the space flag corresponding to the target storage space to a first preset value; wherein the first preset value indicates that the storage space has been allocated.
[0117] In this implementation, a space flag may be used to mark whether the storage space has been allocated. The space flag may correspond to the storage space one by one, and the space flag corresponding to any storage space may be used to mark whether the storage space has been allocated. If any space flag is a first preset value, it may indicate that the storage space corresponding to the space flag has been allocated; if any space flag is a second preset value, it may indicate that the storage space corresponding to the space flag has not been allocated.
[0118] As an example of this implementation, the first preset value is 1, and the second preset value is 0.
[0119] As another example of this implementation, the first preset value is 0, and the second preset value is 1.
[0120] In this implementation, target storage space is allocated to the first process based on a space process mapping table and a space flag corresponding to the storage space in the space process mapping table, and the space flag is used to mark whether the storage space has been allocated. After the target storage space is allocated to the first process, the space flag corresponding to the target storage space is updated to a first preset value, thereby improving the efficiency of storage space allocation through the space flag.
[0121] In a possible implementation manner, after allocating the target storage space to the first process, the method further includes: updating a process space counter corresponding to the first process according to the amount of the target storage space.
[0122] In this implementation, the process space counter may correspond to each process one by one. The process space counter corresponding to any process may be used to record the amount of storage space occupied by the process. That is, the process space counter corresponding to any process may be used to record the amount of storage space allocated to the process. For example, the process space counter corresponding to the first process may be used to record the amount of storage space occupied by the first process.
[0123] If before receiving the storage space allocation request from the first process, the value of the process space counter corresponding to the first process is 0, then the updated value of the process space counter corresponding to the first process can be equal to the amount of target storage space; if before receiving the storage space allocation request from the first process, the value of the process space counter corresponding to the first process is n, and n is greater than 0, then the updated value of the process space counter corresponding to the first process can be equal to n+m, where m represents the amount of target storage space.
[0124] In this implementation, by updating the process space counter corresponding to the first process according to the amount of the target storage space, the amount of storage space occupied by each process can be recorded through the process space counter corresponding to each process, so that the amount of storage space occupied by each process can be obtained through the process space counter corresponding to each process. In addition, in this implementation, the total amount of storage space occupied by all processes and the amount of remaining storage space can also be determined according to the process space counter corresponding to each process.
[0125] In another possible implementation, the amount of storage space occupied by each process can be recorded through a process space counting table. In this implementation, the amount of storage space occupied by each process can be recorded in the same process space counting table.
[0126] In a possible implementation, allocating the target storage space to the first process according to the space-process mapping table includes: allocating the target storage space to the first process according to the space-process mapping table through a space request processing module.
[0127] As an example of this implementation method, the idle request processing module can respond to receiving a storage space allocation request from any process, allocate storage space to the process according to the amount of storage space requested by the storage space allocation request, the space process mapping table and the space flag, and can update the space process mapping table, the space flag, the address mapping table and the process space counter corresponding to the process.
[0128] As an example of this implementation, the space release processing module may read the amount of storage space requested by the storage space allocation request, the space process mapping table, and the space flag in response to receiving the storage space allocation request from the first process. If the space release processing module does not receive a storage space release request from other processes while receiving the storage space allocation request from the first process, the space release processing module may directly pass the amount of storage space requested by the storage space allocation request, the space process mapping table, and the space flag to the space request processing module. If the space release processing module receives at least one storage space release request from at least one second process while receiving the storage space allocation request from the first process, the space release processing module may send the amount of storage space requested by the storage space allocation request, as well as the updated space process mapping table and the space flag to the space request processing module after processing the storage space release request.
[0129] In this implementation, the target storage space is allocated to the first process according to the space-process mapping table through the space request processing module, thereby enabling the allocation of storage space through the space request processing module.
[0130] In one possible implementation, allocating target storage space to the first process according to the space process mapping table includes: in response to the amount of unallocated storage space in the space process mapping table satisfying the requirement of the storage space allocation request from the first process, allocating target storage space to the first process.
[0131] In this implementation, the amount of unallocated storage space and which storage space is unallocated can be determined according to the space process mapping table. As an example of this implementation, the amount of unallocated storage space in the space process mapping table can be obtained from a free space counter.
[0132] In a possible implementation, storage space allocation requests from different processes are responded to in order of priority from high to low.
[0133] In this implementation, allocating target storage space to the first process according to the space process mapping table may include: allocating target storage space to the first process when the storage space allocation request from the first process is the storage space allocation request with the highest priority and the amount of unallocated storage space in the space process mapping table meets the requirements of the storage space allocation request from the first process.
[0134] In this implementation, each storage space allocation request may be processed in order from high to low priority, that is, only the storage space allocation request with the highest priority may be responded to each time.
[0135] In this implementation, when the storage space allocation request of the first process is the storage space allocation request with the highest priority among the current storage space allocation requests, it can be further determined whether the number of unallocated storage spaces in the space process mapping table is greater than or equal to the number of storage spaces requested by the storage space allocation request of the first process. If the number of unallocated storage spaces in the space process mapping table is greater than or equal to the number of storage spaces requested by the storage space allocation request of the first process, the target storage space can be allocated to the first process; if the number of unallocated storage spaces in the space process mapping table is less than the number of storage spaces requested by the storage space allocation request of the first process, it can wait for other processes to release storage space until the number of unallocated storage spaces in the space process mapping table is greater than or equal to the number of storage spaces requested by the storage space allocation request of the first process, and then the target storage space can be allocated to the first process.
[0136] By adopting this implementation, it is possible to process storage space allocation requests based on their priorities, so that when multiple processes request storage space at the same time, processes with higher priorities can be responded to first.
[0137] In another possible implementation, if the amount of unallocated storage space in the space process mapping table does not satisfy the amount of storage space requested by the storage space allocation request with the highest priority, but satisfies the amount of storage space requested by the storage space allocation request with non-highest priority, then the storage space allocation request with non-highest priority can be responded to first, that is, storage space can be allocated to the process corresponding to the storage space allocation request with non-highest priority first.
[0138] In a possible implementation, when the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously. In this implementation, when the amount of unallocated storage space in the space process mapping table is sufficient, multiple processes can be responded to simultaneously, that is, storage space can be allocated to multiple processes simultaneously.
[0139] In a possible implementation, when the amount of unallocated storage space in the space process mapping table is less than the amount of storage space requested by the storage space allocation request of the first process, the storage space allocation request may not be responded to temporarily. Storage space may be released by other processes until the amount of unallocated storage space in the space process mapping table is greater than or equal to the amount of storage space requested by the storage space allocation request of the first process, and then the target storage space is allocated to the first process.
[0140] In an embodiment of the present disclosure, after allocating the target storage space to the first process, the mapping relationship between the logical address and the physical address of the target storage space is recorded in the address mapping table, and the space process mapping table is updated. In an embodiment of the present disclosure, each process may correspond to the same address mapping table. The address mapping table may be used to record the mapping relationship between the logical address and the physical address of the storage space of each process. By adopting the address mapping table, the mapping relationship between the logical address and the physical address of the storage space occupied by each process can be recorded, so that the mapping relationship between the logical address and the physical address of the storage space occupied by each process can be obtained according to the address mapping table. By establishing the mapping relationship between the logical address and the physical address of the storage space through the address mapping table, the logical address can be separated from the actual physical address, so that the continuity requirement of the logical address can be met in the discrete storage space. In addition, the mapping relationship between the logical address and the physical address of the storage space of all processes is recorded through one address mapping table, and there is no need to use multiple address mapping tables to record the mapping relationship between the logical address and the physical address of the storage space of multiple processes respectively, thereby saving storage space.
[0141] In one possible implementation, the method further includes: in response to receiving at least one storage space release request from at least one second process, clearing the identification information of the at least one second process in the space process mapping table, and clearing the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0142] In this implementation, the storage space release request may represent a request for requesting the release of storage space, that is, the storage space release request may be used to request the release of storage space.
[0143] In this implementation, in response to receiving a storage space release request from any second process, the identification information of the second process can be cleared in the space process mapping table so that the identification information of the process corresponding to the storage space originally occupied by the second process is empty.
[0144] In this implementation, in response to receiving a storage space release request from any second process, the mapping relationship between the logical address and the physical address of the storage space corresponding to the second process can be cleared in the address mapping table. That is, in response to receiving a storage space release request from any second process, the mapping relationship between the logical address and the physical address of the storage space originally occupied by the second process can be cleared in the address mapping table.
[0145] In this implementation, in response to receiving at least one storage space release request from at least one second process, the identification information of the at least one second process is cleared in the space process mapping table, and the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process is cleared in the address mapping table. Therefore, whether each storage space is occupied by a process and the identification information of the process occupying the storage space can be accurately determined through the space process mapping table, and the mapping relationship between the logical address and the physical address of the storage space occupied by the process can also be accurately determined through the address mapping table when the process occupies the storage space.
[0146] In this implementation, the release of the storage space is not limited to the continuity of the physical address of the storage space, and the storage space release requests of multiple processes can be responded to and processed simultaneously.
[0147] As an example of this implementation, the method also includes: in response to receiving at least one storage space release request from at least one second process, updating the space flag of the storage space corresponding to the at least one second process to a second preset value, wherein the second preset value indicates that the storage space is not allocated.
[0148] In this example, in response to receiving at least one storage space release request from at least one second process, the space flag of the storage space corresponding to the at least one second process is updated to a second preset value, thereby being able to accurately mark whether the storage space is free through the space flag.
[0149] As an example of this implementation, the method further includes: in response to receiving at least one storage space release request from at least one second process, clearing at least one process space counter corresponding to the at least one second process.
[0150] In this example, in response to receiving a storage space release request from any process, the process space counter corresponding to the process can be cleared, thereby accurately determining the amount of storage space occupied by the process based on the process space counter corresponding to the process.
[0151] As an example of this implementation method, in response to receiving at least one storage space release request from at least one second process, clearing the identification information of the at least one second process in the space process mapping table, and clearing the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table, includes: in response to receiving at least one storage space release request from at least one second process, by the space release processing module, clearing the identification information of the at least one second process in the space process mapping table, and clearing the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0152] In this example, the space release processing module can respond to receiving a storage space release request from any process by clearing the identification information of the process in the space process mapping table and clearing the mapping relationship between the logical address and the physical address of the storage space corresponding to the process in the address mapping table. By adopting this example, the storage space can be released through the space release processing module.
[0153] As an example of this implementation, in response to receiving a storage space allocation request from a first process, allocating a target storage space to the first process according to a space process mapping table includes: in response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, allocating the target storage space to the first process according to the space process mapping table after clearing the identification information of the at least one second process. In this example, the storage space allocation requests and storage space release requests of multiple processes can be responded to at one time, and the storage space allocation requests and storage space release requests of multiple processes can be processed at the same time. In addition, in this example, the storage space can be immediately recycled after being released.
[0154] In an embodiment of the present disclosure, when the first process needs to perform cache reading and writing, the physical address corresponding to the logical address in the instruction or program segment can be determined based on the logical address in the instruction or program segment and the mapping relationship between the logical address and the physical address of the storage space occupied by the first process in the address mapping table, and the physical address corresponding to the logical address in the instruction or program segment can be returned to the instruction or program segment.
[0155] The storage space management method provided by the embodiments of the present disclosure can be applied to technical fields such as processors, space fragmentation, address indexing, hardware circuits, etc., and is not limited here.
[0156] The storage space management method provided by the embodiment of the present disclosure is described below through a specific application scenario.
[0157] Figure 2 A schematic diagram of a storage space management device provided by an embodiment of the present disclosure is shown. Figure 2 As shown, the storage space management device may include a space request processing module, a free space counter, a space release processing module, a process space counter, an address mapping table, a space process mapping table and a space flag.
[0158] The process space counter may correspond to each process one by one. The process space counter corresponding to any process may be used to record the amount of storage space currently occupied by the process. Figure 2 In the example shown, there are N+1 process space counters 0 to N corresponding to N+1 processes.
[0159] Each process may correspond to the same address mapping table. The address mapping table may be used to record the mapping relationship between the logical address and the physical address of the storage space of each process. By using the address mapping table, it is convenient for other modules to convert between the logical address and the physical address.
[0160] The space process mapping table can be used to record the correspondence between the physical address of the storage space and the identification information of the process.
[0161] The space flag bit may correspond to the storage space one by one. The space flag bit corresponding to any storage space may be used to mark whether the storage space has been allocated.
[0162] The free space counter can calculate the number of free storage spaces (i.e., the number of unallocated storage spaces) according to the space flags corresponding to the respective storage spaces. In addition, the free space counter can also determine the number of free storage spaces that each free storage space is, thereby facilitating the allocation of storage spaces. That is, for any free storage space, the free space counter can also determine the number of free storage spaces between the first free storage space and the storage space.
[0163] The space release processing module can respond to receiving a storage space release request from any process by clearing the identification information of the process in the space process mapping table, updating the space flag bit of the storage space corresponding to the process to 0, clearing the mapping relationship between the logical address and the physical address of the storage space corresponding to the process in the address mapping table, and clearing the process space counter corresponding to the process.
[0164] The space request processing module can respond to receiving a storage space allocation request from any process, allocate storage space to the process according to the amount of storage space requested by the storage space allocation request, the space process mapping table and the space flag, and can update the space process mapping table, the space flag, the address mapping table and the process space counter corresponding to the process.
[0165] In this application scenario, in response to receiving a storage space allocation request from a first process, the space release processing module can read the space process mapping table and the space flag. If the space release processing module does not receive a storage space release request from other processes while receiving the storage space allocation request from the first process, the space release processing module can directly pass the space process mapping table and the space flag to the space request processing module. If the space release processing module receives at least one storage space release request from at least one second process while receiving the storage space allocation request from the first process, the space release processing module can send the updated space process mapping table and the space flag to the space request processing module after processing the storage space release request. The space request processing module can determine whether there is enough storage space to allocate to the first process through the free space counter. If there is enough storage space, the storage space can be allocated to the first process, and the space process mapping table, the space flag, the address mapping table and the process space counter corresponding to the first process can be updated.
[0166] When the first process needs to perform cache reading and writing, the physical address corresponding to the logical address in the instruction or program segment can be determined based on the logical address in the instruction or program segment and the address mapping table, and the physical address corresponding to the logical address in the instruction or program segment can be returned to the instruction or program segment.
[0167] Figure 3 A schematic diagram showing the storage space allocation and release process of the storage space management method provided by the embodiment of the present disclosure. Figure 3 In the figure, process space counter 1 represents the process space counter corresponding to process 1, and process space counter 2 represents the process space counter corresponding to process 2.
[0168] exist Figure 3 In the example shown, the space process mapping table includes 4 storage spaces. When the system starts running, the identification information of the processes corresponding to the 4 storage spaces in the space process mapping table are all empty, and the space flag bits of the 4 storage spaces are all 0. For example, the physical addresses of the 4 storage spaces are physical address 1, physical address 2, physical address 3, and physical address 4 from bottom to top.
[0169] In response to receiving a storage space allocation request from process 1, storage space corresponding to physical address 1 and storage space corresponding to physical address 2 may be allocated to process 1 according to the number 2 of storage space requested by the storage space allocation request. In the space process mapping table, identification information of the process corresponding to the storage space corresponding to physical address 1 may be updated to 1, and identification information of the process corresponding to the storage space corresponding to physical address 2 may be updated to 1. Space flags of the storage space corresponding to physical address 1 and the storage space corresponding to physical address 2 may be updated to 1. The mapping relationship between logical address 1 and physical address 1 of process 1, and the mapping relationship between logical address 2 and physical address 2 of process 1 may be recorded in the address mapping table. The value of process space counter 1 may be updated to 2.
[0170] In response to receiving a storage space allocation request from process 2, storage space corresponding to physical address 3 may be allocated to process 2 according to the number 1 of storage space requested by the storage space allocation request. In the space process mapping table, identification information of the process corresponding to the storage space corresponding to physical address 3 may be updated to 2. The space flag bit of the storage space corresponding to physical address 3 may be updated to 1. The mapping relationship between logical address 1 and physical address 3 of process 2 may be recorded in the address mapping table. The value of process space counter 2 may be updated to 1.
[0171] In response to receiving a storage space allocation request from process 1, storage space corresponding to physical address 4 may be allocated to process 1 according to the number 1 of storage space requested by the storage space allocation request. In the space process mapping table, identification information of the process corresponding to the storage space corresponding to physical address 4 may be updated to 1. The space flag bit of the storage space corresponding to physical address 4 may be updated to 1. The mapping relationship between logical address 3 and physical address 4 of process 1 may be recorded in the address mapping table. The value of process space counter 1 may be updated to 3.
[0172] In response to receiving a storage space release request from process 1, the identification information of the processes corresponding to physical address 1, physical address 2, and physical address 4 in the space process mapping table may be cleared, and the space flag bits corresponding to physical address 1, physical address 2, and physical address 4 may be updated to 0. In the address mapping table, the mapping relationship between logical address 1 and physical address 1 of process 1, the mapping relationship between logical address 2 and physical address 2 of process 1, and the mapping relationship between logical address 3 and physical address 4 of process 1 may be cleared. Process space counter 1 may be cleared.
[0173] In response to receiving a storage space release request from process 2, the identification information of the process corresponding to physical address 3 in the space process mapping table may be cleared, and the space flag corresponding to physical address 3 may be updated to 0. In the address mapping table, the mapping relationship between the logical address 1 and the physical address 3 of process 2 may be cleared. The process space counter 2 may be cleared.
[0174] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0175] In addition, the present disclosure also provides a storage space management device, an electronic device, a computer-readable storage medium, and a computer program product, all of which can be used to implement any storage space management method provided by the present disclosure. The corresponding technical solutions and technical effects can be found in the corresponding records in the method part and will not be repeated here.
[0176] Figure 4 FIG. 2 is a block diagram of a storage space management device provided by an embodiment of the present disclosure. Figure 4 As shown, the storage space management device includes:
[0177] an allocation module 41, configured to allocate a target storage space to the first process according to a space-process mapping table in response to receiving a storage space allocation request from the first process, wherein the space-process mapping table is used to record a correspondence between a physical address of the storage space and identification information of the process;
[0178] The recording and updating module 42 is used to record the mapping relationship between the logical address and the physical address of the target storage space in the address mapping table, and update the space process mapping table; wherein the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
[0179] In one possible implementation,
[0180] The allocation module 41 is used to allocate target storage space to the first process according to the space process mapping table and the space flag corresponding to the storage space in the space process mapping table, wherein the space flag is used to mark whether the storage space has been allocated;
[0181] The device also includes: a first updating module, used to update the space flag corresponding to the target storage space to a first preset value; wherein the first preset value indicates that the storage space has been allocated.
[0182] In a possible implementation manner, the device further includes:
[0183] The second updating module is used to update the process space counter corresponding to the first process according to the amount of the target storage space.
[0184] In a possible implementation manner, the device further includes:
[0185] A clearing module is used to, in response to receiving at least one storage space release request from at least one second process, clear the identification information of the at least one second process in the space process mapping table, and clear the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0186] In a possible implementation manner, the device further includes:
[0187] The third update module is used to update the space flag of the storage space corresponding to the at least one second process to a second preset value in response to receiving at least one storage space release request from the at least one second process, wherein the second preset value indicates that the storage space is not allocated.
[0188] In a possible implementation manner, the device further includes:
[0189] The clearing module is used to clear at least one process space counter corresponding to the at least one second process in response to receiving at least one storage space release request from the at least one second process.
[0190] In a possible implementation, the allocation module 41 is used to:
[0191] In response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, the target storage space is allocated to the first process according to the space process mapping table after clearing the identification information of the at least one second process.
[0192] In a possible implementation, the clearing module is used to:
[0193] In response to receiving at least one storage space release request from at least one second process, the space release processing module clears the identification information of the at least one second process in the space process mapping table, and clears the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0194] In a possible implementation, the allocation module 41 is used to:
[0195] The target storage space is allocated to the first process according to the space process mapping table through the space request processing module.
[0196] In a possible implementation, the allocation module 41 is used to:
[0197] In response to the amount of unallocated storage space in the space process mapping table satisfying the storage space allocation request from the first process, a target storage space is allocated to the first process.
[0198] In a possible implementation, the allocation module 41 is used to:
[0199] Respond to storage space allocation requests from different processes in order of priority from high to low;
[0200] or,
[0201] When the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously.
[0202] The disclosed embodiment also provides a storage space management device, including a space process mapping table, a space request processing module and an address mapping table;
[0203] The space process mapping table is used to: record the correspondence between the physical address of the storage space and the identification information of the process;
[0204] The space request processing module is used to: in response to receiving a storage space allocation request from a first process, allocate a target storage space to the first process according to the space-process mapping table;
[0205] The address mapping table is used to: record the mapping relationship between the logical address and the physical address of the storage space of each process, including recording the mapping relationship between the logical address and the physical address of the target storage space;
[0206] Among them, the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
[0207] In one possible implementation,
[0208] The storage space management device further includes: a space flag bit, which corresponds to the storage space one by one and is used to mark whether the corresponding storage space has been allocated;
[0209] The space request processing module is specifically used to: allocate target storage space to the first process according to the space process mapping table and the space flag corresponding to the storage space in the space process mapping table; update the space flag corresponding to the target storage space to a first preset value, wherein the first preset value indicates that the storage space has been allocated.
[0210] In one possible implementation,
[0211] The storage space management device further includes: a process space counter corresponding to each process one by one, used to record the amount of storage space currently occupied by the corresponding process;
[0212] The space request processing module is further used to: update a process space counter corresponding to the first process according to the amount of the target storage space.
[0213] In one possible implementation,
[0214] The storage space management device also includes: a space release processing module, which is used to respond to receiving at least one storage space release request from at least one second process, clear the identification information of the at least one second process in the space process mapping table, and clear the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
[0215] In a possible implementation manner, the space release processing module is further used to:
[0216] In response to receiving at least one storage space release request from at least one second process, a space flag bit of the storage space corresponding to the at least one second process is updated to a second preset value, wherein the second preset value indicates that the storage space is not allocated.
[0217] In a possible implementation manner, the space release processing module is further used to:
[0218] In response to receiving at least one storage space release request from at least one second process, at least one process space counter corresponding to the at least one second process is cleared.
[0219] In a possible implementation manner, the space request processing module is specifically used to:
[0220] In response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, the target storage space is allocated to the first process according to the space process mapping table after clearing the identification information of the at least one second process.
[0221] In a possible implementation manner, the space request processing module is specifically used to:
[0222] Respond to storage space allocation requests from different processes in order of priority from high to low;
[0223] or,
[0224] When the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously.
[0225] In a possible implementation manner, the device further includes:
[0226] The free space counter is used to calculate the amount of free storage space according to the space flag bits corresponding to each storage space.
[0227] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. Its specific implementation and technical effects can refer to the description of the above method embodiments. For the sake of brevity, they will not be repeated here.
[0228] The embodiment of the present disclosure also provides a storage space management device, wherein the cache managed by the storage space management device is implemented based on the general memory of the processor, and the interface accessed by the storage space management device includes: one or more space request interfaces, one or more space release interfaces, and one or more logical address and physical address conversion interfaces. Among them, the space request interface is used to process storage space allocation requests, the space release interface is used to process storage space release requests, and the conversion interface is used for conversion between logical addresses and physical addresses.
[0229] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium.
[0230] The embodiment of the present disclosure further provides a computer program, including a computer-readable code. When the computer-readable code is executed in an electronic device, a processor in the electronic device executes the above method.
[0231] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the above method.
[0232] An embodiment of the present disclosure also provides an electronic device, comprising: one or more processors; and a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute the above method.
[0233] The electronic device may be provided as a terminal, a server, or a device in other forms.
[0234] Figure 5 1 is a block diagram of an electronic device 1900 provided in an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal. Figure 5 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0235] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as a Microsoft Server operating system (Windows Server 2003). TM ), a graphical user interface operating system launched by Apple (MacOS X TM ), a multi-user, multi-process computer operating system (Unix TM), a free and open source Unix-like operating system (Linux TM ), an open source Unix-like operating system (FreeBSD TM ) or similar.
[0236] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0237] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0238] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0239] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0240] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0241] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0242] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0243] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0244] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0245] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0246] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0247] If the technical solution of the embodiments of the present disclosure involves personal information, the product using the technical solution of the embodiments of the present disclosure has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of the embodiments of the present disclosure involves sensitive personal information, the product using the technical solution of the embodiments of the present disclosure has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the requirement of "explicit consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to collect his or her personal information; or on the device for processing personal information, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0248] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A storage space management method, characterized in that: include: In response to receiving a storage space allocation request from a first process, allocating a target storage space to the first process according to a space process mapping table and a space flag bit corresponding to the storage space in the space process mapping table, wherein the space process mapping table is used to record a correspondence between a physical address of the storage space and identification information of the process; In the address mapping table, the mapping relationship between the logical address and the physical address of the target storage space is recorded, and the space flag corresponding to the target storage space in the space process mapping table is updated to a first preset value; wherein the first preset value indicates that the storage space has been allocated, the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
2. The method according to claim 1, characterized in that After allocating the target storage space to the first process, the method further includes: According to the amount of the target storage space, a process space counter corresponding to the first process is updated.
3. The method according to any one of claims 1 to 2, characterized in that The method further comprises: In response to receiving at least one storage space release request from at least one second process, the identification information of the at least one second process is cleared in the space process mapping table, and the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process is cleared in the address mapping table.
4. The method according to claim 3, characterized in that: The method further comprises: In response to receiving at least one storage space release request from at least one second process, a space flag bit of the storage space corresponding to the at least one second process is updated to a second preset value, wherein the second preset value indicates that the storage space is not allocated.
5. The method according to claim 3, characterized in that: The method further comprises: In response to receiving at least one storage space release request from at least one second process, at least one process space counter corresponding to the at least one second process is cleared.
6. The method according to claim 3, characterized in that In response to receiving a storage space allocation request from a first process, allocating a target storage space to the first process according to a space-process mapping table includes: In response to simultaneously receiving the storage space allocation request from the first process and the at least one storage space release request from the at least one second process, the target storage space is allocated to the first process according to the space process mapping table after clearing the identification information of the at least one second process.
7. The method according to claim 3, characterized in that In response to receiving at least one storage space release request from at least one second process, clearing identification information of the at least one second process in the space-process mapping table, and clearing a mapping relationship between a logical address and a physical address of a storage space corresponding to the at least one second process in the address mapping table, including: In response to receiving at least one storage space release request from at least one second process, the space release processing module clears the identification information of the at least one second process in the space process mapping table, and clears the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
8. The method according to claim 1 or 2, characterized in that: The allocating the target storage space to the first process according to the space-process mapping table includes: The target storage space is allocated to the first process according to the space process mapping table through the space request processing module.
9. The method according to claim 1 or 2, characterized in that: The allocating the target storage space to the first process according to the space-process mapping table includes: In response to the amount of unallocated storage space in the space process mapping table satisfying the storage space allocation request from the first process, a target storage space is allocated to the first process.
10. The method according to claim 1 or 2, characterized in that: Respond to storage space allocation requests from different processes in order of priority from high to low; or, When the amount of unallocated storage space in the space process mapping table is sufficient, storage space allocation requests from different processes are responded to simultaneously.
11. A storage space management device, characterized in that: It includes a space process mapping table, a space request processing module and an address mapping table; The space process mapping table is used to: record the correspondence between the physical address of the storage space and the identification information of the process; The space flag bit corresponds to the storage space one by one and is used to mark whether the corresponding storage space has been allocated; The space request processing module is used to: in response to receiving a storage space allocation request from a first process, allocate a target storage space to the first process according to the space process mapping table and the space flag corresponding to the storage space in the space process mapping table, and update the space flag corresponding to the target storage space to a first preset value, wherein the first preset value indicates that the storage space has been allocated; The address mapping table is used to: record the mapping relationship between the logical address and the physical address of the storage space of each process, including recording the mapping relationship between the logical address and the physical address of the target storage space; Among them, the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
12. The device according to claim 11, characterized in that The storage space management device further includes: a process space counter corresponding to each process one by one, used to record the amount of storage space currently occupied by the corresponding process; The space request processing module is further used to: update a process space counter corresponding to the first process according to the amount of the target storage space.
13. The device according to claim 11 or 12, characterized in that The storage space management device also includes: a space release processing module, which is used to respond to receiving at least one storage space release request from at least one second process, clear the identification information of the at least one second process in the space process mapping table, and clear the mapping relationship between the logical address and the physical address of the storage space corresponding to the at least one second process in the address mapping table.
14. The device according to claim 11, characterized in that The device also includes: The free space counter is used to calculate the amount of free storage space according to the space flag bits corresponding to each storage space.
15. A storage space management device, characterized in that: include: an allocation module, configured to allocate a target storage space to the first process in response to receiving a storage space allocation request from the first process, according to a space process mapping table and a space flag bit corresponding to the storage space in the space process mapping table, wherein the space process mapping table is used to record a correspondence between a physical address of the storage space and identification information of the process; A recording and updating module is used to record the mapping relationship between the logical address and the physical address of the target storage space in the address mapping table, and update the space flag corresponding to the target storage space in the space process mapping table to a first preset value; wherein the first preset value indicates that the storage space has been allocated, the logical address of the storage space corresponding to the first process is continuous, the physical address of the storage space corresponding to the first process is allowed to be non-continuous, and the mapping relationship between the logical address and the physical address of the storage space of different processes is recorded in the same address mapping table.
16. An electronic device, characterized in that: include: one or more processors; a memory for storing executable instructions; The one or more processors are configured to call the executable instructions stored in the memory to execute the method according to any one of claims 1 to 10.
17. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
TLB filling method and device of virtual machine and storage medium
CN110196757A
Method for avoiding Linux kernel memory fragmentation, device and computer storage medium
CN111813710A