Question
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 1 ms and to read a block from the disk is 10 ms. Assume that the cost of checking whether a block exists in the cache is negligible. Available cache sizes are in multiples of 10 MB.
The smallest cache size required to ensure an average read latency of less than 6 ms is _____ MB.
Official answer and solution
- Official answer
- 30
- From
- Official GATE 2016 answer key
Solution
Set up the average latency formula as a function of miss rate and read the smallest valid discrete cache size from the graph.
Let be the cache miss rate (expressed as a fraction ). The hit rate is .
Reading from cache takes , while reading from disk on a miss takes . The average read latency is:
We need the average read latency to be strictly less than 6 ms:
From the given miss rate graph:
- At Cache Size = 10 MB: Miss rate = 80% ()
- At Cache Size = 20 MB: Miss rate = 60% ()
- At Cache Size = 30 MB: Miss rate = 40% ()
- At Cache Size = 40 MB: Miss rate = 30% ()
Since cache sizes are available in multiples of 10 MB, the smallest cache size that achieves an average read latency under 6 ms is 30 MB.
30
Adding disk access time on top of cache latency during a miss (i.e. ), or misinterpolating the discrete values plotted on the graph.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 2
- Question
- 60 of 65, printed as CS Q.50
- 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.