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

📄 第四节.htm

📁 浙江大学计算机学院计算机组成教材《计算机组成与设计》(潘学增)的课堂教学课件。
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<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>存储器层次结构的公共框架(1) </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 size="6" color="#000000">第四节 存储器层次结构的公共框架</font>           
</p>    
    
<p align="center"><font color="#000000" size="6">存储器层次结构的公共框架(1)</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><font size="6">&nbsp;&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       
<a href="3。3.htm"><img border="0" src="IMAGES/PREV.GIF" width="60" height="45"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       
<a href="4.2.htm"><img border="0" src="IMAGES/FORW.GIF" width="60" height="45"></a></font>       
</p>       
       
<p><font size="6" color="#000000">&nbsp;</font>              
</p>              
              
<p><font color="#000000"><font size="6">&nbsp;&nbsp; </font><font size="5">&nbsp;&nbsp;&nbsp;</font><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font>            
</p>            
            
<p><font color="#000000" size="4">&nbsp;下面讨论存储系统的共性问题.</font>          
</p>          
          
        
<table border="1" width="99%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">        
  <tr>        
    <td width="21%"><font color="#000000" size="4">&nbsp; Feature</font></td>           
    <td width="25%"><font color="#000000" size="4">Typical values for catches</font></td>          
    <td width="29%"><font color="#000000" size="4">Typical values for paged           
      memory</font></td>          
    <td width="25%"><font color="#000000" size="4">typical values for a TLB</font></td>          
  </tr>          
  <tr>          
    <td width="21%"><font color="#000000" size="4">Total size in blocks</font></td>          
    <td width="25%"><font color="#000000" size="4">250-10,000</font></td>      
    <td width="29%"><font color="#000000" size="4">2,000-250,000</font></td>      
    <td width="25%"><font color="#000000" size="4">32-1024</font></td>      
  </tr>      
  <tr>      
    <td width="21%"><font color="#000000" size="4">Total size in bytes</font></td>          
    <td width="25%"><font color="#000000" size="4">4KB-4MB</font></td>      
    <td width="29%"><font color="#000000" size="4">8MB-1GB</font></td>      
    <td width="25%"><font color="#000000" size="4">128-8000</font></td>      
  </tr>      
  <tr>      
    <td width="21%"><font color="#000000" size="4">Block size in bytes</font></td>          
    <td width="25%"><font color="#000000" size="4">4-256</font></td>      
    <td width="29%"><font color="#000000" size="4">4KB-16KB</font></td>      
    <td width="25%"><font color="#000000" size="4">4-16</font></td>      
  </tr>      
  <tr>      
    <td width="21%"><font color="#000000" size="4">Miss penalty in clocks</font></td>          
    <td width="25%"><font color="#000000" size="4">10-100</font></td>      
    <td width="29%"><font color="#000000" size="4">100,000-1,000,000</font></td>      
    <td width="25%"><font color="#000000" size="4">10-50</font></td>      
  </tr>      
  <tr>      
    <td width="21%"><font color="#000000" size="4">Miss rates</font></td>          
    <td width="25%"><font color="#000000" size="4">0.1%-20%</font></td>      
    <td width="29%"><font color="#000000" size="4">0.00001%-0.0001%</font></td>      
    <td width="25%"><font color="#000000" size="4">0.01%-1%</font></td>      
  </tr>      
</table>      
<p><font color="#000000" size="4">&nbsp;图7.21充量的说明了存储系统的特性.</font>        
</p>        
        
<p><font size="4" color="#000000">1.地址映射(变换)的方法</font>          
</p>          
          
<p><font color="#000000" size="4">&nbsp; 1) 直接映射DIRECT MAPPING&nbsp;</font>             
</p>             
             
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;在CACHE中看到,设J是高层存储器的字块号,I是低层存储器的块号,M是高层存储器的块数,则J=I MOD M<br>             
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>           
&nbsp;&nbsp;&nbsp;例如(图7.22):替换存储块号为12的三种方法。在直接映射法中,高层存储器为8块,12 mod 8=4。在二路组相联法中,一共有4组,12         
mod 4=0,所以可以替换该组中任意个元素。在全相联法中,数据可以在任一位置出</font>           
</p>           
           
<p><font color="#000000" size="4">&nbsp;现. <img border="0" src="IMAGES/第四1.gif" width="653" height="281">            
</font>            
</p>            
            
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>          
</p>          
          
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>          
</p>          
          
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;    
直接映的优点是实现简单,只需利用主存地址某些字段直接判断,即可确定所虚字块是否在Cache中。其缺点是不够灵活,主存中的字块只能对应唯一的Cache字块,因此 Cache中别的许多地址也不能占用,这使得Cache存储空间得不到充分的利用,并降低了利用率.</font>           
</p>           
           
<p><font color="#000000" size="4">&nbsp; 2) 全相联映象</font>            
</p>            
            
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在虚存系统中可以看到,一个逻辑地址可以放到任何一个物理页中。<br>              
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>             
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;主存地址</font>            
</p>            
            
<div align="center">          
  <center>          
  <table border="1" width="73%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">          
    <tr>          
      <td width="50%"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            
        实际页号数</font></td>           
      <td width="50%"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            
        页面地址</font></td>           
    </tr>           
  </table>           
  </center>       
</div>       
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>       
</p>       
       
<p><font color="#000000" size="4">&nbsp; 3) 组相联映象</font>             
</p>             
             
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 主存地址</font>           
</p>           
           
<div align="center">          
  <center>          
  <table border="1" width="74%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">          
    <tr>          
      <td width="13%"><font color="#000000" size="4">&nbsp; Tag</font></td>           
      <td width="25%"><font color="#000000" size="4">&nbsp;&nbsp; cache组地址</font></td>           
      <td width="29%"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;            
        组内快号</font></td>           
      <td width="33%"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            
        块内地址</font></td>           
    </tr>           
  </table>           
  </center>       
</div>       
<p><font color="#000000" size="4"><br>         
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 介于上述两者之间的地址转换方式,把CACHE分为N组,每组有N页,在组内实行全相联,在组外实行直接映射.</font>           
</p>           
           
<p><font color="#000000" size="4">&nbsp;讨论:全相联是组相联的一个特例,只有一个组的组相联。组相联,组内分块可以提高命中率,但是从4字块到8字块的命中率变化不大.</font>          
</p>          
          
<p><font color="#000000" size="4">&nbsp;实例比较:</font>         
</p>         
         
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例1(图7.23):cache一共有八块,直接映射、二路组相联、四路组相联和</font>        
</p>        
        
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 全相联的结构如下图所示。</font>         
</p>         
         
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img border="0" src="IMAGES/第四2.gif" width="629" height="510">          
</font>          
</p>          
          
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp; 例2:有三个cache,每个cache分为四块,每一块一个字,给定存储器访问的地址是0,8,0,6,8,现在分别用前面三种方法测试一下命中率.         
其中组相联每组二块。</font>         
</p>         
         
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;解&nbsp;:&nbsp;a.直接映象法&nbsp;</font>        
</p>        
        
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          
每一块到cache的地址映象:&nbsp;0 MOD 4 =0&nbsp;&nbsp;&nbsp;&nbsp; 6 MOD 4 =2             
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>             
</p>             
             
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4 MOD 4 =0&nbsp;&nbsp;&nbsp;&nbsp; 8 MOD 4 =0</font>             
</p>             
             
<p><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          
所以直接映象0,8,0,6,8,这五次都失败.</font>          
</p>          
          
<div align="center">         
  <center>         
  <table border="1" width="74%" height="67" bordercolordark="#CC9966" bordercolorlight="#FFCC66">         
    <tr>         
      <td width="9%" height="38" rowspan="2"><font color="#000000" size="4">Address          
        of memory block accessed</font></td>         
      <td width="6%" height="38" rowspan="2"><font color="#000000" size="4">Hit          
        or miss</font></td>         
      <td width="50%" height="45" colspan="4"><font color="#000000" size="4">contents          
        of cache blocks after reference</font></td>         
    </tr>         
    <tr>         
      <td width="12%" height="29"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        0</font></td>          
      <td width="13%" height="29"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;&nbsp;           
        1</font></td>          
      <td width="12%" height="29"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        2</font></td>          
      <td width="13%" height="29"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        3</font></td>          
    </tr>          
    <tr>          
      <td width="9%" height="22"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        0</font></td>          
      <td width="6%" height="22"><font color="#000000" size="4">Miss</font></td>      
      <td width="12%" height="1"><font color="#000000" size="4">Memory[0]</font></td>      
      <td width="13%" height="1"></td>      
      <td width="12%" height="1"></td>      
      <td width="13%" height="1"></td>      
    </tr>      
    <tr>      
      <td width="9%" height="16"><font color="#000000" size="4">&nbsp;&nbsp;&nbsp;           
        8</font></td>          
      <td width="6%" height="16"><font color="#000000" size="4">Miss</font></td>      
      <td width="12%" height="16"><font color="#000000" size="4">Memory[8]</font></td>      

⌨️ 快捷键说明

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