Module 4 Extra Problems On Cache
Module 4 Extra Problems On Cache
ROM chip
Cache Memory (Levels of memory)
Cache Memory (Levels of memory)
• Level 1 or Register : Data is stored and accepted that are
immediately stored in CPU. Most commonly used
registers are accumulator, Program counter, address
register etc.
• Level 2 or Cache memory: Fastest memory which has
faster access time where data is temporarily stored.
• Level 3 or Main Memory: Memory on which computer
works currently. It is small in size and once power is off
data no longer stays in this memory.
• Level 4 or Secondary Memory: External memory which is
not as fast as main memory but data stays permanently in
this memory.
Cache Mapping
• Direct mapping, Associative mapping, and Set-
Associative mapping
Cache Mapping: Direct mapping
• Maps each block of main memory into only one
possible cache line.
Consider a direct mapped cache of size 16 KB with block
size 256 bytes. The size of main memory is 128 KB. Find the
number of bits in tag and Tag directory size.
• Solution:
Given:-
– Cache memory size = 16 KB
– Block size = Frame size = Line size = 256 bytes
– Main memory size = 128 KB
• Consider that the memory is byte addressable
• Number of Bits in Physical Address-
• Size of main memory= 128 KB = 217 bytes
• Thus, Number of bits in physical address = 17 bits
Problem 1
Consider a direct mapped cache of size 16 KB with block
size 256 bytes. The size of main memory is 128 KB. Find the
number of bits in tag and Tag directory size.
• Solution:
Number of bits in physical address = 17 bits
Consider a direct mapped cache of size 16 KB with block
size 256 bytes. The size of main memory is 128 KB. Find the
number of bits in tag and Tag directory size.
• Solution
• Given:
• Cache memory size = 512 KB
• Block size = Frame size = Line size = 1 KB
• Number of bits in tag = 7 bits
• Consider that the memory is byte addressable.
Problem-02: Consider a direct mapped cache of size 512 KB
with block size 1 KB. There are 7 bits in the tag. Find Size of
main memory, Tag directory size
• Number of Bits in Block Offset-
• Block size = 1 KB = 210 bytes
• Thus, Number of bits in block offset = 10 bits