Explanation of a Flash chip’s storage management routine
Hats off to Louis Gerbarg on his excellent write-up of how a Flash chip manages reads, writes, and most interestingly – deletes. I have a relatively comprehensive understanding of how file systems work from classes back at CMU. But back when I was taking those classes, Flash storage was basically non-existent in a file system context. This post is definitely eye-opening and if you’re at all interested in how this stuff works, I highly recommend checking it out. Here’s a quote that’ll get you interested in this stuff:
Okay, so lets assume for a second we have a 1MB flash device with 2 512KB blocks. This would be sold to the consumer as a 512KB flash drive, because some amount of the internal storage needs to be used for bookkeeping as we shall see.
And another quote:
Flash is a relatively complicated storage medium, and has its own view of the world. It works in terms of pages and blocks. Usually a page is the smallest amount of space you can reasonably read or write to a a flash chip (for our discussion, 4K), and a block is the smallest chunk of space you can erase at a time (for our discussion 128 blocks). With a fresh (unwritten block) all the bits are set to “1″, and during a write they can only be transition to “0.” That means in order to rewrite a page you must erase it first. This is a super important point, you can’t just go and erase a page of the flash, you need to erase the 128 contiguous pages contained in a whole block at a the same time.
And I thought tuning a filesystem to provide the best contiguous access to large files was interesting. By comparison Flash garbage collection and bookkeeping algorithms must be fascinating. In any case, I guess I’m just a little nostalgic reminiscing about CMU’s 15-412 Operating Systems course.
Tags: file systems, flash