Memory Hierarchy

Running two programs alternately on the same core can make each slower than running alone. What is the best explanation from a cache perspective?

  1. AAlternating doubles the number of instructions that each of the two programs executes
  2. BAlternating reconfigures the cache to half its capacity
  3. CThe other program evicts one's data, causing reloads
Show answer and explanation

Answer: C. The other program evicts one's data, causing reloads

If the two programs' data together does not fit in the cache, each switch fills the caches and TLB with the other program's data, so by the time a program runs again some of its data has been evicted. Accesses that would hit when running alone now miss, costing time to reload from lower cache levels or main memory. The shorter the interval between switches, the larger the effect. Instruction counts are unchanged and cache capacity is not reconfigured; the slowdown comes from sharing the cache.

  • A. Each program's instruction count is unchanged.
  • B. Cache capacity does not change.
  • C. Correct. The other program's data evicts one's own, increasing reload misses.

Related calculators

Books on Memory Hierarchy Ad

As an Amazon Associate I earn from qualifying purchases.

More Memory Hierarchy questions

  1. Which is the best example of temporal locality?
  2. Scanning the 2D C array a[i][j] with j in the inner loop, as above, tends to be faster than with i in the inner loop. Why?
  3. For a direct-mapped cache with 32-bit addresses, 32 KB capacity and 64-byte lines, how many tag bits are there?
  4. How many sets does a 4-way set-associative cache with 32-bit addresses, 32 KB capacity and 64-byte lines have?
  5. In a fully associative cache, how many address bits are used for the index (the part that selects a set)?

Comparisons in this topic