edited by
23,715 views
69 votes
69 votes
The memory access time is $1$ nanosecond for a read operation with a hit in cache, $5$ nanoseconds for a read operation with a miss in cache, $2$ nanoseconds for a write operation with a hit in cache and $10$ nanoseconds for a write operation with a miss in cache. Execution of a sequence of instructions involves $100$ instruction fetch operations, $60$ memory operand read operations and $40$ memory operand write operations. The cache hit-ratio is $0.9$. The average memory access time (in nanoseconds) in executing the sequence of instructions is ______.
edited by

6 Answers

Best answer
67 votes
67 votes
The question is to find the time taken for,

$\frac{\Large100 \space \text{fetch operations and $60$ operand read operations and $40$ memory
operand write operations}}{\Large\text{total number of instructions}}$.

Total number of instructions $=100+60+40 =200$

Time taken for $100$ fetch operations(fetch = read) $= 100*((0.9*1)+(0.1*5))$

$1$ corresponds to time taken for read when there is cache hit $= 140 \,\text{ns}$

$0.9$ is cache hit rate

Time taken for $60$ read operations,

$= 60*((0.9*1)+(0.1*5))$
$= 84\,\text{ns}$

Time taken for $40$ write operations

$= 40*((0.9*2)+(0.1*10))$
$= 112\,\text{ns}$

Here, $2$ and $10$ are the times taken for write when there is cache hit and no cache hit respectively.

So,the total time taken for $200$ operations is,

$= 140+84+112$
$= 336\,\text{ns}$

Average time taken $=$ time taken per operation

$=\dfrac{336}{200}$

$= 1.68\,\text{ns}$
edited by
37 votes
37 votes
Fetch is also a memory read operation.

Avg access time $= \dfrac{160 (0.9 \times 1+0.1 \times 5)+ 40(0.9 \times 2+0.1 \times 10)}{200} \\=\dfrac{160\times 1.4+40 \times 2.8}{200} \\=\dfrac{336}{200} \\=1.68$
edited by
6 votes
6 votes
TavgR = 0.9 * 1 + 0.1 * 5 = 1.4 //TavgR here is avg time needed to one read operation

TavgW=0.9 *2 + 0.1*10 =2.8 //TavgW here is avg time needed to one write operation

Tavg = Total time needed to read/write operations / total no.of operations

Here Read operations are=100(fetch) + 60(memory read) = 160

Here Write operations are=40

So= (160 * 1.4 + 40 * 2.8 ) / 200

    =336/200=1.68ns
1 votes
1 votes

……………………....………….….………..……..........................….……..…

Answer:

Related questions

35 votes
35 votes
5 answers
4
go_editor asked Sep 28, 2014
8,745 views
Let $S$ be a sample space and two mutually exclusive events $A$ and $B$ be such that $A \cup B = S$. If $P(.)$ denotes the probability of the event, the maximum value of ...