Skip to content
BetterDL

Flash memory

Also called: flash, NAND flash, NOR flash, flash ROM, flash storage

Electrically erasable non-volatile memory that is erased in large blocks rather than byte by byte. Dense and cheap; used in SSDs, USB drives and firmware.

Flash is the electrically erasable member of the ROM family that won. Like an EEPROM, it stores bits as charge on floating gates and needs no power to keep them: it's non-volatile.

The difference is how it erases: in blocks, often thousands of bytes at a time. Writing can set individual bits one way, but changing them back requires erasing the whole block. Giving up byte-level erasing lets the cells be smaller and simpler, so flash is far denser and cheaper per bit.

Changing one byte inside a block therefore takes three steps:

  1. Read the whole block into RAM.
  2. Erase the block.
  3. Write the block back with the one byte changed.

Flash wears out after a limited number of erase cycles per block, so controllers spread writes around (wear leveling).

Where it's used: SSDs, USB sticks, memory cards, phones, and the firmware of almost every modern device, which is why firmware can be updated in the field.

Worked example

Example

Changing one byte

A flash chip erases in 4 KiB blocks. One byte in a block must change.

  1. 1.

    Copy the 4096-byte block into RAM.

  2. 2.

    Change the one byte in the RAM copy.

  3. 3.

    Erase the whole block on the flash chip.

  4. 4.

    Write all 4096 bytes back. One small change cost a full block erase.

Common mistakes

  • Thinking flash rewrites single bytes in place like RAM. Erasing always works on whole blocks.

  • Calling flash volatile. It keeps its data with the power off.

  • Assuming unlimited rewrites. Each block survives a limited number of erase cycles.

Practice Flash memory

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Flash memory is taught in Memory.