Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bookbuyer

macrumors newbie
Original poster
Feb 25, 2021
19
3
I don't understand how TRIM helps Garbage Collection.
I thought "Garbage Collection" recognizes 2 types of files:
• "Valid data"
• "Stale data"
And then moves "stale data" to blocks whereby those blocks get deleted with a flash of voltage.

Along comes TRIM: when the OS deletes a file, "TRIM" tells "Garbage Collection" that the file is no longer needed.

My question is "SO WHAT if the OS's TRIM command tells Garbage Collection the file is no longer needed?"

Garbage Collection STILL needs to move those "no longer needed" files to blocks where they can get zapped by voltage.

All over the internet are those long "explanations with pretty charts" showing what TRIM and Garbage Collection does, but it still looks like TRIM has to move around the "no longer needed" files anyway...

Obviously I'm missing something :)
 
Thank you, Lou. But as I mentioned I've already read several copies of that article that is all over the Internet. My question still stands. If you would please read the Link you shared, you would have the same question.
 
I think you're perhaps misunderstanding how it is all glued together...

Garbage Collection is the SSD internal process for clearing empty cells. The SSD will perform this automatically at intervals that are controlled by its internal algorithms. It is completely unknown to the OS or anything else.

Wear Leveling is the SSD process for moving data around on the drive aimed at helping the drive wear evenly and last longer as a result. You don't want all of your writes happening on the first 10GB of a 100GB SSD because the user only ever uses 10GB. This was fine on an magnetic HDD, but not on an SSD. The SSD will internally move data around transparently to the OS and other applications that are listening for that data on top of it. Cells that have been moved around for wear leveling would then to cleaned up by the SSD Garbage Collection Process.

TRIM is valuable because it allows the OS to tell the SSD which blocks are no longer needed. The SSD can then purge those blocks whenever it decides to do so. But it now knows that those blocks are stale. Without this the SSD would be unable to free up space internally as often and it would weaken the wear leveling and garbage collection processes.

In the old magnetic HDD days it wasn't important for the OS to tell the underlying storage media that blocks were stale since there was no cost to leaving the waste behind.
 
@LogicalApex, thank you for taking the time to answer. However, I might have to close this thread as "unanswered" because my question is very specific. The generalization "...is the internal process for clearing empty cells," is too vague. Data occupies "pages," which in turn occupy "blocks." Garbage collection is continually moving Valid data, and corralling Stale data to "blocks." The voltage required to actually 'zap' (make available for writing again) is too strong to zap just a 'page' (usually 4k), so Garbage Collection moves the Stale Data to "blocks" where they can then be zapped ("cleared"). My question is "EXACTLY WHAT" triggers Garbage Collection to actually CLEAR those blocks, if the OS does not have TRIM support.....
Again, thank you for taking the time to answer, but I think my question might go unanswered here, I might have to find an engineering forum. Any ideas?
 
@LogicalApex, thank you for taking the time to answer. However, I might have to close this thread as "unanswered" because my question is very specific. The generalization "...is the internal process for clearing empty cells," is too vague. Data occupies "pages," which in turn occupy "blocks." Garbage collection is continually moving Valid data, and corralling Stale data to "blocks." The voltage required to actually 'zap' (make available for writing again) is too strong to zap just a 'page' (usually 4k), so Garbage Collection moves the Stale Data to "blocks" where they can then be zapped ("cleared"). My question is "EXACTLY WHAT" triggers Garbage Collection to actually CLEAR those blocks, if the OS does not have TRIM support.....
Again, thank you for taking the time to answer, but I think my question might go unanswered here, I might have to find an engineering forum. Any ideas?
The SSD controller triggers and manages garbage collection.

I think you are looking at things slightly askew.
 
Q: "What triggers my telephone to ring?"
A: "The bell inside."

I'm reminded of my first grade teacher. When I asked a math question, she told me I would have to wait until 2nd grade to find out. The real reason was she didn't know the answer.

Thread closed.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.