\n"); } else { $mime_type = "text/html"; header("Content-type: $mime_type; charset=utf-8"); } ?> CS-343 Assignment 10 Solutions

Answers

Questions

  1. Number of blocks of primary memory

    total bytes ÷ bytes per block = total blocks
    (23 × 230) ÷ (23 × 23) = 233 ÷ 26 = 227 blocks.

  2. Number of cache lines

    cache capacity ÷ bytes per line = number of lines
    (21 × 220) ÷ (23 × 23) = (221 ÷ 26) = 215 lines.

  3. Number of cache sets

    Number of lines ÷ lines per set = number of sets
    215 ÷ 21 = 214 = 16,384 sets.

  4. Primary memory address size

    log2(number of addressable bytes) = 33 bits

  5. Size of byte offset field

    log2(bytes per word) = 3 bits

  6. Size of block offset field

    log2(words per block|line) = 3 bits

  7. Size of index field

    log2(number of sets = 14 bits

  8. Size of tag field

    Address width - (index + block offset + byte offset) = 13 bits

  9. p(hit) if the CPU were to access memory totally randomly

    Proportion of main memory that fits in cache = 221 233 = 22−12 = 0.0002441.

  10. Average access time if the CPU were to access memory totally randomly

    p(hit) × 500 psec + p(miss) × (500 psec + 5 nsec) = 0.0002441 × 500 + .9997559 × 5500 = 5.4987794 nsec
    This is correct: the hit time has to be added to the miss penalty on a miss. Other semesters, the “miss time” = was used, which would have been given as 5.5 nsec for this example. You will not have to worry about which number to use on the final: both values will be given to avoid confusion.

  11. Average access time if p(hit) is 0.97

    0.97 × 500 + 0.03 × 5,500 = 650 psec.