Systems:
Internals Chapter 1
and
Design Computer System
Principles Overview
Eighth Edition
By William Stallings
Operating System
Memanfaatkan sumber daya hardware dari satu
atau lebih prosesor
Menyediakan suatu set layanan bagi pengguna
sistem
Mengatur memori sekunder dan perangkat I / O
Basic Elements
I/O
Processor Modules
System
Main
Bus
Memory
Processor
Melakukan
Mengontrol
fungsi
operasi2 dalam
pemrosesan
komputer
data
Dikenal sebagai
Central
Processing Unit
(CPU)
Main Memory
Volatile
Isi
memori akan hilang jika
komputer mati
Dikenal sbg memori utama
I/O Modules
penyimpanan
(mis: hard
drive)
Memindahkan
data antara
Peralatan
komputer dan komunikasi
linkungan
eksternal, spt:
terminal2
System Bus
Menyediakan jalur
komunikasi antara
processors, memori
utama, and I/O modules
CPU Main Memory
0
System 1
2
PC MAR Bus
Instruction
Instruction
Instruction
IR MBR
I/O AR
Data
Execution
unit Data
I/O BR Data
Data
PC = Program counter
Buffers IR = Instruction register
MAR = Memory address register
MBR = Memory buffer register
I/O AR = Input/output address register
I/O BR = Input/output buffer register
Setiap
chip (socket) berisi beberapa
prosesor (core)
Graphical Processing
Units (GPU’s)
Memberikan perhitungan yang efisien
pada larik data menggunakan teknik
Single-Instruction Multiple Data (SIMD)
Digunakan untuk pemrosesan numerik
scr umum
Simulasi fisik untuk game
Komputasi pada large spreadsheet
Digital Signal Processors
(DSPs)
Berurusan dengan sinyal streaming
seperti audio atau video
Digunakan untuk disematkan di
perangkat seperti modem
Encoding / decoding pada speech dan
video (codecs)
Dukungan untuk enkripsi dan
keamanan
System on a Chip
(SoC)
Untukmemenuhi persyaratan
perangkat genggam, mikroprosesor
menawarkan fitur SoC
Komponenseperti DSP, GPU, codec
dan memori utama, selain CPU
dan cache, berada pada chip
yang sama
Instruction Execution
Dua langkah
Fetch Stage Execute Stage
Timer
Dihasilkan oleh timer dalam prosesor. Ini memungkinkan sistem operasi
untuk melakukan fungsi-fungsi tertentu secara teratur.
I/O
Dihasilkan oleh pengontrol I/O, untuk menandai penyelesaian normal suatu
operasi atau untuk menandai berbagai kondisi kesalahan.
Hardware failure
Dihasilkan oleh kegagalan, seperti kegagalan daya atau kesalahan paritas
memori.
User I/O User
Program Program Program
1 4 1
I/O
Command
WRITE WRITE
5
2a
Figure 1.5a 2
END
2b
WRITE WRITE
Aliran Kontrol 3a
Tanpa Interupsi 3
3b
WRITE WRITE
1 4 1 4 1
I/O I/O
Command Command
WRITE WRITE WRITE
5
2a
END
Figure 1.5b
2
Interrupt
2
2b Handler
3 3
3b
4 1 4 1 4
Interrupt Interrupt
2b Handler Handler
WRITE 5 WRITE 5
Long I/O Wait END END
3a
3b
WRITE WRITE
No interrupts (b) Interrupts; short I/O wait (c) Interrupts; long I/O wait
User Program Interrupt Handler
i
Interrupt
occurs here i+1
Interrupts
Disabled
Check for
Fetch next Execute interrupt;
START instruction instruction initiate interrupt
Interrupts
handler
Enabled
HALT
1 1
4 4
I/O operation
I/O operation;
processor waits 2a concurrent with
processor executing
5 5
2b
2
4
I/O operation
4 3a concurrent with
processor executing
I/O operation;
processor waits 5
5 3b
1 1
4 4
5
2
4
4
3 I/O operation
concurrent with
I/O operation; processor executing;
processor waits then processor
waits
5
5
Device controller or
other system hardware
issues an interrupt
Save remainder of
process state
information
Processor finishes
execution of current
instruction
Process interrupt
Processor signals
acknowledgment
of interrupt
Restore process state
information
Processor pushes PSW
and PC onto control
stack
Restore old PSW
and PC
Processor loads new
PC value based on
interrupt
Y Start Y Start
Interrupt General Interrupt General
Service Registers Service Registers
Y + L Return Routine T Y + L Return Routine T–M
Stack Stack
Pointer Pointer
Processor Processor
T–M T
N User's N User's
N+1 N+1
Program Program
Main Main
Memory Memory
Interupsi terjadi
saat interupsi lain Dua pendekatan:
sedang diproses
• misalnya menerima • nonaktifkan interupsi
data dari saluran sementara interupsi
komunikasi dan sedang diproses
mencetak hasil pada • menggunakan skema
saat yang bersamaan prioritas
Interrupt
User Program Handler X
Interrupt
Handler Y
Interrupt
User Program Handler X
Interrupt
Handler Y
15
0 t=
t =1
t = 25
t= t = 25 Disk
40 interrupt service routine
t=
35
Kapasistas lebih
Waktu akses besar = biaya per bit
lebih cepat = lebih murah
biaya per bit Kapasistas lebih
lebih mahal besar = kecepatan
aksesnya lebih
lambat
The Memory Hierarchy
Hirarki menurun: Inb
g-
Re r s
i st
e
e
ch
Me o a r d Ca
mo in
ry M a or y
m
Me
meningkatkan waktu B
akses Of
S t o f - li n e
rag ag
ne
tic
Ta
p e
e M
mengurangi frekuensi
akses ke memori oleh
prosesor
Figure 1.14 The Memory Hierarchy
T1 + T2
T2
T1
0 1
Fraction of accesses involving only Level 1 (Hit ratio)
Juga disebut
sebagai memori
tambahan
• external
• nonvolatile
• digunakan untuk
menyimpan file
program dan data
Tidak terlihat oleh OS
Berinteraksi dengan perangkat manajemen memori lainnya
Prosesor harus mengakses memori setidaknya satu kali
per siklus instruksi
eksekusi prosesor dibatasi oleh waktu siklus memori
Eksploitasi prinsip lokalitas dengan memori yang kecil dan
cepat
Block Transfer
Word Transfer
Fastest Fast
Less Slow
fast
C-1
Block Length
(K Words)
(a) Cache
Block M – 1
2n - 1
Word
Length
(b) Main memory
RA - read address
Receive address
RA from CPU
Load main
Deliver RA word
memory block
to CPU
into cache slot
DONE
jumlah
ukuran
tingkat
blok
cache
Kategori
utama:
Kebijakan fungsi
penulisan pemetaan
algoritma
penggantia
n
Cache and Block Size
ukuran ukuran
cache blok
cache kecil unit data yang
memiliki dampak dipertukarkan
signifikan antara cache dan
terhadap kinerja memori utama
Mapping Function
∗Menentukan lokasi cache
mana yang akan ditempati
oleh blok ketika satu blok dibaca,
yang lain mungkin harus
diganti
Dua kendala yang
mempengaruhi desain:
semakin fleksibel fungsi
pemetaan, semakin
kompleks sirkuit yang
diperlukan untuk mencari
cache
Replacement Algorithm
Algoritma Least Last Used (LRU)
strategi yang efektif adalah mengganti blok yang
telah lama di cache tanpa adanya referensi ke blok
tersebut
mekanisme perangkat keras diperlukan untuk
mengidentifikasi blok yang paling baru digunakan
memilih blok mana yang akan digantikan/ditindih
ketika blok baru akan dimuat ke cache
Write Policy
System Bus
Main I/O
Memory I/O Adapter
Subsystem
I/O
Adapter
I/O
Adapter
32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB
L1-I L1-D L1-I L1-D L1-I L1-D L1-I L1-D L1-I L1-D L1-I L1-D
12 MB
L3 Cache