RAM, or random access memory, is a kind of computer memory in which any byte of memory can be accessed without needing to access the previous bytes as well. RAM is a volatile medium for storing digital data, meaning the device needs to be powered on for the RAM to work. DRAM, or Dynamic RAM, is the most widely used RAM that consumers deal with. DDR3 is an example of DRAM.
SRAM, or static RAM, offers better performance than DRAM because DRAM needs to be refreshed periodically when in use, while SRAM does not. However, SRAM is more expensive and less dense than DRAM, so SRAM sizes are orders of magnitude lower than DRAM.
Different Kinds of Memory Explained
The following video explains the different types of memory used in a computer — DRAM, SRAM (such as used in a processor's L2 cache) and NAND flash (e.g. used in an SSD).
Structure and Function
The structures of both types of RAM are responsible for their main characteristics as well as their respective pros and cons. For a technical, in-depth explanation of how DRAM and SRAM work, see this engineering lecture from the University of Virginia.
Dynamic RAM (DRAM)
Each memory cell in a DRAM chip holds one bit of data and is composed of a transistor and a capacitor. The transistor functions as a switch that allows the control circuitry on the memory chip to read the capacitor or change its state, while the capacitor is responsible for holding the bit of data in the form of a 1 or 0.
In terms of function, a capacitor is like a container that stores electrons. When this container is full, it designates a 1, while a container empty of electrons designates a 0. However, capacitors have a leakage that causes them to lose this charge, and as a result, the “container” becomes empty after just a few milliseconds.
Thus, in order for a DRAM chip to work, the CPU or memory controller must recharge the capacitors that are filled with electrons (and therefore indicate a 1) before they discharge in order to retain the data. To do this, the memory controller reads the data and then rewrites it. This is called refreshing and occurs thousands of times per second in a DRAM chip. This is also where the “Dynamic” in Dynamic RAM originates, since it refers to the refreshing necessary to retain the data.
Because of the need to constantly refresh data, which takes time, DRAM is slower.
Static RAM (SRAM)
Static RAM, on the other hand, uses flip-flops, which can be in one of two stable states that the support circuitry can read as either a 1 or a 0. A flip-flop, while requiring six transistors, has the advantage of not needing to be refreshed. The lack of a need to constantly refresh makes SRAM faster than DRAM; however, because SRAM needs more parts and wiring, an SRAM cell takes up more space on a chip than a DRAM cell does. Thus, SRAM is more expensive, not only because there is less memory per chip (less dense) but also because they are harder to manufacture.
Because SRAM does not need to refresh, it is typically faster. The average access time of DRAM is about 60 nanoseconds, while SRAM can give access times as low as 10 nanoseconds.
Capacity and Density
Because of its structure, SRAM needs more transistors than DRAM to store a certain amount of data. While a DRAM module only requires one transistor and one capacitor to store every bit of data, SRAM needs 6 transistors. Since the number of transistors in a memory module determines its capacity, for a similar number of transistors, a DRAM module can have up to 6 times more capacity than an SRAM module.
Typically, an SRAM module consumes less power than a DRAM module. This is because SRAM only requires a small steady current while DRAM requires bursts of power every few milliseconds to refresh. This refresh current is several orders of magnitude greater than the low SRAM standby current. Thus, SRAM is used in most portable and battery-operated equipment.
However, the power consumption of SRAM does depend on the frequency at which it is accessed. When SRAM is used at a slower pace, it draws nearly negligible power while idled. On the other hand, at higher frequencies, SRAM can consume as much power as DRAM.
SRAM is much more expensive than DRAM. A gigabyte of SRAM cache costs around $5000, while a gigabyte of DRAM costs $20-$75. Since SRAM uses flip-flops, which can be made of up to 6 transistors, SRAM needs more transistors to store 1 bit than DRAM does, which only uses a single transistor and capacitor. Thus, for the same amount of memory, SRAM requires a higher number of transistors, which increases the production cost.
Like all RAM, DRAM and SRAM are volatile and therefore cannot be used to store "permanent" data such as operating systems or data files like pictures and spreadsheets.
The most common application of SRAM is to serve as cache for the processor (CPU). In processor specifications, this is listed as L2 cache or L3 cache. SRAM performance is really fast but SRAM is expensive, so typical values of L2 and L3 cache are 1MB to 8MB.
The most common application of DRAM — such as DDR3 — is volatile storage for computers. While not as fast as SRAM, DRAM is still very fast and can connect directly to the CPU bus. Typical sizes of DRAM are about 1 to 2GB in smartphones and tablets, and 4 to 16GB in laptops.
- Lecture 21: Storage - Computer Science at the University of Texas-Austin
- SRAM memory interface to microcontroller in embedded systems - EE Herald
- Wikipedia: Dynamic random-access memory
- Wikipedia: Static random-access memory
- Wikipedia: Memory refresh