Memory & Cache โ€” Practice

Exam-pattern questions across locality, direct-mapped caches, bits, and associativity.

Locality & hierarchy

M-1smallState the two types of locality with an example of each.
M-2smallDown the memory hierarchy, what happens to size, speed and cost per bit?

Direct-mapped caches

M-3smallAn 8-line direct-mapped cache. Which line do memory blocks 12 and 20 map to, and what's the problem?
M-4big32-bit address, direct-mapped cache with 1024 one-word lines. Split the address and give the hit condition.

Total bits

M-5bigHow many total bits for a direct-mapped cache with 16 KB of data, 4-word blocks, 32-bit address? (COD/slide example)
M-6bigTotal memory units for a direct-mapped cache with 2 MB of data, 8-word blocks, 32-bit address. (Spring 2024 Q3c)
M-7smallA direct-mapped cache has 2^12 blocks and memory has 2^30 blocks. Index and tag size?

Associativity

M-8smallHow many degrees of associativity are possible for a 16-block cache? List them.
M-9smallFor a cache with 2^n entries, which configuration is direct-mapped and which is fully associative?

Virtual memory

M-10small16-bit virtual address, 4 KB pages. How many bits for the offset and VPN, and how many virtual pages?