in Operating System retagged by
421 views
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 _______
in Operating System retagged by
by
421 views

1 Answer

5 votes
5 votes
Best answer
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.
selected by

4 Comments

Yes, i think main memory block size is always same as cache block size ..
0
0
edited by

@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
2
ok sir..thank you so much :)
1
1
Answer:

Related questions