Fasilkom UI – 2005 Versi: 2.2
Fakultas Ilmu Komputer Universitas Indonesia
Review Memory Systems & Technology Trends
Johny Moningka (moningka@cs.ui.ac.id)
OSK/JM-2005/V2.2/2
Overview
Review: Memory Technology Apa yang seharusnya anda ketahui
•Kuliah sebelumnya: prinsip dasar kerja cell & jenis memory, organisasi chips memory etc.
Teknologi Trends: benchmark (memory access)
•SDRAM, DDR SDRAM, RDDRAM.
Review: Memory Hierarchy
Prinsip dasar rancang bangun semua sistim memori komputer
OSK/JM-2005/V2.2/3
Memory Technology: Terminology (1/2)
Ditinjau dari cara akses, memori dibagi:
Random Access:
•“Random” is good: waktu akses sama untuk semua address memory
•Pengertian akses dapat dilakukan pada semua lokasi data (data availabile, dgn waktu akses sama). •Tipikal: semikonduktor memori (tanpa ada latency
mekanis).
“Non-so-random” Access Technology:
•Waktu akses tergantung lokasi dan kapan di akses. •Terdapat lokasi dimana diperlukan search data (mis.
head pada disk)
Sequential Access Technology: access time linear in location (e.g., tape)
OSK/JM-2005/V2.2/4
Memory Technology: Terminology (2/2)
Ukuran kinerja memory Access time
•Waktu interval antara request data dibaca (ditulis) dan data tersebut deliver (stored)
Cycle time
•Waktu antara memori tersebut diakses, sampai waktu memori tersebut dapat diakses lagi.
•Waktu antara request
Examples: Disk, CDROM
Bandwidht (throughput)
•Rate dimana data dapat ditransfer dari/ke memory Latency = cycle time + access time
OSK/JM-2005/V2.2/5
Semiconductor RAM
Key features
Dalam bentuk package chips (semikonduktor memory) Basic storage unit: cell (satu bit per cell)
Multipe RAM chips membangun sistim memory
SRAM: Static Random Access Memory Low density, high power, expensive, fast Static: content will last (until lose power)
DRAM: Dynamic Random Access Memory High density, low power, cheap, slow Dynamic: need to be “refreshed” regularly
OSK/JM-2005/V2.2/6
Non-volatile Memories
DRAM & SRAM adalah volatile memory Informasi hilang jika “powered off”
Non-volatile memory tetap menyimpan informasi walaupun “powered off”
Generik: ROM (Read Only Memory), walaupun terdapat jenis ROM yang dapat diubah (write).
Jenis ROM:
Programmable ROMs (PROM)
Eraseable Programmable ROM (EPROM)
OSK/JM-2005/V2.2/7 µProc 55%/yr. DRAM 7%/yr. 1 10 100 1000 198 0 198 1 198 3 198 4 198 5 198 6 198 7 198 8 198 9 199 0 199 1 199 2 199 3 199 4 199 5 199 6 199 7 199 8 199 9 200 0 DRAM CPU 198 2 Processor-Memory Performance Gap: (grows 50% / year) Performance
Time
Processor-DRAM Memory Gap (latency)
Why we need DRAM speed up ....
OSK/JM-2005/V2.2/8
The CPU-Memory Gap
The gap widens between DRAM, disk, and CPU speeds. 1 10 100 1,000 10,000 100,000 1,000,000 10,000,000 100,000,000 1980 1985 1990 1995 2000 year ns
Disk seek time DRAM access time SRAM access time CPU cycle time
OSK/JM-2005/V2.2/9
Storage Trends
(Source: Computer Systems, RE Bryant, D. O’Hallaron, Back issues of Byte and PC Magazine) metric 1980 1985 1990 1995 2000 2000:1980 $/MB 8,000 880 100 30 1 8,000 access (ns) 375 200 100 70 60 6 typical size(MB) 0.064 0.256 4 16 64 1,000 DRAM metric 1980 1985 1990 1995 2000 2000:1980 $/MB 19,200 2,900 320 256 100 190 access (ns) 300 150 35 15 2 100 SRAM metric 1980 1985 1990 1995 2000 2000:1980 $/MB 500 100 8 0.30 0.05 10,000 access (ms) 87 75 28 10 8 11 typical size(MB) 1 10 160 1,000 9,000 9,000 Disk OSK/JM-2005/V2.2/10
CPU Clock Rates
1980 1985 1990 1995 2000 2000:1980 processor 8080 286 386 Pent P-III
clock rate(MHz) 1 6 20 150 750 750 cycle time(ns) 1,000 166 50 6 1.6 750
OSK/JM-2005/V2.2/11
Memory Technology: DRAM (1/2)
Sinkronus DRAM (SDRAM)
Kecepatan memori bus meningkat dari 66 MHz, menjadi 100 MHz, 133 MHz
Interface baru chipset (controller):
•transfer/latch data secara sinkronus (burst) dari/ke CPU (dikenal: 100 Mhz setara dgn 10 ns). Double Data Rate DRAM (DDR SDRAM)
Interface sama seperti SDRAM, hanya memanfaatkan “edge/trigger clock” naik dan turun => 2 sinyal pada 1 clock
•Secara efektif clock 100 MHz => 2 x 100 MHz => 200 MHz
OSK/JM-2005/V2.2/12
Memory Technology: DRAM (2/2)
Saat ini trend teknologi “main memory” dikuasai oleh DDR SDRAM (open standar JEDEC)
Chip specification
DDR-333: DDR-SDRAM - 166 MHz
DDR-400: DDR-SDRAM - 200 MHz
Stick/module specification
PC-2700: DDR-SDRAM using DDR-333 chips,
2.667 GByte/s bandwidth per channel
PC-3200: DDR-SDRAM using DDR-400 chips,
OSK/JM-2005/V2.2/13
Memory Technology: DRAM (3/3)
Dual Channel DDR
Platform => dua kanal memory module dapat diakses oleh CPU sekaligus.
Terintegrasi dgn sistim chipset (motherboard).
Rambus (RDRAM)
Protocol based => asinkronus (proprietary Intel dan Rambus Inc.)
Interface baru dalam bentuk chips controller dengan clock rate yang lebih tinggi dari SDRAM.
Proprietary: mahal dan tidak mendapat dukungan dari industri
Tidak banyak dukungan lagi, setelah Intel terpaksa mendukung DDR DRAM pada Pentium 4.
OSK/JM-2005/V2.2/14
Recap. Memroy Property: fast, cheap & big
Fakta teknologi memory (tipikal PC): Static RAM: access time: 1-2 ns; size: 256K SDRAM: access time: 20 ns – 100 ns: size 1024 MB Hard-disk (Disk): access time: 5 ms – 10 ms;
size: 40 – 200 GB
Tape/Network: access time: > 10 ms; size > 1000 GB
Fakta & cost:
Memori dengan akses cepat => kapasitas kecil Memori dengan kapasitas kecil => high cost
Memory dengan kapasitas besar dan “low cost”, pasti lambat,
Bagaimana membuat sistim memori yang besar, murah dan cepat (… most of the time)?
OSK/JM-2005/V2.2/15
Locality of Programs
Principle of Locality:
Program cenderung menggunakan kembali (reuse) data dan instruksi yang sebelumnya digunakan (recently)
Temporal locality: Recently referenced items are likely to be referenced in the near future.
Spatial locality: Items with nearby addresses tend to be referenced close together in time.
Umumnya instruksi (code program) mempunyai karakteristik kedua locality tsb
Structured programming: flow program Procedure call
OSK/JM-2005/V2.2/16
Locality Example
• Data
– Reference array elements in succession (stride-1 reference pattern):
– Reference sum each iteration:
• Instructions
– Reference instructions in sequence: – Cycle through loop repeatedly:
Spatial locality Spatial locality Temporal locality Temporal locality sum = 0; for (i = 0; i < n; i++) sum += v[i]; return sum; OSK/JM-2005/V2.2/17 Memory Hierarchies
Properti dasar dari hardware dan software: Teknologi storage yang cepat lebih mahal per-byte,
dengan kapasitas yang lebih kecil.
Umumnya program cenderung mengikuti prinsip lokalitas.
Terdapat kesenjangan (gap) antara kecepatan CPU dan memory => perlu memory yang cepat
Properti ini yang saling melengkapi untuk membangun sistim memory/storages komputer dalam bentuk memory hierarchy.
OSK/JM-2005/V2.2/18
An Example Memory Hierarchy registers on-chip L1 cache (SRAM)
main memory (DRAM)
local secondary storage (local disks) Larger, slower, and cheaper (per byte) storage devices
remote secondary storage (tapes, distributed file systems, Web servers)
Local disks hold files retrieved from disks on remote network servers. Main memory holds disk blocks retrieved from local disks.
off-chip L2 cache (SRAM)
L1 cache holds cache lines retrieved from the L2 cache memory. CPU registers hold words retrieved from L1 cache.
L2 cache holds cache lines retrieved from main memory.
L0: L1: L2: L3: L4: L5: Smaller, faster, and costlier (per byte) storage devices
OSK/JM-2005/V2.2/19
Caches
Cache:A smaller, faster storage device that acts as a
staging area for a subset of the data in a larger, slower device.
Ide dasar dari memory hirakis:
Untuk setiap k, “faster”, “smaller” device pada tingkat k melayani sebagai cache untuk “larger”, “slower” device pada tingkat (k+1).
Fungsi cache?
Program cenderung mengakses data pada tingkat k lebih sering dibanding mengakses data pada tingkat (k+1).
Jadi, storage pada tingkat (k+1) dapat lebih lambat, tapi lebih besar dan murah per-MB.
Net effect: A large pool of memory that costs as much as
the cheap storage near the bottom, but that serves data to programs at the rate of the fast storage near the top.
OSK/JM-2005/V2.2/20
Memory Hierarchy: How Does it Work?
Temporal Locality (Locality in Time):
=> Keep most recently accessed data items closer to the processor
Spatial Locality (Locality in Space):
=> Move blocks consists of contiguous words to the upper levels Lower Level Memory Upper Level Memory To Processor From Processor Block Block copy OSK/JM-2005/V2.2/21
Caching in a Memory Hierarchy
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Larger, slower, cheaper storage device at level k+1 is partitioned into blocks.
Data is copied between levels in block-sized transfer units
8 9 14 3
Smaller, faster, more expensive device at level k caches a subset of the blocks from level k+1 Level k: Level k+1: 4 4 4 10 10 10 OSK/JM-2005/V2.2/22 Request 14 Request 12
General Caching Concepts
Program perlu objek d, yang
tersimpan pada blok b.
Cache hit
Program finds b in the cache at level k. E.g., block 14.
Cache miss
b is not at level k, so level k cache must fetch it from level k+1. E.g., block 12.
If level k cache is full, then some current block must be replaced (evicted). Which one is the “victim”?
•Placement policy:where can the new block go? E.g., b mod 4
•Replacement policy:which block should be evicted? E.g., LRU
9 3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Level k: Level k+1: 14 14 12 14 4* 4* 12 12 0 1 2 3 Request 12 4* 4* 12 OSK/JM-2005/V2.2/23
Examples of Caching in the Hierarchy
Hardware 0 On-Chip TLB Address translations TLB Web browser 10,000,000 Local disk Web pages Browser cache Web cache Network buffer cache Buffer cache Virtual Memory L2 cache L1 cache Registers Cache Type Web pages Parts of files Parts of files 4-KB page 64-bytes block 64-bytes block 4-byte words What is Cached? Web proxy server 1,000,000,000 Remote server disks OS 100 Main memory Hardware 1 On-Chip L1 Hardware 10 Off-Chip L2 AFS/NFS client 10,000,000 Local disk Hardware+ OS 100 Main memory Compiler 0 CPU core Managed By Latency (cycles) Where is it Cached? OSK/JM-2005/V2.2/24
How is the hierarchy managed?
Apa yang telah dipelajari? Managed & transfer data?
Siapa yang bertanggung jawab.
Apa yang dapat dilakukan oleh programmer? Designer? User? Registers <-> Main-memory by compiler (programmer?) Cache <-> Main-memory by the hardware Main-memory <-> Disks
OSK/JM-2005/V2.2/25
Summary ..
Perkembangan teknologi dan organisasi CPU jauh lebih cepat dari memori => terdapat “gap” antara CPU dan memory.
Solusi teknologi memori mencoba mempersempit gap ini tapi tidak tetap tidak mampu mengejar ketinggalan tsb
Terknologi memori utama teranyar: DDR SDRAM, mampu memompa data ke CPU dalam orde clock 200 MHz, tapi CPU mempunyak clock rate 3 GHz.
OSK/JM-2005/V2.2/26
Summary
Pengamatan eksekusi program:
Tidak semua kode program mempunyai kemungkinan yang sama diakses oleh CPU
Program menganut prinsip lokalitas: temporaldan spatial
Memori hirarkisadalah pilihan terbaik dalam menyediakan sistim memori yang cepat dengan kapasitas dan cost yang termurah
Big IDEA: “gap” antara kecepatan dan kapasitas dalam penyimpanan data (komponen komputer) harus diorganisasikan secara hirarkis dengan memperpendek “gap” tsb, dengan
struktur/organisasi baru => caching
OSK/JM-2005/V2.2/27
Review Questions
1. Berikan contoh program (pseudo code) yang tidak menganut prinsip lokalitas (temporal dan spatial) terhada data akses.
Berikan karakteristik umum jenis program tsb.
2. Apakah ada program yang menunjukkan lokalitas temporal yang sangat tinggi, tapi spatial yang rendah terhadap data akses, atau sebaliknya.
3. Berikan contoh program (pseudo code) yang menunjukkan lokalitas temporal yang tinggi terhadap instruction (fetch).
4. Misalkan suatu komputer, waktu akses rata-rata cache = 20 ns, waktu akses rata-rata ke main-memory =100 ns. Asumsikan cache hit ratio dapat mencapai 95%. Hitung waktu rata-rata akses efektif sistim memori tersebut?