Organisasi dan Arsitektur Komputer Perancangan Kinerja William Stallings

  • Slides: 59
Download presentation
Organisasi dan Arsitektur Komputer : Perancangan Kinerja (William Stallings) Chapter 4 Memori Internal Abdul

Organisasi dan Arsitektur Komputer : Perancangan Kinerja (William Stallings) Chapter 4 Memori Internal Abdul Rouf - 1

Karakteristik Memori z Lokasi z Kapasitas z Unit transfer z Metode Akses z Kinerja

Karakteristik Memori z Lokasi z Kapasitas z Unit transfer z Metode Akses z Kinerja z Jenis fisik z Sifat-sifat fisik z Organisasi 2

Lokasi z CPU (register) z Internal (main memori) z External (secondary memori) 3

Lokasi z CPU (register) z Internal (main memori) z External (secondary memori) 3

Kapasitas z Ukuran Word y. Satuan alami organisasi memori z Banyaknya words yatau Bytes

Kapasitas z Ukuran Word y. Satuan alami organisasi memori z Banyaknya words yatau Bytes 4

Satuan Transfer z Internal y. Jumlah bit dalam sekali akses y. Sama dengan jumlah

Satuan Transfer z Internal y. Jumlah bit dalam sekali akses y. Sama dengan jumlah saluran data (= ukuran word) z External y. Dalam satuan block yg merupakan kelipatan word z Addressable unit y. Lokasi terkecil yang dpt dialamati secara uniq y. Secara internal biasanya sama dengan Word y. Untuk disk digunakan satuan Cluster 5

Metode Akses z Sekuensial y Mulai dari awal sampai lokasi yang dituju y Waktu

Metode Akses z Sekuensial y Mulai dari awal sampai lokasi yang dituju y Waktu akses tergantung pada lokasi data dan lokasi sebelumnya y Contoh tape z Direct y Setiap blocks memilki address yg unique y Pengaksesan dengan cara lompat ke kisaran umum (general vicinity) ditambah pencarian sekuensial y Waktu akses tdk tergantung pada lokasi dan lokasi sebelumnya y contoh disk 6

Metode Akses z Random y Setiap lokasi memiliki alamat tertentu y Waktu akses tdk

Metode Akses z Random y Setiap lokasi memiliki alamat tertentu y Waktu akses tdk tergantung pada urutan akses sebelumnya y Contoh RAM z Associative y Data dicarai berdasarkan isinya bukan berdasarkan alamatnya y Waktu akses tdk tergantung terhadap lokasi atau pola akses sebelumnya y Contoh: cache 7

Hierarki Memori z Register y. Dalam CPU z Internal/Main memory y. Bisa lebih dari

Hierarki Memori z Register y. Dalam CPU z Internal/Main memory y. Bisa lebih dari satu level dengan adanya cache y“RAM” z External memory y. Penyimpan cadangan 8

Performance z Access time y. Waktu untuk melakukan operasi baca-tulis z Memory Cycle time

Performance z Access time y. Waktu untuk melakukan operasi baca-tulis z Memory Cycle time y. Diperlukan waktu tambahan untuk recovery sebelum akses berikutnya y. Access time + recovery z Transfer Rate y. Kecepatan transfer data ke/dari unit memori 9

Jenis Fisik z Semiconductor y. RAM z Magnetic y. Disk & Tape z Optical

Jenis Fisik z Semiconductor y. RAM z Magnetic y. Disk & Tape z Optical y. CD & DVD z Others y. Bubble y. Hologram 10

Karakteristik z Decay z Volatility z Erasable z Power consumption Organisasi z Susunan fisik

Karakteristik z Decay z Volatility z Erasable z Power consumption Organisasi z Susunan fisik bit-bit untuk membentuk word 11

Kendala Rancangan z Berapa banyak? y. Capacity z Seberapa cepat? y. Time is money

Kendala Rancangan z Berapa banyak? y. Capacity z Seberapa cepat? y. Time is money z Berapa mahal? 12

Hierarki z Registers z L 1 Cache z L 2 Cache z Main memory

Hierarki z Registers z L 1 Cache z L 2 Cache z Main memory z Disk cache z Disk z Optical z Tape 13

Ingin Komputer yg Cepat? z Komputer hanya menggunakan static RAM z Akan sangat cepat

Ingin Komputer yg Cepat? z Komputer hanya menggunakan static RAM z Akan sangat cepat z Tidak diperlukan cache y. Apa perlu cache untuk cache? z Harga menjadi sangat mahal 14

Locality of Reference z Selama berlangsungnya eksekusi suatu program, referensi memori cenderung untuk mengelompok

Locality of Reference z Selama berlangsungnya eksekusi suatu program, referensi memori cenderung untuk mengelompok (cluster) z Contoh: loops 15

Memori Semiconductor z RAM y. Penamaan yang salah karena semua memori semiconductor adalah random

Memori Semiconductor z RAM y. Penamaan yang salah karena semua memori semiconductor adalah random access (termasuk ROM) y. Read/Write y. Volatile y. Penyimpan sementara y. Static atau dynamic 16

Dynamic RAM z Bit tersimpan berupa muatan dalam capacitor z Muatan dapat bocor z

Dynamic RAM z Bit tersimpan berupa muatan dalam capacitor z Muatan dapat bocor z Perlu di-refresh z Konstruksi sederhana z Ukuran per bit nya kecil z Murah z Perlu refresh-circuits z Lambat z Main memory 17

Static RAM z Bit disimpan sebagai switches on/off z Tidk ada kebocoran z Tdk

Static RAM z Bit disimpan sebagai switches on/off z Tidk ada kebocoran z Tdk perlu refreshing z Konstruksi lebih complex z Ukuran per bit lebih besar z Lebih mahal z Tidak memerlukan refresh-circuits z Lebih cepat z Cache 18

Read Only Memory (ROM) z Menyimpan secara permanen z Untuk y. Microprogramming y. Library

Read Only Memory (ROM) z Menyimpan secara permanen z Untuk y. Microprogramming y. Library subroutines y. Systems programs (BIOS) y. Function tables 19

Jenis ROM z Ditulisi pada saat dibuat y Sangat mahal z Programmable (once) y

Jenis ROM z Ditulisi pada saat dibuat y Sangat mahal z Programmable (once) y PROM y Diperlukan peralatan khusus untuk memprogram z Read “mostly” y Erasable Programmable (EPROM) x. Dihapus dg sinar UV y Electrically Erasable (EEPROM) x. Perlu waktu lebih lama untuk menulisi y Flash memory x. Menghapus seleuruh memori secara electris 20

Organisasi z 16 Mbit chip dapat disusun dari 1 M x 16 bit word

Organisasi z 16 Mbit chip dapat disusun dari 1 M x 16 bit word z 1 bit/chip memiliki 16 lots dengan bit ke 1 dari setiap word berada pada chip 1 z 16 Mbit chip dapat disusun dari array: 2048 x 4 bit y. Mengurangi jumlah addres pins y. Multiplex row address dg column address y 11 pins untuk address (211=2048) y. Menambah 1 pin kapasitas menjadi 4 x 21

Refreshing z Rangkaian Refresh diamsukkan dalam chip z Disable chip z Pencacahan melalui baris

Refreshing z Rangkaian Refresh diamsukkan dalam chip z Disable chip z Pencacahan melalui baris z Read & Write back z Perlu waktu z Menurunkan kinerja 22

Contoh: 16 Mb DRAM (4 M x 4) 23

Contoh: 16 Mb DRAM (4 M x 4) 23

Packaging 24

Packaging 24

Organisation Module 25

Organisation Module 25

Organisation Modul (2) 26

Organisation Modul (2) 26

Koreksi kesalahan z Rusak berat y. Cacat/rusak Permanent z Rusak ringan y. Random, non-destructive

Koreksi kesalahan z Rusak berat y. Cacat/rusak Permanent z Rusak ringan y. Random, non-destructive y. Rusak non permanent z Dideteksi menggunakan Hamming code 27

Error Correcting Code Function 28

Error Correcting Code Function 28

Cache z Memori cepat dg kapasitas yg sedikit z Terletak antara main memory dengan

Cache z Memori cepat dg kapasitas yg sedikit z Terletak antara main memory dengan CPU z Bisa saja diletakkan dalam chip CPU atau module tersendiri 29

Operasi pada Cache z CPU meminta isi data dari lokasi memori tertentu z Periksa

Operasi pada Cache z CPU meminta isi data dari lokasi memori tertentu z Periksa data tersebut di cache z Jika ada ambil dari cache (cepat) z Jika tidak ada, baca 1 block data dari main memory ke cache z Ambil dari cache ke CPU z Cache bersisi tags untuk identitas block dari main memory yang berada di cache 30

Desain Cache z Ukuran (size) z Fungsi Mapping z Algoritma penggantian (replacement algrthm) z

Desain Cache z Ukuran (size) z Fungsi Mapping z Algoritma penggantian (replacement algrthm) z Cara penulisan (write policy) z Ukuran Block z Jumlah Cache 31

Size z Cost y. Semakin besar semakin mahal z Speed y. Semakin besar semakin

Size z Cost y. Semakin besar semakin mahal z Speed y. Semakin besar semakin cepat y. Check data di cache perlu waktu 32

Organisasi Cache 33

Organisasi Cache 33

Fungsi Mapping z Ukuran Cache 64 k. Byte z Ukuran block 4 bytes ydiperlukan

Fungsi Mapping z Ukuran Cache 64 k. Byte z Ukuran block 4 bytes ydiperlukan 16 k (214) alamat per alamat 4 bytes y. Jumlah jalur alamat cache 14 z Main memory 16 MBytes z Jalur alamat perlu 24 bit y(224=16 M) 34

Direct Mapping z Setiap block main memory dipetakan hanya ke satu jalur cache y.

Direct Mapping z Setiap block main memory dipetakan hanya ke satu jalur cache y. Jika suatu block ada di cache, maka tempatnya sudah tertentu z Address terbagi dalam 2 bagian z LS-w-bit menunjukkan word tertentu z MS-s-bit menentukan 1 blok memori z MSB terbagi menjadi field jalur cache r dan tag sebesar s-r (most significant) 35

Struktur Alamat Direct Mapping Tag s-r 8 Line or Slot r Word w 14

Struktur Alamat Direct Mapping Tag s-r 8 Line or Slot r Word w 14 2 z 24 bit address z 2 bit : word identifier (4 byte block) z 22 bit: block identifier y 8 bit tag (=22 -14) y 14 bit slot atau line z 2 blocks pada line yg sama tidak boleh memiliki tag yg sama z Cek isi cache dengan mencari line dan Tag 36

Table Cache Line pada Direct Mapping z Cache line z 0 z 1 blocks

Table Cache Line pada Direct Mapping z Cache line z 0 z 1 blocks main memori 0, m, 2 m, 3 m… 2 s-m 1, m+1, 2 m+1… 2 s-m+1 z m-1, 2 m-1, 3 m-1… 2 s-1 37

Organisai Cache Direct Mapping 38

Organisai Cache Direct Mapping 38

Contoh Direct Mapping 39

Contoh Direct Mapping 39

Keuntungan & Kerugian Direct Mapping z Sederhana z Murah z Suatu blok memiliki lokasi

Keuntungan & Kerugian Direct Mapping z Sederhana z Murah z Suatu blok memiliki lokasi yang tetap y. Jika program mengakses 2 block yang di map ke line yang sama secara berulang-ulang, maka cache-miss sanagat tinggi 40

Associative Mapping z Blok main memori dpt di simpan ke cache line mana saja

Associative Mapping z Blok main memori dpt di simpan ke cache line mana saja z Alamat Memori di interpresi sbg tag dan word z Tag menunjukan identitas block memori z Setiap baris tag dicari kecocokannya z Pencarian data di Cache menjadi lama 41

Organisasi Cache Fully Associative 42

Organisasi Cache Fully Associative 42

Contoh Associative Mapping 43

Contoh Associative Mapping 43

Struktur Address Associative Mapping Word 2 bit Tag 22 bit z 22 bit tag

Struktur Address Associative Mapping Word 2 bit Tag 22 bit z 22 bit tag disimpan untuk blok data 32 bit z tag field dibandingkan dg tag entry dalam cache untuk pengecekan data z LS 2 bits dari address menunjukkan 16 bit word yang diperlukan dari 32 bit data block z contoh y. Address Cache line y. FFFFFC Tag FFFFFC Data 2468 3 FFF 44

Set Associative Mapping z Cache dibagi dalam sejumlah sets z Setiap set berisi sejumlah

Set Associative Mapping z Cache dibagi dalam sejumlah sets z Setiap set berisi sejumlah line z Suatu blok di maps ke line mana saja dalam set ymisalkan Block B dapat berada pada line mana saja dari set i z Contoh: per set ada 2 line y 2 way associative mapping y. Suatu block dpt berada pada satu dari 2 lines dan hanya dalam 1 set 45

Contoh Set Associative Mapping z Nomor set 13 bit z Nomor Block dlm main

Contoh Set Associative Mapping z Nomor set 13 bit z Nomor Block dlm main memori adl modulo 213 z 000000, 00 A 000, 00 B 000, 00 C 000 … map ke set yang sama 46

Organisasi Cache: Two Way Set Associative 47

Organisasi Cache: Two Way Set Associative 47

Struktur Address: Set Associative Mapping Tag 9 bit Word 2 bit Set 13 bit

Struktur Address: Set Associative Mapping Tag 9 bit Word 2 bit Set 13 bit z set field untuk menentukan set cache set yg dicari z Bandingkan tag field untuk mencari datanya z Contoh: z Address Tag Data Set number y 1 FF 7 FFC y 001 7 FFC 1 FF 001 12345678 11223344 1 FFF 48

Contoh Two Way Set Associative Mapping 49

Contoh Two Way Set Associative Mapping 49

Replacement Algorithms (1) Direct mapping z Tidak ada pilihan z Setiap block hanya di

Replacement Algorithms (1) Direct mapping z Tidak ada pilihan z Setiap block hanya di map ke 1 line z Ganti line tersebut 50

Replacement Algorithms (2) Associative & Set Associative z Hardware implemented algorithm (speed) z Least

Replacement Algorithms (2) Associative & Set Associative z Hardware implemented algorithm (speed) z Least Recently used (LRU) z e. g. in 2 way set associative y. Which of the 2 block is lru? z First in first out (FIFO) yreplace block that has been in cache longest z Least frequently used yreplace block which has had fewest hits z Random 51

Write Policy z Must not overwrite a cache block unless main memory is up

Write Policy z Must not overwrite a cache block unless main memory is up to date z Multiple CPUs may have individual caches z I/O may address main memory directly 52

Write through z All writes go to main memory as well as cache z

Write through z All writes go to main memory as well as cache z Multiple CPUs can monitor main memory traffic to keep local (to CPU) cache up to date z Lots of traffic z Slows down writes z Remember bogus write through caches! 53

Write back z Updates initially made in cache only z Update bit for cache

Write back z Updates initially made in cache only z Update bit for cache slot is set when update occurs z If block is to be replaced, write to main memory only if update bit is set z Other caches get out of sync z I/O must access main memory through cache z N. B. 15% of memory references are writes 54

Pentium Cache z Foreground reading z Find out detail of Pentium II cache systems

Pentium Cache z Foreground reading z Find out detail of Pentium II cache systems z NOT just from Stallings! 55

Newer RAM Technology (1) z Basic DRAM same since first RAM chips z Enhanced

Newer RAM Technology (1) z Basic DRAM same since first RAM chips z Enhanced DRAM y. Contains small SRAM as well y. SRAM holds last line read (c. f. Cache!) z Cache DRAM y. Larger SRAM component y. Use as cache or serial buffer 56

Newer RAM Technology (2) z Synchronous DRAM (SDRAM) y currently on DIMMs y. Access

Newer RAM Technology (2) z Synchronous DRAM (SDRAM) y currently on DIMMs y. Access is synchronized with an external clock y. Address is presented to RAM y. RAM finds data (CPU waits in conventional DRAM) y. Since SDRAM moves data in time with system clock, CPU knows when data will be ready y. CPU does not have to wait, it can do something else y. Burst mode allows SDRAM to set up stream of data and fire it out in block 57

SDRAM 58

SDRAM 58

Newer RAM Technology (3) z Foreground reading z Check out any other RAM you

Newer RAM Technology (3) z Foreground reading z Check out any other RAM you can find z See Web site: y. The RAM Guide 59