简体   繁体   English

计算有效访问时间

[英]calculate the effective access time

This is a paragraph from Operating System Concepts, 9th edition by Silberschatz et al: 这是Silberschatz等人的第9版操作系统概念的一段:

The percentage of times that the page number of interest is found in the TLB is called the hit ratio. 在TLB中找到感兴趣的页面编号的次数称为命中率。 An 80-percent hit ratio, for example, means that we find the desired page number in the TLB 80 percent of the time. 例如,80%的命中率意味着我们在80%的时间内在TLB中找到所需的页码。 If it takes 100 nanoseconds to access memory, then a mapped-memory access takes 100 nanoseconds when the page number is in the TLB. 如果访问内存需要100纳秒,那么当页码在TLB中时,映射内存访问需要100纳秒。 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. 如果我们无法在TLB中找到页码,那么我们必须首先访问页表和帧号(100纳秒)的内存,然后访问内存中所需的字节(100纳秒),总共200纳秒。 (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 (我们假设页面表查找只需要一次内存访问,但它可能需要更多内容,我们将会看到。)为了找到有效的内存访问时间,我们通过概率对案例进行加权:有效访问时间= 0.80 ×100 + 0.20×200 = 120纳秒

but in the 8th edition of the same book 但是在同一本书的第8版中 在此输入图像描述

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(TLB命中)中找到页面,则总时间将是TLB中搜索的时间加上访问内存的时间,因此

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(TLB未命中)中找不到页面,则总时间将是搜索TLB的时间(您没有找到任何内容,但仍未搜索)以及访问内存以获取页面表的时间和框架,加上访问内存以获取数据的时间,所以

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 但是在个别情况下,当您想知道TLB性能的平均度量时,您使用有效访问时间,即先前度量的加权平均值

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

The effective time here is just the average time using the relative probabilities of a hit or a miss. 这里的有效时间只是使用命中或未命中的相对概率的平均时间。 So if a hit happens 80% of the time and a miss happens 20% of the time then the effective time (ie average time) over a large number of hits/misses will be 0.8 * (hit time) + 0.2 * (miss time). 因此,如果在80%的时间内发生命中并且在20%的时间内发生未命中,则在大量命中/未命中的有效时间(即平均时间)将是0.8 *(命中时间)+ 0.2 *(未命中时间) )。

General Formula for EAT EAT通用公式

Hit ratio = a 命中率= a

Main Memory access time = m 主存储器访问时间= m

Associative Lookup (TLB access) = e 关联查找(TLB访问)= e

EAT = (m + e) a + (2m + e) (1 - a) EAT =(m + e)a +(2m + e)(1 - a)

    = 2m - ma + e

In TLB a copy of frequently accessed page number and frame no is maintained which is from the page table stored into memory. 在TLB中,保持频繁访问的页码和帧号的副本,该副本来自存储在存储器中的页表。

It first looks into TLB. 它首先考虑TLB。 If found, it goes to the memory location so the total access time is equals to: 如果找到,它将进入内存位置,因此总访问时间等于:

20 + 100 = 120 ns

Now if TLB is missing then you need to first search for TLB, then for the page table which is stored into memory. 现在如果缺少TLB,则需要先搜索TLB,然后搜索存储在内存中的页表。 So one memory access plus one particular page acces, nothing but another memory access. 所以一个内存访问加上一个特定的页面访问,只有另一个内存访问。 So the total time is equals to: 所以总时间等于:

20 + 100 + 100 = 220 ns

And effective memory access time is equals to: 有效的内存访问时间等于:

0.80 * 120 + 0.20* 220 = 140 ns

有效访问时间是访问内存所花费的总时间(即主内存和缓存访问时间的总和)除以内存引用的总数。

平均访问时间是命中时间+未命中率*错过时间,不同意@Paul R的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM