Hi, it's HandyAndy Tech Tips here, and today I'm going to tell you a few things about SSDs
that you might not have known, and which might help you reach a decision as to whether to
buy one or not.
So, first off, let's start with speed.
Now everybody knows that storage is the biggest bottleneck in a modern PC.
You can replace your CPU, your graphics card, and your RAM, but nothing will make as big
a difference as changing your storage device.
Now, speed can be measured in several different ways, but the most common one seems to be
throughput.
That is, how fast contiguous, or sequential, blocks of data can be transferred from your
disk to RAM.
But in practical terms, such a figure is a little bit meaningless.
There's not much point being able to transfer a huge file at several hundred megabytes per
second, if smaller files - in other words, those which your operating system is likely
to use - are very slow to find.
Here's the problem.
With desktop hard drives, it can take around 9 milliseconds for the head of the drive to
move to the area on the platter where the data that you want is stored.
For laptop hard drives, this figure can be even worse, in the ballpark of about 15 milliseconds.
But SSDs - on the other hand - have no moving parts, so their access time is based mainly
around I/O limitations.
And what is it?
100 microseconds.
Yep, that's 0.1 milliseconds.
With this kind of speed, you would be forgiven for thinking that SSDs could never get fragmented.
After all, you could have little bits of data lying everywhere and they would be almost
instantaneous to access, right?
Well, I want you to cast your mind back a couple of years and remember the lag problems
that plagued the first generation of the Nexus 7.
These were caused by a fundamental problem with the way that flash memory is written.
In many cases, this problem is even worse than fragmentation, but it can be solved with
something called TRIM.
Let me explain.
At the most basic level, NAND memory is made up of cells, which store binary digits.
However, to reduce complexity, the smallest unit which can be read or written is called
a "page", which is a collection of cells.
Just in case you're wondering, a page is a bit like a sector, and can range from 2KB
to 16KB.
Anyway, writing new data to free pages, as you can see, is quite easy - I can write x,
y, z, b, q, p, which represents some data in there.
But what if I wanted to erase some data, so I wanted to get rid of y and z?
On a traditional hard drive, the operating system would simply mark these sectors as
deleted, even though there was still data in them.
And, indeed, on an SSD without TRIM, a similar thing would happen.
The difference comes when the new data is written in.
On a hard drive, sectors can be erased individually.
However, on an SSD, the entire block, the entire collection of pages must be destroyed.
As an example, let's see what would happen if we wanted to overwrite y and z.
First, so that we don't lose anything, we need to go to another block - Block B - and
we'll copy the data that we want to keep from Block A over to that.
So, I'm going to copy x, b, q and p.
Then, we wipe Block A - we delete everything from it.
The new Block A is therefore a combination of the original data that we wanted to keep
from Block A - which is now stored in Block B - plus the new data.
So you can see that x, b, q and p are still there, but we've replaced y and z - they've
been deleted - with r and s.
Now, you can see how this process could seriously slow down your SSD.
If, for every tiny file - say, for example, a file only a couple of kilobytes in size
- you had to rewrite megabytes of data, then storage would be pathetically slow.
THIS is where TRIM comes in.
Instead of the operating system just marking the data as "destroyed" itself, only to be
rewritten later, the operating system will now tell the SSD that it wants to delete that
particular data.
This allows this big, long-winded process that I've just shown you to be skipped when
new data is being written.
Essentially, it's a form of garbage collection - which is a term that a lot of programmers
will be familiar with - and it's part of the reason why SSDs are so fast.
Anyway, I'm HandyAndy and thank you very much for watching Part 1 of this series.
In part two, we look at reliability.
Well, many people have argued that the adoption of such techniques as wear-levelling and overprovisioning,
which basically spread out the read/write cycles evenly amongst all the cells in the
SSD, will offset such a limitation.