Friday, March 14, 2008

Limitations of Flash memory

Flash memory is non-volatile computer memory that can be electrically erased and reprogrammed. It is a technology that is primarily used in memory cards, and USB flash drives for general storage and transfer of data between computers and other digital products.

One limitation of flash memory is that although it can be read or programmed a byte or a word at a time in a random access fashion, it must be erased a "block" at a time. This generally sets all bits in the block to 1. Starting with a freshly erased block, any location within that block can be programmed. However, once a bit has been set to 0, only by erasing the entire block can it be changed back to 1. In other words, flash memory (specifically NOR flash) offers random-access read and programming operations, but cannot offer arbitrary random-access rewrite or erase operations. A location can, however, be rewritten as long as the new value's 0 bits are a superset of the over-written value's. For example, a nibble value may be erased to 1111, then written as 1110. Successive writes to that nibble can change it to 1010, then 0010, and finally 0000. Although data structures in flash memory cannot be updated in completely general ways, this allows members to be "removed" by marking them as invalid. This technique must be modified somewhat for multi-level devices, where one memory cell holds more than one bit.


Another limitation is that flash memory has a finite number of erase-write cycles (most commercially available flash products are guaranteed to withstand 100,000 write-erase-cycles for block 0, and no guarantees for other blocks. This effect is partially offset by some chip firmware or file system drivers by counting the writes and dynamically re-mapping the blocks in order to spread the write operations between the sectors; this technique is called wear leveling. Another mechanism is to perform write verification and re-mapping to spare sectors in case of write failure, which is named bad block management (BBM). With these mechanisms in place, some industry analysts have calculated that flash memory can be written to at full speed continuously for 51 years before exceeding its write endurance, even if such writes frequently cause the entire memory to be overwritten. This figure (51 years) involved a worst-case scenario using specific data parameters and should not be confused with a particular "shelf life" for a flash memory device. The bottom line is that a typical user using a commercial device, such as a camera, with a flash drive will probably not wear out the memory for the effective life of the camera. However, it - like any other hardware component - can fail. Anyone using flash memory (and any other medium) for critical data would be well advised to backup the data to another device (preferably of a different medium). Many have found it very fast and reliable for 'read-only' operating systems such as thin clients and routers.

No comments: