Search

CN-121979454-A - Garbage collection method for flash memory device, and readable storage medium

CN121979454ACN 121979454 ACN121979454 ACN 121979454ACN-121979454-A

Abstract

The application discloses a garbage collection method of a flash memory device, the flash memory device and a readable storage medium, and the garbage collection method of the flash memory device comprises the steps of setting a first threshold value and a second threshold value according to basic parameters of the flash memory device; the method comprises the steps of determining the number of idle blocks of storage equipment, wherein a first threshold value is smaller than a second threshold value, monitoring the number of the idle blocks of the storage equipment in real time, judging the relation between the number of the idle blocks and the first threshold value and the second threshold value, dynamically adjusting the number of the idle blocks, triggering garbage collection operation when the number of the idle blocks is smaller than the first threshold value, and closing the garbage collection operation when the number of the idle blocks is larger than the second threshold value. The application realizes the optimal balance of garbage collection and abrasion by reasonably controlling the number of the idle blocks, and prolongs the service life of the flash memory device.

Inventors

  • ZHANG WEIXIAN
  • HUANG SHANYONG

Assignees

  • 深圳市时创意电子股份有限公司

Dates

Publication Date
20260505
Application Date
20251231

Claims (10)

  1. 1. A garbage collection method of flash memory device is characterized by comprising the following steps: setting a first threshold and a second threshold according to basic parameters of the flash memory device, wherein the first threshold is smaller than the second threshold; monitoring the number of idle blocks of the storage device in real time; judging the relation between the number of the idle blocks and the first threshold value and the second threshold value, and dynamically adjusting the number of the idle blocks; when the number of the idle blocks is lower than a first threshold value, triggering garbage collection operation; and when the number of idle blocks is higher than a second threshold value, closing the garbage collection operation.
  2. 2. The garbage collection method of a flash memory device according to claim 1, wherein the second threshold is equal to a sum of a capacity required by a speed measurement platform and a capacity of a redundant block; the first threshold is equal to a redundant block capacity that is 3% to 10% of a total capacity of the flash memory device.
  3. 3. The garbage collection method of a flash memory device according to claim 1, wherein the step of triggering the garbage collection operation when the number of idle blocks is lower than a first threshold value comprises: triggering garbage collection operation when the number of idle blocks is lower than a first threshold value; monitoring the number of idle blocks of the storage device in real time; And when the number of the idle blocks is equal to a second threshold value, closing the garbage collection operation.
  4. 4. The garbage collection method of a flash memory device according to claim 1, wherein the garbage collection operation comprises the steps of: selecting a source physical block to be recovered; Moving the effective data in the source physical block to the target physical block; marking a source physical block as available; Updating the cycle count of each physical block; Optimizing an erase time interval of the target physical block; Wherein the source physical block satisfies a minimum effective data amount and a minimum erasure number condition.
  5. 5. The garbage collection method of a flash memory device according to claim 4, wherein the step of moving the valid data in the source physical block to the target physical block comprises: Evaluating the data type in the source physical block according to the data heat; Adopting a batch transfer mode for cold data; And adopting a page-by-page transfer mode for the hot data.
  6. 6. The garbage collection method of a flash memory device according to claim 4, wherein the step of marking the source physical block as available comprises: Reading a physical address mapping table of a source physical block; Deleting the source physical block from the active mapping table; The state of the source physical block is marked as available.
  7. 7. The garbage collection method of a flash memory device according to claim 4, wherein the step of updating the cycle count of each physical block comprises: reading cycle counts of a source physical block and a target physical block; adding one operation to the cycle count of the target physical block; and performing a decrementing operation on the cycle count of the source physical block.
  8. 8. The garbage collection method of a flash memory device according to claim 4, wherein the step of optimizing the erase time interval of the target physical block comprises: calculating the current erasing time interval of the target physical block; if the erasing time interval is smaller than the preset threshold value, adjusting the erasing time interval of the target physical block; and updating the erasure time interval record of the target physical block.
  9. 9. A flash memory device for storing program data executable to implement the garbage collection method of a flash memory device of any of claims 1 to 8.
  10. 10. A readable storage medium for storing program data executable to implement the garbage collection method of a flash memory device of any one of claims 1 to 8.

Description

Garbage collection method for flash memory device, and readable storage medium Technical Field The present application relates to the field of display technologies, and in particular, to a garbage collection method for a flash memory device, and a readable storage medium. Background As a novel storage medium, the NAND flash memory device has the advantages of large capacity, high read-write speed, shock resistance, falling resistance, low power consumption, no noise, low price and the like compared with a mechanical hard disk storage, and is applied in the consumer personal computer field and the enterprise server field in a large scale. In a high frequency power down scenario, a NAND flash memory device may experience a situation where idle blocks are exhausted, resulting in inoperability. To solve this problem, conventional techniques typically reserve some fixed blocks, dedicated to this scene processing. However, this scheme reduces the free blocks that are actually available when the NAND flash memory device is running, which can have an adverse effect on write amplification, and can also cause the scheme to fail if bad blocks occur in the fixed blocks. When garbage collection operation is performed, the problem that the garbage collection strategy of the solid state disk only considers the capacity utilization rate, and intelligent control on the number of idle blocks is lacking, so that the power consumption is increased due to frequent garbage collection in the background in idle time is solved. Disclosure of Invention The application aims to provide a garbage collection method of a flash memory device, the flash memory device and a readable storage medium, which realize the optimal balance of garbage collection and abrasion and prolong the service life of the flash memory device by reasonably controlling the number of idle blocks. The application discloses a garbage collection method of flash memory equipment, which comprises the following steps: setting a first threshold and a second threshold according to basic parameters of the flash memory device, wherein the first threshold is smaller than the second threshold; monitoring the number of idle blocks of the storage device in real time; judging the relation between the number of the idle blocks and the first threshold value and the second threshold value, and dynamically adjusting the number of the idle blocks; when the number of the idle blocks is lower than a first threshold value, triggering garbage collection operation; and when the number of idle blocks is higher than a second threshold value, closing the garbage collection operation. Optionally, the second threshold is equal to the sum of the capacity required by the speed measuring platform and the capacity of the redundant blocks, and the first threshold is equal to the capacity of the redundant blocks, wherein the capacity of the redundant blocks is 3-10% of the total capacity of the flash memory device. Optionally, when the number of idle blocks is lower than the first threshold, the step of triggering the garbage collection operation includes: triggering garbage collection operation when the number of idle blocks is lower than a first threshold value; monitoring the number of idle blocks of the storage device in real time; And when the number of the idle blocks is equal to a second threshold value, closing the garbage collection operation. Optionally, the garbage collection operation includes the steps of: selecting a source physical block to be recovered; Moving the effective data in the source physical block to the target physical block; marking a source physical block as available; Updating the cycle count of each physical block; Optimizing an erase time interval of the target physical block; Wherein the source physical block satisfies a minimum effective data amount and a minimum erasure number condition. Optionally, the step of moving the valid data in the source physical block to the target physical block includes: Evaluating the data type in the source physical block according to the data heat; Adopting a batch transfer mode for cold data; And adopting a page-by-page transfer mode for the hot data. Optionally, the step of marking the source physical block as available includes: Reading a physical address mapping table of a source physical block; Deleting the source physical block from the active mapping table; The state of the source physical block is marked as available. Optionally, the step of updating the cycle count of each physical block includes: reading cycle counts of a source physical block and a target physical block; adding one operation to the cycle count of the target physical block; and performing a decrementing operation on the cycle count of the source physical block. Optionally, the step of optimizing the erase time interval of the target physical block includes: calculating the current erasing time interval of the target physical block; if the erasing time inter