ExamSaathi learning library · Government exams · SSC CGL computer knowledge; published syllabus labelled 2024 · Computer knowledge

Computer memory: registers, cache, RAM, ROM and storage devices

Compare computer memory from registers and cache to RAM and ROM, and storage devices such as hard disks, SSDs, optical discs and pen drives, and plan safe back-ups.

Status: original pilot lesson. Teacher review is pending. It is not a complete course or official exam material.

You will learn to

Before you start

A computer needs one place for the programs and data in use now, and another for files kept for later. The first is primary memory, which the processor reads directly. The second is secondary storage, such as a hard disk or a pen drive; its files must be copied into primary memory before they are used. Memory that loses its contents when the power goes off is volatile, and memory that keeps them is non-volatile.

The memory hierarchy: from fastest to largest

No kind of memory is fast, large and cheap at once, so a computer uses a ladder of them. Going down the ladder, speed falls, capacity grows and the cost of each byte drops.

Registers: inside the processor; the fastest of all; a small set of fixed-size stores, each for an instruction, an address or a value.

Cache: built into the processor; very fast; much smaller than RAM, from kilobytes for the smallest level to megabytes or more for the largest.

Main memory (RAM): separate memory chips; fast; usually several GB in a PC.

Secondary storage (SSD or hard disk): far slower; hundreds of GB or more; non-volatile.

Tape for archives: slowest to reach; very large; cheapest per byte.

Registers, cache and RAM lose their contents without power. Cache helps because programs often reuse the same instructions and data. It keeps copies of recently used items close to the processor; when the item needed is there (a cache hit), the processor need not wait for slower RAM, so a high hit rate speeds up work. Most processors have several levels of cache, and L1 is the smallest and fastest.

RAM, ROM and virtual memory

RAM (random access memory) is the main working memory. It is volatile, can be read and written, and holds the operating system, open programs and their data. Static RAM (SRAM) stores each bit in a small circuit of transistors; it is fast and costly, so it is used for cache. Dynamic RAM (DRAM) stores each bit as a charge in a tiny capacitor that must be refreshed many times a second; it is cheaper and denser, so it is used for main memory. ROM (read-only memory) is non-volatile. The start-up firmware that runs when a computer is switched on is kept in ROM or, commonly today, in flash memory, so that it can be updated. A PROM can be written only once. An EPROM is erased by strong ultraviolet light through a small window on the chip, and can then be written again. An EEPROM is erased electrically, and flash memory is a kind of EEPROM erased in blocks. Mainstream PC and smartphone operating systems typically use virtual memory: the operating system maps each program's addresses onto real memory. On a PC, when RAM runs short, it moves less-used pages to a page file, or swap area, on the disk, which works but is much slower than RAM.

Storage devices and access methods

A hard disk drive (HDD) records data magnetically on spinning platters, read by heads on a moving arm; it is cheap for its size but has moving parts. A solid state drive (SSD) uses flash memory chips and has no moving parts, so it is faster, silent and better at surviving a knock, though it costs more per GB. Optical discs are read by a laser: a CD holds about 700 MB, a single-layer DVD 4.7 GB and a single-layer Blu-ray disc 25 GB. Pen drives and memory cards are small flash devices for carrying files. Magnetic tape gives sequential access: records lie one after another along the tape, so the drive must wind past those in between to reach the one wanted. A disk gives direct access: the drive can go straight to the block it needs, so finding one file is much quicker.

Common mistakes

Calling ROM volatile or RAM permanent; it is the other way round. Thinking that cache is a part of the hard disk; it is fast memory built into the processor, while the disk area used when RAM runs short is the page file. Swapping SRAM and DRAM: SRAM is the faster one, used for cache. Saying that EEPROM is erased by ultraviolet light; that is EPROM. Counting the hard disk as primary memory because it sits inside the cabinet. Expecting a bigger hard disk to make programs faster; it adds room, not speed.

A routine and a back-up checklist

1. Decide where the item sits: inside the processor (registers, cache), in primary memory (RAM, ROM) or in secondary storage (disks, discs, flash drives, tape). 2. Ask whether it keeps data without power. 3. Place it on the ladder of speed, cost per byte and capacity. 4. For the ROM family, recall how each is erased: PROM never, EPROM by ultraviolet light, EEPROM and flash electrically. For back-ups: keep at least two copies of important files on different devices, such as an external hard disk and cloud storage; keep one copy away from the office; update it on a fixed day; and check now and then that the copies open.

Worked examples

  1. A cyber cafe computer in Bhopal has registers and cache in its processor, 16 GB of RAM, a 512 GB SSD and a 2 TB hard disk. Order them from fastest to slowest, and say which lose their contents in a power cut.

    1. Registers, inside the processor, are the fastest; the cache built into the processor comes next, then RAM, far faster than any drive.
    2. The SSD has no moving parts, so it is faster than the hard disk, whose heads must move over spinning platters.
    3. Registers, cache and RAM are volatile; the SSD and the hard disk keep their data.

    Answer: Fastest to slowest: registers, cache, RAM, SSD, hard disk. Registers, cache and RAM lose their contents in a power cut.

  2. A small business in Kochi wants to archive 20 GB of scanned bills on optical discs. How many single-layer DVDs would it need, or how many single-layer Blu-ray discs? What else should it do?

    1. A single-layer DVD holds 4.7 GB, and 20 / 4.7 is about 4.3, so 4 discs fall short and 5 are needed.
    2. A single-layer Blu-ray disc holds 25 GB, which is more than 20 GB, so 1 disc is enough.
    3. Discs can be scratched or lost, so it should also keep a second copy elsewhere, such as in cloud storage.

    Answer: 5 single-layer DVDs or 1 single-layer Blu-ray disc, with a second copy kept somewhere else.

Practice checks

  1. Ravi is typing a bill on a shop computer in Jaipur when the power fails before he can save it. Where was the unsaved bill held?
  2. Which memory chip is erased by exposing it to strong ultraviolet light?
  3. Which order runs from the fastest memory to the slowest?
  4. Why does cache memory make a computer faster?
  5. A bank archives old records on magnetic tape. Why is tape slow for finding one record?

Sources checked