7/24/2019 OSK2014 08 Input Output
1/39
Organisasi Sistem Komputer
Priyanto
E-mail : [email protected]
Program Studi Pendidikan Teknik Elektronika
Jurusan Pendidikan Teknik Elektronika
FT UNY 2014
Input Output (IO)
1
7/24/2019 OSK2014 08 Input Output
2/39
2
IO controller
IO devices
Storage
Device mana yang paling lambat?
7/24/2019 OSK2014 08 Input Output
3/39
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
7/24/2019 OSK2014 08 Input Output
4/39
Basic I/O hardware ports, buses, devices and controllers
I/O Software
Interrupt Handlers, Device Driver, Device-Independent Software, User-Space I/O Software
Important concepts
Three ways to perform I/O operations Polling, interrupt and DMAs
Copyright : Nahrstedt, Angrave, Abdelzaher 4
7/24/2019 OSK2014 08 Input Output
5/39
Storage devices (disk, tapes)
Transmission devices (network card, modem)
Human interface devices (screen, keyboard,mouse)
Specialized device (joystick)
Barcode reader
Copyright : Nahrstedt, Angrave, Abdelzaher 5
7/24/2019 OSK2014 08 Input Output
6/39
I/O units typically consist of A mechanical component: the device itself
An electroniccomponent: the device controller oradapter.
Interface between controller and device is a very lowlevel interface.
Example:
Disk controller converts the serial bit stream, comingoff the drive into a block of bytes, and performs errorcorrection.
Copyright : Nahrstedt, Angrave, Abdelzaher 6
7/24/2019 OSK2014 08 Input Output
7/39Copyright : Nahrstedt, Angrave, Abdelzaher 7
7/24/2019 OSK2014 08 Input Output
8/39
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 8
7/24/2019 OSK2014 08 Input Output
9/39Copyright : Nahrstedt, Angrave, Abdelzaher 9
7/24/2019 OSK2014 08 Input Output
10/3910
7/24/2019 OSK2014 08 Input Output
11/3911
Cadangan
Input Output
Memory
Input Output
Cadangan
Cadangan
Memory
00 0
1023
40954095
4096
5119
4096
5119
Memory Mapped IO Mapped (Isolated IO)
5120 5120
7/24/2019 OSK2014 08 Input Output
12/39
12
Main
MemoryCPU IO Port 1 IO Port 2 IO Port 3
Write
Read
Data
Address
IO Device 1 IO Device 2Memiliki 2
instruksi
sekaligus untuk
Memori dan IO
Write
Read
7/24/2019 OSK2014 08 Input Output
13/39
13
Main
MemoryCPU IO Port 1 IO Port 2 IO Port 3
M Read
M Write IO Write
IO Read
Data
Address
IO Device 1 IO Device 2Memiliki 4
instruksi
untuk memori
dan IO
M Write
M Read
IO Write
IO Read
7/24/2019 OSK2014 08 Input Output
14/39
14
Programmed IO
Interrupt Driven
Direct Memory Access
(DMA)
7/24/2019 OSK2014 08 Input Output
15/39
15
Mulai
Baca Status
Periksa Status
Divais
Siap?
Layani Divais
Lakukan tugas
lain
Ya
Tidak
7/24/2019 OSK2014 08 Input Output
16/39
Copyright : Nahrstedt, Angrave, Abdelzaher 16
Connections between devices and interrupt controller actuallyuse interrupt lines on the bus rather than dedicated wires
7/24/2019 OSK2014 08 Input Output
17/39
Menangguhkan eksekusi program yang sedang
berlangsung
Menyimpan statusnya Melompat ke interrup service routine (ISR)
Kembali untuk melanjutkan eksekusi program
yang diinterupsi
17
7/24/2019 OSK2014 08 Input Output
18/39
18
7/24/2019 OSK2014 08 Input Output
19/39
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
DMAMembebaskan prosesor dari tanggung jawab
transfer data
7/24/2019 OSK2014 08 Input Output
20/39
7/24/2019 OSK2014 08 Input Output
21/39
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 (memoryI/O device, or vice
versa)
7/24/2019 OSK2014 08 Input Output
22/39
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 ackstransfer to DMA controller
Copyright : Nahrstedt, Angrave, Abdelzaher 22
7/24/2019 OSK2014 08 Input Output
23/39
Copyright : Nahrstedt, Angrave, Abdelzaher 23
7/24/2019 OSK2014 08 Input Output
24/39
24
D a ta
C o n t r o l
S ta tu s
P r o g ra m m e d
I /O in te r fa c e
I /O d e v ic e
A d d r e s s /d a ta
b u s
a n d r e a d /w r i t e
c o n tr o l s ig n a l M e m o r y
C P U
l i
l i l
7/24/2019 OSK2014 08 Input Output
25/39
25
D a ta
C o n t r o l
S ta tu s
P r o g r a m m e d
I /O in te r fa c e
I/O d e v ic e
A d d r e s s /d a ta
b u s
a n d r e a d /w r i t e
c o n tr o l s ig n a l
M e m o r y
In te r r u p t s ig n a l
C P U
7/24/2019 OSK2014 08 Input Output
26/39
26
S ta tu s
D a ta
C o n tr o l
P r o g ra m m e d
I/O in te r fa c e
I/ O d e v ic e
A d d r e s s /d a ta
b u s
a n d r e a d /w r i t e
c o n tr o l s ig n a l M e m o r y
C P UIn te r r u p t s ig n a l
D M A s ig n a l
7/24/2019 OSK2014 08 Input Output
27/39
27
7/24/2019 OSK2014 08 Input Output
28/39
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 andI/O interfaces
7/24/2019 OSK2014 08 Input Output
29/39
Expansion buses or slots Disk interfaces
External buses
Communications interfaces
7/24/2019 OSK2014 08 Input Output
30/39
These are slots on the motherboard
Examples
ISAIndustry Standard Architecture
PCIPersonal Component Interconnect
EISAExtended ISA SIMMSingle Inline Memory Module
DIMMDual Inline Memory Module
MCAMicro-Channel Architecture
AGPAccelerated Graphics Port VESAVideo Electronics Standards Association
PCMCIAPersonal Computer Memory Card InternationalAssociation (not just memory!)
7/24/2019 OSK2014 08 Input Output
31/39
3 ISA
slots
5 PCI slots Pentium CPU6 SIMM
slots
2 DIMM
slots
7/24/2019 OSK2014 08 Input Output
32/39
Expansion buses or slots Disk interfaces
External buses
Communications buses
7/24/2019 OSK2014 08 Input Output
33/39
ATAAT Attachment (named after IBM PC-AT) IDEIntegrated 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
SCSISmall Computer Systems Interface
ESDIEnhanced Small Device Interface (mid-80s, obsolete)
PCMCIA (Personal Computer Memory Card International
Association)
SATASerial AT Attachment
7/24/2019 OSK2014 08 Input Output
34/39
High-speed serial connection between motherboardand drive
Serial cables can be longer than parallel ones
Cables are easier to work with
Speeds of 150MB/sec and higher possible
7/24/2019 OSK2014 08 Input Output
35/39
Expansion buses or slots Disk interfaces
External buses
Communications buses
7/24/2019 OSK2014 08 Input Output
36/39
Parallelsometimes called LPT (line printer) Serialtypically RS232C (sometimes RS422)
PS/2for keyboards and mice
USBUniversal Serial Bus IrDAInfrared Device Attachment
FireWirenew, very high speed, developed by
IEEEFireWire kalah dengan USB di pasaran.
7/24/2019 OSK2014 08 Input Output
37/39
Expansion buses or slots Disk interfaces
External buses
Communications buses
7/24/2019 OSK2014 08 Input Output
38/39
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
7/24/2019 OSK2014 08 Input Output
39/39