Search code examples
cachingoperating-systempagingtlb

Calculation of the average memory access time based on the following data?


Consider the following information

  • Assume the cache is physically addressed
  • TLB hit rate is 95%, with access time = 1 cycle
  • Cache hit rate is 90%, with access time of again = 1 cycle
  • Page fault is 1% and occurs when miss occurs in both TLB and Cache
  • The TLB access and cache access are sequential
  • Main memory access time is 5 cycles
  • Disk access time is 100 cycles
  • Page tables are always kept in main memory

What will be the Average memory access time based on the following information ?

My Approach => I am giving my approach of how i understood this question. Please check it.

Average memory access time

==>

Probability of NO page fault (Memory access time) 
+ 
Probability of page fault (Page fault service time)

==>

0.99 ( TLB hit (TLB access time + cache hit + cache miss) + TLB miss (TLB access time + Page table access time + cache hit + cache miss) )

+

0.01 (TLB access time + page table access time + Disk access time)

==>

0.99 ( 0.95 (1 + 0.90(1) + 0.10(1 + 5)) + 0.05(1 + 5 + 0.90(1) + 0.10(1 + 5)))

+

0.01 (1 + 5 + 100)

Is the given expression correct ?

Please let me know, that, is my approach right or have i committed some mistakes?

Can Anyone help me ?

PS : I am having my mid term next week and need to practice such questions


Solution

  • In your case the tricky line is cache is physically addressed meaning before hitting it we must perform the translation (as programs use virtual addresses)

    I build the following probability tree to compute the average. We will be reducing it from leaves to calculate the whole average. Rules are super easy: we calculate branch costs and multiply them by the probability pretty much like you did in your calc. The value I get is 2.7225

    Tree

    complete tree

    1st leave reduction, page fault

    reduction 1

    after the reduction

    after the reduction

    cost for cache hit scenario

    Note: that we pay 1 cycle for cache access anyway

    cache hit scenario cost

    before last reduction

    Note: we pay 1 cycle for TLB anyway

    before last reduction

    1 + 0.95*1.5 + 0.05*5.95 = 1 + 1.425 + 0.2975 = 2.7225