This is a paragraph from Operating System Concepts, 9th edition by Silberschatz et al:
The percentage of times that the page number of interest is found in the TLB is called the hit ratio. An 80-percent hit ratio, for example, means that we find the desired page number in the TLB 80 percent of the time. If it takes 100 nanoseconds to access memory, then a mapped-memory access takes 100 nanoseconds when the page number is in the TLB. If we fail to find the page number in the TLB then we must first access memory for the page table and frame number (100 nanoseconds) and then access the desired byte in memory (100 nanoseconds), for a total of 200 nanoseconds. (We are assuming that a page-table lookup takes only one memory access, but it can take more, as we shall see.) To find the effective memory-access time, we weight the case by its probability: effective access time = 0.80 × 100 + 0.20 × 200 = 120 nanoseconds
but in the 8th edition of the same book
I'm confused with the
effective access time
Can someone explain it for me?
In the case that the page is found in the TLB (TLB hit) the total time would be the time of search in the TLB plus the time to access memory, so
TLB_hit_time := TLB_search_time + memory_access_time
In the case that the page is not found in the TLB (TLB miss) the total time would be the time to search the TLB (you don't find anything, but searched nontheless) plus the time to access memory to get the page table and frame, plus the time to access memory to get the data, so
TLB_miss_time := TLB_search_time + memory_access_time + memory_access_time
But this is in individual cases, when you want to know an average measure of the TLB performance, you use the Effective Access Time, that is the weighted average of the previous measures
EAT := TLB_miss_time * (1- hit_ratio) + TLB_hit_time * hit_ratio
or
EAT := (TLB_search_time + 2*memory_access_time) * (1- hit_ratio) +
(TLB_search_time + memory_access_time) * hit_ratio