Skip to content
Official PYQ · 2016

GATE CS 2016 Set 2 Q50 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

A file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is 11 ms and to read a block from the disk is 1010 ms. Assume that the cost of checking whether a block exists in the cache is negligible. Available cache sizes are in multiples of 1010 MB.

The smallest cache size required to ensure an average read latency of less than 66 ms is _________ MB.

View worked solution

Answer: 30

To find the smallest cache size required to ensure an average read latency of less than 6 ms6\text{ ms}, we first formulate the average read latency equation.

Let:

  • Latency to read from cache, Tc=1 msT_c = 1\text{ ms}
  • Latency to read from disk, Td=10 msT_d = 10\text{ ms}
  • Miss rate of the cache = mm

Since the cost of checking the cache is 1 ms1\text{ ms} and a disk access is required on a miss, the average read latency TavgT_{\text{avg}} is given by:

Tavg=Tc+m×TdT_{\text{avg}} = T_c + m \times T_d

We require Tavg<6 msT_{\text{avg}} < 6\text{ ms}:

1+m×10<6  ⟹  10m<5  ⟹  m<0.51 + m \times 10 < 6 \implies 10m < 5 \implies m < 0.5

From the given miss rate graph, we observe the miss rates for different cache sizes:

  • At Cache Size=10 MB\text{Cache Size} = 10\text{ MB}, Miss Rate (m)=0.8\text{Miss Rate } (m) = 0.8
  • At Cache Size=20 MB\text{Cache Size} = 20\text{ MB}, Miss Rate (m)=0.6\text{Miss Rate } (m) = 0.6
  • At Cache Size=30 MB\text{Cache Size} = 30\text{ MB}, Miss Rate (m)=0.4\text{Miss Rate } (m) = 0.4

The smallest cache size that achieves a miss rate m<0.5m < 0.5 is 30 MB30\text{ MB} (which gives Tavg=1+0.4×10=5 ms<6 msT_{\text{avg}} = 1 + 0.4 \times 10 = 5\text{ ms} < 6\text{ ms}).

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Memory Hierarchy: Cache, Main Memory and Secondary Storage questions