Cache Memory · Computer Organization and Architecture
68 questions · asked in 25 of 27 years (2000–2026)
MCQ 44 · MSQ 4 · NAT 201-mark 30 · 2-mark 38
2000Questions per year2026
Questions 1–5 of 68
The size of the physical address space of a processor is bytes. The capacity of a cache memory unit is bytes. The cache block size is bytes. The cache memory unit can be built as a direct mapped cache or as a -way set-associative cache, where and . Let the length of the TAG field be bits for the direct mapped cache, and bits for the set-associative cache.
Which one of the following options is true?
Which one of the following options is true?
Answer: (A)
Data: physical address space bytes, cache capacity bytes, and block size bytes.
Direct-mapped cache: the number of cache lines . So the index field has bits and the offset field has bits. The tag field then has bits.
-way set-associative cache (where ): the number of sets . So the index field has bits, and the offset field stays at bits. The tag field then has bits.
Compare the two: , because .
Answer:
Direct-mapped cache: the number of cache lines . So the index field has bits and the offset field has bits. The tag field then has bits.
-way set-associative cache (where ): the number of sets . So the index field has bits, and the offset field stays at bits. The tag field then has bits.
Compare the two: , because .
Answer:
Consider a system with a processor and a KB direct mapped cache with block size of bytes. The system has a MB physical memory. Four words , and S are accessed by the processor in the same order times. That is, there are a total of memory references in the sequence
Assume that the cache memory is initially empty. The physical addresses of the words are given below ( word byte).
Which of the following statements is/are true?
Note: and
Assume that the cache memory is initially empty. The physical addresses of the words are given below ( word byte).
Which of the following statements is/are true?
Note: and
One or more options are correct.
Answer: (A), (B)
Block size 16 bytes, so the offset is 4 bits. Lines: , so the index is 8 bits. 16 MB memory means 24-bit addresses, so the tag is bits. In hex, the last digit is the offset, the next two digits are the index, and the first three digits are the tag.
P = 0x845B32: tag 845, index B3, offset 2
Q = 0x845B26: tag 845, index B2, offset 6
R = 0x845B36: tag 845, index B3, offset 6
S = 0x846B32: tag 846, index B3, offset 2
So P and R are in the same block. Q uses a different line (index B2). S uses the same line as P and R (index B3) but has a different tag, so S and P/R replace each other.
Run the sequence P, Q, R, S, P, Q, R, S, ...
(A) True. Each S removes the P/R block, so every P is a miss.
(B) True. The block of P was just loaded, so every R is a hit.
(C) False. Q is a miss only the first time; after that its line is never replaced, so Q hits.
(D) False. Each S finds the P/R block in its line, so every S is a miss, not only the first.
Answer: (A), (B)
P = 0x845B32: tag 845, index B3, offset 2
Q = 0x845B26: tag 845, index B2, offset 6
R = 0x845B36: tag 845, index B3, offset 6
S = 0x846B32: tag 846, index B3, offset 2
So P and R are in the same block. Q uses a different line (index B2). S uses the same line as P and R (index B3) but has a different tag, so S and P/R replace each other.
Run the sequence P, Q, R, S, P, Q, R, S, ...
(A) True. Each S removes the P/R block, so every P is a miss.
(B) True. The block of P was just loaded, so every R is a hit.
(C) False. Q is a miss only the first time; after that its line is never replaced, so Q hits.
(D) False. Each S finds the P/R block in its line, so every S is a miss, not only the first.
Answer: (A), (B)
Consider a system with MB physical memory and a word length of byte. The system uses a direct mapped cache, with block numbers starting from . The word with physical address is mapped to the cache block number . The maximum possible size of the cache (in KB ) for this configuration is ________. (answer in integer)
Note: and
Note: and
Answer: 128
The 1 MB memory has bytes, so addresses have 20 bits:
(bits 19 down to 0).
.
Let the block offset have b bits and the index have L bits. The index field is bits to , and it must have the value 176. The cache size is bytes.
Find 10110000 in the address. It appears only at bits 13 to 6 (bit 13 = 1, bit 12 = 0, bits 11, 10 = 1, bits 9 to 6 = 0). So b = 6, a block size of 64 bytes.
The index may be wider than 8 bits if the extra top bits are 0. Bits 14, 15 and 16 are 0, so the index can grow to bits 16 to 6. Bit 17 is 1, so one more bit would change the index value. So (2048 lines), and the tag is bits 19 to 17, which is .
Largest cache size bytes KB.
Answer: 128 KB
(bits 19 down to 0).
.
Let the block offset have b bits and the index have L bits. The index field is bits to , and it must have the value 176. The cache size is bytes.
Find 10110000 in the address. It appears only at bits 13 to 6 (bit 13 = 1, bit 12 = 0, bits 11, 10 = 1, bits 9 to 6 = 0). So b = 6, a block size of 64 bytes.
The index may be wider than 8 bits if the extra top bits are 0. Bits 14, 15 and 16 are 0, so the index can grow to bits 16 to 6. Bit 17 is 1, so one more bit would change the index value. So (2048 lines), and the tag is bits 19 to 17, which is .
Largest cache size bytes KB.
Answer: 128 KB
Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, 1K = , 1M = .]
Answer: (A)
The cache size bytes and each block bytes. So the number of cache lines . The index field has bits and the offset field has bits.
Main memory bytes and it is byte-addressable, so an address is bits long. Each line needs a tag field of bits.
Total bits to store all the tag values: .
Answer: 6×2^10
Main memory bytes and it is byte-addressable, so an address is bits long. Each line needs a tag field of bits.
Total bits to store all the tag values: .
Answer: 6×2^10
A computer has a memory hierarchy consisting of two-level cache (L1 and L2) and a main memory. If the processor needs to access data from memory, it first looks into L1 cache. If the data is not found in L1 cache, it goes to L2 cache. If it fails to get the data from L2 cache, it goes to main memory, where the data is definitely available. Hit rates and access times of various memory units are shown in the figure. The average memory access time in nanoseconds (ns) is _________. (rounded off to two decimal places)
Answer: 11.83 to 11.87
This system uses hierarchical (serial) cache access. To reach L2, the processor must first try L1 and miss. To reach main memory, it must first try L1 and L2 and miss in both. So the access times given for L2 and main memory already include the time spent on the earlier levels. L1 access time: ns. L2 access time (includes the L1 miss time): ns. Main memory access time (includes the L1 and L2 miss times): ns. Hit rates: for L1 and for L2.
The average memory access time is a weighted sum of three cases: hit in L1, miss in L1 then hit in L2, or miss in both and go to main memory:
ns.
Answer: 11.85
The average memory access time is a weighted sum of three cases: hit in L1, miss in L1 then hit in L2, or miss in both and go to main memory:
ns.
Answer: 11.85
Keep practising