retagged by
2,879 views
13 13 votes

Consider a Computer system with a single core CPU, a single level of cache of size $4 \text{MB}$, and main memory. It takes one CPU cycle to access a memory byte if it is in cache, and $145$ cycles if the memory access incurs a cache miss and must be fetched from main memory. The size of the cache line is $64$ bytes. Consider two arrays $A$ and $B$, each of $N=2^{20}$ integers (assume that an integer requires $4$ bytes of storage). The arrays are stored contiguously in memory, and are aligned at cache line boundaries. The below code shows an access pattern of the arrays $A$ and $B$. Calculate the average time (in CPU cycles) required to access a single element of array $A$ (averaged overall accesses to $A$). Assume that the cache is empty at the start of every scenario, and no other process is using the cache and the cache does not use any optimizations like prefetching.
A direct mapped cache, and every element of $A$ and $B$ is read in sequence as follows:

for (i=0;i<N;i++)
{
    read A[i];
    read B{i];
}

 

1 Answer

Answer:
Position:
Show:

Related questions

7 7 votes
1 answers 1 answer
2.1k
2.1k views
Ruturaj Mohanty asked Dec 27, 2018
2,132 views
Consider the $2$ dimensional array $A$:int A[][]=new int[100][100];where $A[0][0]$ is at location $800$ in a paged memory system with pages of size $800 bytes$. Each int ...
75 75 votes
9 answers 9 answers
39.6k
39.6k views
Kathleen asked Sep 13, 2014
39,593 views
The access times of the main memory and the Cache memory, in a computer system, are $500$ n sec and $50$ nsec, respectively. It is estimated that $80\%$ of the main memor...
2 2 votes
2 answers 2 answers
2.1k
2.1k views
Ruturaj Mohanty asked Dec 27, 2018
2,069 views
A program runs in $20s$ in machine A with a clock speed of $200MHz$. A computer architecture wants to build a machine B which will run this program in $6$ seconds. The a...
2 2 votes
1 answers 1 answer
1.9k
1.9k views
Ruturaj Mohanty asked Dec 27, 2018
1,858 views
A $5$ stage pipeliine is used to overlap all the instructions except the branch instructions. The target of the branch can't be fetched till the current instruction is co...