


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



(a) What is the average time to write 4 MB of data to the disk assuming that sectors available for writing are spread randomly on the disk? Explain your answer. 9 points
Solution: For each sector, we perform: Seek: 7 ms (average) Rotation: (^10000) rotation^0.^5 rotation minute ×^
1 minute 60000 ms
= 3 ms (average)
Transfer: (^1000) sectors^1 sector track ×^
1 track rotation ×^
10000 rotations minute ×^
160000 minute ms = 0.006 ms
File size = 4 MB = 4512 ×^1024 bytes/sector×^1024 bytes = 8192 sectors.
Hence, the total time required is 8192 × (7 + 3 + 0.006) ms. (b) If the bus supplying data to the disk has a bandwidth of 60 KB/s, what is the bottleneck for the above write operation: the bus or the hard disk? Explain your answer. 2 points
Solution: The average rate at which data is written to the disk is (^51210). 006 bytes/sector ms/sector ' 50 KB/s. Since this is less than the bandwidth of the bus, the disk is the bottleneck.
(a) The L1 cache has a write-through policy, size = 128 KB, block size = 32 bytes, and implements full LRU using just one LRU bit per set. Compute the length of the block-offset, index and tag. Explain your answer. 6 points Solution: 128 KB= 2^17 bytes data, 32 = 2^5 bytes per block. Hence, 5-bit block offset , 2 17 25 = 2
(^12) blocks. Full associativity and one LRU bit per set, hence 2-way set associative. Thus, 2^12 /2 = 2^11 sets, i.e. 11-bit index. 20-bit address, therefore 20 − 11 − 5 = 4-bit tag.
(b) The L2 cache has a write-back policy, size = 256 KB, 4-way set associative, 8-bit block offset, 8-bit index, 4-bit tag and implements full LRU. Initially, both caches are empty (i.e. all data is invalid). Construct five distinct addresses a 1 , a 2 ,... , a 5 such that after reading each address exactly once, the L1 cache holds valid data for address a 1 whereas the L2 cache does not. Explain your answer. 6 points
Hint: Choose addresses that map to the same set in the L2 cache. Use the fact that the L2 cache is 4-way set associative. You do not have to write out the addresses, but you must describe them clearly.
Solution: The 20-bit addresses are decomposed as follows for the two caches:
L1 cache: tag index offset L2 cache: tag index offset 4 8 8 Choose addresses a 1 ,... , a 5 that have all the following properties:
Consider an interleaved memory with 2 banks, each with a latency of 3 cycles. The cache-to-memory bus has width = 4 bytes, latency = 1 cycle and has multiplexed address and data lines. Each cache block holds 16 bytes. To transfer data between the cache and memory (in either direction), a 4-byte address must be sent to each bank individually over the bus.
(a) Use the table below to show how a dirty cache-block can be written to memory in at most 11 cy- cles. 2 points
1 2 3 4 5 6 7 8 9 10 11 12 A D L L L A D L L L A D L L L A D L L L Here, A = address, D = data, L = latency (of the bank) (b) Use the table below to show how a clean cache-block can be replaced with a block from memory in at most 12 cycles. For full credit, show that it can be done in 11 cycles. 5 points
1 2 3 4 5 6 7 8 9 10 11 12 A L L L D A L L L D
(d) A two-tier page table and a two-level page table are designed so that both require the same amount of memory. Explain one advantage and one disadvantage of the two-tier page table. 2 points Advantage: Only one memory access is needed to retrieve the PPN in the best case (i.e. a hit in T 1 ) – a two-level page-table always needs at least two memory accesses. Disadvantage: T 1 stores only one PPN per entry, hence it is “direct mapped”. Thus, there is a conflict between any two virtual addresses that map to the same entry in T 1. Hence, it is very easy to get worst-case behavior (i.e. expensive disk access) in a two-tier cache.