Consider a system with 1 MB physical memory and a word length of 1 byte. The…

2026

Consider a system with 1 MB physical memory and a word length of 1 byte. The system uses a direct mapped cache, with block numbers starting from 0. The word with physical address 0xA2C28 is mapped to the cache block number 17610. The maximum possible size of the cache (in KB) for this configuration is ___________. (answer in integer)
Note: 1K=210 and 1M=220

Attempted by 16 students.

Show answer & explanation

Correct answer: 128

To find the maximum possible cache size, we analyze the direct mapping formula: Cache_Block_Index = Physical_Address mod Number_of_Cache_Blocks.

1. Convert Physical Address to Decimal: 0xA2C28 = 666,664.

2. Apply Mapping Formula: 666,664 mod N = 17,610, where N is the number of cache blocks.

This implies: 666,664 = k * N + 17,610, which simplifies to k * N = 649,054.

3. Determine Constraints on N: N must be a divisor of 649,054. Additionally, in standard computer architecture, the number of cache blocks (N) is typically a power of 2.

4. Factorize 649,054: 649,054 = 2 * 324,527. Since 324,527 is not divisible by 2, the only power of 2 divisor is 2.

5. Calculate Cache Size: If N = 2 blocks and block size is 1 byte, Cache Size = 2 bytes. Converting to KB: 2 / 1024 KB. However, the question asks for the answer in integer KB. If the question implies the cache size in bytes must be an integer multiple of 1KB, or if the 'maximum size' refers to the largest N (2) resulting in 2 bytes, the integer KB is 0. But typically, such problems imply the cache size is a power of 2 in bytes. If N=2, size=2 bytes. If the question allows non-power-of-2 N, max N=649,054, size=649,054 bytes ≈ 633 KB. Given the context of 'maximum possible size' and standard constraints, if N must be a power of 2, the answer is 2 bytes (0 KB). If N can be any divisor, the answer is 633 KB. Assuming standard constraints where cache size is a power of 2 bytes, and N=2, the size is 2 bytes. If the question implies the cache size in KB is the integer part of the max possible size, and N is not restricted to powers of 2, the answer is 633. However, if N must be a power of 2, the only valid N is 2, leading to 2 bytes. Let's assume the question allows any divisor for 'maximum possible size'. Max N = 649,054. Size = 649,054 bytes. 649,054 / 1024 = 633.84. Integer part is 633.

Final Answer: 633

Explore the full course: Gate Guidance By Sanchit Sir