Cache

Memory Hierarchy Concept

Memory hierarchy

i5

Cache Memory

e.g. ARM Cortex A9

line length = 8 words 4-way set associative critical word first size = 16, 32 or 64 kB

e.g

  1. cache starts empty
  2. read at $24
  3. cache miss
  4. all of B1 copied to cache L0
  5. word 1 passed to proc
  6. read at $28
  7. cache hit in L0
  8. word 2 passed to proc

Cache example

Performance

e.g.

h = 90%, C = 1 cycle, M = 10 cycles

tavg = 0.9 x 1 + (1 - 0.9) 10 = 1.9 cycles

Store Instructions

Store Instruction

Write policy:

Mapping Schemes

Fully associative mapping scheme Direct associative mapping scheme Set associative mapping scheme

Eviction Policy

Address decomposition

Address decomposition

e.g. line size = 32 bytes, #lines = 64, # address bits = 16

addresses 0 - 31 B0 0000 0000 000X XXXX

      32- 63   B0    0000 0000 001X XXXX

      64- 95   B0    0000 0000 010X XXXX

address 0x1234 => 0001 0010 0011 0100

Fully associative: 0001 0010 001 tag, 1 0100 offset

4 way set associative: 0001 001 tag, 0 001 index, 1 0100 offset
#sets = 64 / 4 = 16, index bits = log216 = 4

Direct mapped: 0001 0 tag, 010 001 index, 1 0100 offset
index bits = log264 = 6

Virtual Memory

Page Table

Translation Lookaside Buffer

Page Faults

Hard Disk Drives

Hard disk drive

Platter surface

See next chapter See previous chapter