3 votes 3 votes Consider a computer with 8 MB of main memory and a 128 KB cache. The cache block size is 4KB and it uses a direct mapping scheme for cache management. Total number of different main memory blocks can map onto a given physical cache block is _______ Operating System go-os-1 operating-system co-and-architecture cache-memory numerical-answers + – Bikram asked Sep 3, 2016 • retagged Nov 13, 2017 by Arjun Bikram 1.4k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 6 votes 6 votes No. of blocks in main memory = 8MB / block size = 8MB/ 4KB = 2K. No. of blocks in cache = cache size/block size = 128 KB/ 4KB = 32 So, no. of different main memory blocks that can map to a given cache block = 2K / 32 (direct mapping is used) = 64. go_editor answered Sep 3, 2016 • selected Aug 25, 2017 by Bikram go_editor comment Share Follow See all 6 Comments See all 6 6 Comments reply Ritwik Mishra 1 commented Jan 11, 2017 reply Follow Share any of the 2K blocks in main memory can be mapped onto a given (or single) cache block, why only 64? 0 votes 0 votes shraddha priya commented Aug 25, 2017 reply Follow Share ^This is because only 64 can be mapped at a time to a cache block. 0 votes 0 votes shraddha priya commented Aug 25, 2017 reply Follow Share @bikram sir, Here we are assuming that main memory block size is same as cache block size, right? Is it always true? 1 votes 1 votes Bikram commented Aug 25, 2017 reply Follow Share Yes, i think main memory block size is always same as cache block size .. 0 votes 0 votes Bikram commented Aug 26, 2017 i edited by Bikram Aug 26, 2017 reply Follow Share @shraddha Generally in questions we are given only cache block size, which is need to be considered. But there is no need to be of same block size. see this Gate question https://gateoverflow.in/2352/gate2010-48 ( they mention explicitly that different block size for L1 and L2 ) .. We can say there no block , actually there all is virtual. We define block size to structure our memory. Initially we can think that two consecutive memories must have same block size, but consider a L1,L2, MM, Disk structure. Here disk and MM use a "Common Unit" which we call page to transfer which is defined for MM. While transferring through MM to L2 we cannot send a whole page to it, we define a smaller common unit b/w them (virtual) block or cache line size. So L1 cache block size need not to be equal to L2 block size and for MM, it is the higher level of memory which decides which block to be used, like MM is so big that it can satisfy both L1 block size and L2 block size, so fetch whatever you want but the cache should be able to hold that size too. So it cache in Cache-MM which decides the block size to be used. We can't say they are equal in all level, but in some respect block size is bounded by higher level of memory unit. 2 votes 2 votes shraddha priya commented Aug 26, 2017 reply Follow Share ok sir..thank you so much :) 1 votes 1 votes Please log in or register to add a comment.