Storage space management method, device, electronic device and storage medium

By obtaining and updating the free address table and recording logical and physical address mapping, efficient allocation and recycling of storage space is achieved, which solves the problem of storage space fragmentation in chip design and improves storage space utilization.

CN117743203BActive Publication Date: 2024-08-30MOORE THREADS TECHNOLOGY (CHENGDU) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311844161.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2024-08-30
Estimated Expiration
2043-12-28

AI Technical Summary

Technical Problem

In chip design, on-chip storage space is limited, resulting in disordered space allocation and recycling in storage space management, leading to fragmentation and inability to effectively utilize the remaining space.

Method used

By obtaining the free address table, allocating and releasing storage space according to the table, recording the mapping relationship between logical addresses and physical addresses, allowing logical addresses to be continuous but physical addresses to be non-continuous, allocating space using first-in, first-out order, and updating the table when releasing, to achieve Efficient space recycling.

Benefits of technology

Maximize the use of limited storage space, improve storage space utilization, respond to multiple storage space allocation requests, and improve the operating efficiency of the process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117743203B
    Figure CN117743203B
Patent Text Reader

Abstract

The present disclosure relates to a storage space management method, device, electronic device and storage medium. The method comprises: in response to a storage space allocation request from a first process, obtaining a free address table, wherein the free address table is used to record the physical address of an unallocated storage space; according to the free address table, allocating a target storage space to the first process; recording a mapping relationship between a logical address and a physical address of the target storage space; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.
Need to check novelty before this filing date? Find Prior Art

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 a storage space allocation request from the first process, obtaining a free address table, wherein the free address table is used to record a physical address of an unallocated storage space;

[0007] Allocating target storage space to the first process according to the free address table;

[0008] Recording a mapping relationship between a logical address and a physical address of the target storage space; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.

[0009] In a possible implementation, recording a mapping relationship between a logical address and a physical address of the target storage space includes:

[0010] In the process address mapping table corresponding to the first process, a mapping relationship between the logical address and the physical address of the target storage space is recorded.

[0011] In a possible implementation, after allocating the target storage space to the first process and before recording the mapping relationship between the logical address and the physical address of the target storage space, 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, recording a mapping relationship between a logical address and a physical address of the target storage space includes:

[0014] Determine a target location in a process address mapping table corresponding to the first process according to a value of a process space counter corresponding to the first process;

[0015] Based on the target location, a mapping relationship between the logical address and the physical address of the target storage space is recorded.

[0016] In a possible implementation, allocating a target storage space to the first process according to the free address table includes:

[0017] Based on a first-in-first-out order, storage space in the free address table is allocated to the first process.

[0018] In a possible implementation, the method further includes:

[0019] In response to at least one storage space release request from at least one second process, determining a space release address table corresponding to the at least one storage space release request;

[0020] The idle address table is updated according to the space release address table.

[0021] In a possible implementation, the method further includes:

[0022] In response to at least one storage space release request from at least one second process, at least one process address mapping table corresponding to the at least one second process is cleared.

[0023] In a possible implementation, the method further includes:

[0024] In response to 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.

[0025] In one possible implementation,

[0026] The step of determining, in response to at least one storage space release request from at least one second process, a space release address table corresponding to the at least one storage space release request comprises: determining, by a space release processing module, in response to at least one storage space release request from at least one second process, a space release address table corresponding to the at least one storage space release request;

[0027] The updating of the idle address table according to the space release address table includes: updating the idle address table according to the space release address table by the space release processing module.

[0028] In a possible implementation, allocating a target storage space to the first process according to the free address table includes:

[0029] 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, a target storage space is allocated to the first process according to the updated free address table.

[0030] In a possible implementation, allocating a target storage space to the first process according to the free address table includes:

[0031] Allocate target storage space to the first process according to the free address table through a space request processing module.

[0032] In a possible implementation, allocating a target storage space to the first process according to the free address table includes:

[0033] In response to the storage space allocation request from the first process being the storage space allocation request with the highest priority, and the free address table indicating that the amount of unallocated storage space meets the requirements of the storage space allocation request from the first process, a target storage space is allocated to the first process.

[0034] According to one aspect of the present disclosure, there is provided a storage space management device, comprising:

[0035] an acquisition module, configured to acquire a free address table in response to a storage space allocation request from a first process, wherein the free address table is used to record a physical address of an unallocated storage space;

[0036] an allocation module, configured to allocate a target storage space to the first process according to the free address table;

[0037] A recording module is used to record the mapping relationship between the logical address and the physical address of the target storage space; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.

[0038] In a possible implementation, the recording module is used to:

[0039] In the process address mapping table corresponding to the first process, a mapping relationship between the logical address and the physical address of the target storage space is recorded.

[0040] In a possible implementation manner, the device further includes:

[0041] The first updating module is used to update the process space counter corresponding to the first process according to the amount of the target storage space.

[0042] In a possible implementation, the recording module is used to:

[0043] Determine a target location in a process address mapping table corresponding to the first process according to a value of a process space counter corresponding to the first process;

[0044] Based on the target location, a mapping relationship between the logical address and the physical address of the target storage space is recorded.

[0045] In a possible implementation, the allocation module is used to:

[0046] Based on a first-in-first-out order, storage space in the free address table is allocated to the first process.

[0047] In a possible implementation manner, the device further includes:

[0048] a determination module, configured to determine, in response to at least one storage space release request from at least one second process, a space release address table corresponding to the at least one storage space release request;

[0049] The second updating module is used to update the idle address table according to the space release address table.

[0050] In a possible implementation manner, the device further includes:

[0051] The clearing module is used to clear at least one process address mapping table corresponding to the at least one second process in response to at least one storage space release request from the at least one second process.

[0052] In a possible implementation manner, the device further includes:

[0053] The clearing module is used to clear at least one process space counter corresponding to the at least one second process in response to at least one storage space release request from the at least one second process.

[0054] In one possible implementation,

[0055] The determination module is used to: determine a space release address table corresponding to at least one storage space release request in response to at least one storage space release request from at least one second process through the space release processing module;

[0056] The second updating module is used to update the free address table according to the space release address table through the space release processing module.

[0057] In a possible implementation, the allocation module is used to:

[0058] 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, a target storage space is allocated to the first process according to the updated free address table.

[0059] In a possible implementation, the allocation module is used to:

[0060] Allocate target storage space to the first process according to the free address table through a space request processing module.

[0061] In a possible implementation, the allocation module is used to:

[0062] In response to the storage space allocation request from the first process being the storage space allocation request with the highest priority, and the free address table indicating that the amount of unallocated storage space meets the requirements of the storage space allocation request from the first process, a target storage space is allocated to the first process.

[0063] 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.

[0064] 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.

[0065] 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.

[0066] In an embodiment of the present disclosure, a free address table is obtained by responding to a storage space allocation request from a first process, wherein the free address table is used to record the physical address of the unallocated storage space, and a target storage space is allocated to the first process according to the free address table, and a mapping relationship between the logical address and the physical address of the target storage space is recorded, wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous, so that when allocating storage space to the process, it is only necessary to consider whether the remaining storage space is sufficient (i.e., 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 (i.e., 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. In addition, in an embodiment 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 the running needs, which is conducive to improving the utilization rate of the storage space.

[0067] 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.

[0068] 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

[0069] 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.

[0070] Figure 1 A flowchart of a storage space management method provided by an embodiment of the present disclosure is shown.

[0071] Figure 2 A schematic diagram of a storage space management device provided by an embodiment of the present disclosure is shown.

[0072] 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.

[0073] Figure 4 A block diagram of a storage space management device provided by an embodiment of the present disclosure is shown.

[0074] Figure 5 A block diagram of an electronic device 1900 provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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.

[0079] There are the following two storage space management methods in the related art.

[0080] 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.

[0081] 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.

[0082] 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.

[0083] In order to solve the technical problems similar to those described above, the embodiment of the present disclosure provides a storage space management method, by responding to a storage space allocation request from a first process, obtaining a free address table, wherein the free address table is used to record the physical address of the unallocated storage space, and according to the free address table, allocating a target storage space to the first process, and recording the mapping relationship between the logical address and the physical address of the target storage space, wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous, 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. 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.

[0084] The storage space management method provided by the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.

[0085] 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 1As shown, the storage space management method includes steps S11 to S13.

[0086] In step S11, in response to a storage space allocation request from a first process, a free address table is obtained, wherein the free address table is used to record the physical address of an unallocated storage space.

[0087] In step S12, a target storage space is allocated to the first process according to the free address table.

[0088] In step S13, the mapping relationship between the logical address and the physical address of the target storage space is recorded; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.

[0089] In the disclosed embodiment, the free address table can be used to record the physical address of the unallocated storage space. According to the free address table, the number of unallocated storage spaces and which storage spaces are unallocated can be determined. Among them, the unallocated storage space can also be referred to as free storage space, that is, storage space that can be allocated. In some application scenarios, the free address table can also be referred to as a free address queue, an unallocated address table, etc., which is not limited here.

[0090] In the embodiment of the present disclosure, when the system starts to run, the free address table can be initialized, and the physical address of each unallocated storage space can be written into the free address table.

[0091] 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.

[0092] 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.

[0093] In an embodiment of the present disclosure, a target storage space may be allocated to the first process according to the free address 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.

[0094] In a possible implementation, allocating target storage space to the first process according to the free address table includes: allocating storage space in the free address table to the first process based on a first-in-first-out order.

[0095] In this implementation, the newly released storage space may be inserted into the tail of the free address table, and the free address table may allocate the storage space based on a first-in, first-out order.

[0096] By adopting this implementation method, the storage space in the free address table is allocated to the first process based on a first-in-first-out order, which can help to average out the hot spots of the storage space, that is, it can help to make the number of times each storage space is allocated close, which helps to increase the life of the memory.

[0097] In a possible implementation, allocating the target storage space to the first process according to the free address table includes: allocating the target storage space to the first process according to the free address table by a space request processing module.

[0098] As an example of this implementation method, the idle request processing module can respond to 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 and the free address table, and can update the free address table, the process space counter corresponding to the process, and the process address mapping table corresponding to the process.

[0099] As an example of this implementation, the idle release processing module may send an idle address table, a process space counter corresponding to the process, and a process address mapping table corresponding to the process to the idle request processing module.

[0100] In this implementation, the target storage space is allocated to the first process according to the free address table through the space request processing module, thereby enabling the allocation of storage space through the space request processing module.

[0101] In one possible implementation, allocating target storage space to the first process based on the free address table includes: in response to the storage space allocation request from the first process being a storage space allocation request with the highest priority, and the free address table indicating that the amount of unallocated storage space meets the requirement of the storage space allocation request from the first process, allocating target storage space to the first process.

[0102] In this implementation, each storage space allocation request may be processed in sequence according to the order of priority from high to low.

[0103] 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 free address 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 free address 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 free address 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 free address 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.

[0104] By adopting this implementation, it is possible to process storage space allocation requests based on their priorities.

[0105] In another possible implementation, if the amount of unallocated storage space in the free address 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.

[0106] In a possible implementation, after allocating the target storage space to the first process and before recording the mapping relationship between the logical address and the physical address of the target storage space, the method further includes: updating a process space counter corresponding to the first process according to the amount of the target storage space.

[0107] 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. 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.

[0108] 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.

[0109] 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 be determined according to the process space counter corresponding to each process.

[0110] 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.

[0111] In a possible implementation, recording the mapping relationship between the logical address and the physical address of the target storage space includes: recording the mapping relationship between the logical address and the physical address of the target storage space in a process address mapping table corresponding to the first process.

[0112] In this implementation, the process address mapping table may correspond to a process one by one. The process address mapping table corresponding to any process may be used to record the mapping relationship between the logical address and the physical address of the storage space occupied by the process. For example, the process address mapping table corresponding to the first process may be used to record the mapping relationship between the logical address and the physical address of the storage space occupied by the first process.

[0113] In this implementation, by recording the mapping relationship between the logical address and the physical address of the target storage space in the process address mapping table corresponding to the first process, the mapping relationship between the logical address and the physical address of the storage space occupied by each process can be recorded through the process address mapping table corresponding to each process, so that the mapping relationship between the logical address and the physical address of the storage space occupied by each process can be obtained through the process address mapping table corresponding to each process. By establishing the mapping relationship between the logical address and the physical address of the storage space through the process 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.

[0114] In one possible implementation, recording the mapping relationship between the logical address and the physical address of the target storage space includes: determining the target position in the process address mapping table corresponding to the first process according to the value of the process space counter corresponding to the first process; and recording the mapping relationship between the logical address and the physical address of the target storage space based on the target position.

[0115] As an example of this implementation, the target position may represent the starting position for recording the mapping relationship between the logical address and the physical address of the target storage space. In this example, the target position in the process address mapping table corresponding to the first process may be determined according to the value of the process space counter corresponding to the first process, and the mapping relationship between the logical address and the physical address of the target storage space may be recorded starting from the target position in the process address mapping table corresponding to the first process.

[0116] As another example of this implementation, the target location may include all locations that record the mapping relationship between the logical address and the physical address of the target storage space. In this example, the target location in the process address mapping table corresponding to the first process may be determined based on the value of the process space counter corresponding to the first process and the amount of storage space requested by the storage space allocation request from the first process, and the mapping relationship between the logical address and the physical address of the target storage space may be recorded in the target location in the process address mapping table corresponding to the first process.

[0117] In this implementation, the target position in the process address mapping table corresponding to the first process is determined according to the value of the process space counter corresponding to the first process, and based on the target position, the mapping relationship between the logical address and the physical address of the target storage space is recorded. In this way, the value of the process space counter corresponding to the first process can be used as an insertion pointer to insert into the process address mapping table corresponding to the first process.

[0118] In a possible implementation, the method further includes: in response to at least one storage space release request from at least one second process, determining a space release address table corresponding to the at least one storage space release request; and updating the free address table according to the space release address table.

[0119] 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.

[0120] In this implementation, in response to a storage space release request from any second process, a space release address table corresponding to the storage space release request can be obtained according to the physical address of the storage space occupied by the second process. The space release address table can be used to record the physical address of the storage space to be released by the second process, for example, the space release address table can include the physical address of each storage space occupied by the second process.

[0121] As an example of this implementation method, in response to a storage space release request from any second process, the physical address of the storage space occupied by the second process can be determined according to the process address mapping table corresponding to the second process to determine the space release address table corresponding to the storage space release request.

[0122] In this implementation, the space release address table and the idle address table may be merged to obtain an updated idle address table.

[0123] 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.

[0124] As an example of this implementation, the method further includes: in response to at least one storage space release request from at least one second process, clearing at least one process address mapping table corresponding to the at least one second process.

[0125] In this example, in response to a storage space release request from any process, the process address mapping table corresponding to the process can be cleared, thereby accurately determining whether the process occupies storage space, and the mapping relationship between the logical address and the physical address of the storage space occupied by the process when the process occupies storage space.

[0126] As an example of this implementation, the method further includes: in response to 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.

[0127] In this example, in response to 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.

[0128] As an example of this implementation method, the method of determining a space release address table corresponding to at least one storage space release request in response to at least one storage space release request from at least one second process includes: determining a space release address table corresponding to the at least one storage space release request in response to at least one storage space release request from at least one second process through a space release processing module; and updating the free address table according to the space release address table includes: updating the free address table according to the space release address table through the space release processing module.

[0129] In this example, the space release processing module can respond to a storage space release request from any process, determine the physical address of the storage space occupied by the process according to the process address mapping table corresponding to the process, and obtain the space release address table corresponding to the storage space release request according to the physical address of the storage space occupied by the process. The space release processing module can merge the space release address table and the free address table to obtain an updated free address table.

[0130] By adopting this example, the storage space can be released through the space release processing module.

[0131] As an example of this implementation, the allocating target storage space to the first process according to the free address table includes: in response to 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 at the same time, allocating the target storage space to the first process according to the updated free address table. In this example, the storage space allocation request and storage space release request of multiple processes can be responded to at one time, and the storage space allocation request and storage space release request 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.

[0132] In the 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, and the physical address corresponding to the logical address in the instruction or program segment is returned to the instruction or program segment. In a possible implementation, 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 process address mapping table corresponding to the first process, and the physical address corresponding to the logical address in the instruction or program segment is returned to the instruction or program segment.

[0133] 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.

[0134] The storage space management method provided by the embodiment of the present disclosure is described below through a specific application scenario.

[0135] 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 release processing module, a space request processing module, a process space counter, a process address mapping table and a free address table.

[0136] 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. Figure 2 In the example shown, there are N+1 process space counters 0 to N corresponding to N+1 processes.

[0137] The process address mapping table may correspond to each process one by one. The process address mapping table corresponding to any process may be used to record the mapping relationship between the logical address and the physical address of the storage space occupied by the process. Figure 2 In the example shown, N+1 process address mapping tables 0 to N corresponding to N+1 processes are included.

[0138] The free address table can be used to record the physical addresses of unallocated storage space.

[0139] The space release processing module can respond to a storage space release request from any process, determine the physical address of the storage space occupied by the process according to the process address mapping table corresponding to the process, and obtain the space release address table corresponding to the storage space release request according to the physical address of the storage space occupied by the process. The space release processing module can merge the space release address table and the free address table to obtain an updated free address table.

[0140] The idle request processing module can respond to 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 and the free address table, and update the free address table, the process space counter corresponding to the process, and the process address mapping table corresponding to the process.

[0141] In this application scenario, in response to a storage space allocation request from the first process, the free address table, the process space counter corresponding to the first process, and the process address mapping table corresponding to the first process can be read by the space release processing module.

[0142] If the space release processing module does not receive a storage space release request from other processes while receiving a storage space allocation request from the first process, the space release processing module can directly pass the free address table, the process space counter corresponding to the first process, and the process address mapping table corresponding to the first process to the space request processing module.

[0143] If the space release processing module receives at least one storage space release request from at least one second process while receiving a storage space allocation request from the first process, the space release processing module can obtain a space release address table based on at least one process address mapping table corresponding to the at least one second process, and can merge the space release address table with the free address table to obtain an updated free address table. In addition, the space release processing module can clear at least one process space counter corresponding to the at least one second process, and clear at least one process address mapping table corresponding to the at least one second process. The free release processing module can pass the updated free address table, the process space counter corresponding to the first process, and the process address mapping table corresponding to the first process to the space request processing module.

[0144] After receiving the free address table, the process space counter corresponding to the first process, and the process address mapping table corresponding to the first process, the space request processing module can determine whether there is enough storage space to allocate to the first process according to the free address table. If there is enough storage space, the storage space can be allocated to the first process, and the free address table, the process space counter corresponding to the first process, and the process address mapping table corresponding to the first process are updated.

[0145] 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 process address mapping table corresponding to the first process, and the physical address corresponding to the logical address in the instruction or program segment can be returned to the instruction or program segment.

[0146] 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 address mapping table 0 represents the process address mapping table corresponding to process 0, process space counter 0 represents the process space counter corresponding to process 0, process address mapping table 1 represents the process address mapping table corresponding to process 1, and process space counter 1 represents the process space counter corresponding to process 1.

[0147] like Figure 3 As shown, when the system starts running, the free address table includes physical address 1, physical address 2, physical address 3 and physical address 4.

[0148] In response to a storage space allocation request from process 0, according to the number 1 of storage space requested by the storage space allocation request, the storage space corresponding to physical address 1 can be allocated to process 0, and the free address table, process address mapping table 0 and process space counter 0 can be updated. At this time, the free address table includes physical address 2, physical address 3 and physical address 4, the process address mapping table 0 includes the mapping relationship between physical address 1 and the logical address, and the value of process space counter 0 is 1.

[0149] In response to a storage space allocation request from process 1, the storage space corresponding to physical address 2 and the storage space corresponding to physical address 3 can be allocated to process 1 according to the amount of storage space 2 requested by the storage space allocation request, and the free address table, process address mapping table 1 and process space counter 1 can be updated. At this time, the free address table includes physical address 4, the process address mapping table 1 includes the mapping relationship between physical address 2 and the logical address and the mapping relationship between physical address 3 and the logical address, and the value of process space counter 1 is 2.

[0150] In response to the storage space allocation request from process 0, according to the number 1 of storage space requested by the storage space allocation request, the storage space corresponding to physical address 4 can be allocated to process 0, and the free address table, process address mapping table 0 and process space counter 0 can be updated. At this time, the free address table is empty, the process address mapping table 0 includes the mapping relationship between physical address 1 and the logical address and the mapping relationship between physical address 4 and the logical address, and the value of process space counter 0 is 2.

[0151] In response to a storage space release request from process 1, physical address 2 and physical address 3 in process address mapping table 1 may be written into the free address table, process address mapping table 1 may be cleared, and process space counter 1 may be cleared.

[0152] In response to a storage space release request from process 0, physical address 1 and physical address 4 in process address mapping table 0 may be written into the free address table, process address mapping table 0 may be cleared, and process space counter 0 may be cleared.

[0153] 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.

[0154] 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.

[0155] 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:

[0156] An acquisition module 41, configured to acquire a free address table in response to a storage space allocation request from a first process, wherein the free address table is used to record a physical address of an unallocated storage space;

[0157] an allocation module 42, configured to allocate a target storage space to the first process according to the free address table;

[0158] The recording module 43 is used to record the mapping relationship between the logical address and the physical address of the target storage space; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.

[0159] In a possible implementation, the recording module 43 is used to:

[0160] In the process address mapping table corresponding to the first process, a mapping relationship between the logical address and the physical address of the target storage space is recorded.

[0161] In a possible implementation manner, the device further includes:

[0162] The first updating module is used to update the process space counter corresponding to the first process according to the amount of the target storage space.

[0163] In a possible implementation, the recording module 43 is used to:

[0164] Determine a target location in a process address mapping table corresponding to the first process according to a value of a process space counter corresponding to the first process;

[0165] Based on the target location, a mapping relationship between the logical address and the physical address of the target storage space is recorded.

[0166] In a possible implementation, the allocation module 42 is used to:

[0167] Based on a first-in-first-out order, storage space in the free address table is allocated to the first process.

[0168] In a possible implementation manner, the device further includes:

[0169] a determination module, configured to determine, in response to at least one storage space release request from at least one second process, a space release address table corresponding to the at least one storage space release request;

[0170] The second updating module is used to update the idle address table according to the space release address table.

[0171] In a possible implementation manner, the device further includes:

[0172] The clearing module is used to clear at least one process address mapping table corresponding to the at least one second process in response to at least one storage space release request from the at least one second process.

[0173] In a possible implementation manner, the device further includes:

[0174] The clearing module is used to clear at least one process space counter corresponding to the at least one second process in response to at least one storage space release request from the at least one second process.

[0175] In one possible implementation,

[0176] The determination module is used to: determine a space release address table corresponding to at least one storage space release request in response to at least one storage space release request from at least one second process through the space release processing module;

[0177] The second updating module is used to update the free address table according to the space release address table through the space release processing module.

[0178] In a possible implementation, the allocation module 42 is used to:

[0179] 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, a target storage space is allocated to the first process according to the updated free address table.

[0180] In a possible implementation, the allocation module 42 is used to:

[0181] Allocate target storage space to the first process according to the free address table through a space request processing module.

[0182] In a possible implementation, the allocation module 42 is used to:

[0183] In response to the storage space allocation request from the first process being the storage space allocation request with the highest priority, and the free address table indicating that the amount of unallocated storage space meets the requirements of the storage space allocation request from the first process, a target storage space is allocated to the first process.

[0184] 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.

[0185] 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.

[0186] 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.

[0187] 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.

[0188] 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.

[0189] 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.

[0190] The electronic device may be provided as a terminal, a server, or a device in other forms.

[0191] 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.

[0192] 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.

[0193] 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.

[0194] 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.

[0195] 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.

[0196] 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.

[0197] 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.

[0198] 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.

[0199] 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.

[0200] 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.

[0201] 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.

[0202] 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.

[0203] 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.

[0204] 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.

[0205] 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 a storage space allocation request from the first process, obtaining a free address table, wherein the free address table is used to record a physical address of an unallocated storage space; Allocating target storage space to the first process according to the free address table; According to the amount of the target storage space, updating the process space counter corresponding to the first process; wherein the process space counter corresponds to each process one by one, and the process space counter corresponding to any process is used to record the amount of storage space occupied by the process; Determine a target location in a process address mapping table corresponding to the first process according to a value of a process space counter corresponding to the first process; In the process address mapping table corresponding to the first process, starting from the target position, the mapping relationship between the logical address and the physical address of the target storage space is recorded; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.

2. The method according to claim 1, characterized in that The allocating target storage space to the first process according to the free address table includes: Based on a first-in-first-out order, storage space in the free address table is allocated to the first process.

3. The method according to claim 1, characterized in that The method further comprises: In response to at least one storage space release request from at least one second process, determining a space release address table corresponding to the at least one storage space release request; The idle address table is updated according to the space release address table.

4. The method according to claim 3, characterized in that The method further comprises: In response to at least one storage space release request from at least one second process, at least one process address mapping table corresponding to the at least one second process is cleared.

5. The method according to claim 3, characterized in that: The method further comprises: In response to 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 The step of determining, in response to at least one storage space release request from at least one second process, a space release address table corresponding to the at least one storage space release request comprises: determining, by a space release processing module, in response to at least one storage space release request from at least one second process, a space release address table corresponding to the at least one storage space release request; The updating of the idle address table according to the space release address table includes: updating the idle address table according to the space release address table by the space release processing module.

7. The method according to claim 3, characterized in that The allocating target storage space to the first process according to the free address 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, a target storage space is allocated to the first process according to the updated free address table.

8. The method according to claim 1, characterized in that The allocating target storage space to the first process according to the free address table includes: Allocate target storage space to the first process according to the free address table through a space request processing module.

9. The method according to claim 1, characterized in that: The allocating target storage space to the first process according to the free address table includes: In response to the storage space allocation request from the first process being the storage space allocation request with the highest priority, and the free address table indicating that the amount of unallocated storage space meets the requirements of the storage space allocation request from the first process, a target storage space is allocated to the first process.

10. A storage space management device, characterized in that: include: an acquisition module, configured to acquire a free address table in response to a storage space allocation request from a first process, wherein the free address table is used to record a physical address of an unallocated storage space; an allocation module, configured to allocate a target storage space to the first process according to the free address table; A recording module is used to update a process space counter corresponding to the first process according to the number of the target storage space, wherein the process space counter corresponds to the process one-to-one, and the process space counter corresponding to any process is used to record the number of storage spaces occupied by the process; according to the value of the process space counter corresponding to the first process, the target position in the process address mapping table corresponding to the first process is determined, and in the process address mapping table corresponding to the first process, starting from the target position, the mapping relationship between the logical address and the physical address of the target storage space is recorded; wherein the logical address of the storage space corresponding to the first process is continuous, and the physical address of the storage space corresponding to the first process is allowed to be non-continuous.

11. 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 executable instructions stored in the memory to execute the method according to any one of claims 1 to 9.

12. 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 9 is implemented.

Citation Information

Patent Citations

  • Memory management method and device and embedded system

    CN103970680A

  • Method for avoiding Linux kernel memory fragmentation, device and computer storage medium

    CN111813710A

  • Smart card fragment storage space arrangement method, smart card and system

    CN112527197A