MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPUTER ARCHITECTURE

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider a direct mapped cache with block size 4 KB. The size of main memory is 16 GB and there are 10 bits in the tag. Find the number of bits in block offset.
A
8 bits
B
12 bits
C
16 bits
D
32 bits
Explanation: 

Detailed explanation-1: -AI Recommended Answer: There are 2^32 = 4, 294, 967, 296 total bits in a 32-bit address. Therefore, the required number of bits for a direct-mapped cache with 16 KB of data and 4-word blocks is 2^32 + 4 = 4, 294, 967, 296.

Detailed explanation-2: -You have 16 kB = 16*1024 = 16384 bytes of data . Since word has 4 bytes, this makes 16384 bytes / 4 bytes per word = 4096 words . Block size is 4 words, that makes 4096 words/4 words per block = 1024 (2^10) blocks . This means 10 bits are used for the index.

Detailed explanation-3: -A direct-mapped cache is the simplest approach: each main memory address maps to exactly one cache block. For example, on the right is a 16-byte main memory and a 4-byte cache (four 1-byte blocks). Memory locations 0, 4, 8 and 12 all map to cache block 0. Addresses 1, 5, 9 and 13 map to cache block 1, etc.

There is 1 question to complete.