TRIM
What is TRIM?
TRIM is a facility by which the OS can notify the SSD when data is either marked for erase or no longer valid. TRIM helps to make Garbage Collection more efficient by preparing invalid data for deletion. When the OS “deletes” data, the data does not actually go anywhere. The space in which it resides is simply marked as “free space” that may be used later. By default, the OS doesn't let the SSD know which data is now free. TRIM allows the OS to inform the SSD which data is no longer valid, allowing the SSD to skip over invalid data when performing Garbage Collection.
TRIM is an operating system command that is supported by Windows 7 and higher and Mac OS X 10.7 (Lion) and higher that allows the operating system to notify the SSD when data is no longer needed.
In this example, we have 4 blocks available. We make the assumption that we must have at least one free block available at all times.
Let’s write File A. Then, we’ll write File B. Next, let’s modify file A again.
Next, we’re going to delete File A. At this point, the TRIM command is automatically issued by the OS (assuming the OS supports TRIM). As soon as File A is deleted, the OS notifies the SSD that the contents of file A are no longer needed and the SSD marks the appropriate pages as Invalid, automatically creating a free block (remember... a free block is either empty or contains all invalid data). So, when we finally go to write File C, we don’t have to worry about Garbage Collection because we already have a free block prepared ahead of time, thanks to TRIM.