# GATE | GATE-CS-2014-(Set-3) | Question 65

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 __________.
(A) 1.26
(B) 1.68
(C) 2.46
(D) 4.52

Explanation:

```The question is to find the time taken for,
"100 fetch operation and 60 operand red operations and 40 memory
operand write operations"/"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 ns //0.9 is cache hit rate

Time taken for 60 read operations = 60*((0.9*1)+(0.1*5))
= 84ns

Time taken for 40 write operations = 40*((0.9*2)+(0.1*10))
= 112 ns

// Here 2 and 10 the time taken for write when there is cache
// hit and no cahce hit respectively

So,the total time taken for 200 operations is = 140+84+112
= 336ns

Average time taken = time taken per operation = 336/200
= 1.68 ns ```
My Personal Notes arrow_drop_up
Article Tags :

1

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.