Input Output (IO)
Organisasi Sistem Komputer
Priyanto
E-mail :
[email protected]Program Studi Pendidikan Teknik Elektronika
Jurusan Pendidikan Teknik Elektronika
FT UNY 2014
IO controller
IO devices
Storage
Device mana yang paling lambat?
2
I/O devices serve two main purposes
To communicate with outside world
To store data
I/O controller acts as an interface between the systems
bus and I/O device
Relieves the processor of low-level details
Takes care of electrical interface
I/O controllers have three types of registers
Data
Command
Status
Basic I/O hardware
ports, buses, devices and controllers
I/O Software
Interrupt Handlers, Device Driver, DeviceIndependent Software, User-Space I/O Software
Important concepts
Three ways to perform I/O operations
Polling, interrupt and DMAs
Copyright : Nahrstedt, Angrave, Abdelzaher
Storage devices (disk, tapes)
Transmission devices (network card, modem)
Human interface devices (screen, keyboard,
mouse)
Specialized device (joystick)
Barcode reader
Copyright : Nahrstedt, Angrave, Abdelzaher
I/O units typically consist of
A mechanical component: the device itself
An electronic component: the device controller or
adapter.
Interface between controller and device is a very low
level interface.
Example:
Disk controller converts the serial bit stream, coming
off the drive into a block of bytes, and performs error
correction.
Copyright : Nahrstedt, Angrave, Abdelzaher
Copyright : Nahrstedt, Angrave, Abdelzaher
Device-specific code to control an IO device, is usually written
by device's manufacturer
disk driver has to know about sectors, tracks, heads, etc).
A device driver is usually part of the OS kernel
Compiled with the OS
Dynamically loaded into the OS during execution
Each device driver handles
one device type (e.g., mouse)
one class of closely related devices (e.g., SCSI disk driver to handle
multiple disks of different sizes and different speeds.).
Categories:
Block devices
Character devices
Copyright : Nahrstedt, Angrave, Abdelzaher
Copyright : Nahrstedt, Angrave, Abdelzaher
10
Cadangan
Cadangan
5120
5119
Input Output
4096
4095
Memory
Cadangan
5120
5119
4096
4095
Memory
Input Output
0
Memory Mapped
1023
IO Mapped (Isolated IO)
11
Data
Address
Write
Read
Main
Memory
Memiliki 2
instruksi
sekaligus untuk
Memori dan IO
CPU
Write
Read
IO Port 1
IO Port 2
IO Device 1
IO Port 3
IO Device 2
12
Data
Address
M Write
IO Write
IO Read
M Read
Main
Memory
Memiliki 4
instruksi
untuk memori
dan IO
CPU
M Write
M Read
IO Write
IO Read
IO Port 1
IO Port 2
IO Device 1
IO Port 3
IO Device 2
13
Programmed IO
Interrupt Driven
Direct Memory Access
(DMA)
14
Mulai
Baca Status
Lakukan tugas
lain
Tidak
Periksa Status
Divais
Siap?
Ya
Layani Divais
15
Connections between devices and interrupt controller actually
use interrupt lines on the bus rather than dedicated wires
Copyright : Nahrstedt, Angrave, Abdelzaher
16
Menangguhkan eksekusi program yang sedang
berlangsung
Menyimpan statusnya
Melompat ke interrup service routine (ISR)
Kembali untuk melanjutkan eksekusi program
yang diinterupsi
17
18
Permasalahan programmed I/O
Waktu CPU terbuang untuk polling, contoh:
Menunggu keyboard ditekan
Menunggu keyboard dilepas
Tidak memenuhi untuk batasan waktu yang berkaitan
dengan beberapa divais:
Membaca dan menulis ke disk
DMA Membebaskan prosesor dari tanggung jawab
transfer data
DMA is implemented using a DMA controller
DMA controller
Acts as slave to processor
Receives instructions from processor
Example: Reading from an I/O device
Processor gives details to the DMA controller
I/O device number
Main memory buffer address
Number of bytes to transfer
Direction of transfer (memory I/O device, or vice
versa)
Contoh DMA untuk Disk
CPU memprogram DMAC: men-set register untuk
menentukan alamat sumber/tujuan, jumlah byte,
dan informasi kontrol (read atau write)
DMAC melanjutkan untuk mengoperasikan bus
memori secara langsung tanpa bantuan CPU utama
Disk controller mentransfer data ke memori utama
Disk controller acks transfer to DMA controller
Copyright : Nahrstedt, Angrave, Abdelzaher
22
Copyright : Nahrstedt, Angrave, Abdelzaher
23
A d d r e s s /d a ta
bus
a n d r e a d /w r ite
c o n tr o l s ig n a l
D a ta
M e m o ry
C o n tr o l
S ta tu s
P ro g ra m m e d
I/O in te r fa c e
CPU
I/O d e v ic e
(a )
A d d r e s s /d a ta
bus
a n d r e a d /w r ite
c o n tr o l s ig n a l
D a ta
C o n tr o l
S ta tu s
M e m o ry
24
P ro g ra m m e d
I/O in te r fa c e
CPU
I/O d e v ic e
(a )
A d d r e s s /d a ta
bus
a n d r e a d /w r ite
c o n tr o l s ig n a l
D a ta
C o n tr o l
M e m o ry
S ta tu s
In te r r u p t s ig n a l
CPU
P ro g ra m m e d
I/O in te r fa c e
I/O d e v ic e
(b )
A d d r e s s /d a ta
bus
a n d r e a d /w r ite
D a ta
25
CPU
I/O in te r fa c e
I/O d e v ic e
(b )
A d d r e s s /d a ta
bus
a n d r e a d /w r ite
c o n tr o l s ig n a l
D a ta
M e m o ry
C o n tr o l
S ta tu s
In te r r u p t s ig n a l
CPU
P ro g ra m m e d
I/O in te r fa c e
D M A s ig n a l
I/O d e v ic e
(c )
26
27
There are many standards for I/O buses and
interfaces
Standards allow open architectures
Many vendors can provide peripheral (I/O) devices
for many different systems
Most systems support several I/O buses and
I/O interfaces
Expansion buses or slots
Disk interfaces
External buses
Communications interfaces
These are slots on the motherboard
Examples
ISA Industry Standard Architecture
PCI Personal Component Interconnect
EISA Extended ISA
SIMM Single Inline Memory Module
DIMM Dual Inline Memory Module
MCA Micro-Channel Architecture
AGP Accelerated Graphics Port
VESA Video Electronics Standards Association
PCMCIA Personal Computer Memory Card International
Association (not just memory!)
3 ISA
slots
5 PCI slots
Pentium CPU
6 SIMM
slots
2 DIMM
slots
Expansion buses or slots
Disk interfaces
External buses
Communications buses
ATA AT Attachment (named after IBM PC-AT)
IDE Integrated Drive Electronics (same as ATA)
Enhanced IDE
Encompasses several older standards (ST-506/ST-412, IDE, ESDI,
ATA-2, ATA-3, ATA-4)
Floppy disk
SCSI Small Computer Systems Interface
ESDI Enhanced Small Device Interface (mid-80s, obsolete)
PCMCIA (Personal Computer Memory Card International
Association)
SATA Serial AT Attachment
High-speed serial connection between motherboard
and drive
Serial cables can be longer than parallel ones
Cables are easier to work with
Speeds of 150MB/sec and higher possible
Expansion buses or slots
Disk interfaces
External buses
Communications buses
Parallel sometimes called LPT (line printer)
Serial typically RS232C (sometimes RS422)
PS/2 for keyboards and mice
USB Universal Serial Bus
IrDA Infrared Device Attachment
FireWire new, very high speed, developed by
IEEE
FireWire kalah dengan USB di pasaran.
Expansion buses or slots
Disk interfaces
External buses
Communications buses
For connecting systems to systems
Parallel/LPT
special purpose, e.g., using special software
(Laplink) to transfer data between systems
Serial/RS232C
To connect a system to a voice-grade modem
Ethernet
To connect a system to a high-speed network
39