CDA3101 Test 3 Review Problem Set Solutions 1. Assume a 2-way set-associative cache with 16 cache sets, 1 word per block, and an LRU replacement policy. For both a write-through, no write-allocate and a write-back, write-allocate cache, fill in the appropriate information for the following memory references 16 cache sets 24 cache sets 4 index bits 1 word/block 4 bytes/block 22 bytes/block 2 offset bits 92 28 94 24 88 216 26 0101 1100 0001 1100 0101 1110 0001 1000 0101 1000 1101 1000 0001 1010 Write Through / No Write Allocate Type Address Tag Index Offset Result Memref R R W W R W R 92 28 94 24 88 216 26 1 0 1 0 1 3 0 7 7 7 6 6 6 6 0 0 2 0 0 0 2 Miss Miss Hit Miss Miss Miss Miss Yes Yes Yes Yes Yes Yes Yes Update Cache? Yes Yes Yes No Yes No Yes Write Back / Write Allocate Type Address Tag Index Offset Result Memref R R W W R W R 92 28 94 24 88 216 26 1 0 1 0 1 3 0 7 7 7 6 6 6 6 0 0 2 0 0 0 2 Miss Miss Hit Miss Miss Miss Miss Yes Yes No Yes Yes Yes (2) Yes Update Cache? Yes Yes Yes Yes Yes Yes Yes 2. Consider a virtual memory scheme with a 4KB page size. We have a direct-mapped TLB with 4 entries. A virtual address is 20 bits and a physical address is 18 bits. How many virtual pages are allowed? How many physical pages are allowed? How many bits are used for the page offset, TLB index, and TLB tag? - Virtual pages: 256 pages - Physical pages: 64 pages - Page offset: 12 bits - TLB index: 2 bits - TLB tag: 6 bits 3. The following table is a stream of virtual addresses as seen on a system. Assume 1KB pages, an initially empty 2-way set associative TLB with 4 sets and true LRU replacement. If pages must be brought in from disk, assign the next available physical page number. 9452 6388 10944 5540 6200 1244 5548 0010 0100 1110 1100 0001 1000 1111 0100 0010 1010 1100 0000 0001 0101 1010 0100 0001 1000 0011 1000 0000 0100 1101 1100 0001 0101 1010 1100 Page Table Index 0 1 2 3 4 5 6 7 8 9 10 11 Valid 1 1 0 1 1 1 01 1 0 01 1 0 Physical Page Number or Disk 2 6 Disk 5 4 3 Disk 8 1 Disk Disk 7 0 Disk Given the two address streams in the table above, for each stream show the final state of the system given the initial state of the TLB and Page Table. Also, for each reference, indicate whether it was a hit in the TLB, a hit in the page table, or a page fault. What is the physical address that corresponds to every virtual address? Virtual Address 9452 6388 10944 5540 6200 1244 5548 Virtual Page # 9 6 10 5 6 1 5 Page Offset 236 244 704 420 56 220 428 TLB Tag 2 1 2 1 1 0 1 TLB Index 1 2 2 1 2 1 1 TLB Result Miss Miss Miss Miss Hit Miss Hit Page Table Result Miss Miss Hit Hit Hit - Physical Page # 7 8 0 3 8 6 3
© Copyright 2026 Paperzz