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 41–45 of 68
A computer system has an L1 cache, an L2 cache, and a main memory unit connected as shown below. The block size in L1 cache is 4 words. The block size in L2 cache is 16 words. The memory access times are 2 nanoseconds. 20 nanoseconds and 200 nanoseconds for L1 cache, L2 cache and main memory unit respectively.
When there is a miss in both L1 cache and L2 cache, first a block is transferred from main memory to L2 cache, and then a block is transferred from L2 cache to L1 cache. What is the total time taken for these transfers?
When there is a miss in both L1 cache and L2 cache, first a block is transferred from main memory to L2 cache, and then a block is transferred from L2 cache to L1 cache. What is the total time taken for these transfers?
Answer: (C)
Each transfer reads the data from the source and writes it into the destination, so its time is the source access time plus the destination access time. The data bus carries 4 words at a time.
Main memory L2: the L2 block has 16 words, so there are transfers. Each takes ns (read main memory, write L2). Total ns.
L2 L1: the L1 block has 4 words, so there is 1 transfer. It takes ns (read L2, write L1).
Total time ns. Counting only the source access times would leave out the time to write into the destination.
Answer: (C)
Main memory L2: the L2 block has 16 words, so there are transfers. Each takes ns (read main memory, write L2). Total ns.
L2 L1: the L1 block has 4 words, so there is 1 transfer. It takes ns (read L2, write L1).
Total time ns. Counting only the source access times would leave out the time to write into the destination.
Answer: (C)
A computer system has an L1 cache, an L2 cache, and a main memory unit connected as shown below. The block size in L1 cache is 4 words. The block size in L2 cache is 16 words. The memory access times are 2 nanoseconds. 20 nanoseconds and 200 nanoseconds for L1 cache, L2 cache and main memory unit respectively.
When there is a miss in L1 cache and a hit in L2 cache, a block is transferred from L2 cache to L1 cache. What is the time taken for this transfer?
When there is a miss in L1 cache and a hit in L2 cache, a block is transferred from L2 cache to L1 cache. What is the time taken for this transfer?
Answer: (C)
The L1 block has 4 words, which is the same as the bus width. So the block moves in a single transfer. Time taken: reading from L2 takes 20 ns, and writing into L1 takes 2 ns. Total = 22 ns.
Answer: 22 nanoseconds
Answer: 22 nanoseconds
Consider a 4-way set associative cache (initially empty) with total 16 cache
blocks. The main memory consists of 256 blocks and the request for memory
blocks is in the following order:
0, 255, 1, 4, 3, 8, 133, 159, 216, 129, 63, 8, 48, 32, 73, 92, 155.
Which one of the following memory block will NOT be in cache if LRU replacement policy is used?
0, 255, 1, 4, 3, 8, 133, 159, 216, 129, 63, 8, 48, 32, 73, 92, 155.
Which one of the following memory block will NOT be in cache if LRU replacement policy is used?
Answer: (D)
The cache has 16 blocks in sets of 4, so it has sets. Set number . Each set keeps the 4 most recently used distinct blocks.
Set 0 gets blocks 0, 4, 8, 216, 8, 48, 32, 92 (in this order):
0, 4, 8, 216 fill the set. The second 8 is a hit. 48 replaces the least recently used block 0. 32 replaces 4. 92 replaces 216.
Set 0 ends with 8, 48, 32, 92, so 216 is not in the cache.
Set 1 gets 1, 133, 129, 73. These are only 4 blocks, so all stay.
Set 3 gets 255, 3, 159, 63, 155. The fifth block evicts 255, so the set ends with 3, 159, 63, 155.
Set 2 gets no request.
Blocks 3, 8 and 129 are in the cache. Block 216 is not.
Answer: (D)
Set 0 gets blocks 0, 4, 8, 216, 8, 48, 32, 92 (in this order):
0, 4, 8, 216 fill the set. The second 8 is a hit. 48 replaces the least recently used block 0. 32 replaces 4. 92 replaces 216.
Set 0 ends with 8, 48, 32, 92, so 216 is not in the cache.
Set 1 gets 1, 133, 129, 73. These are only 4 blocks, so all stay.
Set 3 gets 255, 3, 159, 63, 155. The fifth block evicts 255, so the set ends with 3, 159, 63, 155.
Set 2 gets no request.
Blocks 3, 8 and 129 are in the cache. Block 216 is not.
Answer: (D)
Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB.
While accessing the memory location 0C795H by the CPU, the contents of the TAG field of the corresponding cache line is:
While accessing the memory location 0C795H by the CPU, the contents of the TAG field of the corresponding cache line is:
Answer: (A)
Memory is 1 MB, so an address has 20 bits. A block has 128 words of 1 byte each, so the word (offset) field has 7 bits.
Cache lines . With 4 lines per set, sets , so the set field has 4 bits.
Tag bits .
Drop the last 7 bits (word): .
The last 4 of these bits, , are the set number. The first 9 bits, , are the tag.
Option (C) has only 8 bits, so it cannot be a 9-bit tag. Option (B) is the last 9 of the 13 bits, but the tag is the first 9.
Answer: (A)
Cache lines . With 4 lines per set, sets , so the set field has 4 bits.
Tag bits .
Drop the last 7 bits (word): .
The last 4 of these bits, , are the set number. The first 9 bits, , are the tag.
Option (C) has only 8 bits, so it cannot be a 9-bit tag. Option (B) is the last 9 of the 13 bits, but the tag is the first 9.
Answer: (A)
Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB.
The number of bits in the TAG, SET and WORD fields, respectively are:
The number of bits in the TAG, SET and WORD fields, respectively are:
Answer: (D)
Main memory is 1 MB bytes, so an address has 20 bits. A word is 1 byte.
WORD field: a block has 128 words, so bits.
Number of blocks in the cache: .
Number of sets: 4 blocks per set, so sets. The SET field needs bits.
TAG field: bits.
So TAG, SET, WORD are 9, 4, 7.
Answer: (D)
WORD field: a block has 128 words, so bits.
Number of blocks in the cache: .
Number of sets: 4 blocks per set, so sets. The SET field needs bits.
TAG field: bits.
So TAG, SET, WORD are 9, 4, 7.
Answer: (D)
Keep practising