BAB 1 - Uky Yudatama, S.Si, M.Kom | Tidak Ada Kata Sulit ... · Web viewDMA Transfer Cycle Stealing...
Transcript of BAB 1 - Uky Yudatama, S.Si, M.Kom | Tidak Ada Kata Sulit ... · Web viewDMA Transfer Cycle Stealing...
BAB 1Pendahuluan
1.1. Arsitektur & Organisasi
Arsitekture komputer berkaitan dengan atribute-atribute yang nampak bagi
programmer
Set Instruksi, jumlah bit yang digunakan untuk penyajian data,
mekanisme I/O, teknik pengalamantan (addressing techniques).
Contoh: apakah tersedia instruksi untuk perkalian?
Organisasi komputer berkaitan dengan unit-unit operasional dan
interkoneksinya yang merealisasikan spesifikasi arsitektural
Control signals, interfaces, memory technology.
Contoh: Apakah instruksi perkalian diimplementasikan secara hardware,
ataukah dikerjakan dengan penambahan secara berulang?
Arsitektur sama, organisasi dapat berbeda
Arsitektur bertahan lama, organisasi menyesuaikan perkembangan
teknologi
Semua Intel famili x86 memiliki arsitektur dasar yang sama
Famili IBM System/370 memiliki arsitektur dasar yang sama
Memberikan compatibilitas instruksi level mesin
At least backwards
Organisasi antar versi memiliki perbedaan
1.2. Struktur & Fungsi Strukture adalah bagaimana masing-masing komponen saling
berhubungan satu sama lain
Fungsi merupakan operasi dari masing-masing komponen sebagai bagian
dari struktur
1
a. FUNGSI Semua komputer memiliki 4 fungsi:
Pengolahan data - Data processing
Penyimpanan data - Data storage
Pemindahan data - Data movement
Kendali – Control
Gambar 1.1. Komputer dilihat dari sudut pandang Fungsi.
a. Fungsi – Pemindahan data
Contoh: dari keyboard ke layar monitor
2
Gambar 1.2. Fungsi – Pemindahan datab. Fungsi – Penyimpanan data
Contoh: download dari internet
Gambar 1.3. Fungsi – Penyimpanan data
c. Fungsi – Pengolahan data
Contoh: updating bank statement
Gambar 1.4. Fungsi – Pengolahan data
3
d. Fungsi – Pengolahan data
Contoh: pencetakan bank statement
Gambar 1.5. Fungsi – Pengolahan data
b. STRUKTUR
4
Gambar 1.6. Strukture Komputer - Top Level
Gambar 1.7. Strukture CPU
5
Gambar 1.8. Strukture - Control Unit
BAB 2Evolusi dan Kinerja Komputer
2.1. ENIAC Electronic Numerical Integrator And Computer
Eckert and Mauchly
University of Pennsylvania
Tabel Lintasan peluru
Mulai dibuat 1943
Selesai 1946
Terlambat untuk digunakan dlm PD-II
Dipakai sampai 1955
2.2. ENIAC - details Menggunakan sistem Decimal (bukan binary)
Memiliki 20 accumulator untuk 10 digits
Diprogram secara manual melalui sakelar
Berisi 18,000 vacuum tubes
Berat 30 tons
Luas 15,000 square feet
Daya 140 kW
Kecepatan: 5,000 penambahan per detik
2.3. von Neumann/Turing Konsep: Stored Program Computer
Main memory: menyimpan program dan data
ALU: mengerjakan operasi data biner
Control unit: interpretasi instruksi dari memory dan meng-eksekusi
Peratan Input/output dikendailkan oleh control unit
6
Princeton Institute for Advanced Studies
IAS
Selesai dibuat 1952
Gambar 2.1. Structure Mesin von Nuemann
2.4. IAS - details Kapasitas memori: 1000 x 40 bit words
Menggunakan sistem bilangan Biner
Panjang instruksi 20 bit ( 1 word = 2 instruksi )
Register-register dalam CPU
MBR (Memory Buffer Register)
MAR (Memory Address Register)
IR (Instruction Register)
IBR (Instruction Buffer Register)
PC (Program Counter)
AC (Accumulator)
MQ (Multiplier Quotient)
7
Gambar 2.2. Structure detail IAS
2.5. Komputer Komersial 1947 - Eckert-Mauchly Computer Corporation
UNIVAC I (Universal Automatic Computer)
Untuk kalkulasi sensus 1950 oleh US Bureau of Census
Menjadi divisi dari Sperry-Rand Corporation
UNIVAC II dipasarkan akhir th. 1950-an
Lebih cepat
Kapasitas memori lebih besar
2.6. IBM Pabrik peralatan Punched-card
1953 – IBM-701
Komputer pertama IBM (stored program computer)
Untuk keperluan aplikasi Scientific
8
1955 – IBM- 702
Untuk applikasi bisnis
Merupakan awal dari seri 700/7000 yang membuat IBM menjadi pabrik
komputer yang dominan
2.7. Transistor Menggantikan vacuum tubes
Lebih kecil
Lebih murah
Disipasi panas sedikit
Merupakan komponen Solid State
Dibuat dari Silicon (Sand)
Ditemukan pada th 1947 di laboratorium Bell
Oleh William Shockley dkk.
2.8. Komputer berbasisTransistor Mesin generasi II
NCR & RCA menghasilkan small transistor machines
IBM 7000
DEC - 1957
Membuat PDP-1
2.9. Microelectronics Secara harafiah berarti “electronika kecil”
Sebuah computer dibuat dari gerbang logika (gate), sel memori dan
interkoneksi
Sejumlah gate dikemas dalam satu keping semikonduktor
silicon wafer
2.10. Generasi Komputer
9
1946-1957 : Vacuum tube
1958-1964 : Transistor
1965-1971 : SSI - Small scale integration
Up to 100 devices on a chip
1971 : MSI - Medium scale integration (
100-3,000 devices on a chip
1971-1977 : LSI - Large scale integration
3,000 - 100,000 devices on a chip
1978- : VLSI - Very large scale integration
100,000 - 100,000,000 devices on a chip
Ultra large scale integration
Over 100,000,000 devices on a chip
2.11. Moore’s Law Gordon Moore - cofounder of Intel
Meningkatkan kerapatan komponen dalam chip
Jumlah transistors/chip meningkat 2 x lipat per tahun
Sejak 1970 pengembangan agak lambat
Jumlah transistors 2 x lipat setiap 18 bulan
Harga suatu chip tetap / hampir tidak berubah
Kerapatan tinggi berarti jalur pendek, menghasilkan kinerja yang
meningkat
Ukuran semakin kecil, flexibilitas meningkat
Daya listrik lebih hemat, panas menurun
Sambungan sedikit berarti semakin handal / reliable
10
Gambar 2.3. Jumlah Transistor dalam CPU
2.12. IBM seri 360 1964
Pengganti seri 7000 (tidak kompatibel)
Rancangan awal suatu “keluarga” komputer
Memiliki set instruksi yang sama atau identik
Menggunakan O/S yang sama atau identik
Kecepatan meningkat
Jumlah I/O ports bertambah (i.e. terminal tambah banyak)
Kapasitas memori bertambah
Harga meningkat
2.13. DEC PDP-8 1964
Minicomputer pertama
Tidak mengharuskan ruangan ber-AC
Ukurannya kecil
Harga $16,000
$100k+ untuk IBM 360
11
Embedded applications & OEM
Menggunakan BUS STRUCTURE
Gambar 2.4. Struktur Bus pada DEC - PDP-8
2.14. Memori Semiconductor 1970
Fairchild
Ukuran kecil ( sebesar 1 sel core memory)
Dapat menyimpan 256 bits
Non-destructive read
Lebih cepat dari core memory
Kapasitas meningkat 2 x lipat setiap tahun
2.15. Intel 1971 - 4004
Microprocessor pertama, CPU dalam 1 chip, 4 bit
1972 - 8008
12
8 bit, Digunakan untuk aplikasi khusus
1974 - 8080
Microprocessor general purpose yang pertama dari Intel
1978 - 8086, 80286
1985 - 80386
1989 - 80486
2.16. Meningkatkan kecepatan Pipelining
On board cache
On board L1 & L2 cache
Branch prediction
Data flow analysis
Speculative execution
2.17. Performance Mismatch Kecepatan Processor meningkat
Kapasitas memory meningkat
Kecepatan memory tertinggal dari prosesor
13
Gambar 2.5. DRAM and Processor Characteristics
Gambar 2.6. Trends in DRAM use
14
2.18. Solusi Meningkatkan jumlah bit per akses
Mengubah interface DRAM
Cache
Mengurangi frekuensicy akses memory
Cache yg lebih kompleks dan cache on chip
Meningkatkan bandwidth interkoneksi
Bus kecepatan tinggi - High speed buses
Hierarchy of buses
2.19. Pentium CISC
Menggunakan teknik-teknik superscalar
Eksekusi instruksi secara parallel
P6 : menggunakan:
Brach prediction
Data flow analisys
Specultive execution
P7 : menggunakan teknologi berbasis RISC
2.20. PowerPC Sistem RISC superscalar
Hasil kerjasama IBM – Motorolla - Apple
Diturunkan dari arsitektur POWER (IBM RS/6000)
Keluarga PowerPC:
601: 32-bit
603: low-end desktop dan komputer portabel
604: desktop dan low-end user
620: 64-bit penuh, high-end user
15
BAB 3Bus Sistem
3.1. Konsep Program Pemrograman (hardware) merupakan proses penghu-bungan berbagai
komponen logik pada konfigurasi yang diinginkan untuk membentuk operasi
aritmatik dan logik pada data tertentu
Hardwired program tidak flexibel
General purpose hardware dapat mengerjakan berbagai macam tugas
tergantung sinyal kendali yang diberikan
Daripada melakukan re-wiring, Lebih baik menambah-kan sinyal-sinyal
kendali yang baru
3.2. Program Adalah suatu deretan langkah-langkah
Pada setiap langkah, dikerjakan suatu operasi arithmetic atau logical
Pada setiap operasi, diperlukan sejumlah sinyal kendali tertentu
3.3. Fungsi Control Unit Untuk setiap operasi disediakan kode yang unik
Contoh: ADD, MOVE
Bagian hardware tertentu menerima kode tersebut kemudian
menghasilkan sinyal-sinyal kendali
Jadilah komputer!
3.4. Komponen yang diperlukan Control Unit (CU) dan Arithmetic and Logic Unit (ALU) membentuk Central
Processing Unit (CPU)
Data dan instruksi harus diberikan ke sistem dan dikeluarkan dari sistem
Input/output
16
Diperlukan tempat untuk menyimpan sementara kode instruksi dan hasil
operasi.
Main memory
Gambar 3.1. Komponen Komputer: Top Level View
17
3.5. Siklus Instruksi Two steps:
Fetch
Execute
Gambar 3.2. Siklus Instruksi
3.6. Fetch Cycle Program Counter (PC) berisi address instruksi berikutnya yang akan
diambil
Processor mengambil instruksi dari memory pada lokasi yang ditunjuk
oleh PC
Naikkan PC
Kecuali ada perintah tertentu
Instruksi dimasukkan ke Instruction Register (IR)
Processor meng-interpret dan melakukan tindakan yang diperlukan
3.7. Execute Cycle Processor-memory
Transfer data antara CPU dengan main memory
18
Processor I/O
Transfer data antara CPU dengan I/O module
Data processing
Operasi arithmetic dan logical pada data tertentu
Control
Mengubah urutan operasi
Contoh: jump
Kombinasi diatas
19
Gambar 3.3. Contoh Eksekusi Program
Gambar 3.4. Diagram Keadaan Siklus Instruksi
3.8. Interrupt Suatu mekanisme yang disediakan bagi modul-modul lain (mis. I/O) untuk
dapat meng-interupsi operasi normal CPU
Program
Misal: overflow, division by zero
Timer
Dihasilkan oleh internal processor timer
Digunakan dalam pre-emptive multi-tasking
I/O
dari I/O controller
Hardware failure
Misal: memory parity error
20
Gambar 3.5. Program Flow Control
3.9. Siklus Interupsi Ditambahkan ke instruction cycle
Processor memeriksa adanya interrupt
Diberitahukan lewat interrupt signal
Jika tidak ada interrupt, fetch next instruction
21
Jika ada interrupt:
Tunda eksekusi dari program saat itu
Simpan context
Set PC ke awal address dari routine interrupt handler
Proses interrupt
Kembalikan context dan lanjutkan program yang terhenti.
Gambar 3.6. Diagram keadaan Siklus Instruksi dengan Interrupt
3.10. Multiple Interrupts Disable interrupts
Processor akan mengabaikan interrupt berikutnya
Interrupts tetap akan diperiksa setelah interrupt ynag pertama selesai
dilayani
Interrupts ditangani dalam urutan sesuai datangnya
22
Define priorities
Low priority interrupts dapat di interrupt oleh higher priority interrupts
Setelah higher priority interrupt selesai dilayani, akan kembali ke interrupt
sebelumnya.
Gambar 3.7. Multiple Interrupts – Sequential
23
Gambar 3.8. Multiple Interrupts - Nested3.11. Sambungan Semua unit harus tersambung
Unit yang beda memiliki sambungan yang beda
Memory
Input/Output
CPU
3.12. Sambungan Memori Menerima dan mengirim data
Menerima addresses
Menerima sinyal kendali
Read
Write
Timing
3.13. Sambungan Input/Output Serupa dengan sambungan memori
24
Output
Menerima data dari computer
Mengirimkan data ke peripheral
Input
Menerima data dari peripheral
Mengirimkan data ke computer
3.14. Sambungan Input/Output Menerima sinyal kendali dari computer
Mengirimkan sinyal kendali ke peripherals
Contoh: spin disk
Menerima address dari computer
Contoh: nomor port
Mengirimkan sinyal interrupt
3.15. CPU Connection Membaca instruksi dan data
Menuliskan data (setelah diproses)
Mengirimkan sinyal kendali ke unit-unit lain
Menerima (& menanggapi) interrupt
3.16. Bus Ada beberapa kemungkinan interkoneksi sistem
Yang biasa dipakai: Single Bus dan multiple BUS
PC: Control/Address/Data bus
DEC-PDP: Unibus
a. Pengertian Bus Jalur komunikasi yang menghubungkan beberapa device
Biasanya menggunakan cara broadcast
Seringkali dikelompokkan
25
Satu bus berisi sejumlah kanal (jalur)
Contoh bus data 32-bit berisi 32 jalur
Jalur sumber tegangan biasanya tidak diperlihatkan
b. Data Bus Membawa data
Tidak dibedakan antara “data” dan “instruksi”
Lebar jalur menentukan performance
8, 16, 32, 64 bit
c. Address bus Menentukan asal atau tujuan dari data
Misalkan CPU perlu membaca instruksi (data) dari memori pada lokasi
tertentu
Lebar jalur menentukan kapasitas memori maksimum dari sistem
Contoh 8080 memiliki 16 bit address bus maka ruang memori maksimum
adalah 64k
d. Control Bus Informasi kendali dan timing
Sinyal read/write memory (MRD/MWR)
Interrupt request (IRQ)
Clock signals (CK)
26
Gambar 3.9. Skema Interkoneksi Bus
e. Bentuk Fisik Bagaimana bentuk fisik bus?
Jalur-jalur parallel PCB
Ribbon cables
Strip connectors pada mother boards
contoh PCI
Kumpulan kabel
3.17. Problem pada Single Bus Banyak devices pada bus tunggal menyebabkan:
Propagation delays
Jalur data yg panjang berarti memerlukan koordinasi pemkaian shg
berpengaruh pada performance
If aggregate data transfer approaches bus capacity
27
Kebanyakan sistem menggunakan multiple bus
Gambar 3.10. Bus Traditional (ISA)(menggunakan cache)
Gambar 3.11. High Performance Bus
28
3.18. Jenis Bus Dedicated
Jalur data & address terpisah
Multiplexed
Jalur bersama
Address dan data pada saat yg beda
Keuntungan – jalur sedikit
Kerugian
Kendali lebih komplek
Mempengaruhi performance
3.19. Arbitrasi Bus Beberapa modul mengendalikan bus
contoh CPU dan DMA controller
Setiap saat hanya satu modul yg mengendalikan
Arbitrasi bisa secara centralised atau distributed
3.20. Arbitrasi Centralised Ada satu hardware device yg mengendalikan akses bus
Bus Controller
Arbitrer
Bisa berupa bagian dari CPU atau terpisah
3.21. Arbitrasi Distributed Setiap module dapat meng-klaim bus
Setiap modules memiliki Control logic
3.22. Timing Koordinasi event pada bus
Synchronous
Event ditentukan oleh sinyal clock
29
Control Bus termasuk jalur clock
Siklus bus ( bus cycle) transmisi 1 ke 0
Semua devices dpt membaca jakur clock
Biasanya sinkronisasi terjadi pada tepi naik (leading edge)
Suatu event biasanya dimualai pada awal siklus
Gambar 3.12. Synchronous Timing Diagram
Gambar 3.12. Asynchronous Timing Diagram
30
3.23. Bus PCI Peripheral Component Interconnection
Dikeluarkan oleh Intel sebagai public domain
32 atau 64 bit
50 Jalur
3.24. Jalur pada Bus PCI (yg harus) Jalur System
clock and reset
Address & Data
32 jalur multiplex address/data
Jalur validasi
Interface Control
Arbitrasi
Not shared
Direct connection to PCI bus arbiter
Error lines
3.25. Jalur Bus PCI (Optional) Interrupt lines
Not shared
Cache support
64-bit Bus Extension
Additional 32 lines
Time multiplexed
2 lines to enable devices to agree to use 64-bit transfer
JTAG/Boundary Scan
For testing procedures
3.26. Command pada PCI Transaksi antara initiator (master) dg target
Master pegang kendali bus
31
Master menentukan jenis transaksi
Misal I/O read/write
Fase Address
Fase Data
Gambar 3.14. PCI Read Timing Diagram
32
Gambar 3.15. PCI Bus Arbitration
BAB 4MEMORI INTERNAL
4.1. Karakteristik Memori Lokasi
Kapasitas
Unit transfer
Metode Akses
Kinerja
Jenis fisik
Sifat-sifat fisik
Organisasi
33
4.2. Lokasi CPU (register)
Internal (main memori)
External (secondary memori)
4.3. Kapasitas Ukuran Word
Satuan alami organisasi memori
Banyaknya words
atau Bytes
4.4. Satuan Transfer Internal
Jumlah bit dalam sekali akses
Sama dengan jumlah saluran data (= ukuran word)
External
Dalam satuan block yg merupakan kelipatan word
Addressable unit
Lokasi terkecil yang dpt dialamati secara uniq
Secara internal biasanya sama dengan Word
Untuk disk digunakan satuan Cluster
4.5. Metode Akses Sekuensial Mulai dari awal sampai lokasi yang dituju
Waktu akses tergantung pada lokasi data dan lokasi sebelumnya
Contoh tape
Direct Setiap blocks memilki address yg unique
Pengaksesan dengan cara lompat ke kisaran umum (general vicinity)
ditambah pencarian sekuensial
34
Waktu akses tdk tergantung pada lokasi dan lokasi sebelumnya
contoh disk
4.6. Metode Akses Random Setiap lokasi memiliki alamat tertentu
Waktu akses tdk tergantung pada urutan akses sebelumnya
Contoh RAM
Associative Data dicarai berdasarkan isinya bukan berdasarkan alamatnya
Waktu akses tdk tergantung terhadap lokasi atau pola akses sebelumnya
Contoh: cache
4.7. Hierarki Memori Register
Dalam CPU
Internal/Main memory
Bisa lebih dari satu level dengan adanya cache
“RAM”
External memory
Penyimpan cadangan
4.8. Performance Access time
Waktu untuk melakukan operasi baca-tulis
Memory Cycle time
Diperlukan waktu tambahan untuk recovery sebelum akses berikutnya
Access time + recovery
Transfer Rate
Kecepatan transfer data ke/dari unit memori
35
4.9. Jenis Fisik Semiconductor
RAM
Magnetic
Disk & Tape
Optical
CD & DVD
Others
Bubble
Hologram
4.10. Karakteristik Decay
Volatility
Erasable
Power consumption
Organisasi Susunan fisik bit-bit untuk membentuk word
4.11. Kendala Rancangan Berapa banyak?
Capacity
Seberapa cepat?
Time is money
Berapa mahal?
4.12. Hierarki Registers
L1 Cache
L2 Cache
36
Main memory
Disk cache
Disk
Optical
Tape
4.13. Ingin Komputer yg Cepat? Komputer hanya menggunakan static RAM
Akan sangat cepat
Tidak diperlukan cache
Apa perlu cache untuk cache?
Harga menjadi sangat mahal
4.14. Locality of Reference Selama berlangsungnya eksekusi suatu program, referensi memori
cenderung untuk mengelompok (cluster)
Contoh: loops
4.15. Memori Semiconductor RAM
Penamaan yang salah karena semua memori semiconductor adalah
random access (termasuk ROM)
Read/Write
Volatile
Penyimpan sementara
Static atau dynamic
4.16. Dynamic RAM Bit tersimpan berupa muatan dalam capacitor
37
Muatan dapat bocor
Perlu di-refresh
Konstruksi sederhana
Ukuran per bit nya kecil
Murah
Perlu refresh-circuits
Lambat
Main memory
4.17. Static RAM Bit disimpan sebagai switches on/off
Tidk ada kebocoran
Tdk perlu refreshing
Konstruksi lebih complex
Ukuran per bit lebih besar
Lebih mahal
Tidak memerlukan refresh-circuits
Lebih cepat
Cache
4.18. Read Only Memory (ROM) Menyimpan secara permanen
Untuk
Microprogramming
Library subroutines
Systems programs (BIOS)
Function tables
4.19. Jenis ROM Ditulisi pada saat dibuat
Sangat mahal
38
Programmable (once)
PROM
Diperlukan peralatan khusus untuk memprogram
Read “mostly”
Erasable Programmable (EPROM)
Dihapus dg sinar UV
Electrically Erasable (EEPROM)
Perlu waktu lebih lama untuk menulisi
Flash memory
Menghapus seleuruh memori secara electris
4.20. Organisasi 16Mbit chip dapat disusun dari 1M x 16 bit word
1 bit/chip memiliki 16 lots dengan bit ke 1 dari setiap word berada pada
chip 1
16Mbit chip dapat disusun dari array: 2048 x 2048 x 4bit
Mengurangi jumlah addres pins
Multiplex row address dg column address
11 pins untuk address (211=2048)
Menambah 1 pin kapasitas menjadi 4x
4.21. Refreshing Rangkaian Refresh diamsukkan dalam chip
Disable chip
Pencacahan melalui baris
Read & Write back
Perlu waktu
Menurunkan kinerja
39
Gambar 4.1. Contoh: 16 Mb DRAM (4M x 4)
40
Gambar 4.2. Packaging
Gambar 4.3. Organisation Module
41
Gambar 4.4. Organisation Modul (2)
4.22. Koreksi kesalahan Rusak berat
Cacat/rusak Permanent
Rusak ringan
Random, non-destructive
Rusak non permanent
Dideteksi menggunakan Hamming code
42
Gambar 4.5. Error Correcting Code Function
4.23. Cache Memori cepat dg kapasitas yg sedikit
Terletak antara main memory dengan CPU
Bisa saja diletakkan dalam chip CPU atau module tersendiri
Gambar 4.6. Hubungan Cache dengan CPU dan Main Memory.
43
4.24. Operasi pada Cache CPU meminta isi data dari lokasi memori tertentu
Periksa data tersebut di cache
Jika ada ambil dari cache (cepat)
Jika tidak ada, baca 1 block data dari main memory ke cache
Ambil dari cache ke CPU
Cache bersisi tags untuk identitas block dari main memory yang berada di
cache
4.25. Desain Cache Ukuran (size)
Fungsi Mapping
Algoritma penggantian (replacement algrthm)
Cara penulisan (write policy)
Ukuran Block
Jumlah Cache
4.26. Size Cost
Semakin besar semakin mahal
Speed
Semakin besar semakin cepat
Check data di cache perlu waktu
44
Gambar 4.7. Organisasi Cache
4.27. Fungsi Mapping Ukuran Cache 64kByte
Ukuran block 4 bytes
diperlukan 16k (214) alamat per alamat 4 bytes
Jumlah jalur alamat cache 14
Main memory 16MBytes
Jalur alamat perlu 24 bit
(224=16M)
4.28. Direct Mapping Setiap block main memory dipetakan hanya ke satu jalur cache
Jika suatu block ada di cache, maka tempatnya sudah tertentu
Address terbagi dalam 2 bagian
LS-w-bit menunjukkan word tertentu
MS-s-bit menentukan 1 blok memori
MSB terbagi menjadi field jalur cache r dan tag sebesar s-r (most
significant)
45
4.29. Struktur Alamat Direct Mapping 24 bit address
2 bit : word identifier (4 byte block)
22 bit: block identifier
8 bit tag (=22-14)
14 bit slot atau line
2 blocks pada line yg sama tidak boleh memiliki tag yg sama
Cek isi cache dengan mencari line dan Tag
Gambar 4.8. Struktur Alamat Direct Mapping
4.30. Table Cache Line pada Direct Mapping Cache line blocks main memori
0 0, m, 2m, 3m…2s-m
1 1,m+1, 2m+1…2s-m+1
m-1 m-1, 2m-1,3m-1…2s-1
46
Gambar4.9. Organisai Cache Direct Mapping
Gambar 4.10. Contoh Direct Mapping
47
4.31. Keuntungan & Kerugian Direct Mapping Sederhana
Murah
Suatu blok memiliki lokasi yang tetap
Jika program mengakses 2 block yang di map ke line yang sama secara
berulang-ulang, maka cache-miss sanagat tinggi
4.32. Associative Mapping Blok main memori dpt di simpan ke cache line mana saja
Alamat Memori di interpresi sbg tag dan word
Tag menunjukan identitas block memori
Setiap baris tag dicari kecocokannya
Pencarian data di Cache menjadi lama
Gambar 4.11. Organisasi Cache Fully Associative
48
Gambar 4.12. Contoh Associative Mapping
4.33. Struktur Address Associative Mapping 22 bit tag disimpan untuk blok data 32 bit
tag field dibandingkan dg tag entry dalam cache untuk pengecekan data
LS 2 bits dari address menunjukkan 16 bit word yang diperlukan dari 32
bit data block
contoh
Address Tag Data Cache line
FFFFFC FFFFFC 24682468 3FFF
4.34. Set Associative Mapping Cache dibagi dalam sejumlah sets
Setiap set berisi sejumlah line
Suatu blok di maps ke line mana saja dalam set
misalkan Block B dapat berada pada line mana saja dari set i
49
Contoh: per set ada 2 line
2 way associative mapping
Suatu block dpt berada pada satu dari 2 lines dan hanya dalam 1 set
4.35. Contoh Set Associative Mapping Nomor set 13 bit
Nomor Block dlm main memori adl modulo 213
000000, 00A000, 00B000, 00C000 … map ke set yang sama
Gambar 4.13. Organisasi Cache: Two Way Set Associative
50
4.36. Struktur Address: Set Associative Mapping set field untuk menentukan set cache set yg dicari
Bandingkan tag field untuk mencari datanya
Contoh:
Address Tag Data Set number
1FF 7FFC 1FF 12345678 1FFF
001 7FFC 001 11223344 1FFF
Gambar 4.14. Contoh Two Way Set Associative Mapping
51
4.37. Replacement Algorithms (1) Direct mapping Tidak ada pilihan
Setiap block hanya di map ke 1 line
Ganti line tersebut
4.38. Replacement Algorithms (2) Associative & Set Associative Hardware implemented algorithm (speed)
Least Recently used (LRU)
e.g. in 2 way set associative
Which of the 2 block is lru?
First in first out (FIFO)
replace block that has been in cache longest
Least frequently used
replace block which has had fewest hits
Random
4.39. Write Policy Must not overwrite a cache block unless main memory is up to date
Multiple CPUs may have individual caches
I/O may address main memory directly
4.40. Write through All writes go to main memory as well as cache
Multiple CPUs can monitor main memory traffic to keep local (to CPU)
cache up to date
Lots of traffic
Slows down writes
Remember bogus write through caches!
4.41. Write back
52
Updates initially made in cache only
Update bit for cache slot is set when update occurs
If block is to be replaced, write to main memory only if update bit is set
Other caches get out of sync
I/O must access main memory through cache
N.B. 15% of memory references are writes
4.42. Pentium Cache Foreground reading
Find out detail of Pentium II cache systems
NOT just from Stallings!
4.43. Newer RAM Technology (1) Basic DRAM same since first RAM chips
Enhanced DRAM
Contains small SRAM as well
SRAM holds last line read (c.f. Cache!)
Cache DRAM
Larger SRAM component
Use as cache or serial buffer
4.44. Newer RAM Technology (2) Synchronous DRAM (SDRAM)
currently on DIMMs
Access is synchronized with an external clock
Address is presented to RAM
RAM finds data (CPU waits in conventional DRAM)
Since SDRAM moves data in time with system clock, CPU knows when
data will be ready
CPU does not have to wait, it can do something else
Burst mode allows SDRAM to set up stream of data and fire it out in block
53
Gambar 4.15. SDRAM
4.45. Newer RAM Technology (3) Foreground reading
54
Check out any other RAM you can find
See Web site:
The RAM Guide
BAB 5Memori External
55
5.1. Jenis Memori ExternaL Magnetic Disk
RAID
Removable
Optical
CD-ROM
CD-Writable (WORM)
CD-R/W
DVD
Magnetic Tape
5.2. Magnetic Disk Metal atau plastic dilapisi dg material yg bersifat magnet (iron oxide)
Jenis kemasan
Floppy
Winchester hard disk
Removable hard disk
5.3. Format dan Organisasi Data Lingkaran konsentris atau track
Ada Gap antar track
Gap sempit, kapasitas bertambah
Jumlah bit per track sama (kerapatan bervariasi)
Kecepatan putar tetap
Track dibagi menjadi beberapa sector
Ukuran minimum block adalah satu sector
Satu block bisa berisi lebih dari satu sector
5.4. Fixed/Movable Head Disk
56
Fixed head
Ada satu head (r/w) per track
Head diletakkan pada tangkai yg tetap
Movable head
Hanya ada satu head per side
Diletakkan pada tangkai yg dpt bergerak
5.5. Removable / Nonremovable Removable disk
Dapat dilepas dari drive dan diganti dg disk lain
Memberikan kapasitas simpanan yg tak terbatas
Mudah melakukan transfer data antar sistem
Nonremovable disk
Terpasanang permanen dalam drive
5.6. Floppy Disk 8”, 5.25”, 3.5”
Kapasitas kecil
sampai 1.44Mbyte (ada yg 2.88M)
Lambat
Umum dipakai
Murah
5.7. Winchester Hard Disk (1) Dikembangkan oleh IBM di Winchester (USA)
Dikemas dalam satu unit
Berisi satu cakram atau lebih
Head sangat kecil
Handal
5.8. Winchester Hard Disk (2)
57
Umum digunakan
Murah
Sbg external storage yg sangat cepat
Kapasitas semakin besar
Dalam orde GB
5.9. Removable Hard Disk ZIP
Murah
Banyak digunakan
100MB
JAZ
Mahal
1G
L-120 (a: drive)
Juga dpt untuk membaca 3.5” floppy
5.10. Pencarian Sector Harus dapat mengenali awal suatu track dan sector
Format disk
Menambahkan informasi tambahan
Memberi tanda awal track dan sector
58
Gambar 5.11. ST506 format (old!)
5.11. Karakteristik Fixed head atau movable head
Removable disk atau fixed disk
Single side atau double side
Single platter atau multiple platter
Mekanisme head
Contact (Floppy)
Fixed gap
Flying (Winchester)
5.12. Multiple Platter Satu head per side
Semua head di-join dan di-align
Track-track yg setiap platter membentuk cylinder
Data dipecah berdasarkan cylinder
59
Mengurangi gerakan head
Meningkatkan kecepatan (transfer rate)
5.13. Kecepatan Seek time
gerakan head ke track yg dituju
(Rotational) latency
Putar platter sampai posisi data dibawah head
Access time = Seek + Latency
Transfer rate
5.14. RAID Redundant Array of Independent Disks
Redundant Array of Inexpensive Disks
Ada 6 level
Tidak berhirarki
Sejumlah disks (fisik) yg dipandang sbg satu drive (logical) oleh Sistem
Operasi
Data tersebar diantara disk fisik
5.15. RAID 0 No redundancy
Data striped across all disks
Round Robin striping
Increase speed
Multiple data requests probably not on same disk
Disks seek in parallel
A set of data is likely to be striped across multiple disks
60
5.16. RAID 1 Mirrored Disks
Data is striped across disks
2 copies of each stripe on separate disks
Read from either
Write to both
Recovery is simple
Swap faulty disk & re-mirror
No down time
Expensive
5.17. RAID 2 Disks are synchronized
Very small stripes
Often single byte/word
Error correction calculated across corresponding bits on disks
Multiple parity disks store Hamming code error correction in corresponding
positions
Lots of redundancy
Expensive
Not used
5.18. RAID 3 Similar to RAID 2
Only one redundant disk, no matter how large the array
Simple parity bit for each set of corresponding bits
Data on failed drive can be reconstructed from surviving data and parity
info
Very high transfer rates
61
5.19. RAID 4 Each disk operates independently
Good for high I/O request rate
Large stripes
Bit by bit parity calculated across stripes on each disk
Parity stored on parity disk
5.20. RAID 5 Like RAID 4
Parity striped across all disks
Round robin allocation for parity stripe
Avoids RAID 4 bottleneck at parity disk
Commonly used in network servers
N.B. DOES NOT MEAN 5 DISKS!!!!!
5.21. Optical Storage CD-ROM Originally for audio
650Mbytes giving over 70 minutes audio
Polycarbonate coated with highly reflective coat, usually aluminum
Data stored as pits
Read by reflecting laser
Constant packing density
Constant linear velocity
5.22. CD-ROM Drive Speeds Audio is single speed
Constant linier velocity
1.2 ms-1
Track (spiral) is 5.27km long
Gives 4391 seconds = 73.2 minutes
62
Other speeds are quoted as multiples
e.g. 24x
The quoted figure is the maximum the drive can achieve
Gambar 5.2. CD-ROM Format
Mode 0=blank data field
Mode 1=2048 byte data+error correction
Mode 2=2336 byte data
5.23. Random Access on CD-ROM Difficult
Move head to rough position
Set correct speed
Read address
Adjust to required location
(Yawn!)
63
5.24. CD-ROM for & against Large capacity (?)
Easy to mass produce
Removable
Robust
Expensive for small runs
Slow
Read only
5.25. Other Optical Storage CD-Writable
WORM
Now affordable
Compatible with CD-ROM drives
CD-RW
Erasable
Getting cheaper
Mostly CD-ROM drive compatible
5.26. DVD - what’s in a name? Digital Video Disk
Used to indicate a player for movies
Only plays video disks
Digital Versatile Disk
Used to indicate a computer drive
Will read computer disks and play video disks
Dogs Veritable Dinner
Officially - nothing!!!
64
5.27. DVD - technology Multi-layer
Very high capacity (4.7G per layer)
Full length movie on single disk
Using MPEG compression
Finally standardized (honest!)
Movies carry regional coding
Players only play correct region films
Can be “fixed”
5.28. DVD - Writable Loads of trouble with standards
First generation DVD drives may not read first generation DVD-W disks
First generation DVD drives may not read CD-RW disks
Wait for it to settle down before buying!
5.29. Foreground Reading Check out optical disk storage options
Check out Mini Disk
5.30. Magnetic Tape Serial access
Slow
Very cheap
Backup and archive
5.31. Digital Audio Tape (DAT)
65
Uses rotating head (like video)
High capacity on small tape
4Gbyte uncompressed
8Gbyte compressed
Backup of PC/network servers
BAB 6
66
Input/Output
6.1. Input/Output Problems Wide variety of peripherals
Delivering different amounts of data
At different speeds
In different formats
All slower than CPU and RAM
Need I/O modules
6.2. Input/Output Module Interface to CPU and Memory
Interface to one or more peripherals
GENERIC MODEL OF I/O DIAGRAM 6.1
6.3. External Devices Human readable
Screen, printer, keyboard
Machine readable
Monitoring and control
Communication
Modem
Network Interface Card (NIC)
6.4. I/O Module Function Control & Timing
CPU Communication
Device Communication
Data Buffering
Error Detection
67
6.5. I/O Steps CPU checks I/O module device status
I/O module returns status
If ready, CPU requests data transfer
I/O module gets data from device
I/O module transfers data to CPU
Variations for output, DMA, etc.
Gambar 6.1. I/O Module Diagram
6.6. I/O Module Decisions Hide or reveal device properties to CPU
Support multiple or single device
Control device functions or leave for CPU
Also O/S decisions
e.g. Unix treats everything it can as a file
6.7. Input Output Techniques
68
Programmed
Interrupt driven
Direct Memory Access (DMA)
6.8. Programmed I/O CPU has direct control over I/O
Sensing status
Read/write commands
Transferring data
CPU waits for I/O module to complete operation
Wastes CPU time
6.9. Programmed I/O - detail CPU requests I/O operation
I/O module performs operation
I/O module sets status bits
CPU checks status bits periodically
I/O module does not inform CPU directly
I/O module does not interrupt CPU
CPU may wait or come back later
6.10. I/O Commands CPU issues address
Identifies module (& device if >1 per module)
CPU issues command
Control - telling module what to do
e.g. spin up disk
Test - check status
e.g. power? Error?
Read/Write
Module transfers data via buffer from/to device
69
6.11. Addressing I/O Devices Under programmed I/O data transfer is very like memory access (CPU
viewpoint)
Each device given unique identifier
CPU commands contain identifier (address)
6.12. I/O Mapping Memory mapped I/O
Devices and memory share an address space
I/O looks just like memory read/write
No special commands for I/O
Large selection of memory access commands available
Isolated I/O
Separate address spaces
Need I/O or memory select lines
Special commands for I/O
Limited set
6.13. Interrupt Driven I/O Overcomes CPU waiting
No repeated CPU checking of device
I/O module interrupts when ready
6.14. Interrupt Driven I/OBasic Operation
CPU issues read command
I/O module gets data from peripheral whilst CPU does other work
I/O module interrupts CPU
CPU requests data
I/O module transfers data
70
6.15. CPU Viewpoint Issue read command
Do other work
Check for interrupt at end of each instruction cycle
If interrupted:-
Save context (registers)
Process interrupt
Fetch data & store
See Operating Systems notes
6.16. Design Issues How do you identify the module issuing the interrupt?
How do you deal with multiple interrupts?
i.e. an interrupt handler being interrupted
6.17. Identifying Interrupting Module (1) Different line for each module
PC
Limits number of devices
Software poll
CPU asks each module in turn
Slow
6.18. Identifying Interrupting Module (2) Daisy Chain or Hardware poll
Interrupt Acknowledge sent down a chain
Module responsible places vector on bus
CPU uses vector to identify handler routine
Bus Master
Module must claim the bus before it can raise interrupt
71
e.g. PCI & SCSI
6.19. Multiple Interrupts Each interrupt line has a priority
Higher priority lines can interrupt lower priority lines
If bus mastering only current master can interrupt
6.20. Example - PC Bus 80x86 has one interrupt line
8086 based systems use one 8259A interrupt controller
8259A has 8 interrupt lines
6.21. Sequence of Events 8259A accepts interrupts
8259A determines priority
8259A signals 8086 (raises INTR line)
CPU Acknowledges
8259A puts correct vector on data bus
CPU processes interrupt
72
Gambar 6.2. PC Interrupt Layout
6.22. ISA Bus Interrupt System ISA bus chains two 8259As together
Link is via interrupt 2
Gives 15 lines
16 lines less one for link
IRQ 9 is used to re-route anything trying to use IRQ 2
Backwards compatibility
Incorporated in chip set
73
Gambar 6.3. ISA Interrupt Layout
6.23. Direct Memory Access Interrupt driven and programmed I/O require active CPU intervention
Transfer rate is limited
CPU is tied up
DMA is the answer
6.24. DMA Function Additional Module (hardware) on bus
DMA controller takes over from CPU for I/O
6.25. DMA Operation CPU tells DMA controller:-
Read/Write
Device address
Starting address of memory block for data
Amount of data to be transferred
CPU carries on with other work
DMA controller deals with transfer
74
DMA controller sends interrupt when finished
6.26. DMA Transfer Cycle Stealing DMA controller takes over bus for a cycle
Transfer of one word of data
Not an interrupt
CPU does not switch context
CPU suspended just before it accesses bus
i.e. before an operand or data fetch or a data write
Slows down CPU but not as much as CPU doing transfer
6.27. Aside What effect does caching memory have on DMA?
Hint: how much are the system buses available?
Gambar 6.4. DMA Configurations (1) Single Bus, Detached DMA controller
Each transfer uses bus twice
I/O to DMA then DMA to memory
CPU is suspended twice
75
Gambar 6.5. DMA Configurations (2) Single Bus, Integrated DMA controller
Controller may support >1 device
Each transfer uses bus once
DMA to memory
CPU is suspended once
Gambar 6.6. DMA Configurations (3)
76
Separate I/O Bus
Bus supports all DMA enabled devices
Each transfer uses bus once
DMA to memory
CPU is suspended once
6.28. I/O Channels I/O devices getting more sophisticated
e.g. 3D graphics cards
CPU instructs I/O controller to do transfer
I/O controller does entire transfer
Improves speed
Takes load off CPU
Dedicated processor is faster
6.29. Interfacing Connecting devices together
Bit of wire?
Dedicated processor/memory/buses?
E.g. SCSI, FireWire
6.30. Small Computer Systems Interface (SCSI) Parallel interface
8, 16, 32 bit data lines
Daisy chained
Devices are independent
Devices can communicate with each other as well as host
6.31. SCSI - 1 Early 1980s
77
8 bit
5MHz
Data rate 5MBytes.s-1
Seven devices
Eight including host interface
6.32. SCSI - 2 1991
16 and 32 bit
10MHz
Data rate 20 or 40 Mbytes.s-1
(Check out Ultra/Wide SCSI)
6.33. SCSI Signaling (1) Between initiator and target
Usually host & device
Bus free? (c.f. Ethernet)
Arbitration - take control of bus (c.f. PCI)
Select target
Reselection
Allows reconnection after suspension
e.g. if request takes time to execute, bus can be released
6.34. SCSI Signaling (2) Command - target requesting from initiator
Data request
Status request
Message request (both ways)
78
Gambar 6.7. SCSI Bus Phases
6.35. Configuring SCSI Bus must be terminated at each end
Usually one end is host adapter
Plug in terminator or switch(es)
SCSI Id must be set
Jumpers or switches
Unique on chain
0 (zero) for boot device
Higher number is higher priority in arbitration
6.36. IEEE 1394 FireWire High performance serial bus
Fast
Low cost
Easy to implement
Also being used in digital cameras, VCRs and TV
79
6.37. FireWire Configuration Daisy chain
Up to 63 devices on single port
Really 64 of which one is the interface itself
Up to 1022 buses can be connected with bridges
Automatic configuration
No bus terminators
May be tree structure
6.38. FireWire 3 Layer Stack Physical
Transmission medium, electrical and signaling characteristics
Link
Transmission of data in packets
Transaction
Request-response protocol
6.39. FireWire - Physical Layer Data rates from 25 to 400Mbps
Two forms of arbitration
Based on tree structure
Root acts as arbiter
First come first served
Natural priority controls simultaneous requests
i.e. who is nearest to root
Fair arbitration
Urgent arbitration
6.40. FireWire - Link Layer
80
Two transmission types
Asynchronous
Variable amount of data and several bytes of transaction data transferred
as a packet
To explicit address
Acknowledgement returned
Isochronous
Variable amount of data in sequence of fixed size packets at regular
intervals
Simplified addressing
No acknowledgement
81