Viz.:
Rather than dilute other threads, I am starting a thread on the topic of solid state media and TRIM.
As I mentioned in my previous post:
Why TRIM?
Magnetic media devices, particularly hard drives, can read, write, erase, or whatever at the sector/cluster level, completely independent of any other sectors or clusters elsewhere on the device. In essence, they are mechanical, persistent RAM.
The physical device doesn’t have to manage garbage collection, (aside from reallocating bad blocks), as that’s entirely within the operating system’s control and authority.
The operating system manages the volume bitmap, the “deleted” flag on directory items, cluster file links, etc. As far as the media device is concerned, all it does is follow instructions - go hither and yon, and do something.
Magnetic media is changeable at the micro-level.
On the other hand, solid state media is fundamentally different. Instead of storing data as easily-changed magnetic domains on a surface, solid state media stores data as trapped charges that are “injected” into an isolated gate buried within a silicon substrate.
Because they’re “injected”, (requiring relatively high amounts of energy to trap the charge), they cannot be “un-trapped”.
Actually, they can, but it’s not easy.
Early solid state devices, (EPROMs), used high energy ultraviolet light to allow the trapped charges to bleed away.
Later devices (Electrically Erasable PROMs or EEPROM devices), could be erased by a special, higher voltage signal that would discharge the trapped charges. (CMOS firmware chips are common examples of this.)
The problem with all of these was that it was an “all or none” arrangement. When you erased the device, you erased the ENTIRE device. If you had to update five bytes of data, you had to nuke and reprogram the entire device from start to finish.
“Flash” devices introduced the ability to modify localized domains within the device, but there was a “quid” to be paid for that “pro-quo” - the flash devices was, essentially, a collection of EEPROM devices on the same die.
Now, that’s not exactly true, but it’s close enough to make the point.
An “erase block” is roughly the equivalent of an individual electrically erasable device with smaller writable domains within it.
As a consequence, erase blocks are huge, many megs in size.
Since only an entire erase block can be erased to prepare it for re-use, management of them becomes a major task and non-trivial amounts of programming logic are devoted to it. SSD’s and flash devices have entire processors and miniature operating systems installed just to manage the memory. A recent tear-down, (un-encapsulation), of a SSD showed a large-scale ATMEL processor running the show within it.
So, it’s important to understand the significant architectureal differences between magnetic media and solid-state media.