edited by
32,582 views
93 votes
93 votes

Consider a machine with a byte addressable main memory of $2^{16}$ bytes. Assume that a direct mapped data cache consisting of $32$ lines of $64$ bytes each is used in the system. A $50 \times 50$ two-dimensional array of bytes is stored in the main memory starting from memory location $1100H$. Assume that the data cache is initially empty. The complete array is accessed twice. Assume that the contents of the data cache do not change in between the two accesses. 

How many data misses will occur in total?

  1. $48$
  2. $50$
  3. $56$
  4. $59$
edited by

10 Answers

4 votes
4 votes

 Size of main memory=216 bytes

Size of cache=32*64 Bytes

=2 11 Bytes

Size of array=2500 Bytes

Array is stored in main memory but cache will be empty

Size of cache=2048 Bytes

So number of page faults=2500-2048=452

Complete array will be access twice

So for second access no. of total page faults=452*2=904

So total page faults=452+904=1356

So data cache misses will be 56

So (C) is correct option

http://www.geeksforgeeks.org/gate-gate-cs-2007-question-80/

2 votes
2 votes

1 cache block contains maximum of 64 elements

which means there will be 1 miss in every 64 references

We have Total 2500 (50*50) elements.

Since 1 element = 1 Byte

 

In first iteration :

Maximum capacity of elements in cache = 32 * 64 = 2048 elements = 2048 references (compulsory miss )

That means 2500-2048=452 elements will be left , when the cache size gets full

these 452 references will again replace 452 elements in the cache. ( conflict miss )

 

 

In second iteration :

452 elements will again be replaced as they were the last 452 elements of the array. ( conflict miss )

In between for 1144 elements there will not be any conflict misses

And Finally the last 452 elements will again  require the replacement of first 452 elements. ( conflict miss )

 

So total misses = 2048/64 + ceil(452/64) + ceil(452/64) + ceil(452/64) = 56 misses

 

0 votes
0 votes

The image is self explanatory

I have drawn 50*50 array which is stored in contigious fashion.

Now calculate how much data 1 line can store which is 64B 

Now 2500/64 = 39.05 so 40 blocks will be needed.

 

Answer:

Related questions

22 votes
22 votes
1 answer
2
30 votes
30 votes
2 answers
3
go_editor asked Apr 23, 2016
9,968 views
Consider the following program segment. Here $\text{R1, R2}$ and $\text{R3}$ are the general purpose registers.$$\begin{array}{|l|l|l|c|} \hline & \text {Instruction} & \...
35 votes
35 votes
5 answers
4
go_editor asked Apr 23, 2016
9,464 views
Consider the following program segment. Here $\text{R1, R2}$ and $\text{R3}$ are the general purpose registers.$$\small \begin{array}{|c|l|l||c|} \hline & \text {Instruct...