# GATE - 2014 | OS | The memory access time is 1 nanosecond for a read operation with a hit in ## Question:

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.68 B 1.69 C 1.7 D 1.71

## Solution:

### Option (A) is Correct.

Total instruction=100 instruction fetch operation +60 memory operand read operation +40 memory operand write op
=200 instructions (operations)

Time taken for fetching 100 instructions (equivalent to read) = 90*1ns + 10*5ns = 140ns

Memory operand Read operations = 90% (60)*1ns + 10% (60) × 5ns = 54ns + 30 ns = 84ns

Memory operands Write operations time = 90% (40)*2ns + 10% (40)*10ns
= 72ns + 40ns = 112ns

Total time taken for executing 200 instructions = 140 + 84 + 112 = 336ns
∴ Average memory access time =336 ns/200=1.68ns

Thank You