Read Data , Write Data
The most basic component of a flash memory chip is the flash cell, which we just covered. Group a few of these cells together; you will get a page which is 4 KB in size. A page is the smallest entity that is readable/writable in a SSD. Next, group 128 pages together to get a block which is the smallest entity that can be erased. Moving on with the grouping, 1024 of these blocks form a plane. Then these planes are grouped together to form a flash die.
The image below will help explain the concept of grouping further.
The main points to remember here are that
- 1 Plane -> 1024 Blocks
- 1 Block -> 128 Pages
- 1 Page -> several flash cells
In terms of size,
- 1 Page -> 4KB
- 1 Block -> 512 KB
- 1 Plane -> 512 MB
How data is written to the SSD
Remember we just talked about a page which is the smallest entity that you can write data to or read data from in a SSD. The size of the page is normally 4 KB in size. So you can read or write data to a SSD 4 KB at a time. Now things are about to get interesting. Although you can read/write 4 KB at a time, if you want to erase you have to do so 512 KB at a time. Remember, that 512 KB is a block. So you can read/write in pages but can only erase in blocks. Pay close attention to the text in bold, as I’m going to refer to it in a moment.
When a user deletes a file, the OS marks it as deleted and removes it from it’s memory of files that exist on the disk. In reality the file is not deleted on the disk. This is how most of the file recovery software work. The file is truly deleted when it is overwritten by another file.
In a SSD, although an OS will mark a file as deleted, the SSD controller has no idea that the file is deleted. The problem arises when you try to write a new file to a page that has been marked as deleted by the OS. Remember the bolded text above, this condition will cause the difference in how a file is overwritten in SSD vs Hard Disk Drive (HDD). While the sectors containing deleted files in hard disk can be overwritten, this is not possible in SSD. This is because to overwrite data in a SSD, you first need to erase the old data.
To get around having to erase data everytime you want to write, SSDs try to fill up all the available pages first. So even though your operating system may say you have such and such free space left, the SSD controller does not know about the deleted files. The end result is that it takes longer to write a file to a SSD than you would expect because the resident data has to be erased first. Take a look at the example below of how the actual write operation works in a SSD.
1. The user wants to write 8 KB (2 Pages) of data. The block has 2 pages that are marked as deleted by the OS, but data still exists on the physical media.
2. To write the new data these 2 pages will have to be erased first. So the entire contents of the block (512 KB) are copied to the SSD cache, where individual pages can be deleted.
3. The new data is written over the previously deleted pages in the SSD cache.
4. The entire data (512 KB) is written back from the memory to the block along with the new data.
Notice that just to write 8 KB, we had to first copy 512 KB into the memory, then we had to write 512 KB back to the block. This is why SSDs write speeds go down as more and more data is written to them. This is why newer SSDs are being released with a larger cache as it really helps in the write speeds. The Torqx M28 drive we are testing in this review features 128 MB of cache.