Memory hierarchy (cache, RAM, disk)

Computer Science · Computer architecture & systems

Question 1 of 10

0

    Bandwidth of a memory or storage device refers to:

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Memory hierarchy (cache, RAM, disk) explained

    A computer has several kinds of memory and storage arranged in a hierarchy. The closer a memory is to the processor, the faster and more expensive it is, and the smaller its capacity. Registers are the fastest, followed by cache, then RAM, then solid state or hard disk storage, which holds the most data but is much slower.

    Cache is a small, very fast memory on or near the processor that keeps copies of data the CPU is likely to need again. RAM (random access memory) holds the programs and data that are currently in use. RAM is volatile, so its contents are lost when the power is switched off. Disk storage is non-volatile and keeps files without power.

    Units are another source of confusion. Storage manufacturers usually use powers of 1000, so 1 GB is 1000000000 bytes. Some operating systems use powers of 1024 when reporting sizes, so the same drive can appear smaller than advertised.

    A common mistake is to think that more RAM makes the processor run faster. Extra RAM lets more programs stay in memory without the system slowing down by swapping data to disk, but it does not change the CPU's clock speed.

    Worked example

    How many bytes are in 2 GB of RAM if 1 GB is taken as 102431024^3 bytes (strictly a gibibyte, GiB)?

    1. One GB is 1024×1024×1024=10737418241024 \times 1024 \times 1024 = 1073741824 bytes.
    2. Two GB is 2×1073741824=21474836482 \times 1073741824 = 2147483648 bytes.

    Using the decimal convention, 2 GB would be 2000000000 bytes. The two answers differ by 147483648 bytes.

    What you will practise

    105 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.

    Example questions

    • The fastest memory is:
    • RAM is:
    • Disk storage is:
    • Cache speeds up access by:
    • A cache miss means:
    • The term for memory that loses its data when the power is removed is:
    • The cache level closest to the processor core is usually:
    • A solid-state drive (SSD) is an example of:

    …and 97 more.