Field of the Invention
[0001] The present disclosure relates to the field of communication technologies, and in particular to a wear leveling and access method and a wear leveling and access device for a non-volatile memory, and a storage medium.
Background of the Invention
[0002] Non-volatile memories (NVM) have experienced rapid development in recent years for having both the durability of a traditional external memory and the high performance of a traditional internal memory. Similar to solid state drives (SSD), a non-volatile memory can be erased and written only a limited number of times. This feature determines that wear leveling must be supported in a non-volatile memory. Otherwise, unintentional hotspot accesses or malicious repeated erasing attacks will cause certain physical addresses (pages, blocks, segments) to reach upper limits of erasing times first, leading to negative effects such as decrease of an available capacity in a less severe case and scrapping of an entire disk in a severe case.
[0003] A solid state drive completes wear leveling tasks by a hardware mapping table method, i.e., realizing mapping between logical addresses and physical addresses by means of a mapping table in a flash translation layer (FTL). The FTL counts access times to physical addresses, and for a physical address that is accessed at a high frequency, it is only necessary to change the mapping table by changing the physical address mapped by the logical address to a physical address that is accessed at a low frequency. In addition to address mapping and wear leveling, the FTL also undertakes tasks such as garbage collection, error correcting code (ECC) verification, bad block management, etc.
[0004] However, wear leveling for a non-volatile memory cannot just imitate the traditional hardware mapping table method for the following reasons. (1) A non-volatile memory has no FTL hardware. AFTL contains core technologies of a manufacturer of solid state drives, and it is integrated in hardware devices. A non-volatile memory, however, does not have FTL hardware. If increasing overhead and cost in hardware design only for wear leveling, it will be difficult to get support from the hardware manufacturer. (2) There are high requirements for performance of a non-volatile memory. Table lookup by means of software is inefficient, and also increases a step of "counting the number of times of erasing and writing". Such performance damage accounts for only less than 1% (basically negligible) of the solid state drive performance; however, for a non-volatile memory whose access latency is lower than a solid state drive by one to two orders of magnitude, such performance damage will produce more than 30% performance damage (very significant). (3) A non-volatile memory is rather expensive. If a mapping table is implemented and mapping relationships of "logical addresses, physical addresses, and the number of times of erasing/writing" are recorded by means of software, valuable memory space will be occupied, which greatly reduce available capacity. In summary, neither the traditional hardware mapping table method nor the software-improved mapping table method is suitable for a non-volatile memory.
[0005] In view of the above, the present disclosure proposes a wear leveling for a non-volatile memory to solve the problem of microscopic wear leveling inside the non-volatile memory.
[0006] US patent application
US2018107386A1 discloses a data storage device including a nonvolatile memory device including a memory region, the memory region including a plurality of memory units; and a controller suitable for monitoring an elapsed time and a write count of the memory region, and performing a wear leveling operation for at least one memory unit selected among the plurality of memory units depending on a monitoring result.
[0007] US patent application
US2016313929A1 discloses a system including: a memory including a plurality of pages; and a control circuit suitable for delivering user access to the memory and for implementing a balancing method for the wear of the memory, including movement of data within the memory, in which the control circuit is suitable for delivering, between the first and second consecutive page read or write operations of the wear balancing method and between the second and a third consecutive page read or write operation of the wear balancing method, one or more user accesses to the pages of the memory.
[0008] US patent application
US2017256305A1 discloses a method of wear leveling for a storage device or a memory device including: receiving an inputted memory address; randomizing the inputted memory address to be a randomized memory address; and periodically reassigning the randomized memory address to be a different memory address.
Summary of the Invention
[0009] The invention is defined in the appended claims. The dependent claims set out particular embodiments.
[0010] Embodiments of the present disclosure relate to a wear leveling and access method and a wear leveling and access device for a non-volatile memory, and a storage medium, to solve the problem of microscopic wear leveling inside the non-volatile memory.
Brief Description of the Drawings
[0011]
Fig. 1 is a flowchart of a wear leveling and access method for a non-volatile memory according to an embodiment of the present disclosure;
Fig. 2 is a schematic diagram of a wear leveling and access method for a non-volatile memory according to an embodiment of the present disclosure;
Fig. 3 is a flowchart of a wear leveling and access method for a non-volatile memory according to an embodiment of the present disclosure;
Fig. 4 is a flowchart of a wear leveling and access method for a non-volatile memory according to another embodiment of the present disclosure;
Fig. 5 is a schematic diagram of a wear leveling and access method for a non-volatile memory according to an embodiment of the present disclosure;
Fig. 6 is a block diagram of a wear leveling and access device for a non-volatile memory according to an embodiment of the present disclosure; and
Fig. 7 is a block diagram of a wear leveling and access device for a non-volatile memory according to another embodiment of the present disclosure.
[0012] Further features and advantages of the present disclosure will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
Detailed Description of the Embodiments
[0013] It should be appreciated that the specific embodiments described herein are only intended to explain rather than limiting the present disclosure.
[0014] In the following description, suffixes such as "module", "component", or "unit" used to denote elements are only used to facilitate description of the present disclosure, and they per se have no special meanings. The terms "module", "component", or "unit" can therefore be used in a mixed manner.
[0015] As shown in Fig. 1, an embodiment of the present disclosure provides a wear leveling and access method for a non-volatile memory, which includes the following steps.
[0016] In step S110, the non-volatile memory is logically divided into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. P is a positive integer greater than 1.
[0017] In the present embodiment, for example, the non-volatile memory is logically divided into n first physical units each with a size of N. Each of the first physical units is divided into m second physical units each with a size of M. Each of the second physical units is divided into k third physical units each with a size of K... and so on.
[0018] In the present embodiment, triggering conditions for step S 110 are further restricted. Examples of typical triggering conditions are: (1) manual triggering by a user; and (2) detecting, by a CPU, that in a past period of time, for example, in one hour, a number of times of writing to a fixed address in the non-volatile memory exceeded a preset threshold, for example, 100,000 times. Before step S110 is triggered, a traditional mapping table method is used.
[0019] In step S120, when a time cycle corresponding to q
th-level physical units arrives, data in each of the q
th-level physical units is migrated to another q
th-level physical unit. q is any positive integer from 1 to p.
[0020] In the present embodiment, termination conditions for step S120 are further restricted. Examples of typical termination conditions are: (1) manually triggering by the user; (2) detecting, by the CPU, that in a past period of time, for example, in any time period such as in one hour within seven days, a number of times of writing to a fixed address in the non-volatile memory did not exceed a preset threshold, for example, 100,000 times; (3) detecting that the non-volatile memory has reached a preset service life value and is approaching an end of the service life, in which case there is no need for wear leveling; and (4) writing times for a plurality of addresses in the non-volatile memory having reached upper limits. After step S120 is terminated, the traditional mapping table method is used.
[0021] In the present embodiment, a rotation time cycle for the first physical units is set to A; a rotation time cycle for the second physical units is set to B; and a rotation time cycle for the third physical units is C... and so on. In the present embodiment, for example, when the time cycle A arrives, the n first physical units are rotated; when the time cycle B arrives, the m second physical units in each of the first physical units are rotated; and when the time cycle C arrives, the k third physical units in each of the second physical units are rotated... and so on. After the rotation, locations of the data are changed, as shown in Fig. 2.
[0022] In the present embodiment, physical units of the rotation include but are not limited to: (1) segment; (2) block; (3) page; (4) bytes (B); (5) kilobytes (KB); (6) megabytes (MB); (7) gigabytes (GB); (8) and other memory capacity units. Time units of the rotation include but are not limited to: (1) years; (2) quarters; (3) months; (4) weeks; (5) days; (6) hours; (7) minutes; (8) seconds; (9) and other lunar and Tibetan calendar time units. Modes of the rotation include but are not limited to: (1) one-by-one rotation in sequence; (2) one-by-one rotation in an inverted sequence; (3) jumping rotation in sequence; (4) jumping rotation in an inverted sequence; (5) pseudo-random rotation; and (6) other rotation modes.
[0023] According to the present embodiment, unintentional or centralized malicious accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, to thereby achieve a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion between logical addresses and physical addresses through simple calculation without long-time occupying of additional memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0024] As shown in Fig. 3, an embodiment of the present disclosure provides a wear leveling and access method for a non-volatile memory, which includes the following steps.
[0025] In step S310, the non-volatile memory is logically divided into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. p is a positive integer greater than 1.
[0026] In step S320, a time cycle corresponding to q
th-level physical units is set based on a current working scenario.
[0027] In the present embodiment, physical units to be rotated are rotated independently and simultaneously. Of course, rotation of segments only or rotation of blocks only can realize a wear leveling effect to some extent, but fixedly distributing accesses to a same logical address to a few physical addresses cannot lead to distribution of the logical address to all physical addresses. The present disclosure needs to protect all steps or combinations of the steps. The shorter a rotation interval is, the stronger a wear leveling effect is, and the more frequent the migration of data is, which will temporarily interrupt external services. Therefore, the rotation interval cannot be too long or too short, and needs to be determined as practically required when use cases are implemented. In an embodiment, a migration time should be during a low-load period of the system. In an embodiment, when the system is under attack, or in other scenarios where there is a need, the time cycles A, B, and C may be shortened and triggered by the user or automatically triggered by the system.
[0028] In step S330, when a time cycle corresponding to q
th-level physical units arrives, data in each of the q
th-level physical units is copied to an external memory or an internal memory, and then copied from the external memory or the internal memory to the non-volatile memory to a location where the data of the q
th-level physical unit is rotated to. q is any positive integer from 1 to p.
[0029] In the present embodiment, another rotation mode is also provided. Specifically, data in a q
th-level physical unit is copied to an external memory or an internal memory; data in each of other q
th-level physical units is copied one by one to a location of last copied data in the non-volatile memory; and then the data in the external memory or the internal memory is copied to a location of a last copied data in the non-volatile memory.
[0030] In the present embodiment, (1) all data in the non-volatile memory is copied to another internal memory or external memory, and then the data is copied to the non-volatile memory to new locations; and (2) a last segment (or block) in the non-volatile memory is copied to another internal memory or external memory, and then other data in the non-volatile memory is copied segment (block) by segment (block) to new locations, and finally the last segment (or block) temporarily stored in said internal memory or external memory is copied to a new location in the non-volatile memory.
[0031] In step S340, when the user accesses the non-volatile memory, a logical address of an a
th physical unit among n q
th-level physical units is set to (x/Q+y/A)%n, where x is a logical address of the non-volatile memory; Q is a size of each of the q
th-level physical units; y is the user's access time; and A is the time cycle corresponding to the q
th-level physical units.
[0032] In the present invention, when the user accesses a memory with a logical address x at time y, a physical address Z of the memory is calculated by this method. In an a
th first physical unit, Z=(x/N+y/A)%n is calculated; in a b
th second physical unit, Z=(x/M+y/B)%m is calculated; in a c
th third physical unit, Z=(x/K+y /C)%k is calculated...and so on. The physical address Z can be determined through the a, b, c... The above access method may be performed by the user or not by the user. In case of the former, the user performs the above steps, and converts a logical address into a physical address first when accessing. In case of the latter, rotation of a physical address is transparent to the user, and the user always accesses a logical address only during the accessing, and the logical address is converted to a physical address by a driver (or an operating system, or a container).
[0033] According to the present embodiment, unintentional or malicious centralized accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, to thereby achieve a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion between logical addresses and physical addresses through simple calculation without additional long-time occupying of memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0034] As shown in Fig. 4, an embodiment of the present disclosure provides a wear leveling and access method for a non-volatile memory, which includes the following steps.
[0035] In step S31, the non-volatile memory is logically divided into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. P is a positive integer greater than 1.
[0036] In step S32, a time cycle corresponding to q
th-level physical units is set based on a current working scenario.
[0037] In the present embodiment, physical units to be rotated are rotated independently and simultaneously. Of course, rotation of segments only or rotation of blocks only can realize a wear leveling effect to some extent, but fixedly distributing accesses to a same logical address to a few physical addresses cannot lead to distribution of the logical address to all physical addresses. The present disclosure needs to protect all steps or combinations of some of the steps. The shorter a rotation interval is, the stronger a wear leveling effect is, and the more frequent the migration of data is, which will temporarily interrupt external services. Therefore, the rotation interval cannot be too long or too short, and needs to be determined as practically required when use cases are implemented. In an embodiment, a migration time should be during a low-load period of the system. In an embodiment, when the system is under attack, or in other scenarios where there is a need, the time cycles A, B, and C may be shortened and triggered by the user or automatically triggered by the system.
[0038] In step S33, when a time cycle corresponding to the q
th-level physical units arrives, data in each of the q
th-level physical units is copied to another free location in the non-volatile memory or to an external memory or an internal memory, and then copied from said another free location in the non-volatile memory or from the external memory or the internal memory to the non-volatile memory to a location where the data of the q
th-level physical unit is rotated to. q is any positive integer from 1 to p.
[0039] In the present embodiment, another rotation mode is also provided: data in a q
th-level physical unit is copied to another free location in the non-volatile memory or to an external memory or an internal memory; data in each of other q
th-level physical units is copied one by one to a location of last copied data in the non-volatile memory; and then the data at said another free location in the non-volatile memory or in the external memory or the internal memory is copied to a location of a last copied data in the non-volatile memory.
[0040] In the present embodiment, (1) all data in the non-volatile memory is copied to another internal memory or external memory, and then the data is copied to the non-volatile memory according to new locations; and (2) a last segment (or block) in the non-volatile memory is copied to another internal memory or external memory, and then other data in the non-volatile memory is copied segment (block) by segment (block) to new locations, and finally the last segment (or block) temporarily stored in said internal memory or external memory is copied to a new location in the non-volatile memory.
[0041] In step S34, when the user accesses the non-volatile memory, a logical address of an a
th physical unit among n q
th-level physical units is set to (x/Q+y/A)%n, where x is a logical address of the non-volatile memory; Q is a size of each of the q
th-level physical units; y is the user's access time; and A is the time cycle corresponding to the q
th-level physical units.
[0042] In the present invention, when the user accesses a memory with a logical address x at time y, a physical address Z of the memory is calculated by this method. In an a
th first physical unit, Z=(x/N+y/A)%n is calculated; in a b
th second physical unit, Z=(x/M+y/B)%m is calculated; in a c
th third physical unit, Z=(x/K+y /C)%k is calculated...and so on. The physical address Z can be determined through the a, b, c... The above access method may be performed by the user or not by the user. In case of the former, the user performs the above steps, and converts a logical address into a physical address first when accessing. In case of the latter, rotation of a physical address is transparent to the user, and the user always accesses a logical address only during the accessing, and the logical address is converted to a physical address by a driver (or an operating system, or a container).
[0043] According to the present embodiment, unintentional or malicious centralized accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, to thereby achieve a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion between logical addresses and physical addresses through simple calculation without additional long-time occupying of memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0044] Fig. 5 shows a specific example of the present embodiment.
- (1) The rotation cycle A is a month. The rotation cycle B is a year. The non-volatile memory is logically divided into three segments, each segment having ten blocks. The mode of rotation is one-by-one rotation in sequence.
- (2) In a last second of each month, the three segments in the non-volatile memory are rotated. That is, contents in a 3rd segment are temporarily written to another internal memory; contents in a 2nd segment are written to a location of the 3rd segment 3; contents in a 1st segment are written to a location of the 2nd segment; and the contents temporarily stored in said another internal memory are written to a location of the 1st segment.
- (3) In a last second of each year, blocks in the three segments in the non-volatile memory are rotated one by one. Specifically, contents in a 1st block are written to a location of a 2nd block; contents in the 2nd block are written to a location of a 3rd block...and so on.
- (4) The following steps show conversion of a logical address to a physical address at a specific time.
- (5) In March 2017, a logical address that the user accessed is a 16th block, which was a 7th block in the 2nd segment. Because it is March, the segment is shifted backwards three times in its serial number, and the segment after the shift is still the 2nd segment. Because it is 2017, the block is shifted backwards two thousand and seventeen times in its serial number, and the block after the shift is a 4th block in the segment. In summary, a physical address of this block is the 4th block in the 2nd segment, namely a 13th block.
- (6) In April 2017, a logical address that the user accessed is still the 16th block. Because it is April, the segment is circularly shifted backwards four times in its serial number, and the segment after the shift is the 3rd segment. Because it is 2017, the block is shifted backwards two thousand and seventeen times in its serial number, and the block after the shift is a 4th block in the segment. In summary, a physical address of this block is the 4th block in the 3rd segment, namely a 23rd block.
- (7) In May 2017, a logical address that the user accessed is still the 16th block. Because it is May, the segment is circularly shifted backward five times in its serial number, and the segment after the shift is the 1st segment. Because it is 2017, the block is shifted backwards two thousand and seventeen times in its serial number, and the block after the shift is a 4th block in the segment. In summary, a physical address of this block is the 4th block in the 1st segment, namely a 3rd block.
- (8) In May 2018, a logical address that the user accessed is still the 16th block. Because it is May, the segment is circularly shifted backward five times in its serial number, and the segment after the shift is the 1st segment. Because it is 2018, the block is shifted backwards two thousand and eighteen times in its serial number, and the block after the shift is a 5th block in the segment. In summary, a physical address of this block is the 5th block in the 1st segment, namely a 4rd block.
- (9) Similarly, for a block with a logical address of 22, its physical address in March 2017 was a 29th block; its physical address in April 2017 was a 9th block; its physical address in May 2017 was a 19th block; and its physical address in June 2018 was a 10th block.
[0045] As shown in Fig. 6, an embodiment of the present disclosure provides a data rotation device, including a non-volatile memory 510, a processor 520, a memory 530, and a communication bus 540. The communication bus 540 is configured to realize connected communication between the processor 520 and the memory 530. The processor 520 is configured to execute a data rotation program stored in the memory 530 so as to implement the following steps.
[0046] The non-volatile memory is logically divided into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. P is a positive integer greater than 1.
[0047] In the present embodiment, for example, the non-volatile memory is logically divided into n first physical units each with a size of N. Each of the first physical units is divided into m second physical units each with a size of M. Each of the second physical units is divided into k third physical units each with a size of K... and so on.
[0048] When a time cycle corresponding to q
th-level physical units arrives, data in each of the q
th-level physical units is migrated to another q
th-level physical unit. q is any positive integer from 1 to p.
[0049] In the present embodiment, a rotation time cycle for the first physical units is set to A; a rotation time cycle for the second physical units is set to B; and a rotation time cycle for the third physical units is C... and so on. In the present embodiment, for example, when the time cycle A arrives, the n first physical units are rotated; when the time cycle B arrives, the m second physical units in each of the first physical units are rotated; and when the time cycle C arrives, the k third physical units in each of the second physical units are rotated... and so on. After the rotation, locations of the data are changed, as shown in Fig. 2.
[0050] In the present embodiment, physical units of the rotation include but are not limited to: (1) segment; (2) block; (3) page; (4) bytes (B); (5) kilobytes (KB); (6) megabytes (MB); (7) gigabytes (GB); (8) and other memory capacity units. Time units of the rotation include but are not limited to: (1) years; (2) quarters; (3) months; (4) weeks; (5) days; (6) hours; (7) minutes; (8) seconds; (9) and other lunar and Tibetan calendar time units. Modes of the rotation include but are not limited to: (1) one-by-one rotation in sequence; (2) one-by-one rotation in an inverted sequence; (3) jumping rotation in sequence; (4) jumping rotation in an inverted sequence; (5) pseudo-random rotation; and (6) other rotation modes.
[0051] According to the present embodiment, unintentional or malicious accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, thereby achieving a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion of logical addresses and physical addresses through simple calculation without additional long-time occupying of memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0052] As shown in Fig. 6, an embodiment of the present disclosure provides a data rotation device, including a non-volatile memory 510, a processor 520, a memory 530, and a communication bus 540. The communication bus 540 is configured to realize connected communication between the processor 520 and the memory 530. The processor 520 is configured to execute a data rotation program stored in the memory 530 so as to implement the following step: logically dividing the non-volatile memory into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. P is a positive integer greater than 1.
[0053] A time cycle corresponding to q
th-level physical units is set based on a current working scenario.
[0054] In the present embodiment, physical units to be rotated are rotated independently and simultaneously. Of course, rotation of segments only or rotation of blocks only can realize a wear leveling effect to some extent, but fixedly distributing accesses to a same logical address to a few physical addresses cannot lead to distribution of the logical address to all physical addresses. The present disclosure needs to protect all steps or combinations of some of the steps. The shorter a rotation interval is, the stronger a wear leveling effect is, and the more frequent the migration of data is, which will temporarily interrupt external services. Therefore, the rotation interval cannot be too long or too short, and needs to be determined as practically required when use cases are implemented. In an embodiment, a migration time should be during a low-load period of the system. In an embodiment, when the system is under attack, or in other scenarios where there is a need, the time cycles A, B, and C may be shortened and triggered by the user or automatically triggered by the system.
[0055] When a time cycle corresponding to q
th-level physical units arrives, data in each of the q
th-level physical units is copied to an external storage or an internal memory, and then copied from the external memory or the internal memory to the non-volatile memory to a location where the data of the q
th-level physical unit is rotated to. q is any positive integer from 1 to p.
[0056] In the present embodiment, another rotation mode is also provided. Specifically, data in a q
th-level physical unit is copied to an external memory or an internal memory; data in each of other q
th-level physical units is copied one by one to a location of last copied data in the non-volatile memory; and then the data in the external memory or the internal memory is copied to a location of a last copied data in the non-volatile memory.
[0057] In the present embodiment, (1) all data in the non-volatile memory is copied to another internal memory or external memory, and then the data is copied to the non-volatile memory to new locations; and (2) a last segment (or block) in the non-volatile memory is copied to another internal memory or external memory, and then other data in the non-volatile memory is copied segment (block) by segment (block) to new locations, and finally the last segment (or block) temporarily stored in said internal memory or external memory is copied to a new location in the non-volatile memory.
[0058] When the user accesses the non-volatile memory, a logical address of an a
th physical unit among n q
th-level physical units is set to (x/Q+y/A)%n, where x is a logical address of the non-volatile memory; Q is a size of each of the q
th-level physical units; y is the user's access time; and A is the time cycle corresponding to the q
th-level physical units.
[0059] In the invention, when the user accesses a memory with a logical address x at time y, a physical address Z of the memory is calculated by this method. In an a
th first physical unit, Z=(x/N+y/A)%n is calculated; in a b
th second physical unit, Z=(x/M+y/B)%m is calculated; in a c
th third physical unit, Z=(x/K+y /C)%k is calculated...and so on. The physical address Z can be determined through the a, b, c.... The above access method may be performed by the user or not by the user. In case of the former, the user performs the above steps, and converts a logical address into a physical address first when accessing. In case of the latter, rotation of a physical address is transparent to the user, and the user always accesses a logical address only during the accessing, and the logical address is converted to a physical address by a driver (or an operating system, or a container).
[0060] According to the present embodiment, unintentional or malicious centralized accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, to thereby achieve a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion between logical addresses and physical addresses through simple calculation without long-time occupying of additional memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0061] As shown in Fig. 7, an embodiment of the present disclosure provides a wear leveling and access device for a non-volatile memory, including a non-volatile memory 710 and a processor 720.
[0062] The processor 720 is configured to execute a wear leveling and access program for the non-volatile memory to implement the following step: logically dividing the non-volatile memory into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. P is a positive integer greater than 1
[0063] In the present embodiment, for example, the non-volatile memory is logically divided into n first physical units each with a size of N. Each of the first physical units is divided into m second physical units each with a size of M. Each of the second physical units is divided into k third physical units each with a size of K... and so on.
[0064] When a time cycle corresponding to q
th-level physical units arrives, data in each of the q
th-level physical units is migrated to another q
th-level physical unit. q is any positive integer from 1 to p.
[0065] In the present embodiment, a rotation time cycle for the first physical units is set to A; a rotation time cycle for the second physical units is set to B; and a rotation time cycle for the third physical units is C... and so on. In the present embodiment, for example, when the time cycle A arrives, the n first physical units are rotated; when the time cycle B arrives, the m second physical units in each of the first physical units are rotated; and when the time cycle C arrives, the k third physical units in each of the second physical units are rotated... and so on. After the rotation, locations of the data are changed, as shown in Fig. 2.
[0066] In the present embodiment, physical units of the rotation include but are not limited to: (1) segment; (2) block; (3) page; (4) bytes (B); (5) kilobytes (KB); (6) megabytes (MB); (7) gigabytes (GB); (8) and other memory capacity units. Time units of the rotation include but are not limited to: (1) years; (2) quarters; (3) months; (4) weeks; (5) days; (6) hours; (7) minutes; (8) seconds; (9) and other lunar and Tibetan calendar time units. Modes of the rotation include but are not limited to: (1) one-by-one rotation in sequence; (2) one-by-one rotation in an inverted sequence; (3) jumping rotation in sequence; (4) jumping rotation in an inverted sequence; (5) pseudo-random rotation; and (6) other rotation modes.
[0067] According to the present embodiment, unintentional or malicious accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, thereby achieving a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion of logical addresses and physical addresses through simple calculation without additional long-time occupying of memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0068] As shown in Fig. 7, an embodiment of the present disclosure provides a wear leveling and access device for a non-volatile memory, including a non-volatile memory 710 and a processor 720.
[0069] The processor 720 is configured to execute a wear leveling and access program for the non-volatile memory to implement the following step: logically dividing the non-volatile memory into p levels of physical units. The non-volatile memory includes a plurality of 1
st-level physical units, and each (p-1)
th-level physical unit includes a plurality of p
th-level physical units. P is a positive integer greater than 1
[0070] A time cycle corresponding to q
th-level physical units is set based on a current working scenario.
[0071] In the present embodiment, physical units to be rotated are rotated independently and simultaneously. Of course, rotation of segments only or rotation of blocks only can realize a wear leveling effect to some extent, but fixedly distributing accesses to a same logical address to a few physical addresses cannot lead to distribution of the logical address to all physical addresses. The present disclosure needs to protect all steps or combinations of some of the steps. The shorter a rotation interval is, the stronger a wear leveling effect is, and the more frequent the migration of data is, which will temporarily interrupt external services. Therefore, the rotation interval cannot be too long or too short, and needs to be determined as practically required when use cases are implemented. In an embodiment, a migration time should be during a low-load period of the system. In an embodiment, when the system is under attack, or in other scenarios where there is a need, the time cycles A, B, and C may be shortened and triggered by the user or automatically triggered by the system.
[0072] When a time cycle corresponding to the q
th-level physical units arrives, data in each of the q
th-level physical units is copied to another free location in the non-volatile memory or to an external memory or an internal memory, and then copied from said another free location in the non-volatile memory or from the external memory or the internal memory to the non-volatile memory to a location where the data of the q
th-level physical unit is rotated to. q is any positive integer from 1 to p.
[0073] In the present embodiment, another rotation mode is also provided: data in a q
th-level physical unit is copied to another free location in the non-volatile memory or to an external memory or an internal memory; data in each of other q
th-level physical units is copied one by one to a location of last copied data in the non-volatile memory; and then the data in said another free location in the non-volatile memory or in the external memory or the internal memory is copied to a location of a last copied data in the non-volatile memory.
[0074] In the present embodiment, (1) all data in the non-volatile memory is copied to another internal memory or external memory, and then the data is copied to the non-volatile memory to new locations; and (2) a last segment (or block) in the non-volatile memory is copied to another internal memory or external memory, and then other data in the non-volatile memory is copied segment (block) by segment (block) to new locations, and finally the last segment (or block) temporarily stored in said internal memory or external memory is copied to a new location in the non-volatile memory.
[0075] When the user accesses the non-volatile memory, a logical address of an a
th physical unit among n q
th-level physical units is set to (x/Q+y/A)%n, where x is a logical address of the non-volatile memory; Q is a size of each of the q
th-level physical units; y is the user's access time; and A is the time cycle corresponding to the q
th-level physical units.
[0076] In the invention, when the user accesses a memory with a logical address x at time y, a physical address Z of the memory is calculated by this method. In an a
th first physical unit, Z=(x/N+y/A)%n is calculated; in a b
th second physical unit, Z=(x/M+y/B)%m is calculated; in a c
th third physical unit, Z=(x/K+y /C)%k is calculated...and so on. The physical address can be determined through the Z a, b, c... The above access method may be performed by the user or not by the user. In case of the former, the user performs the above steps, and converts a logical address into a physical address first when accessing. In case of the latter, rotation of a physical address is transparent to the user, and the user always accesses a logical address only during the accessing, and the logical address is converted to a physical address by a driver (or an operating system, or a container).
[0077] According to the present embodiment, unintentional or malicious centralized accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, to thereby achieve a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion between logical addresses and physical addresses through simple calculation without additional long-time occupying of memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0078] Fig. 5 shows a specific example of the present embodiment.
- (1) The rotation cycle A is a month. The rotation cycle B is a year. The non-volatile memory is logically divided into three segments, each segment having ten blocks. The mode of rotation is one-by-one rotation in sequence.
- (2) In a last second of each month, the three segments in the non-volatile memory are rotated. That is, contents in a 3rd segment are temporarily written to another internal memory; contents in a 2nd segment are written to a location of the 3rd segment 3; contents in a 1st segment are written to a location of the 2nd segment; and the contents temporarily stored in said another internal memory are written to a location of the 1st segment.
- (3) In a last second of each year, blocks in the three segments in the non-volatile memory are rotated one by one. Specifically, contents in a 1st block are written to a location of a 2nd block; contents in the 2nd block are written to a location of a 3rd block...and so on.
- (4) The following steps show conversion of a logical address to a physical address at a specific time.
- (5) In March 2017, a logical address that the user accessed is a 16th block, which was a 7th block in the 2nd segment. Because it is March, the segment is shifted backwards three times in its serial number, and the segment after the shift is still the 2nd segment. Because it is 2017, the block is shifted backwards two thousand and seventeen times in its serial number, and the block after the shift is a 4th block in the segment. In summary, a physical address of this block is the 4th block in the 2nd segment, namely a 13th block.
- (6) In April 2017, a logical address that the user accessed is still the 16th block. Because it is April, the segment is circularly shifted backwards four times in its serial number, and the segment after the shift is the 3rd segment. Because it is 2017, the block is shifted backwards two thousand and seventeen times in its serial number, and the block after the shift is a 4th block in the segment. In summary, a physical address of this block is the 4th block in the 3rd segment, namely a 23rd block.
- (7) In May 2017, a logical address that the user accessed is still the 16th block. Because it is May, the segment is circularly shifted backward five times in its serial number, and the segment after the shift is the 1st segment. Because it is 2017, the block is shifted backwards two thousand and seventeen times in its serial number, and the block after the shift is a 4th block in the segment. In summary, a physical address of this block is the 4th block in the 1st segment, namely a 3rd block.
- (8) In May 2018, a logical address that the user accessed is still the 16th block. Because it is May, the segment is circularly shifted backward five times in its serial number, and the segment after the shift is the 1st segment. Because it is 2018, the block is shifted backwards two thousand and eighteen times in its serial number, and the block after the shift is a 5th block in the segment. In summary, a physical address of this block is the 5th block in the 1st segment, namely a 4rd block.
- (9) Similarly, for an accessed logical address which was a 22nd block, its physical address in March 2017 was a 29th block; its physical address in April 2017 was a 9th block; its physical address in May 2017 was a 19th block; and its physical address in June 2018 was a 10th block. An embodiment of the present disclosure provides a computer-readable storage medium storing thereon one or more programs. The one or more programs can be executed by one or more processors to implement the following step: logically dividing the non-volatile memory into p levels of physical units. The non-volatile memory includes a plurality of 1st-level physical units, and each (p-1)th-level physical unit includes a plurality of pth-level physical units. P is a positive integer greater than 1.
[0079] In the present embodiment, for example, the non-volatile memory is logically divided into n first physical units each with a size of N. Each of the first physical units is divided into m second physical units each with a size of M. Each of the second physical units is divided into k third physical units each with a size of K... and so on.
[0080] When a time cycle corresponding to q
th-level physical units arrives, data in each of the q
th-level physical units is migrated to another q
th-level physical unit. q is any positive integer from 1 to p.
[0081] In the present embodiment, a rotation time cycle for the first physical units is set to A; a rotation time cycle for the second physical units is set to B; and a rotation time cycle for the third physical units is C... and so on. In the present embodiment, for example, when the time cycle A arrives, the n first physical units are rotated; when the time cycle B arrives, the m second physical units in each of the first physical units are rotated; and when the time cycle C arrives, the k third physical units in each of the second physical units are rotated... and so on. After the rotation, locations of the data are changed, as shown in Fig. 2.
[0082] In the present embodiment, physical units of the rotation include but are not limited to: (1) segment; (2) block; (3) page; (4) bytes (B); (5) kilobytes (KB); (6) megabytes (MB); (7) gigabytes (GB); (8) and other memory capacity units. Time units of the rotation include but are not limited to: (1) years; (2) quarters; (3) months; (4) weeks; (5) days; (6) hours; (7) minutes; (8) seconds; (9) and other lunar and Tibetan calendar time units. Modes of the rotation include but are not limited to: (1) one-by-one rotation in sequence; (2) one-by-one rotation in an inverted sequence; (3) jumping rotation in sequence; (4) jumping rotation in an inverted sequence; (5) pseudo-random rotation; and (6) other rotation modes.
[0083] According to the present embodiment, unintentional or malicious accesses to a same fixed logical address can be actually evenly distributed to various physical addresses, thereby achieving a wear leveling effect. Compared with the traditional mapping table method, the method of the present disclosure completes conversion of logical addresses and physical addresses through simple calculation without additional long-time occupying of memory space, and avoids inefficient table lookup operations, by way of which space and time are saved.
[0084] It should be appreciated that all or some of the steps of the methods, and the functional modules/units of the systems and devices disclosed above, may be implemented as software, firmware, hardware, and any suitable combinations thereof. In hardware implementations, the division between functional modules/units referred to in the above description does not necessarily correspond to the division between physical components. For example, one physical component may have multiple functions, or one function or step may be executed by a combination of a plurality of physical components. Some or all of the components may be implemented as software executed by a processor, such as a CPU, a digital signal processor or a microprocessor, or be implemented as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium which may include computer storage medium (or non-transitory medium) and communication medium (or transitory medium). It should be appreciated that the term computer storage medium includes volatile and non-volatile, removable and non-removable medium implemented in any method or technology for storage of information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage medium includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storages, magnetic cassettes, magnetic tapes, magnetic disk storages or other magnetic storages, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it should be appreciated that communication medium typically contains computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery medium.
[0085] The above describes embodiments of the present disclosure with reference to the accompanying drawings, but the present disclosure is not limited to the above described specific embodiments. The above specific embodiments are only illustrative rather than restrictive.
1. A wear leveling and access method for a non-volatile memory (510, 710), comprising:
logically dividing the non-volatile memory (510, 710) into p levels of physical units, wherein the non-volatile memory (510, 710) comprises a plurality of 1st-level physical units, and each (p-1)th-level physical unit comprises a plurality of pth-level physical units, p being a positive integer greater than 1; and
migrating, when a time cycle corresponding to qth-level physical units arrives, data in each of the qth-level physical units to another qth-level physical unit, q being any positive integer from 1 to p,
characterized in that:
the method further comprises: setting, when a user accesses the non-volatile memory (510, 710), a logical address of an ath physical unit among n qth-level physical units to (x/Q+y/A)%n, wherein x is a logical address of the non-volatile memory (510, 710), Q is a size of each of the qth-level physical units, y is the user's access time, and A is a time cycle corresponding to the qth-level physical units.
2. The method according to claim 1, wherein migrating data in each of the qth-level physical units to another qth-level physical unit comprises:
copying data in each of the qth-level physical units to an external memory or an internal memory, and then copying the data from the external memory or the internal memory to the non-volatile memory (510, 710) to a location where the data of the qth-level physical unit is rotated to.
3. The method according to claim 1, wherein migrating data in each of the qth-level physical units to another qth-level physical unit comprises:
copying data in each of the qth-level physical units to a free location in the non-volatile memory (510, 710) or to an external memory or an internal memory, and then copying the data from the free location in the non-volatile memory (510, 710) or from the external memory or the internal memory to the non-volatile memory (510, 710) to a location where the data of the qth-level physical unit is rotated to.
4. The method according to claim 1, wherein migrating data in each of the qth-level physical units to another qth-level physical unit comprises:
copying data in a qth-level physical unit to an external memory or an internal memory, copying data in each of other qth-level physical units one by one to a location of last copied data in the non-volatile memory (510, 710), and then copying the data in the external memory or the internal memory to a location of a last copied data in the non-volatile memory (510, 710).
5. The method according to claim 1, wherein migrating data in each of the qth-level physical units to another qth-level physical unit comprises:
copying data in a qth-level physical unit to a free location in the non-volatile memory (510, 710) or to an external memory or an internal memory, copying data in each of other qth-level physical units one by one to a location of last copied data in the non-volatile memory (510, 710), and then copying the data at the free location in the non-volatile memory (510, 710) or in the external memory or the internal memory to a location of a last copied data in the non-volatile memory (510, 710).
6. The method according to claim 1, wherein before migrating data in each of the qth-level physical units to another qth-level physical unit, the method further comprises:
setting a time cycle corresponding to the qth-level physical units based on a current working scenario.
7. A wear leveling and access device for a non-volatile memory, comprising: a non-volatile memory (510), a processor (520), a memory (530), and a communication bus (540), wherein:
the communication bus (540) is configured to realize connected communication between the processor (520) and the memory (530); and
the processor (520) is configured to execute a data rotation program stored in the memory (530) so as to implement the following steps:
logically dividing the non-volatile memory (510) into p levels of physical units, wherein the non-volatile memory (510) comprises a plurality of 1st-level physical units, and each (p-1)th-level physical unit comprises a plurality of pth-level physical units, p being a positive integer greater than 1; and
migrating, when a time cycle corresponding to qth-level physical units arrives, data in each of the qth-level physical units to another qth-level physical unit, q being any positive integer from 1 to p,
characterized in that:
the processor (520) is further configured to implement the following steps: setting, when a user accesses the non-volatile memory (510), a logical address of an ath physical unit among n qth-level physical units to (x/Q+y/A)%n, wherein x is a logical address of the non-volatile memory (510), Q is a size of each of the qth-level physical units, y is the user's access time, and A is a time cycle corresponding to the qth-level physical units.
8. The device according to claim 7, wherein in migrating data in each of the qth-level physical units to another qth-level physical unit, the processor (520) is configured to execute the data rotation program to implement the following steps:
copying data in each of the qth-level physical units to an external memory or an internal memory (510), and then copying the data from the external memory or the internal memory to the non-volatile memory (510) to a location where the data of the qth-level physical unit is rotated to.
9. The device according to claim 7, wherein in migrating data in each of the qth-level physical units to another qth-level physical unit, the processor (520) is configured to execute the data rotation program to implement the following steps:
copying data in a qth-level physical unit to an external memory or an internal memory, copying data in each of other qth-level physical units one by one to a location of last copied data in the non-volatile memory (510), and then copying the data in the external memory or the internal memory to a location of a last copied data in the non-volatile memory (510).
10. The device according to claim 7, wherein before migrating data in each of the qth-level physical units to another qth-level physical unit, the processor (520) is further configured to execute the data rotation program to implement the following step:
setting a time cycle corresponding to the qth-level physical units based on a current working scenario.
11. A wear leveling and access device for a non-volatile memory, comprising: the non-volatile memory (710) and a processor (720), wherein:
the processor (720) is configured to execute a wear leveling and access program for the non-volatile memory (710) to implement the following steps:
logically dividing the non-volatile memory (710) into p levels of physical units, wherein the non-volatile memory (710) comprises a plurality of 1st-level physical units, and each (p-1)th-level physical unit comprises a plurality of pth-level physical units, p being a positive integer greater than 1; and
migrating, when a time cycle corresponding to qth-level physical units arrives, data in each of the qth-level physical units to another qth-level physical unit, q being any positive integer from 1 to p,
characterized in that:
the processor (720) is further configured to implement the following steps:: setting, when a user accesses the non-volatile memory (710), a logical address of an ath physical unit among n qth-level physical units to (x/Q+y/A)%n, wherein x is a logical address of the non-volatile memory (710), Q is a size of each of the qth-level physical units, y is the user's access time, and A is a time cycle corresponding to the qth-level physical units.
12. The device according to claim 11, wherein in migrating data in each of the qth-level physical units to another qth-level physical unit, the processor is configured to execute the wear leveling and access program for the non-volatile memory to implement the following steps:
copying data in each of the qth-level physical units to a free location in the non-volatile memory or to an external memory or an internal memory, and then copying the data from the free location in the non-volatile memory or from the external memory or the internal memory to the non-volatile memory to a location where the data of the qth-level physical unit is rotated to.
13. The device according to claim 11, wherein in migrating data in each of the qth-level physical units to another qth-level physical unit, the processor is configured to execute the wear leveling and access program for the non-volatile memory to implement the following steps:
copying data in a qth-level physical unit to a free location in the non-volatile memory or to an external memory or an internal memory, copying data in each of other qth-level physical units one by one to a location of last copied data in the non-volatile memory, and then copying the data at the free location in the non-volatile memory or in the external memory or the internal memory to a location of a last copied data in the non-volatile memory.
14. The device according to claim 11, wherein before migrating data in each of the qth-level physical units to another qth-level physical unit, the processor is further configured to execute the wear leveling and access program for the non-volatile memory to implement the following step:
setting a time cycle corresponding to the qth-level physical units based on a current working scenario.
1. Wear-Leveling- und Zugangsverfahren für einen nichtflüchtigen Speicher (510, 710), umfassend:
logisches Teilen des nichtflüchtigen Speichers (510, 710) in p Ebenen von physikalischen Einheiten, worin der nichtflüchtige Speicher (510, 710) eine Vielzahl von physikalischen Einheiten der 1. Ebene umfasst, und jede physikalische Einheit der (p-1)-ten Ebene eine Vielzahl von physikalischen Einheiten der p-ten Ebene umfasst, wobei p eine positive Ganzzahl größer als 1 ist; und
Migrieren, wenn ein Zeitzyklus, der physikalischen Einheiten der q-ten Ebene entspricht, ankommt, von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene, wobei q jede positive Ganzzahl von 1 bis p ist,
dadurch gekennzeichnet, dass:
das Verfahren ferner umfasst: Setzen, wenn ein Benutzer zum nichtflüchtigen Speicher (510, 710) Zugang hat, einer logischen Adresse einer a-ten physikalischen Einheit unter n physikalischen Einheiten der q-ten Ebene auf (x/Q+y/A)%n, worin x eine logische Adresse des nichtflüchtigen Speichers (510, 710) ist, Q eine Größe von jeder der physikalischen Einheiten der q-ten Ebene ist, y die Zugangszeit des Benutzers ist, und A ein Zeitzyklus ist, der den physikalischen Einheiten der q-ten Ebene entspricht.
2. Verfahren nach Anspruch 1, worin das Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene umfasst:
Kopieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einem externen Speicher oder einem internen Speicher, und dann Kopieren der Daten aus dem externen Speicher oder dem internen Speicher zum nichtflüchtigen Speicher (510, 710) zu einer Stelle, wo die Daten der physikalischen Einheit der q-ten Ebene rotiert worden sind.
3. Verfahren nach Anspruch 1, worin das Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene umfasst:
Kopieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer freien Stelle im nichtflüchtigen Speicher (510, 710) oder zu einem externen Speicher oder einem internen Speicher, und dann Kopieren der Daten aus der freien Stelle im nichtflüchtigen Speicher (510, 710) oder aus dem externen Speicher oder dem internen Speicher zum nichtflüchtigen Speicher (510, 710) zu einer Stelle, wo die Daten der physikalischen Einheit der q-ten Ebene rotiert worden sind.
4. Verfahren nach Anspruch 1, worin das Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene umfasst:
Kopieren von Daten in einer physikalischen Einheit der q-ten Ebene zu einem externen Speicher oder einem internen Speicher, Kopieren von Daten in jeder von anderen physikalischen Einheiten der q-ten Ebene nacheinander zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher (510, 710), und dann Kopieren der Daten in dem externen Speicher oder dem internen Speicher zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher (510, 710).
5. Verfahren nach Anspruch 1, worin das Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene umfasst:
Kopieren von Daten in einer physikalischen Einheit der q-ten Ebene zu einer freien Stelle im nichtflüchtigen Speicher (510, 710) oder zu einem externen Speicher oder einem internen Speicher, Kopieren von Daten in jeder von anderen physikalischen Einheiten der q-ten Ebene nacheinander zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher (510, 710), und dann Kopieren der Daten an der freien Stelle im nichtflüchtigen Speicher (510, 710) oder in dem externen Speicher oder dem internen Speicher zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher (510, 710).
6. Verfahren nach Anspruch 1, worin vor dem Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene das Verfahren ferner umfasst:
Setzen eines Zeitzyklus, der den physikalischen Einheiten der q-ten Ebene entspricht, aufgrund eines aktuellen Arbeitsszenarios.
7. Wear-Leveling- und Zugangsvorrichtung für einen nichtflüchtigen Speicher, umfassend: einen nichtflüchtigen Speicher (510), einen Prozessor (520), einen Speicher (530) und einen Kommunikationsbus (540), worin:
der Kommunikationsbus (540) dazu eingerichtet ist, eine verbundene Kommunikation zwischen dem Prozessor (520) und dem Speicher (530) herzustellen; und
der Prozessor (520) dazu eingerichtet ist, ein Datenrotationsprogramm auszuführen, das im Speicher (530) gespeichert ist, um die folgenden Schritte zu implementieren:
logisches Teilen des nichtflüchtigen Speichers (510) in p Ebenen von physikalischen Einheiten, worin der nichtflüchtige Speicher (510) eine Vielzahl von physikalischen Einheiten der 1. Ebene umfasst, und jede physikalische Einheit der (p-1)-ten Ebene eine Vielzahl von physikalischen Einheiten der p-ten Ebene umfasst, wobei p eine positive Ganzzahl größer als 1 ist; und
Migrieren, wenn ein Zeitzyklus, der physikalischen Einheiten der q-ten Ebene entspricht, ankommt, von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene, wobei q jede positive Ganzzahl von 1 bis p ist,
dadurch gekennzeichnet, dass:
der Prozessor (520) ferner dazu eingerichtet ist, die folgenden Schritte zu implementieren: Setzen, wenn ein Benutzer zum nichtflüchtigen Speicher (510) Zugang hat, einer logischen Adresse einer a-ten physikalischen Einheit unter n physikalischen Einheiten der q-ten Ebene auf (x/Q+y/A)%n, worin x eine logische Adresse des nichtflüchtigen Speichers (510) ist, Q eine Größe von jeder der physikalischen Einheiten der q-ten Ebene ist, y die Zugangszeit des Benutzers ist, und A ein Zeitzyklus ist, der den physikalischen Einheiten der q-ten Ebene entspricht.
8. Vorrichtung nach Anspruch 7, worin beim Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene der Prozessor (520) dazu eingerichtet ist, das Datenrotationsprogramm auszuführen, um die folgenden Schritte zu implementieren:
Kopieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einem externen Speicher oder einem internen Speicher (510), und dann Kopieren der Daten aus dem externen Speicher oder dem internen Speicher zum nichtflüchtigen Speicher (510) zu einer Stelle, wo die Daten der physikalischen Einheit der q-ten Ebene rotiert worden sind.
9. Vorrichtung nach Anspruch 7, worin beim Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene der Prozessor (520) dazu eingerichtet ist, das Datenrotationsprogramm auszuführen, um die folgenden Schritte zu implementieren:
Kopieren von Daten in einer physikalischen Einheit der q-ten Ebene zu einem externen Speicher oder einem internen Speicher, Kopieren von Daten in jeder von anderen physikalischen Einheiten der q-ten Ebene nacheinander zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher (510), und dann Kopieren der Daten in dem externen Speicher oder dem internen Speicher zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher (510).
10. Vorrichtung nach Anspruch 7, worin vor dem Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene der Prozessor (520) ferner dazu eingerichtet ist, das Datenrotationsprogramm auszuführen, um den folgenden Schritt zu implementieren:
Setzen eines Zeitzyklus, der den physikalischen Einheiten der q-ten Ebene entspricht, aufgrund eines aktuellen Arbeitsszenarios.
11. Wear-Leveling- und Zugangsvorrichtung für einen nichtflüchtigen Speicher, umfassend: den nichtflüchtigen Speicher (710) und einen Prozessor (720), worin:
der Prozessor (720) dazu eingerichtet ist, ein Wear-Leveling- und Zugangsprogramm für den nichtflüchtigen Speicher (710) auszuführen, um die folgenden Schritte zu implementieren:
logisches Teilen des nichtflüchtigen Speichers (710) in p Ebenen von physikalischen Einheiten, worin der nichtflüchtige Speicher (710) eine Vielzahl von physikalischen Einheiten der 1. Ebene umfasst, und jede physikalische Einheit der (p-1)-ten Ebene eine Vielzahl von physikalischen Einheiten der p-ten Ebene umfasst, wobei p eine positive Ganzzahl größer als 1 ist; und
Migrieren, wenn ein Zeitzyklus, der physikalischen Einheiten der q-ten Ebene entspricht, ankommt, von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene, wobei q jede positive Ganzzahl von 1 bis p ist,
dadurch gekennzeichnet, dass:
der Prozessor (720) ferner dazu eingerichtet ist, die folgenden Schritte zu implementieren: Setzen, wenn ein Benutzer zum nichtflüchtigen Speicher (710) Zugang hat, einer logischen Adresse einer a-ten physikalischen Einheit unter n physikalischen Einheiten der q-ten Ebene auf (x/Q+y/A)%n, worin x eine logische Adresse des nichtflüchtigen Speichers (710) ist, Q eine Größe von jeder der physikalischen Einheiten der q-ten Ebene ist, y die Zugangszeit des Benutzers ist, und A ein Zeitzyklus ist, der den physikalischen Einheiten der q-ten Ebene entspricht.
12. Vorrichtung nach Anspruch 11, worin beim Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene der Prozessor dazu eingerichtet ist, das Wear-Leveling- und Zugangsprogramm für den nichtflüchtigen Speicher auszuführen, um die folgenden Schritte zu implementieren:
Kopieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer freien Stelle im nichtflüchtigen Speicher oder zu einem externen Speicher oder einem internen Speicher, und dann Kopieren der Daten aus der freien Stelle im nichtflüchtigen Speicher oder aus dem externen Speicher oder dem internen Speicher zum nichtflüchtigen Speicher zu einer Stelle, wo die Daten der physikalischen Einheit der q-ten Ebene rotiert worden sind.
13. Vorrichtung nach Anspruch 11, worin beim Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene der Prozessor dazu eingerichtet ist, das Wear-Leveling- und Zugangsprogramm für den nichtflüchtigen Speicher auszuführen, um die folgenden Schritte zu implementieren:
Kopieren von Daten in einer physikalischen Einheit der q-ten Ebene zu einer freien Stelle im nichtflüchtigen Speicher oder zu einem externen Speicher oder einem internen Speicher, Kopieren von Daten in jeder von anderen physikalischen Einheiten der q-ten Ebene nacheinander zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher, und dann Kopieren der Daten an der freien Stelle im nichtflüchtigen Speicher oder in dem externen Speicher oder dem internen Speicher zu einer Stelle von zuletzt kopierten Daten im nichtflüchtigen Speicher.
14. Vorrichtung nach Anspruch 11, worin vor dem Migrieren von Daten in jeder der physikalischen Einheiten der q-ten Ebene zu einer anderen physikalischen Einheit der q-ten Ebene der Prozessor ferner dazu eingerichtet ist, das Wear-Leveling- und Zugangsprogramm für den nichtflüchtigen Speicher auszuführen, um den folgenden Schritt zu implementieren:
Setzen eines Zeitzyklus, der den physikalischen Einheiten der q-ten Ebene entspricht, aufgrund eines aktuellen Arbeitsszenarios.
1. Procédé de répartition de l'usure et d'accès pour une mémoire non volatile (510, 710), comprenant :
la division de manière logique de la mémoire non volatile (510, 710) en p niveaux d'unités physiques, dans lequel la mémoire non volatile (510, 710) comprend une pluralité d'unités physiques de 1er niveau, et chaque unité physique de (p-l)lème niveau comprend une pluralité d'unités physiques de pième niveau, p étant un entier positif supérieur à 1 ; et
la migration, lorsqu'un cycle temporel correspondant à des unités physiques de qième niveau arrive, des données de chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, q étant un entier positif quelconque de 1 à p,
caractérisé en ce que :
le procédé comprend en outre : l'établissement, lorsqu'un utilisateur accède à la mémoire non volatile (510, 710), d'une adresse logique d'une aième unité physique parmi les n unités physiques de qième niveau à (x/Q+y/A)%n, où x est une adresse logique de la mémoire non volatile (510, 710), Q est une taille de chacune des unités physiques de qième niveau, y est le temps d'accès de l'utilisateur, et A est un cycle de temps correspondant aux unités physiques de qième niveau.
2. Procédé selon la revendication 1, dans lequel la migration des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau comprend :
la copie des données dans chacune des unités physiques de qième niveau vers une mémoire externe ou une mémoire interne, puis la copie des données de la mémoire externe ou de la mémoire interne vers la mémoire non volatile (510, 710) vers un emplacement où les données de l'unité physique de qième niveau sont tournées.
3. Procédé selon la revendication 1, dans lequel la migration des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau comprend :
la copie des données dans chacune des unités physiques de qième niveau vers un emplacement libre dans la mémoire non volatile (510, 710) ou vers une mémoire externe ou une mémoire interne, puis la copie des données de l'emplacement libre dans la mémoire non volatile (510, 710) ou de la mémoire externe ou de la mémoire interne vers la mémoire non volatile (510, 710) vers un emplacement où les données de l'unité physique de qième niveau sont tournées.
4. Procédé selon la revendication 1, dans lequel la migration des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau comprend :
la copie des données dans une unité physique de qième niveau vers une mémoire externe ou une mémoire interne, la copie des données dans chacune des autres unités physiques de qième niveau une par une vers un emplacement des dernières données copiées dans la mémoire non volatile (510, 710), puis la copie des données dans la mémoire externe ou la mémoire interne vers un emplacement des dernières données copiées dans la mémoire non volatile (510, 710).
5. Procédé selon la revendication 1, dans lequel la migration des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau comprend :
la copie des données dans une unité physique de qième niveau vers un emplacement libre dans la mémoire non volatile (510, 710) ou vers une mémoire externe ou une mémoire interne, la copie des données dans chacune des autres unités physiques de qième niveau une par une vers un emplacement des dernières données copiées dans la mémoire non volatile (510, 710), puis la copie des données à l'emplacement libre dans la mémoire non volatile (510, 710) ou dans la mémoire externe ou la mémoire interne vers un emplacement des dernières données copiées dans la mémoire non volatile (510, 710).
6. Procédé selon la revendication 1, dans lequel avant de migrer des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le procédé comprend en outre :
la définition d'un cycle de temps correspondant aux unités physiques de qième niveau en fonction d'un scénario de fonctionnement actuel.
7. Dispositif de répartition de l'usure et d'accès pour une mémoire non volatile, comprenant : une mémoire non volatile (510), un processeur (520), une mémoire (530) et un bus de communication (540), dans lequel :
le bus de communication (540) est configuré pour réaliser une communication connectée entre le processeur (520) et la mémoire (530) ; et
le processeur (520) est configuré pour exécuter un programme de rotation de données stocké dans la mémoire (530) afin de mettre en oeuvre les étapes suivantes :
diviser de manière logique la mémoire non volatile (510) en p niveaux d'unités physiques, dans lequel la mémoire non volatile (510) comprend une pluralité d'unités physiques de 1er niveau, et chaque unité physique de (p-1)er niveau comprend une pluralité d'unités physiques de per niveau, p étant un entier positif supérieur à 1 ; et
migrer, lorsqu'un cycle temporel correspondant à des unités physiques de qième niveau arrive, des données de chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, q étant un entier positif quelconque de 1 à p,
caractérisé en ce que :
le processeur (520) est en outre configuré pour mettre en oeuvre les étapes suivantes : définir, lorsqu'un utilisateur accède à la mémoire non volatile (510), une adresse logique d'une aième unité physique parmi les n unités physiques de qième niveau à (x/Q+y/A)%n, où x est une adresse logique de la mémoire non volatile (510), Q est une taille de chacune des unités physiques de qième niveau, y est le temps d'accès de l'utilisateur, et A est un cycle de temps correspondant aux unités physiques de qième niveau.
8. Dispositif selon la revendication 7, dans lequel lors de la migration de données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le processeur (520) est configuré pour exécuter le programme de rotation de données pour mettre en oeuvre les étapes suivantes :
copier les données dans chacune des unités physiques de qième niveau vers une mémoire externe ou une mémoire interne (510), puis copier les données de la mémoire externe ou de la mémoire interne vers la mémoire non volatile (510) vers un emplacement où les données de l'unité physique de qième niveau sont tournées.
9. Dispositif selon la revendication 7, dans lequel lors de la migration de données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le processeur (520) est configuré pour exécuter le programme de rotation de données pour mettre en oeuvre les étapes suivantes :
copier les données dans une unité physique de qième niveau vers une mémoire externe ou une mémoire interne, copier les données dans chacune des autres unités physiques de qième niveau une par une vers un emplacement des dernières données copiées dans la mémoire non volatile (510), puis copier les données dans la mémoire externe ou la mémoire interne vers un emplacement des dernières données copiées dans la mémoire non volatile (510).
10. Dispositif selon la revendication 7, dans lequel avant de migrer des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le processeur (520) est en outre configuré pour exécuter le programme de rotation de données pour mettre en oeuvre l'étape suivante :
définir un cycle de temps correspondant aux unités physiques de qième niveau en fonction d'un scénario de fonctionnement actuel.
11. Dispositif de mise à niveau et d'accès pour une mémoire non volatile, comprenant : la mémoire non volatile (710) et un processeur (720), dans lequel :
le processeur (720) est configuré pour exécuter un programme de répartition de l'usure et d'accès pour la mémoire non volatile (710) afin de mettre en oeuvre les étapes suivantes :
diviser de manière logique la mémoire non volatile (710) en p niveaux d'unités physiques, dans lequel la mémoire non volatile (710) comprend une pluralité d'unités physiques de 1er niveau, et chaque unité physique de (p-1)er niveau comprend une pluralité d'unités physiques de per niveau, p étant un entier positif supérieur à 1 ; et
migrer, lorsqu'un cycle temporel correspondant à des unités physiques de qième niveau arrive, des données de chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, q étant un entier positif quelconque de 1 à p,
caractérisé en ce que :
le processeur (720) est en outre configuré pour mettre en oeuvre les étapes suivantes : définir, lorsqu'un utilisateur accède à la mémoire non volatile (710), une adresse logique d'une aième unité physique parmi les n unités physiques de qième niveau à (x/Q+y/A)%n, où x est une adresse logique de la mémoire non volatile (710), Q est une taille de chacune des unités physiques de qième niveau, y est le temps d'accès de l'utilisateur, et A est un cycle de temps correspondant aux unités physiques de qième niveau.
12. Dispositif selon la revendication 11, dans lequel lors de la migration de données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le processeur est configuré pour exécuter le programme de répartition de l'usure et d'accès pour la mémoire non volatile afin de mettre en oeuvre les étapes suivantes :
copier des données dans chacune des unités physiques de qième niveau vers un emplacement libre dans la mémoire non volatile ou vers une mémoire externe ou une mémoire interne, puis copier les données de l'emplacement libre dans la mémoire non volatile ou de la mémoire externe ou de la mémoire interne vers la mémoire non volatile vers un emplacement où les données de l'unité physique de qième niveau sont tournées.
13. Dispositif selon la revendication 11, dans lequel lors de la migration de données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le processeur est configuré pour exécuter le programme de répartition de l'usure et d'accès pour la mémoire non volatile afin de mettre en oeuvre les étapes suivantes :
copier des données dans une unité physique de qième niveau vers un emplacement libre dans la mémoire non volatile ou vers une mémoire externe ou une mémoire interne, copier des données dans chacune des autres unités physiques de qième niveau une par une vers un emplacement des dernières données copiées dans la mémoire non volatile, puis copier les données à l'emplacement libre dans la mémoire non volatile ou dans la mémoire externe ou la mémoire interne vers un emplacement des dernières données copiées dans la mémoire non volatile.
14. Dispositif selon la revendication 11, dans lequel avant de migrer des données dans chacune des unités physiques de qième niveau vers une autre unité physique de qième niveau, le processeur est en outre configuré pour exécuter le programme de répartition de l'usure et d'accès pour la mémoire non volatile afin de mettre en oeuvre l'étape suivante :
définir un cycle de temps correspondant aux unités physiques de qième niveau en fonction d'un scénario de fonctionnement actuel.