Class 9 Computer Knowledge

Primary Memory: RAM, ROM, Cache and Registers

WhatsApp Telegram
Primary memory of a computer cover: RAM, ROM, cache, registers and memory hierarchy

Primary memory is the part of a computer that the CPU reads and writes directly. This note explains RAM, ROM and their types, cache, registers and the memory hierarchy for exams. Read it once, then take the quiz.

Primary Memory: Meaning and Features

People also call primary memory main memory or internal memory. It is fast, but it holds a small amount of data. Because the CPU needs instructions quickly, a program must sit here before it runs. Secondary storage, such as a hard disk, holds data for the long term, but the CPU cannot use it directly.

Advertisements

Most books put RAM and ROM in this group. In addition, cache and registers work so close to the CPU that exams often count them as primary memory too. Memory trick: RAM can Read And Modify, while ROM only Reads. To see where memory fits inside the machine, read our note on the CPU, ALU, registers and buses.

Memory hierarchy pyramid from registers and cache to RAM, secondary storage and tape
Memory hierarchy: faster and costlier at the top, bigger and cheaper at the bottom.

RAM: Volatile Working Memory

RAM stands for random access memory. It is the working space of the computer, so the CPU keeps running programs and open files there. RAM is volatile, which means it loses its data when the power goes off. Therefore, you must save your work to the disk.

RAM chips sit in slots on the board, as our note on the motherboard and its ports shows. Two main kinds exist, and exams love the difference between them.

SRAM vs DRAM: Types of RAM

FeatureSRAMDRAM
Cell designFlip-flopCapacitor
Refresh neededNoYes
Speed and costFaster, costlierSlower, cheaper
Main useCacheMain memory

A DRAM capacitor leaks its charge, so the memory must refresh it again and again. SRAM does not need this. As a result, SRAM is faster but also more expensive.

SDRAM works in step with the CPU clock. DDR SDRAM goes further, because it moves data on both edges of each clock beat. Modern PCs use DDR memory. In history, Samsung made the first commercial SDRAM chip in 1992 and the first commercial DDR chip in June 1998. Also, RAM is the main primary memory that you can read and write at high speed.

ROM and Its Types

ROM stands for read-only memory. It is non-volatile, so it keeps its data without power. The computer uses it for start-up instructions, called firmware. For example, the BIOS or UEFI program sits in EEPROM or flash, so a user can update it in place. After you press the power button, the CPU runs this firmware first. Then it loads the operating system into RAM.

  • Mask ROM: the factory fixes the data, and nobody can change it later.
  • PROM: a user can program it once with a special device.
  • EPROM: strong ultraviolet light erases it, and then the user can program it again.
  • EEPROM: an electric signal erases and rewrites it without removing the chip.
  • Flash: a fast form of EEPROM that erases data in blocks.

Memory trick for the order: “My Pet Eats Eggs Fast” gives Mask, PROM, EPROM, EEPROM, Flash.

Chart of ROM types: mask ROM, PROM, EPROM, EEPROM and flash, with how each is written or erased
ROM types in order, with the trick "My Pet Eats Eggs Fast".

Primary Memory: Cache and Registers

Main memory is far slower than the CPU. Cache solves this problem. It is a small, fast memory that keeps copies of the data the CPU uses often. When the data is in the cache, the CPU gets a hit. When it is missing, the CPU gets a miss and must fetch the data from RAM.

Advertisements

Besides that, cache comes in levels. L1 sits closest to the core, so it is the fastest and the smallest. L2 is slower but larger. L3 is larger still, and several cores usually share it. So SRAM builds most cache memory.

In contrast, registers are the smallest and fastest memory units, and they sit inside the CPU. They hold the data and addresses that the CPU is using at that moment. Examples include the program counter, the instruction register and the accumulator. In addition, the memory address register holds the address to fetch. Similarly, the memory data register holds the data itself. Unlike cache, the compiler manages registers, while hardware manages cache.

Memory Hierarchy: Speed, Size and Cost

The memory hierarchy arranges all memory in levels. From top to bottom, the order is registers, cache, main memory, secondary storage and tape. Each level is bigger and slower than the one above it. Meanwhile, the cost per byte falls as you go down.

The design works because of locality of reference. Programs tend to reuse the same data and nearby data. Therefore, a small cache can serve most requests. For example, one modern processor answers from registers in about 0.25 nanoseconds and from L1 cache in about 1 nanosecond. However, RAM takes about 82.5 nanoseconds. Meanwhile, an SSD takes about 0.2 milliseconds, and a hard drive takes about 4 milliseconds. Memory trick: “Really Cool Memory Saves Time” gives Registers, Cache, Memory, Storage, Tape.

Primary Memory Units: Bit to Terabyte

First, a bit is the smallest unit, and 4 bits make a nibble. Eight bits make one byte. After that, each step multiplies by 1,024: 1 KB equals 1,024 bytes, and 1 MB equals 1,024 KB. Similarly, 1 GB equals 1,024 MB, and 1 TB equals 1,024 GB.

Primary Memory: Exam Tips

Exam questions on primary memory often ask for pairs. For example, match SRAM with cache, DRAM with main memory and EPROM with ultraviolet light. Then remember that RAM is volatile, while ROM is not. Finally, use this quick list for revision.

  • RAM: read and write, volatile, holds running programs.
  • ROM: mainly read, non-volatile, holds firmware.
  • Cache: sits between the CPU and RAM, and it speeds up access.
  • Registers: sit inside the CPU, and they are the fastest of all.

Also, learn the order of speed: registers, then cache, then RAM. For wider reading, see the Wikipedia articles on random-access memory, read-only memory and CPU cache.

Frequently Asked Questions

What is primary memory?

Primary memory is the fast, small memory that the CPU reads and writes directly. Many books call it main memory, and it includes RAM and ROM.

What is the difference between RAM and ROM?

RAM is volatile, and the CPU can read and write it. ROM is non-volatile and mostly holds start-up firmware.

What is the difference between SRAM and DRAM?

SRAM uses flip-flops, needs no refresh and is faster but costlier, so it builds cache. DRAM uses capacitors, needs refresh and is cheaper, so it serves as main memory.

What is the memory hierarchy?

It is the order of memory levels: registers, cache, main memory, secondary storage and tape. Higher levels are faster and smaller.

Sources

Take the quiz for this classPrimary Memory: RAM, ROM, Cache and Registers: Quiz · 16 questionsStart

How was this? Tap to react.

Advertisements

From VSR Store

See all

10% extra discountUse this coupon code on vsrsol.com

LEARNWITHVINOD

Leave a Reply

Your email address will not be published. Required fields are marked *