retagged by
28,400 views
16 votes
16 votes

Can anyone explains when to use this formulas?

Average memory access time (AMAT)

AMAT = Hit Time + Miss Rate * Miss Penality

OR

• Effective Access Time:

1. Hit Rate * Hit time+ Miss Rate * Miss Penality

2. [ (H)(TLB access time + mem access time) + (1-H)(TLB access + PT access + mem access)]

retagged by

3 Answers

Best answer
51 votes
51 votes

I'm not going to say when to use these formulas. Because even if I say all the formula there is very little chance any one get it right. Because IIT profs. are not making questions for those remembering formula to answer. They just want to check if one knows the concept properly.

In terms of memory, there are so many scenarios even if we consider GATE level questions. Some common cases are

  1. Cache memory
    Effective Memory Access Time = Cache access time * hit rate + miss rate * Miss penalty
    The above formula is too simple and given in many texts. But it hides what is exactly miss penalty. Because it depends on the implementation and there are simultenous cache look up and hierarchical. Unless otherwise stated in question always assume hierarchical access (case for write through cache explained below). So, for hierarchical cache, we can have the formula:
    Effective Memory Access Time = Cache access time * hit rate + (1 - hit rate) * (cache access time + main memory access time)
    = Cache access time + (1 - hit rate) * main memory access time
  2. Multi level cache
    The above formula can be extended to $n+1$ levels for $n$ levels of caches and main memory
  3. Write Through Cache
    This is applicable when question distinguishes between read and write accesses. When the cache is write through it means all writes going to main memory as well as to cache. Considering the best practical implementation, this should always be considered to be done in parallel and hence only the main memory write matters.
  4. Memory access times can be given in unit of blocks/words and we must use the appropriate one as per the question. When a level 1 access from level 2, block size to be used is of level 1 and similarly for other levels.
  5. In all the above cases we considered only cache and main memory. But if virtual memory is used, we have to consider TLB, page table access etc. TLB is like a cache for page table.
  6. Cache access can be before TLB access - if cache is virtually indexed and virtually tagged - less common
  7. Cache access is after TLB access - if cache is physically indexed and physically tagged - again less common as if TLB is missed we need a main memory lookup for page tables before coming to cache
  8. Cache access is together with TLB acess - if cache is virtually indexed and physically tagged - most common. Here, cache indexing and TLB look-up happens simultaneoulsy and at time of tag comparison, we require physical address.
  9. So, question can come from any of the above cases, so what formula should I give?
selected by
2 votes
2 votes
When u get a hit in the TLB,it generates the physical address or the frame address that maps onto the appropriate frame in the main memory...so TLB access time + main memory time..

 

But when its a miss, that means u have searched the entire TLB for the page number but u didnt get so TLB access is there.. Now u have to access the page table to search the appropriate page number so the page table  access time is included. Now comes the mapping to the appropriate frame.. Once u do that main memory time wud be included.. Hence the equation.. Remember that If u don't find the page in the page table it will generate a page fault then u have to fetch it from the disk...
0 votes
0 votes
Average Memory Access time is used in the context of Cache. AMAT = Hit time + Miss Rate * Miss Penalty.

Effective Memory Access time is used in the context of paging. EMAT = Hit Rate * TLB Time + Miss Rate * Miss Penalty

The difference lies in the fact that the cache will always be serached for, irrespective of if it's a hit or a miss, and this is what constitutes the majority of cache access time; whereas in case of TLB the search time is a negligible fraction of TLB access time and hence it is taken into consideration only when there is a hit.

Related questions