578
技術社區[雲棲]
計算機體係結構6_緩存結構
一,緩存結構
下圖為一個n-way set-associative cache 結構圖:
緩存組織為cache line數組的形式,每一個cache line由三部分組成,內存數據,tag,其他信息。
多個cache line一行,組成一個set,一列cache line為way,在n-way set-associative cache中,每個set由n個cache line
組成,例如一個4-way set-associative cache,每個set由4個cache line組成,每個way一個cache line。
二,緩存索引
通過物理地址獲取數據或指令在緩存中的位置(set, way, byte),每個物理地址被分為三部分:
Index,選擇緩存的行(set),同一行中的所有cache line通過index域選擇。
tag,選擇一行(set)中特定的cache line,物理地址的tag域與每個cache line的tag域進行比較,如果匹配,則發出cache hit信號
,選擇此cache line,否則發出cache miss信號。
offset,物理地址在cache line中的第一個byte,數據或指令從此byte的位置讀取。
三,fully associative cache、direct-mapped scheme和set-associative scheme
direct mapped, if each entry in main memory can go in just one place in the cache, the cache is .
fully associative, If the replacement policy is free to choose any entry in the cache to hold the copy.
N-way set associative, Many caches implement a compromise in which each entry in main memory can go to any one of N places in the cache.
因此2-way set associative意味著,主存中的任意一個entry在緩存中有兩個可以保存的位置。
參考:
AMD64 Architecture Programmer’s Manual Volume 2: System Programming
最後更新:2017-04-03 14:54:08
上一篇:
反射中的Constructor和數組反射
下一篇:
poj 1543 Perfect Cubes【sort排序結構體】
基於圖卷積網絡的圖深度學習
阿裏雲機器學習平台的思考
[WCF REST] Web消息主體風格(Message Body Style)
HDU 1756 判斷點在多邊形內外
Changing the Way of Continuous Delivery with Docker (Part 1)
HDU 3978 斐波那契循環節
卡爾曼濾波簡介及算法實現代碼
Android framework/base 下添加新的接口
Tomcat5發布項目問題(1):jstl java.lang.NoClassDefFoundError javaxelValueExpression
絕對定位元素水平垂直居中的兩種常見方法