The industry of solid-state drive (SSD) encounters many complex issues pertaining to the design of SSDs. One of these complicate issues is how to manage erasing the pre-used blocks that are no longer in use. That’s saying a lot, because NAND flash presents so very many difficult challenges like wear leveling, bad block management, error correction, and write amplification.
The reason for this difficulty comes from the fact that all of today’s software was coded for the platter-based traditional hard drive (HDD) which behaves differently to the solid-state drive (SSD) which is flash-based. (Read if you like: Solid State Drive (SSD) – What You Need To Know)
When a file is deleted from a computer, most operating systems (OSs) delete the table of contents entry, but do not delete the actual data blocks from the storage media. Hard disk drives will simply overwrite the unneeded data blocks. Flash-based SSDs, however, must erase the unneeded data blocks before new data can be written and this can take a half a second – a huge amount of time in the world of computing. Since the software doesn’t accommodate flash’s “erase-before-write” needs, the controller inside the SSD must take care of this bit of housekeeping. Unused and unerased blocks are moved out of the way and erased in the background. This is called the “garbage collection” process.
Working in the background, garbage collection systematically identifies which memory cells contain unneeded data and clears the blocks of unneeded data during off-peak times to maintain optimal write speeds during normal operations.
Most SSD controller makers carefully guard their garbage collection algorithms under a veil of secrecy. These techniques are an important part of the differentiation between suppliers. One thing that is common to nearly all SSDs is the use of over provisioning to help with this process. More flash resides within the SSD than is available to the user – a 64GB SSD may actually contain 80GB of internal NAND, but only 64GB is visible to the user. The other 16GB provides an area that can be used for background processes.
The SSD controller moves unerased blocks that are no longer in use to this pool of reserve flash. A background task erases these blocks without getting in the way of standard disk operation. In most cases there is enough extra flash to ensure that the slow erases will not cause the SSD to run out of erased blocks.
A difficulty arises when the pool of spares backs up. In certain very extreme cases this becomes a problem and the entire SSD is forced to wait until a block’s erase cycle is complete.
As solid state drives became more affordable, the TRIM command was introduced to facilitate “garbage collection” of deleted data, allowing the SSD to reset those “unused” blocks back to an “empty” state. This allows for better performance for many SSDs.
By the constant evolution of solid-state drives the function of garbage collection became more efficient and independent to handle the issue of unused blocks addressed earlier in this article to the extent that in many cases the TRIM command is not needed.
Read if you like: TRIM Command Is Essential To Maintain The Performance Of SSD