Computer Technology

Cache tutorial


  1. Would cache memory work if programs did not loop?

  2. What is meant by:
    1. Write through cache.
    2. Write back cache.
  3. Would a cache be useful if it used the same speed memory as RAM?

  4. Is a "dirty" cache a bad thing?
    When does the CPU have to do something about it?

  5. Why do cache blocks have "tags"?

  6. Suppose a CPU fitted with a cache has a "hit rate (Note 1)" of 90% for memory reads. (Ignore writes)

    When a "cache hit" occurs, one item is read from the cache and passed to the CPU taking one "time unit".

    When a "cache miss" occurs, a block (a number of items) is read into the cache then one item is passed to the CPU. In this case the time taken is 1 + 10 * Block_size time units.
    ie. Main memory access time is 10 times the cache access time.

    Determine the main memory traffic and the time taken (relative to the main memory traffic and time without a cache) if the block_size is: 1 item, 2 items, 4 items, 16 items.

    Which block size seems best?

    Is it possible that adding a cache makes the CPU slower?

  7. Optional difficult question! Suppose a CPU has a 32Kbyte cache. The cache is divided into 8 byte blocks. The CPU has a 32 bit data bus and a 32 bit address bus. The cache and main memory are both addressable as bytes.
    1. How many blocks are there in the cache?
    2. How many address bits are needed to address the cache?
    3. How many bits are there in a tag?
    4. What is the total size of the stored tags?

Notes:
  1. Percentage of memory accesses that find the requested item in the cache.