lecture 12 Flashcards
Cache Memory, Mapping Algorithms, and the Principle of Locality
cache memory (real definition)
small fast SRAM-based memory
- managed in automatically in the hardware (NOT SOFTWARE)
- located on CPU
- hold frequently accessed memory blocks in RAM (main memory)
cache (online definition)
fast storage buffer that is located in the CPU (central processing unit) of a computer
*also called cache memory
where is cache located?
CPU (central processing unit) in your computer
what are blocks?
blocks –> equal-sized chunks of main memory that are held in the cache
are blocks physical partitions?
no, block is a contiguous range of physical address locations
controller
————
0
1
2
…
N - 1
—————–
how many blocks is RAM partitioned into?
RAM = N-1 blocks in total
what is the process for a Block Read Operation for a block that is not in the cache?
- CPU sends Block Read operation
to RAM controller- operation –> CPU sends the start
address of the block in RAM
- operation –> CPU sends the start
- RAM controller goes to that address in main memory
- makes a copy of the block (aka
data) - puts the copy of the block onto
the BUS
- makes a copy of the block (aka
- CPU controller reads the copy of the block from the BUS
- puts it in cache memory in the
CPU
what is the process for a Block Write Operation for a block that is in the cache that needs to be in main memory?
- CPU controller goes into cache
- puts a copy of block onto the BUS
with a specific address in the
main memory
- puts a copy of block onto the BUS
- RAM controller reads from the BUS
- goes to that specific address in
main memory - replaces current block with the
copy of the block from the BUS
from the cache in the CPU
- goes to that specific address in
block size in main memory = ? bytes
4 bytes
0000 —- start of block 0
0001
0010
0011 —- end of block 0
0100 —- start of block 1
0101
0110
0111 —- end of block 1
what are these binary numbers an example of?
block address bits
0000 —- start of block 0
0001
0010
0011 —- end of block 0
0100 —- start of block 1
0101
0110
0111 —- end of block 1
what is ‘10’, ‘11’, ‘01’, ‘10’ an example of?
block offset bits
what are block offset bits?
the last two binary digits in the block address bits –> references specific byte within the block
ex) byte at offset 11
- references one byte within
block with unique block offset
bits
block size =
2^b
b = bytes
total number of blocks =
2^m/ 2^b
m = physical address bits (4)
b = bytes
3 types of cache mapping algorithms
- Fully Associative
- Direct Mapping
- Set Associative