Flash Memory Musings

Today I browsed through various news articles and noticed that Apple are considering to incorporate more flash memory into its products. Subnotebooks will have it, and analysts speculate that the iPod brand will go cold turkey on HDDs and go for flash instead in a while. Also, Samsung have released flash hybrid HDDs. Flash seems to be mighty popular right now!

This got me thinking. It’s a well-known fact that flash memory has a limited amount of rewrites. A common number to throw around is a hundred thousand rewrites. Reading up on the issue a little shows that things aren’t really that simple… A hundred thousand rewrites seems to be a fictional number that someone conjured as a vague average: instead, what matters is the number of erase-write cycles. These number a whopping million rather than a hundred thousand; however, the mapping between erase-write cycles and rewrites isn’t that simple.

There are two types of flash memory: NOR and NAND. NOR flash memory is slow and expensive, but it has a full address interface which allows random access to any location. It’s basically comparable to normal RAM in that aspect. Apparently, it’s often used for BIOS and firmware for embedded consumer products. This type of flash was used in Compact Flash earlier, but later scrapped for the cheaper NAND. NAND also has faster erase and write times and longer endurance, and is used in most products these days. (In fact, I can’t see any reason that NOR is better for BIOSes or firmware. There’s nothing in the nature of those products that requre random access; it must be a typo in Wikipedia.) This type of flash is the one that has a million promised erase-write cycles.

But, and this is a big but: NAND only addresses memory sequentially. There’s no random access, so if you want to – say – read address 0x00ffc you have to read the entire block that contains that address…and the same goes when you want to write something down. In other words, large files will span several blocks and require several erase-write cycles. The last bit is what makes me sit up and take notice.

It’s also interesting to read what Samsung wrote a while ago:

The hybrid hard drive prototype uses 1 Gigabit OneNAND Flash as both the write buffer and boot buffer. In the hybrid write mode, the mechanical drive is spun down for the majority of the time, while data is written to the Flash write buffer. When the write buffer is filled, the rotating drive spins and the data from the write buffer is written to the hard drive.

Is it just me or does this seem rather ineffective, considering that HDDs have a relatively long lifetime – probably longer than the flash’s amount of rewrites. What happens if the flash gives in prior to the HDD? Is the write buffer required or can the hybrid HDD be used as a normal HDD after the flash has croaked? I hope the latter, but I fear that the functions are relatively hard-wired; HDD lifetime expectancy will probably drop, in other words. I know that people talk about switching all your hard drives every third year or so, but seriously, how many do that? I have hard drives that are probably older than some of you who read this. (At least the spambots; I’m sure that I have older HDDs than them.) I do not want a trend where life expectancy is dropping in favour of non-movable parts.

But then again, flash firmware have this neat thing called wear levelling:

This effect is partially offset by some chip firmware or file system drivers by counting the writes and dynamically remapping the blocks in order to spread the write operations between the sectors. This technique is called wear levelling.

I can only assume that similar techniques are implemented for the hybrid HDDs, and that the very nature of using the flash as a write cache rather than random access media will cause the wear to be level. Still, balancing out the wear doesn’t cover the fact that erase-write cycles are pretty limited. I wonder how many blocks are accessed per day in normal computer use; speculating about life expectancy would be much easier if I had some real numbers to mess with rather than throwing up vague ideas that “HDDs last longer than flash.”

It’s strange, really: I’ve been working with flash-based embedded systems for a while, but I never had a grasp of the hardware involved. It’s probably a good thing to read up on things now and then.

Leave a Reply

Copyright © 2009 KarjaSoft