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 _____.

Official answer and solution
Official answer
1.68
From
Official GATE 2014 answer key

Solution

Compute weighted average access times for reads and writes separately, then find the overall average memory access time across all 200 operations.

  1. Operation Breakdown:

    • Instruction fetch operations: 100100 (these are memory read operations).
    • Memory operand read operations: 6060.
    • Total Read operations = 100+60=160100 + 60 = 160.
    • Memory operand write operations: 4040.
    • Total memory operations = 160+40=200160 + 40 = 200.
  2. Given Latencies and Hit Ratio (h=0.9h = 0.9):

    • Read operations:
      • Hit latency = 11 ns
      • Miss latency = 55 ns
      • Average read latency: Tread=0.9(1)+0.1(5)=0.9+0.5=1.4T_{\text{read}} = 0.9(1) + 0.1(5) = 0.9 + 0.5 = 1.4 ns.
    • Write operations:
      • Hit latency = 22 ns
      • Miss latency = 1010 ns
      • Average write latency: Twrite=0.9(2)+0.1(10)=1.8+1.0=2.8T_{\text{write}} = 0.9(2) + 0.1(10) = 1.8 + 1.0 = 2.8 ns.
  3. Total Access Time for the Sequence:

    Ttotal=(160×1.4)+(40×2.8)=224+112=336 ns.T_{\text{total}} = (160 \times 1.4) + (40 \times 2.8) = 224 + 112 = 336\text{ ns}.
  4. Average Memory Access Time:

    Tavg=Ttotal200=336200=1.68 ns.T_{\text{avg}} = \frac{T_{\text{total}}}{200} = \frac{336}{200} = 1.68\text{ ns}.
Final answer

1.68

Common trap

Treating instruction fetches separately or forgetting to count them as read operations.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2014 Computer Science and Information Technology (CS) Session 3
Question
54 of 65, printed as CS Q.44
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.