Ch6 Memory
- 重點一、Principle of Locality
- Pinciple of locality
- temporal locality
- spatial locality
- Memory Technology
- SRAM
- DRAM
- Magnetic disk
- Pinciple of locality
- 重點二、Memory Hierarchy
- 目的
- Block
- terminology (術語)
- hit
- miss
- 重點三、Cache
- direct-mapped cache
- Spatial locality 優點
- block size & missed rate
- 減少 miss penality 方法
- 重點四、Cache Concept
- Cache miss handling
- Cache Write-in handling
- Write Allocate
- Cache 實現分為 : Split Cache & Combined Cache
- Memory Design to Support Cache
- 提升 Memory 結構支援 Cache (p30.)
- 重點五、Cache Performance
- CPU Time
- Mem-stall cycle per program
- Mem-stall cycle per instruction
- CPI effective
- Mem-stall
- hazard-stall
- 重點六、Set associative Cache
- 重點七、多層 Cache 來減少 Miss Penalty Time
- GMR & LMR
- AMAT
- 重點八、Virtual Memory
- address 轉譯
- Page Table ( in memory )
- Page Fault
- LRU 實作
- Write in handling
- 減少 page table size
- 重點九、TLB (Translation Lookaside Buffer)
- 整合 Vitual Memory & TLB & Cache
- 記憶體階層的全部動作
- 重點十、Virtual Addressed Cache
- 重點十ㄧ、Virtual Memory 保護機制
- 重點十二、Memory Hierarchy 4 Question
- Q1 : Block 可以放在哪個地方?
- Q2 : 如何找到 Block ?
- Q3 : Cache miss 時,如何 swap ?
- Q4 : Write in 時會發生什麼 ?
- 重點十三、3C
- 降低 miss penalty 技術
- 重點十四、Cache Control design
- 重點十五、Virtual Machine (參考 O.S)
重點一
Pinciple of Locality
- Pinciple of locality
程式在任何時間點只會存取一小部分的位址空間,稱為區域性(Locality)- [1] temporal locality : 一個 item(instruction or data) 被存取到,很有可能會被再存取到。(e.g. loop)
- [2] spatial locality : 一個 item 被存取到,它位址附近的 item 也很快會被存取到。(e.g. array,program)
- Memory Technology
- SRAM (static random access memory)
- use for cache
- static: content will last forever until lost power
- low density, high power, fast
- DRAM (dynamic random access memory)
- use for main memory
- dynamic: need to be fresh regularly
- high density, low power, slow
- Magnetic disk
- SRAM (static random access memory)
重點二
Memory Hierarchy
- at any given time, data is copied between only two adjacent levels
- upper level: 離 Processor(CPU) 越近,記憶體越快 e.g. Cache
- lower level: 離 Processor(CPU) 越遠,記憶體越慢 e.g. Disk
- 目的 : 用便宜的技術擁有足夠的記憶體,並用最快的記憶體提供最快的存取速度
- Block : the basic unit of information transfer
- terminology (術語)
- hit: data appears in upper level
- hit rate: fraction of memory access found in the upper level
- hit time: 判斷記憶體是否hit + 把上層資料搬到處理器的時間
- miss: data needs to be retrived from a block in the lower level
- miss rate: 1 - (hit rate)
- miss penalty: Time to replace a block in the upper level(主要) + time to deliver the block to processor(CPU)裡的 cache (L1 Cache)
- hit time << miss penalty
- hit: data appears in upper level
重點三
Cache
direct-mapped cache
- 在 cache 裡要儲存 valid bit + tag + data
- valid bit
- 紀錄 cache 內是否為有效資訊
- 1 = present, 0 = not present
- initially 0,因為處理器剛啟動時,內容全部是無效的
- valid bit