Flash memory is one of the most useful, and ubiquitous, tech inventions of the last 25 years. It’s become the portable storage media of choice for small devices such as USB thumb drives, digital cameras, cell phones, and digital media players, and it looks poised to replace the spinning hard drives in laptops.
Although Toshiba invented the technology, Intel was the first company to introduce a commercial flash memory chip, and it currently holds the lion’s share of the market (followed by Samsung). This technology was dubbed “flash” because the process of erasing its contents evoked images of flash photography. Flash memory is a nonvolatile (meaning it does not require electrical power to retain the information stored in it) type of EEPROM (Electrically Erasable Programmable Read-only Memory) that can be erased and programmed in large blocks. Other types of EEPROMs, such as those used to store a BIOS, must be erased in their entirety before new data can be written. Flash memory stores data in an array of cells with a transistor at each intersection of a row and column. It erases and writes data in chunks, instead of one byte at a time, so it does not suffer from the same limitation typical of EEPROMs.
Flash memory stores data in an array of cells consisting of two transistors—a floating gate and a control gate—separated by a thin layer of oxide insulation. When sufficient voltage is applied to the control gate, excited electrons are pushed through the oxide layer (in a process known as “tunneling”) and accumulate inside the floating gate. When this happens, the cell changes its stored bit value from 0 to 1. Under normal conditions, the electrons trapped on the other side of the floating gate won’t discharge for many years, giving the medium its nonvolatile nature.
Single-level cell (SLC) devices store one bit of data in each cell. Multilevel cell (MLC) devices can store more than one bit of data in each cell by accumulating different levels of electrical charge inside the floating gate. A two-bit cell, for instance, can distinguish between four distinct voltages.
Memory-chip designers use one of two methods of data mapping, NAND or NOR (these terms describe the type of logic gates deployed), to interconnect memory cells. Neither approach is universally superior; rather, each is best suited for a particular application. NOR flash memory cells are connected in parallel, so each individual cell can be read and programmed individually. NAND cells are connected in series and must be read from and written to in series.
| NOR flash memory has a contact point for each cell, which renders it capable of fast random access, much like RAM. NAND flash cells operate in series but deliver much faster write and erase operations. This renders NAND well suited for file storage.
The upshot is that data can be read from NOR flash in much the same way that it’s read from random-access memory (RAM). Thanks to this attribute, most microprocessors can use NOR flash memory as execute-in-place (XIP) memory. In other words, NOR flash memory can store and execute software programs without writing the instructions into RAM first. NOR flash memory can also be partitioned, so an application can run in one partition while data is simultaneously read, written to, or erased from another. For these reasons, NOR flash memory is often deployed in handheld devices, such as cell phones, and in embedded systems.
Toshiba developed NAND flash memory later, but it lacks the random-access nature of NOR memory. That precludes it from use as a replacement for system ROM. On the other hand, NAND boasts much faster erase and write times, and it provides greater storage density and a lower cost per bit of storage. NAND cannot be partitioned and data must be read from it one segment at a time. These characteristics render NAND similar to other types of secondary storage, such as hard drives and optical discs. You’ll find NAND memory in Compact Flash (CF), Memory Stick, MultiMediaCard (MMC), all forms of SecureDigital (SD), and xD-Picture Card media. The technology has also been tapped for use in solid-state hard drives.
Most removable flash media has an embedded microcontroller. This enables SD, CompactFlash, and USB thumb drives to be formatted using the familiar FAT file system that Microsoft developed for MS-DOS.
Flash memory devices that don’t have an embedded microcontroller typically use FTL (Flash Translation Layer), a file system that makes a flash memory device look like a FAT (File Allocation Table) disk to the operating system but that also performs wear leveling. JFFS2 (Journaling Flash File System vers. 2) was developed for using flash devices with Linux; it supports both NOR and NAND flash.
The retail price of NAND flash-memory products—SD, CF, xD, and so on—is determined largely by two factors: capacity and speed. The first concept is easy to understand; the second is more confusing than it should be because manufacturers measure performance in different ways.
Patriot Memory, for instance, rates the speed of its 2GB CompactFlash card (part number PSF2G50CF, street price $21) as being “50x.” Read the spec sheet, however, and you’ll find that the 50x refers only to the read speed; no rating is given for write speed. Assuming 1x is 150KB/s (with KB/s defined as 1,024 bytes per second, the data transfer speed of the first compact-disc drives), Patriot’s card is capable of transferring data to its host device at a rate of 7.32MB/s.
SanDisk, on the other hand, lists separate read and write speeds for its Ultra II 2GB CompactFlash card (street price $36) of 10MB/s and 9MB/s, respectively. But since its spec chart measures 1MB as one million bytes, you’ll need to do a little math to obtain a true comparison. (Using Patriot’s terminology, SanDisk’s device delivers read speeds of 9.53MB/s and write speeds of 8.58MB/s.)
NOR and NAND flash memory both have a finite number of erase-write cycles—anywhere between 10,000 and one million—but this limitation is typically offset by wear-leveling instructions in firmware that count the number of write cycles for each cell and dynamically remap the blocks so that erasures and writes are distributed evenly across the medium.
Many NAND flash memory devices have an embedded microcontroller that performs a routine known as bad-block management. If a write operation fails, the microcontroller can remap the data to a spare sector of memory. In fact, most NAND devices are known to have bad blocks when they leave the factory, but since those bad blocks are known, they’re mapped so they don’t get written to. This helps increase yield and hold down costs because not every component needs to be perfect as long as the device delivers at least the amount of storage its manufacturer claims for it.
Thanks to bad-block management, wear leveling, and the absence of any moving parts, most flash memory media should outlast any device that uses it. That’s not to say it’s infallible, however; anyone using it to store digital photos or other valuable content would be well advised to make backup copies.