什么是平均指令执行时间?

时间:2016-10-17 14:54:03

标签: memory operating-system paging cpu-architecture tlb

这是我的作业问题。我只想确认我的方法,从而确认答案。

具有2级分页方案的计算机系统,其中常规内存访问需要300纳秒并且服务于页面故障需要500ns。平均指令需要200 ns的CPU时间和一次内存访问。 TLB命中率为80%,页面错误率为20%。平均指令执行时间是?

我的方法=>

**Average time To Execute Instruction = CPU Time + Memory Access Time**

It is given that CPU Time = 200 ns 
Probability of having a page fault for an instruction = 20% = 1/5  
Hence, probability of not having a page fault = 4/5

If TLB hit occurs, 
then memory Access time = 0 + 300 = 300 ns ( Here, TLB is taken negligible, so,  0 )

and


if TLB miss occurs,
then Memory Access Time = TLB access time + Access time Page Table 1 +
Access time Page table 2 + one memory Access = 0+ 300 + 300 + 300 =  900 ns
( Assume  all  the  page  tables  in  main  memory )

Hit ratio of TLB = 80 %

Hence, Memory Access Time = prob. of no page fault (...Memory 
access...........) + prob. of page fault (.......Page fault service 
time..........)

Memory Access Time = 4/5 ( 0.80 * 300 + 0.20 * 900 )
+ 1/5 ( (0.80 * 300 + 0.20 * 900) + 500 ns for servicing a page fault ) 
                                 = 336 + 184  
                                 = 520 ns 

Average time To Execute Instruction = CPU Time + Memory Access Time 
Average time To Execute Instruction = 200 ns + 520 ns = 720 ns . 

如果我犯了任何错误,请纠正我。

0 个答案:

没有答案