Random Access Memory (RAM) is the hardware in a computing device where the operating system (OS), application programs and data in current use are kept so they can be quickly reached by the device's processor. RAM is the main memory in a computer, and it is much faster to read from and write to than other kinds of storage, such as a hard disk drive (HDD), solid-state drive (SSD) or optical drive.
Random Access Memory is volatile. That means data is retained in RAM as long as the computer is on, but it is lost when the computer is turned off. When the computer is rebooted, the OS and other files are reloaded into RAM, usually from an HDD or SSD.
What Random Access Memory is used for
Because of its volatility, Random Access Memory can't store permanent data. RAM can be compared to a person's short-term memory, and a hard drive to a person's long-term memory. Short-term memory is focused on immediate work, but it can only keep a limited number of facts in view at any one time. When a person's short-term memory fills up, it can be refreshed with facts stored in the brain's long-term memory.
A computer also works this way. If RAM fills up, the computer's processor must repeatedly go to the hard disk to overlay the old data in RAM with new data. This process slows the computer's operation.
A computer's hard disk can become completely full of data and unable to take any more, but RAM won't run out of memory. However, the combination of RAM and storage memory can be completely used up.
How does RAM work?
The term random access as applied to RAM comes from the fact that any storage location, also known as any memory address, can be accessed directly. Originally, the term Random Access Memory was used to distinguish regular core memory from offline memory.
Offline memory typically referred to magnetic tape from which a specific piece of data could only be accessed by locating the address sequentially, starting at the beginning of the tape. RAM is organized and controlled in a way that enables data to be stored and retrieved directly to and from specific locations.
Other types of storage -- such as the hard drive and CD-ROM -- are also accessed directly or randomly, but the term random access isn't used to describe these other types of storage.
RAM is similar in concept to a set of boxes in which each box can hold a 0 or a 1. Each box has a unique address that is found by counting across the columns and down the rows. A set of RAM boxes is called an array, and each box is known as a cell.
To find a specific cell, the RAM controller sends the column and row address down a thin electrical line etched into the chip. Each row and column in a RAM array has its own address line. Any data that's read flows back on a separate data line.
RAM is physically small and stored in microchips. It's also small in terms of the amount of data it can hold. A typical laptop computer may come with 8 gigabytes of RAM, while a hard disk can hold 10 terabytes.
RAM microchips are gathered together into memory modules, which plug into slots in a computer's motherboard. A bus, or a set of electrical paths, is used to connect the motherboard slots to the processor.
A hard drive, on the other hand, stores data on the magnetized surface of what looks like a vinyl record. And, alternatively, an SSD stores data in memory chips that, unlike RAM, are nonvolatile, don't depend on having constant power and won't lose data once the power is turned off.
Most PCs enable users to add RAM modules up to a certain limit. Having more RAM in a computer cuts down on the number of times the processor must read data from the hard disk, an operation that takes longer than reading data from RAM. RAM access time is in nanoseconds, while storage memory access time is in milliseconds.
Types of Random Access Memory
RAM comes in two primary forms:
Dynamic Random Access Memory (DRAM) makes up the typical computing device's RAM and, as was previously noted, it needs that power to be on to retain stored data.
Each DRAM cell has a charge or lack of charge held in an electrical capacitor. This data must be constantly refreshed with an electronic charge every few milliseconds to compensate for leaks from the capacitator. A transistor serves as a gate, determining whether a capacitor's value can be read or written.
Static Random Access Memory (SRAM) also needs constant power to hold on to data, but it doesn't need to be continually refreshed the way DRAM does.
In SRAM, instead of a capacitor holding the charge, the transistor acts as a switch, with one position serving as 1 and the other position as 0. Static RAM requires several transistors to retain one bit of data compared to dynamic RAM which needs only one transistor per bit. As a result, SRAM chips are much larger and more expensive than an equivalent amount of DRAM.
However, SRAM is significantly faster and uses less power than DRAM. The price and speed differences mean static RAM is mainly used in small amounts as cache memory inside a computer's processor.
History of RAM: RAM vs. SDRAM
RAM was originally asynchronous because the RAM microchips had a different clock speed than the computer's processor. This was a problem as processors became more powerful and RAM couldn't keep up with the processor's requests for data.
In the early 1990s, clock speeds were synchronized with the introduction of synchronous dynamic RAM, or SDRAM. By synchronizing a computer's memory with the inputs from the processor, computers were able to execute tasks faster.
However, the original single data rate SDRAM (SDR SDRAM) reached its limit quickly. Around the year 2000, double data rate synchronous Random Access Memory (DDR SRAM) was developed. This moved data twice in a single clock cycle, at the start and the end.
DDR SDRAM has evolved three times, with DDR2, DDR3 and DDR4, and each iteration has brought improved data throughput speeds and reduced power use. However, each DDR version has been incompatible with earlier ones because, with each iteration, data is handled in larger batches.
The JEDEC Solid State Technology Association has been working on the fifth generation of DDR technology, or DDR5 SDRAM, for several years, and it plans to release the full standard in June 2018.
Graphics double data rate (GDDR) SDRAM is used in graphics and video cards. Like DDR SDRAM, the technology enables data to be moved at various points in a CPU clock cycle. However, it runs at higher voltages and has less strict timing than DDR SDRAM.
With parallel tasks, such as 2D and 3D video rendering, tight access times aren't as necessary, and GDDR can enable the higher speeds and memory bandwidth needed for GPU performance.
Similar to DDR, GDDR has gone through several generations of development, with each providing more performance and lower power consumption. GDDR6 is the latest generation of graphics memory.
RAM vs. virtual memory
A computer can run short on memory, especially when running multiple programs simultaneously. Operating systems can compensate for physical memory shortfalls by creating virtual memory.
With virtual memory, data is temporarily transferred from RAM to disk storage, and virtual address space is increased using active memory in RAM and inactive memory in an HDD to form contiguous addresses that hold an application and its data. Using virtual memory, a system can load larger programs or multiple programs running at the same time, letting each operate as if it has infinite memory without having to add more RAM.
Virtual memory is able to handle twice as many addresses as RAM. A program's instructions and data are initially stored at virtual addresses, and once the program is executed, those addresses are turned into actual memory addresses.
One downside to virtual memory is that it can slow a computer because data must be mapped between the virtual and physical memory. With physical memory alone, programs work directly from RAM.
RAM vs. flash memory
Flash memory and RAM are both comprised of solid-state chips, but they play different roles in computer systems because of differences in the way they're made, their performance specifications and cost. Flash memory is used for storage memory, while RAM is used as active memory that performs calculations on the data retrieved from storage.
One significant difference between RAM and flash memory is that data must be erased from NAND flash memory in entire blocks, making it slower than RAM, where data can be erased in individual bits.
However, NAND flash memory is less expensive than RAM, and it's also nonvolatile; unlike RAM, it can hold data even when the power is off. Because of its slower speed, nonvolatility and lower cost, flash is often used for storage memory in SSDs.
RAM vs. ROM
Read-only memory, or ROM, is computer memory containing data that can only be read, not written to. ROM contains boot-up programming that is used each time a computer is turned on. It generally can't be altered or reprogrammed.
The data in ROM is nonvolatile and isn't lost when the computer power is turned off. As a result, read-only memory is used for permanent data storage. Random Access Memory, on the other hand, can only hold data temporarily. ROM is generally several megabytes of storage, while RAM is several gigabytes.
Trends and future directions
Resistive Random Access Memory (RRAM or ReRAM) is nonvolatile storage that can alter the resistance of the solid dielectric material it's composed of. ReRAM devices contain a memristor in which the resistance varies when different voltages are applied.
ReRAM creates oxygen vacancies, which are physical defects in a layer of oxide material. These vacancies represent two values in a binary system, similar to a semiconductor's electrons and holes.
ReRAM has a higher switching speed compared to other nonvolatile storage technologies, such as NAND flash. It also holds the promise of high storage density and less power consumption than NAND flash, making ReRAM a good option for memory in sensors used for industrial, automotive and internet of things applications.
Vendors have struggled for years to develop ReRAM technology and get chips into production. A few vendors are currently shipping them.
3D XPoint technology, such as Intel's Optane, could eventually fill the gap between dynamic RAM and NAND flash memory. 3D XPoint has a transistor-less, cross-point architecture in which selectors and memory cells are at the intersection of perpendicular wires. 3D XPoint isn't as fast as DRAM, but it is nonvolatile memory.
In terms of performance and price, 3D XPoint technology is between fast, but costly DRAM and slower, less expensive NAND flash. As the technology develops, it may blur the distinction between RAM and storage.