Editor's note: This item was updated in December 2016.
When discussing flash memory vs. RAM, both technologies are made up of solid-state chips, but the way they are made, their performance specifications and the relative costs mean they play completely different roles in a computer system. Flash memory is used for storage, while RAM is used as active memory that performs calculations on the data retrieved from storage.
In terms of flash memory vs. RAM speed, RAM is the faster of the two, but it is also more expensive to make. There are two types of RAM commonly used in a computer system: dynamic random access memory (DRAM) and static random access memory (SRAM). Because SRAM is so much more expensive than DRAM, in addition to being faster, it is mainly used as the cache memory inside the integrated circuit that is a computer's CPU. DRAM, being so much less expensive, is mainly used as the primary operational memory, running the operating system (OS) and applications.
Less expensive still is flash memory, which is nonvolatile memory that can hold data even without power, unlike RAM. Compared to either type of RAM, flash memory speed is significantly slower. Because of the slower speed, its persistent nature and its lower cost, flash is used for storage memory, most commonly in devices like solid-state drives.
How RAM works
Since SRAM is built into a CPU and can't be adjusted by the user, let's look at how DRAM works. DRAM uses storage cells made up of a capacitor and a transistor. As mentioned earlier, DRAM storage is dynamic -- it needs a new electronic charge every few milliseconds to compensate for charge leaks from the capacitor. Those storage cells are built into a solid-state chip, and those chips are collected into the familiar rectangular RAM module that is placed into the RAM connectors on a computer's motherboard.
The computer OS running in the RAM calls for data from storage when needed, and the bits that make up that data are held in the storage cells until the OS or application calls for them to be written back to the storage memory.
How flash memory works
Flash memory is made of solid-state chips in which the transistors are connected so they function similar to the logic gate type called NAND. Flash memory is nonvolatile -- able to retain data without a supply of power. Data has to be erased from NAND flash memory in entire blocks -- even if you only need to erase a few bits of data in the block -- as opposed to individual bits, as is the case with RAM. In addition to helping make flash memory slower than RAM, early flash requirements to erase data in entire blocks also caused it to wear out faster than RAM. Today, flash memory lasts much longer due to software functions such as wear leveling.
Flash memory also has a finite number of program-erase cycles before individual blocks can no longer hold any data. Wear leveling helps extend the life of flash memory by spreading the data to different blocks.
NAND flash could be overtaken by new technologies
Flash technology advancements overcome server-side flash challenges
Flash takes on new role as complement to DRAM