Flash memory management method, flash memory management device and computer readable storage medium
By dividing flash memory space according to preset rules and managing time-sharing multiplexing, the problem of short flash memory lifespan in existing technologies is solved, achieving balanced use of flash memory and improved data reliability.
Patent Information
- Application Number
- CN202411431792.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Existing technologies cannot effectively extend the lifespan of flash memory. Hardware protection solutions increase costs and complexity, while software protection solutions have high algorithm complexity and are difficult to achieve comprehensive protection.
The flash memory space is divided into multiple areas to be used according to preset rules, and managed using time-sharing reuse rules. The number of times it is used is recorded, and when the preset value is reached, the areas are re-divided. If the location is different, time-sharing reuse continues.
Balanced usage across regions prevents excessive wear in certain areas, extends the overall lifespan of flash memory, reduces the risk of data errors and loss, and improves data reliability.
Smart Images

Figure CN119536633B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of computers, and particularly relates to a flash memory management method, a flash memory management device and a computer readable storage medium. BACKGROUND
[0002] Flash, as a kind of non-volatile memory, has been widely used in various electronic devices for persistent storage of data due to its high density, low cost and ease of use. However, the service life of flash memory is not infinite, and the main challenge it faces is the limitation of the number of erase-write times. Once the specific erase-write time threshold is reached, the flash memory may lose data or fail to function.
[0003] To address this challenge, current technologies have taken various protective measures. Hardware protection schemes monitor and control the use of flash memory in real time by adding additional monitoring and management circuits in the flash memory system, thereby avoiding damage due to overuse. On the other hand, software protection schemes rely on complex algorithms to manage the use of flash memory, such as optimizing data write distribution through address mapping technology to achieve balanced writing and prolong the overall service life of flash memory.
[0004] However, existing technologies still face many difficulties in practical applications. Although hardware protection schemes are effective, they increase the cost and complexity of devices, causing inconvenience in production and use. While software protection schemes are flexible, their algorithms are often complex and difficult to implement. More importantly, whether it is hardware or software protection scheme, it can only protect flash memory to a certain extent, making it difficult to achieve comprehensive protection, thereby limiting the further improvement of the service life of flash memory. SUMMARY
[0005] The purpose of the present application is to provide a flash memory management method to solve the existing problems of flash memory management. The flash memory management method provided by the present application comprises:
[0006] dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas;
[0007] using the plurality of first to-be-used areas according to a time division multiplexing rule;
[0008] recording the number of uses corresponding to each of the plurality of first to-be-used areas;
[0009] when the number of uses corresponding to a first to-be-used area reaches a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas;
[0010] the positions of the plurality of second to-be-used areas are different from the positions of the plurality of first to-be-used areas;
[0011] use the plurality of second to-be-used areas according to a time-sharing multiplexing rule.
[0012] According to the flash memory management method provided in the first aspect of the embodiments of the present application, optionally, after the plurality of second to-be-used areas are used according to the time-sharing multiplexing rule, the method further comprises:
[0013] regarding the second to-be-used areas as the first to-be-used areas, and re-executing the flash memory management method from the step of using the plurality of first to-be-used areas according to the time-sharing multiplexing rule.
[0014] According to the flash memory management method provided in the first aspect of the embodiments of the present application, optionally, after the plurality of first to-be-used areas are used according to the time-sharing multiplexing rule, the method further comprises using the first to-be-used areas according to a priority scheduling mechanism.
[0015] According to the flash memory management method provided in the first aspect of the embodiments of the present application, optionally, before the flash memory space is divided according to the preset rule to obtain the plurality of first to-be-used areas, the method further comprises:
[0016] monitoring a usage condition of the flash memory space;
[0017] when the usage condition of the flash memory space meets a preset condition, triggering the step of dividing the flash memory space according to the preset rule to obtain the plurality of first to-be-used areas.
[0018] According to the flash memory management method provided in the first aspect of the embodiments of the present application, optionally, the plurality of first to-be-used areas comprises a data backup area.
[0019] The method further comprises: judging whether there is a flash memory damage condition;
[0020] if there is a flash memory damage condition, transferring data meeting an important data definition to the data backup area.
[0021] According to the flash memory management method provided in the first aspect of the embodiments of the present application, optionally,
[0022] the step of when the usage frequency of a first to-be-used area reaches a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas comprises:
[0023] when the usage frequency of any one of the first to-be-used areas reaches a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas, wherein the flash memory space participating in the division does not include the first to-be-used area whose usage frequency reaches the preset value.
[0024] According to the flash memory management method provided in the first aspect of the embodiments of this application, optionally,
[0025] When the number of uses corresponding to the first area to be used reaches a preset value, the flash memory space is re-divided to obtain multiple second areas to be used, including:
[0026] When the number of uses corresponding to each of the first areas to be used reaches a preset value, the flash memory space is re-divided to obtain multiple second areas to be used.
[0027] A second aspect of this application provides a flash memory management device, including:
[0028] The first partitioning unit is used to partition the flash memory space according to preset rules to obtain multiple first areas to be used;
[0029] The first usage unit is used to use the plurality of first areas to be used in accordance with the time-division multiplexing rules;
[0030] A recording unit is used to record the number of times each of the plurality of first areas to be used is used;
[0031] The second partitioning unit is used to re-partition the flash memory space when the number of times the first area to be used reaches a preset value, to obtain multiple second areas to be used, wherein the positions of the multiple second areas to be used are different from the multiple first areas to be used.
[0032] The second usage unit is used to use the plurality of second areas to be used in accordance with the time-division multiplexing rules.
[0033] Optionally, based on the flash memory management device provided in the second aspect of the embodiments of this application, the device further includes:
[0034] The multiplexing unit is used to treat the second area to be used as the first area to be used, and to re-execute the flash memory management method starting from the step of using the plurality of first areas to be used according to the time-division multiplexing rule.
[0035] Based on the flash memory management device provided in the second aspect of the embodiments of this application, optionally, the first usage unit is further configured to: use the first area to be used according to a priority scheduling mechanism.
[0036] Based on the flash memory management device provided in the second aspect of the embodiments of this application, optionally, the device further includes: a monitoring unit, the monitoring unit being used for:
[0037] Monitor the usage of the flash memory space;
[0038] The first dividing unit is triggered when the usage of the flash memory space meets a preset condition.
[0039] According to the flash memory management device provided in the second aspect of the present application, optionally, the plurality of first to-be-used areas include a data backup area.
[0040] The device further includes a damage monitoring unit configured to determine whether there is a flash memory damage condition.
[0041] If there is a flash memory damage condition, data meeting the definition of important data is transferred to the data backup area.
[0042] According to the flash memory management device provided in the second aspect of the present application, optionally,
[0043] The second dividing unit is specifically configured to: when the usage frequency of any one of the first to-be-used areas reaches a preset value, the flash memory space is re-divided, the flash memory space participating in the division does not include the first to-be-used area whose usage frequency reaches the preset value, and a plurality of second to-be-used areas are obtained.
[0044] According to the flash memory management device provided in the second aspect of the present application, optionally,
[0045] The second dividing unit is specifically configured to: when the usage frequency of each of the first to-be-used areas reaches a preset value, the flash memory space is re-divided, and a plurality of second to-be-used areas are obtained.
[0046] The third aspect of the present application provides a flash memory management device, including:
[0047] A central processing unit, a memory, an input and output interface, a wired or wireless network interface, and a power supply;
[0048] The memory is a transient storage memory or a persistent storage memory;
[0049] The central processing unit is configured to communicate with the memory, execute instruction operations in the memory on the device to perform the method in any one of the first aspect of the present application.
[0050] The fourth aspect of the present application provides a computer readable storage medium including instructions, when the instructions run on a computer, the computer executes the method in any one of the first aspect of the present application.
[0051] The fifth aspect of the present application provides a computer program product including instructions, when the instructions run on a computer, the computer executes the method in any one of the first aspect of the present application.
[0052] From the above technical solutions can be seen, the embodiments of the present application have the following advantages: the present application provides a flash memory management method, comprising: dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas; using the plurality of first to-be-used areas according to a time division multiplexing rule; recording the number of uses corresponding to each of the plurality of first to-be-used areas; when the number of uses corresponding to a first to-be-used area reaches a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas; the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas; using the plurality of second to-be-used areas according to the time division multiplexing rule. This scheme balances the number of uses of each area, avoiding the premature failure of some areas due to excessive wear and tear, thereby prolonging the overall life of the flash memory. And by re-dividing the flash memory space, the risk of data errors and loss due to wear and tear can be reduced, improving the reliability of the data. BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only embodiments of the present application, and those skilled in the art can obtain other drawings according to the provided drawings without creative labor. It can be understood that the drawings provided in this part are only for better understanding of the present application, and do not constitute a limitation on the present application.
[0054] Figure 1 A flowchart of an embodiment of the flash memory management method provided by the present application.
[0055] Figure 2 Another flowchart of an embodiment of the flash memory management method provided by the present application.
[0056] Figure 3 A structural diagram of an embodiment of the flash memory management device provided by the present application.
[0057] Figure 4 Another structural diagram of an embodiment of the flash memory management device provided by the present application. DETAILED DESCRIPTION
[0058] In order to make the person skilled in the art better understand the scheme of the present application, the technical solutions in the embodiments of the present application are described clearly and completely below. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor should fall within the scope of protection of the present application. At the same time, in order to describe clearly and concisely, the description of well-known functions and structures is omitted in the following description.
[0059] The terms "first", "second", "third", "fourth" and the like in the description, claims, and drawings of the present application (if any) are used to distinguish similar objects, and do not necessarily have to be used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments described herein can be carried out in sequences other than those illustrated or described herein. Moreover, the terms "comprise" and "have", and any variations thereof, are intended to cover non-exclusive inclusions, for example, a process, method, product, or apparatus that includes a list of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products, or apparatuses.
[0060] Flash memory, as a kind of non-volatile memory, has been widely used in various electronic devices for persistent storage of data due to its high density, low cost and ease of use. However, the service life of flash memory is not infinite, and the main challenge it faces is the limitation of the number of erase-write times. Once the threshold of a certain number of erase-write times is reached, flash memory may experience data loss or device failure.
[0061] To address this challenge, current technology has taken a variety of protective measures. Hardware protection schemes monitor and control the use of flash memory in real time by adding additional monitoring and management circuits in the flash memory system, thereby avoiding damage due to overuse. On the other hand, software protection schemes rely on complex algorithms to manage the use of flash memory, such as optimizing data write distribution through address mapping techniques to achieve balanced writing and prolong the overall service life of flash memory.
[0062] However, the existing technology still faces many difficulties in practical application. Although the hardware protection scheme is effective, it increases the cost and complexity of the device, causing inconvenience in production and use. While the software protection scheme is flexible, its algorithm is often complex and difficult to implement. More importantly, whether it is hardware or software protection scheme, it can only protect flash memory to a certain extent, and it is difficult to achieve comprehensive protection, thereby limiting the further improvement of the service life of flash memory.
[0063] To solve the above problems, the present application provides a new flash memory management method, please refer to Figure 1 One embodiment of the flash memory management method provided by the present application includes steps 101-105.
[0064] 101. Divide the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas.
[0065] According to the preset rule, the flash memory space is divided to obtain a plurality of first to-be-used areas. Specifically, we can divide the flash memory space into multiple blocks, and the size of each block can be set according to actual needs. For example, we can set the size of each block to 1GB. In actual implementation, the block setting rule is determined according to the actual situation. Before performing the space division, the flash memory device needs to be initialized, including clearing all data, checking the hardware state, and configuring necessary parameters. According to the preset rule, the size, number and protection mechanism of each block are determined. These rules should be based on device performance, data storage requirements and application scenarios, etc. In this process, it is necessary to ensure that each block can be effectively protected and meet the preset storage performance requirements. After the division is completed, the division result is verified to ensure that the size, number and protection mechanism of each block meet the expectations. At the same time, the read and write performance needs to be tested to ensure that the divided flash memory device can meet the actual application requirements. And record the position of each first to-be-used area in the flash memory space.
[0066] 102. Use the plurality of first to-be-used areas according to a time division multiplexing rule.
[0067] According to the time-sharing multiplexing rule, the plurality of first to-be-used areas are used. Flash time-sharing multiplexing means that different time periods, different flash blocks will be allocated for data storage or read operations, rather than all blocks being in a high load state at the same time. This strategy aims to balance the read and write load of the flash memory, avoid some blocks from being worn out prematurely due to overuse, and ensure that each flash block is balanced and effectively protected throughout the product life cycle. Implementing flash time-sharing multiplexing technology can not only significantly improve the overall service life of the flash memory, as it reduces local wear and tear caused by frequent reading and writing, but also effectively prevents the loss of important data, as data is stored in different blocks and different time periods, reducing the risk of complete data loss due to a single block failure. In addition, this technology helps improve data access efficiency and stability by reducing waiting time and conflicts through intelligent scheduling, providing users with a smoother data storage experience. Through this time-sharing multiplexing method, we can ensure that each flash block is balanced and protected throughout the normal use cycle of the product, extending the overall service life of the flash memory. Specifically, when a to-be-used area is not full, no erase operation is performed on the area, and the erase operation is performed separately for each first to-be-used area.
[0068] 103. Record the number of uses corresponding to each of the plurality of first to-be-used areas.
[0069] Specifically, each time a flash block is used for data storage or read operations, the system automatically records this operation and updates the usage count of the block. In this way, we can keep track of the usage frequency and status of each block in real time, providing important basis for subsequent management and scheduling.
[0070] 104. Re-divide the flash memory space to obtain a plurality of second to-be-used areas.
[0071] Specifically, when the usage frequency of the first to-be-used area reaches a preset value, the flash memory space is re-divided to obtain a plurality of second to-be-used areas; the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas. When it is monitored that the usage frequency of the first to-be-used area (i.e., the originally allocated flash block) has reached the preset threshold, the system will re-divide the entire flash memory space in detail to generate a set of brand-new second to-be-used areas. The core purpose of this re-division process is to balance the read-write load of each block of the flash memory by changing the physical storage location of the data, and effectively prevent some blocks from being damaged prematurely due to excessive use. It is worth noting that the newly generated second to-be-used areas have significant differences in physical layout from the original first to-be-used areas. The change of position is designed to achieve load balancing and prolong the overall life of the flash memory. Through such adjustment, we can ensure that each flash block can be used more evenly, thereby improving the performance and stability of the entire flash memory system. In actual implementation, the newly divided second to-be-used areas can be the same size as the first to-be-used areas, but occupy 50% of the original first to-be-used areas in terms of position, that is, two first to-be-used areas are halved to form a re-divided second to-be-used area.
[0072] 105. Using the plurality of second to-be-used areas according to the time-sharing multiplexing rule.
[0073] Specifically, after generating brand-new second to-be-used areas, they will be used efficiently and orderly according to the established time-sharing multiplexing rule. For the newly generated second to-be-used areas, the time-sharing multiplexing rule is continued, and reasonable usage time periods are allocated to them according to the read-write requirements of the data, the characteristics of the blocks, and the overall performance requirements of the system. Through such time-sharing multiplexing strategy, not only the overall service life of the flash memory can be further prolonged, but also the read-write speed and storage efficiency of the data can be significantly improved. Through the implementation of this strategy, the flash memory resources can be maximized, and more stable and efficient data storage services can be provided for users.
[0074] From the above technical solutions can be seen, the application embodiments have the following advantages: the application provides a flash memory management method, comprising: dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas; using the plurality of first to-be-used areas according to a time division multiplexing rule; recording the use times corresponding to the plurality of first to-be-used areas respectively; when the use times corresponding to a first to-be-used area reach a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas; the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas; and using the plurality of second to-be-used areas according to the time division multiplexing rule. The present scheme balances the use times of the areas, avoids the premature failure of some areas due to excessive wear and tear, and thus prolongs the overall service life of the flash memory. Moreover, by re-dividing the flash memory space, the risk of data errors and loss due to wear and tear can be reduced, and the reliability of data can be improved.
[0075] To facilitate the use of the present method in actual process, the application further provides a more detailed embodiment which can be selected for implementation, please refer to Figure 2 Another embodiment of the flash memory management method provided by the application comprises steps 201-210.
[0076] 201, monitoring the use condition of the flash memory space.
[0077] A flash memory protection module is added to the product, which can monitor the use condition of the flash memory in real time. Once it is found that the use condition of the flash memory exceeds a preset threshold value, the threshold value is determined according to the product condition, such as 80% of the use times of the flash memory product or the erasing and writing times reaching a fixed value, the flash memory time division multiplexing technology and the time and space multiplexing management algorithm will be automatically started to protect the flash memory from being damaged. When the use condition of the flash memory space meets a preset condition, the step of dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas is triggered.
[0078] 202, dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas
[0079] Specifically, if the use condition of the flash memory space reaches or exceeds a preset threshold value, i.e. meets a preset condition, the flash memory space is divided according to a preset rule to obtain a plurality of first to-be-used areas. The plurality of first to-be-used areas include a data backup area. The data backup area should be a relatively safe area, and specifically, the area with the least erasing and writing times can be determined as the data backup area. This step is similar to step 101 in the foregoing Figure 1 corresponding embodiments, which will not be described herein.
[0080] 203, judging whether there is a flash memory damage condition.
[0081] determine whether there is a flash memory damage situation. The system continuously monitors the state of the flash memory, including its read-write performance, error rate, and other key indicators. Once these indicators exceed the normal range, or the system detects abnormal data access patterns, the module will immediately determine whether there is a risk of flash memory damage. This step can timely discover potential problems, and steps 203 to 204 can be performed at any time during the execution of the method, without limitation.
[0082] 204. Transfer data meeting the important data definition to the data backup area.
[0083] When a flash memory damage situation occurs, data meeting the important data definition is transferred to the data backup area. When the system determines that there is a risk of flash memory damage, a data backup process is immediately started. This process will filter out key business data and user information according to the pre-set important data definition or identification, and transfer these data to the backup area. In this way, even if the flash memory is damaged, the normal use of the product can be quickly restored through the data in the backup area, ensuring the integrity of the data and the stable operation of the product.
[0084] 205. Use the plurality of first to-be-used areas according to time-sharing multiplexing rules.
[0085] 206. Use the first to-be-used areas according to a priority scheduling mechanism.
[0086] Specifically, the usage rules for the first to-be-used areas can include time-sharing multiplexing rules, priority scheduling mechanisms, and a plurality of other rules, including:
[0087] First, the plurality of first to-be-used areas are used according to time-sharing multiplexing rules. This rule aims to avoid excessive use of flash memory through reasonable allocation of time and space. Specifically, the Flash memory is divided into a plurality of logical blocks or partitions, each of which is used by different tasks or applications in different time periods. Through time slice rotation or priority scheduling, this mechanism allocates different priorities to different first to-be-used areas based on factors such as data access frequency, importance, and current state of the flash memory area, thereby ensuring that in the case of limited flash memory resources, the storage needs of critical data can be maximized. We ensure that each block or partition is only occupied by one task or application in a period of time, thereby effectively avoiding frequent erasing caused by multiple tasks writing to the same block of Flash. This time-sharing operation not only improves the utilization of flash memory, but also significantly prolongs its service life.
[0088] In terms of management strategy, a garbage collection mechanism is used to periodically clean up invalid data and fragments in the Flash, thereby releasing storage space. At the same time, wear leveling technology is also used, which migrates data between different logical blocks or partitions, so that each area of the Flash has similar erase-write times. This technology not only prolongs the overall service life of the Flash, but also improves its stability and reliability. In addition, the Read-Modify-Write strategy is implemented, which reads the original data before writing, only modifies the part that needs to be changed, thereby reducing unnecessary erase-write operations.
[0089] In terms of error detection and recovery, the ECC (Error Correction Code) or other verification mechanisms are used to detect and correct errors in the Flash. At the same time, the Flash memory is periodically scanned to detect and repair potential error areas. When unrecoverable errors are detected, data backup and recovery measures are immediately taken to ensure data integrity and availability.
[0090] Finally, in terms of hot backup and fault tolerance design, the hot backup mechanism is designed for key data, which stores data in multiple Flash memories at the same time. This mechanism improves the reliability and fault tolerance of data, even if one of the Flash memories fails, it can ensure the integrity and availability of data. These measures together constitute the complete system of the Flash management and protection strategy of this scheme, ensuring the stable operation of the product and the integrity of the data.
[0091] 207、Record the number of uses corresponding to each of the plurality of first to-be-used areas.
[0092] 208、Re-divide the flash space to obtain a plurality of second to-be-used areas.
[0093] Specifically, the division rule includes two kinds, which can be selected and applied as needed, including:
[0094] (1) When the usage frequency of any of the first to-be-used areas reaches the preset value, the flash memory space is re-divided, and the flash memory space participating in the division does not include the first to-be-used area whose usage frequency reaches the preset value, to obtain a plurality of second to-be-used areas. The flash memory space participating in the division does not include the first to-be-used area whose usage frequency reaches the preset value, to obtain a plurality of second to-be-used areas. This rule aims to protect those areas that have already been under high load and avoid damage due to excessive use. By re-dividing, we can disperse the load to other areas, while the areas with higher usage frequency do not participate in the division process, thereby prolonging the service life of the entire flash memory. It is worth noting that when the method is repeatedly executed according to step 210, the first to-be-used area whose usage frequency reaches the preset value re-participates in the division process.
[0095] (2) When the usage frequency of each of the first to-be-used areas reaches the preset value, the flash memory space is re-divided to obtain a plurality of second to-be-used areas. This rule is applicable to the case where all areas are under high load. At this time, re-division can ensure that each area can obtain a relatively balanced load, thereby maintaining the overall performance and stability of the flash memory.
[0096] 209. Using the plurality of second to-be-used areas according to the time division multiplexing rule
[0097] After the flash memory space is re-divided into a plurality of second to-be-used areas, the time division multiplexing rule is again used to manage the use of these areas. This rule aims to avoid excessive use of flash memory space through reasonable allocation of time, thereby prolonging its service life. Specifically, this scheme will allocate a specific time period for each second to-be-used area to ensure that within this time period, the area is only occupied by one task or application. In this way, we can effectively disperse the write pressure and avoid frequent erasing of a single area, thereby protecting the flash memory from damage.
[0098] 210. Considering the second to-be-used areas as the first to-be-used areas, re-executing the flash memory management method from the step of using the plurality of first to-be-used areas according to the time division multiplexing rule
[0099] In order to continue to protect the flash memory and optimize its use, it is necessary to consider these second to-be-used areas as new first to-be-used areas and re-execute the entire flash memory management method. That is, return to step 202 to re-execute the method.
[0100] From the above technical solution can be seen, the application embodiments have the following advantages: the application provides a flash memory management method, comprising: dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas; using the plurality of first to-be-used areas according to a time division multiplexing rule; recording the use times corresponding to the plurality of first to-be-used areas respectively; when the use times corresponding to a first to-be-used area reach a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas; the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas; and using the plurality of second to-be-used areas according to the time division multiplexing rule. The present scheme balances the use times of each area, avoids the premature failure of some areas due to excessive wear and tear, thereby prolonging the overall life of the flash memory. And by re-dividing the flash memory space, the risk of data errors and loss due to wear and tear can be reduced, and the reliability of data can be improved.
[0101] The above describes the flash memory management method provided by the application. To support the implementation of the above embodiments, the application further provides a flash memory management device, please refer to Figure 3 An embodiment of the flash memory management device provided by the application comprises:
[0102] The first dividing unit 301 is configured to divide the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas.
[0103] The first using unit 302 is configured to use the plurality of first to-be-used areas according to a time division multiplexing rule.
[0104] The recording unit 303 is configured to record the use times corresponding to the plurality of first to-be-used areas respectively.
[0105] The second dividing unit 304 is configured to, when the use times corresponding to a first to-be-used area reach a preset value, re-divide the flash memory space to obtain a plurality of second to-be-used areas, wherein the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas.
[0106] The second using unit 305 is configured to use the plurality of second to-be-used areas according to a time division multiplexing rule.
[0107] In the embodiment, the processes performed by each unit in the flash memory management device are similar to the method processes described in the foregoing Figure 1 corresponding embodiments, which will not be described here again.
[0108] Optionally, the device further comprises:
[0109] The multiplexing unit is configured to regard the second to-be-used area as the first to-be-used area, and re-perform the flash memory management method from the step of using the plurality of first to-be-used areas according to the time-division multiplexing rule.
[0110] Optionally, the first using unit is further configured to use the first to-be-used area according to a priority scheduling mechanism.
[0111] Optionally, the device further comprises a monitoring unit, which is configured to:
[0112] monitor the usage of the flash memory space;
[0113] trigger the first dividing unit when the usage of the flash memory space meets a preset condition.
[0114] Optionally, the plurality of first to-be-used areas comprises a data backup area.
[0115] The device further comprises a damage monitoring unit, which is configured to determine whether there is a flash memory damage condition.
[0116] If there is a flash memory damage condition, data meeting an important data definition is transferred to the data backup area.
[0117] Optionally, the second dividing unit is specifically configured to: when the usage frequency of any first to-be-used area reaches a preset value, re-divide the flash memory space, and the flash memory space participating in the division does not include the first to-be-used area whose usage frequency reaches the preset value, to obtain a plurality of second to-be-used areas.
[0118] Optionally, the second dividing unit is specifically configured to: when the usage frequency of each first to-be-used area reaches a preset value, re-divide the flash memory space to obtain a plurality of second to-be-used areas.
[0119] Figure 4 Fig. 1 is a structural schematic diagram of a flash memory management device provided by an embodiment of the present application. The flash memory management device 400 can comprise one or more central processing units (CPUs) 401 and a memory 405, wherein the memory 405 stores one or more application programs or data.
[0120] In the embodiment, the specific function module division in the central processing unit 401 can be similar to the function module division manner of the units described in the foregoing Figure 3 embodiment, and details are not described herein again.
[0121] The memory 405 can be volatile memory or persistent storage. The programs stored in the memory 405 can include one or more modules, each of which can include a series of instruction operations in the flash memory management device. Further, the central processor 401 can be configured to communicate with the memory 405 to execute the series of instruction operations in the memory 405 on the flash memory management device 400.
[0122] The flash memory management device 400 can also include one or more power supplies 402, one or more wired or wireless network interfaces 403, one or more input / output interfaces 404, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0123] The central processor 401 can execute the operations performed by the flash memory management method of the embodiments shown above, which will not be described in detail here. Figure 1 Or Figure 2 The flash memory management method of the embodiments shown above.
[0124] The embodiments of the present application also provide a computer storage medium for storing computer software instructions for the flash memory management device described above, which includes programs designed for the flash memory management method.
[0125] The flash memory management method can be the flash memory management method described above in Figure 1 Or Figure 2 .
[0126] The embodiments of the present application also provide a computer program product including computer software instructions that can be loaded by a processor to implement the flow of the flash memory management method of any one of the embodiments described above. Figure 1 Figure 2
[0127] In the several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented by other means. For example, the device embodiments described above are only schematic, and equivalent transformations of the circuit, division of the unit, and only a logical function division, actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed can be through some interface, device or unit indirect coupling or communication connection, which can be electrical, mechanical or other forms.
[0128] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0129] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0130] The above is only the preferred embodiment of the present application, and is not used to limit the present application. Any modification, equivalent replacement or improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A flash memory management method, characterized by, The method comprises: dividing the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas; using the plurality of first to-be-used areas according to a time division multiplexing rule; recording the number of times each of the plurality of first to-be-used areas is used; when the number of times a first to-be-used area is used reaches a preset value, re-dividing the flash memory space to obtain a plurality of second to-be-used areas; the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas; using the plurality of second to-be-used areas according to a time division multiplexing rule; after using the plurality of second to-be-used areas according to the time division multiplexing rule, the method further comprises: regarding the second to-be-used areas as the first to-be-used areas, and re-executing the flash memory management method from the step of using the plurality of first to-be-used areas according to the time division multiplexing rule; before the step of dividing the flash memory space according to the preset rule to obtain the plurality of first to-be-used areas, the method further comprises: monitoring the usage of the flash memory space; when the usage of the flash memory space meets a preset condition, triggering the step of dividing the flash memory space according to the preset rule to obtain the plurality of first to-be-used areas; when the number of times any of the first to-be-used areas is used reaches the preset value, re-dividing the flash memory space to obtain the plurality of second to-be-used areas, wherein the flash memory space participating in the division does not include the first to-be-used area whose number of times reaches the preset value. after using the plurality of first to-be-used areas according to the time division multiplexing rule, the method further comprises using the first to-be-used areas according to a priority scheduling mechanism.
2. The flash memory management method of claim 1, wherein, The plurality of first to-be-used areas include a data backup area.
3. The flash memory management method of claim 1, wherein, The method further comprises judging whether there is a flash memory damage condition; if there is a flash memory damage condition, transferring data meeting an important data definition to the data backup area. The method comprises:
4. A flash memory management device, characterized by comprising: a first dividing unit configured to divide the flash memory space according to a preset rule to obtain a plurality of first to-be-used areas; a first using unit configured to use the plurality of first to-be-used areas according to a time division multiplexing rule; a recording unit configured to record the number of times each of the plurality of first to-be-used areas is used; a second dividing unit configured to, when the number of times a first to-be-used area is used reaches a preset value, re-divide the flash memory space to obtain a plurality of second to-be-used areas, wherein the positions of the plurality of second to-be-used areas are different from those of the plurality of first to-be-used areas; a second using unit configured to use the plurality of second to-be-used areas according to a time division multiplexing rule; The device further comprises: a multiplexing unit configured to regard the second to-be-used areas as the first to-be-used areas, and re-execute the method of claim 1 from the step of using the plurality of first to-be-used areas according to the time division multiplexing rule. The device further comprises a monitoring unit for: monitoring the usage of the flash memory space; triggering the first partition unit when the usage of the flash memory space meets preset conditions; The second partition unit is specifically configured to: when the usage frequency of any first to-be-used region reaches a preset value, the flash memory space is re-partitioned, the flash memory space participating in the partition does not include the first to-be-used region whose usage frequency reaches the preset value, and a plurality of second to-be-used regions are obtained.
5. A flash memory management device, characterized by comprising: comprise: a central processing unit, a memory, an input and output interface, a wired or wireless network interface, and a power supply; The memory is a transient storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory, execute instruction operations in the memory on the device to perform the method in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, comprise instructions which, when executed on a computer, cause the computer to perform the method in any one of claims 1 to 3.
Citation Information
Patent Citations
NOR flash memory and repair method thereof
CN105489246A
Time slot resource selecting method and device
CN105991207A