I'm trying to solve a objective type question , came In examination. I actually don't know the right answer, and don't know how to get it , need your help. Thank you .
Question : In a certain system the main memory access time is 100 ns. The cache is 10 time faster than the main memory and uses the write though protocol. If the hit ratio for read request is 0.92 and 85% of the memory requests generated by the CPU are for read, the remaining being for write; then the average time consideration both read and write requests is
a) 14.62ns
b) 348.47ns
c) 29.62ns
d) 296.2ns
My work ::::
Well, memory access time = 100ns
cache access time would be = 10 ns (10 time faster)
In order to find avg time we have a formula
Tavg = hc+(1-h)M
where h = hit rate
(1-h) = miss rate
c = time to access information from cache
M = miss penalty (time to access main memory)
Write through operation : cache location and main memory location is updated simultaneously.
It is given that 85% request generated by CPU is read request and 15% is write request.
Tavg = 0.85(avg time for read request)+ 0.15(avg time for write request)
= 0.85(0.92*10+0.08*100)+0.15(avg time for write request)
//* 0.92 is a hit ratio for read request , but hit ratio for write request is not given ??
If I assume that hit hit ratio for write request is same as hit ratio for read request then,
= 0.85(0.92*10+0.08*100)+0.15(0.92*(10+100)+0.08*100)
=31 ns
If I assume that hit ratio is 0% for write request then,
= 0.85(0.92*10+0.08*100)+0.15(0*110+1*100)
=29.62 ns
A cache hit ratio is calculated by dividing the number of cache hits by the total number of cache hits and misses, and it measures how effective a cache is at fulfilling requests for content.
With a 2-level cache, we can expand our formula: average memory access time = hit time0 + miss rate0 * (hit time1 + miss rate1 * miss penalty1 )
NIM = Net Interest Income / Avg Interest Earning Assets And Average Interest-earning assets are loans / advances given to borrowers by banks / NBFCs. Average of the beginning to end of the period is considered for prudent calculation.
Average Memory access time(AMAT)= Hit Time + Miss Rate * Miss Penalty.
Your second assumption is correct.
With the write-through cache, it writes immediately the modified blocks to memory and then onto disk. Since no disk access time is given, it is eliminated from the equation. My notations are little different, but I will post it that way for future readers. I used the notation given in William Stallings Operating Systems: Internals and Design Principles.
Given:
Tm = 100ns
Tc = 10ns /* 10x faster than Tm */
Hr = 0.92 /* Hit rate reading */
85% reading => 15% of the time writing
Solution:
The effective access time for reading:
Te_r = Hr * Tc + (1-Hr)Tm = 0.92*10 + (1 - 0.92)100 = 9.2 + 8 = 17.2
The effective access time for writing, is determined from the Hit rate Hw,
which is always 0, because the data must be immediately written onto the
memory.
Te_w = Hw * Tc + (1-Hw)Tm = 0*10 + (1 - 0)100 = 100
Taking into account the percentage:
0.85*17.2 + 0.15*100 = 14.62 + 15 = 29.62
Q.E.D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With