0
$\begingroup$

A computer with a single cache (access time 40ns) and main memory (access time 200ns) also uses the hard disk (average access time 0.02 ms) for virtual memory pages. If it is found that the cache hit rate is 90% and the page fault rate is 1%

I have to work out the EAT time for this and the speedup due to use of cache. I'm really confused about how to do this because I have seen two different ways of doing this and I'm not sure which is correct

solution 1: 0.90*40 + 0.10[0.01*20,000 + 0.99*200]=75.8 ns

solution 2: 0.90*40 + 0.10[0.01*(20,000+200) + 0.99*(2*200)]= 95.8 ns

In the second one, it accesses main memory twice when there is a page hit and accesses disk and main memory when there is a page fault. Which one is correct?

And for the speedup, which equation do I use?: Memory access time/(Memory + Cache access EAT) OR EAT without cache/EAT

$\endgroup$

2 Answers 2

2
$\begingroup$

I would approach it this way : Consider 1000 requests made by the processor - the number arrived at by ensuring whole number of requests to each storage. 90 % or 900 of those are served by the cache. Of the 10 % or 100 which are not, only 1 % or a single request faces a page fault and 99 are served by main memory.

The Expected time per request = ( 900 * 40 + 99 * 200 + 20000 ) / 1000 = 75.8 ns.

The speedup due to the cache is based on the ratio of number of cycles spent on a set of operations without the cache to the same set with a cache.

$\endgroup$
0
$\begingroup$

AFAIK this is how we calculate EMAT.

Assuming no page fault Consider your TLB access time is $t$, main memory (RAM) access time is $m$ ($\gg t$) and TLB hit ratio is $h$. Given $n$-level paging is used. Then $$EMAT=h(t+m) + (1-h)(t+(n+1)m)\,.$$

Assuming no TLB Consider demand paging where page hit ratio is $p$, main memory access time is $m$, page fault service time is $S$ ($\gg m$) and $n$-level paging is used. Then $$EMAT=p(n*m) + (1-p)S\,.$$ Here $S$ includes (page fault overhead + swap page out + swap page in + restart overhead)
Notice: here we'll take $n$ and not $n+1$ because the page hit means you've already found the page in the page table.

EMAT with TLB and page fault Consider your TLB access time is $t$, main memory (RAM) access time is $m$ ($\gg t$) and TLB hit ratio is $h$. If the page hit ratio is $p$, page fault service time is $S$ ($\gg m$) and $n$-level paging is used. Then $$EMAT=h(t+m)+(1-h)[t+p(n*m)+(1-p)S]\,.$$ Basically

EMAT=
TLB hit*(TLB access time + Memory access time)
+ TLB Miss*(TLB access time + PageHit*[n * memory access time]
+ PageMiss*PageFaultServiceTime)

In your question, it should be $0.90(40+200) + 0.10[ 40+ 0.99(2*200) + 0.01(S) ]$. Hence your question is incomplete without page fault service time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.