⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2。4.htm

📁 浙江大学计算机学院计算机组成教材《计算机组成与设计》(潘学增)的课堂教学课件。
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>高速缓存(4)</title>
<meta name="Microsoft Theme" content="arcs 011">
</head>

<body background="../images/arctile.jpg" bgcolor="#FFFFFF" text="#000000" link="#3399FF" vlink="#666666" alink="#FF9900">

      
      
<p align="center"><font color="#000000" size="6">高速缓存(4)</font>       
</p>       
       
      
      
<p align="right"><font color="#000000"><a href="Index.htm"><img border="0" src="IMAGES/BACK.GIF" align="left" width="60" height="45"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="2。3.htm"><img border="0" src="IMAGES/PREV.GIF" width="60" height="45"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     
&nbsp;&nbsp; <a href="2。5.htm"><img border="0" src="IMAGES/FORW.GIF" width="60" height="45"></a></font>           
</p>           
           
<p><font color="#000000" size="4">            
6.空间局部性的利用</font>              
</p>              
              
<p><font color="#000000" size="4">前面我们所讨论的CACHE都没有很好的利用空间局部性。为了更好的利用部空&nbsp;间局性我们要增加CACHE的容量。当失效时,我们将        
获得相连的多字块,提高了命中率。</font>              
</p>              
              
<p><font color="#000000" size="4">(1) 多字块的优点-----一块由多个字组成,块组相关映射<img border="0" src="IMAGES/第二2.gif" width="820" height="514"></font>                 
</p>                 
                 
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>                
&nbsp;&nbsp;&nbsp;图7.9是64KB CACHE,每一个块为4字。在CACHE地址中有一个下标域(Index&nbsp;field)用来控制 选择器(multiplexor),进而从4个字中选出所需的字。在&nbsp;多字块的CACHE中,总的TAG数少多了,因为每4个字共用一个TAG。</font>                 
</p>                 
                 
<p><font color="#000000" size="4">&nbsp;例子:具有64块且每块容量为16B,字节地址1200映射第几块?</font>              
</p>              
              
<p><font color="#000000" size="4">&nbsp;&nbsp; 解:[1200/16]=75       75 MOD 64=11块</font>                
</p>                
                
<p><font color="#000000" size="4">&nbsp;通用公式是:[字节地址/每块字节数] MOD 缓存块数=CACHE块号<br>                   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>                   
&nbsp;下图(图7.10)是单字块和多字块的比较,可以看出后者效果明显.</font>                
</p>                
                
<div align="center">         
  <center>         
  <table border="1" width="87%" height="114" bordercolordark="#CC9966" bordercolorlight="#FFCC66">         
    <tr>         
      <td width="20%" height="20"><font color="#000000" size="4">&nbsp;        
        program</font></td>         
      <td width="20%" height="20"><font color="#000000" size="4">Block           
        size&nbsp;</font>          
        <p><font color="#000000" size="4">in words</font></td>          
      <td width="20%" height="20"><font color="#000000" size="4">instruction&nbsp;</font>     
        <p><font color="#000000" size="4">miss rate</font></td>          
      <td width="20%" height="20"><font color="#000000" size="4">Data</font>     
        <p><font color="#000000" size="4">miss rate</font></td>         
      <td width="20%" height="20"><font color="#000000" size="4">Effective          
        combined</font>         
        <p><font color="#000000" size="4">miss rate</font></td>         
    </tr>         
    <tr>         
      <td width="20%" rowspan="2" height="38"><font color="#000000" size="4">&nbsp;           
        gcc</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;           
        1</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        6.1%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        2.1%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        5.4%</font></td>          
    </tr>          
    <tr>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;           
        4</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        2.0%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        1.7%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        1.9%</font></td>          
    </tr>          
    <tr>          
      <td width="20%" rowspan="2" height="38"><font color="#000000" size="4">&nbsp;           
        spice</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;           
        1</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        1.2%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        1.3%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        1.1%</font></td>          
    </tr>          
    <tr>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;           
        4</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        0.3%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        0.6%</font></td>          
      <td width="20%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        0.4%</font></td>          
    </tr>          
  </table>          
  </center>      
</div>      
             
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                 
<img border="0" src="IMAGES/2。4.10.gif" width="470" height="332">                 
</font>                 
</p>                 
                 
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp; 上图(图7.11)是cache容量与字块大小对计算机性能的影响比较。</font>                 
</p>                 
                 
<p><font color="#000000" size="4">(2)多字块的读写特点</font>                
</p>                
                
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp; 读操作与单字块一样。写操作不同,固定的一个字块中有多个字,应该用不同的方法处理,不能</font>               
</p>               
               
<p><font color="#000000" size="4">&nbsp; 直接写进标志和数&nbsp; 据。例如,主存地址X和Y都映射CACHE中的C块,设C块已经有Y,现在将X写进TAG字段和数据。此时,C块有X的TAG,而数据却包括一个X字和三个Y字,引起矛盾。所以,我们要先比较TAG,若两者TAG相        
同则写进CACHE中,若两者不同,先从主存中调块到CACHE,再写入。这和单字块的写操作不同。</font>                
</p>                
                
<p><font color="#000000" size="4">(3) 多字块怎么影响性能呢?</font>                 
</p>                 
                 
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp; 一般说来,字块数越大,失效率越低。例如:假设下列字节地址需要,16,    
……,24,……20并 且这些地址都不在CACHE中。如果CACHE是4字块的,访问16地址失效后,16,20,24,28都将 被调入CACHE中。</font>                
</p>                
                
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>              
</p>              
              
<p><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>              
</p>              
              
<p><font color="#000000"><br>               
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>              
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>              
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>              
</font>              
</p>              
              
        
        
</body>        
        
</html>        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -