Documente Academic
Documente Profesional
Documente Cultură
800 MB/s
AGP
AGP 2x Intel440 2GB
Graphics 533MB/s AGPset 800MB/s SDRAM
PCI
133MB/s
USB
PCI-SCSI 1.5 MB/s
PCI-ISA
40 MB/s
33 MB/s
ISA
HDD 2 HDD 1
Ethernet 16.7MB/s
keyboard Audio
What do I/O devices look like?
Controller
Keyboard Status
Reg How to get these
values into computer?
Data
Reg
The Mechanics
The Algorithmics
First, the mechanics:
Two methods are used to address the device:
Special I/O instructions
Memory-mapped I/O
Issues:
Preventing unauthorized access to devices
Extensibility / Flexibility
Special I/O instructions:
Command word:
sent on the I/O buss data lines
or on memory bus with IO signal indicating IO address space
from register or memory
x86:
64KB IO space (16 bits)
Instruction examples:
IN $AL, 33
OUT 33, $AL
Memory Mapped I/O
I/O instructions
Device space does not consume address space
Makes address and IO extensibility independent
Make instructions privileged
Does not prevent memory mapping
Hardware for Memory or I/O mapping
Address
CPU Data
Control
I/O Device
The Algorithmics
CPU
Is the
data busy wait loop
ready? not an efficient
way to use the CPU
unless the device
yes no is very fast!
Memory read
IOC data
but checks for I/O
completion can be
dispersed among
device store computation
data intensive code
done? no
Advantage: yes
Simple: the processor is totally in control and does all the work
Disadvantage:
Polling overhead can consume a lot of CPU time
Overhead Examples for Polling
Assumptions:
500 MHz processor
400 clock cycles for a polling operation
Hard disk:
transfers data in 4-byte word chucks
transfer rate = 4MB/s
Need to poll: (4MB/s) / 4 bytes per transfer = 250K times per second
Clock cycles per second for polling: 250K x 400 = 100M
Fraction of processor cycles: 100M / 500M = 20%
Interrupt Motivation
Polling is inefficient for highly active components
Even for low rate devices, use the time between polling periods
Polling: are you done yet are you done yet are you.
Interrupt: Just tell me when you are done, meanwhile Im going to do
something else.
CPU Data
Ack
Wire-OR request
I/O Interface I/O Interface I/O Interface
Daisy chained ack
(take ack if you
requested, otherwise
pass it on.)
I/O Device I/O Device I/O Device
When a requestor
receives ack, provides
data vector (what
caused this interrupt?)
Delegating I/O Responsibility from the CPU: DMA
CPU sends a starting address,
direction, and length count
to DMAC. Then issues "start".
Direct Memory Access (DMA):
External to the CPU CPU
Act as a maser on the bus
Transfer blocks of data to or from memory
without CPU intervention
device
DMAC provides handshake
signals for Peripheral
Controller, and Memory
Addresses and handshake
signals for Memory.
Issues with DMA and Memory Hierarchy
Interrupts
Done? Done?
Summary of Algorithmics (2)
DMA I/O
Issue Read
Do something
Cmd to DMAC
else
Error?
Continue
Responsibilities of the Operating System
System Bus
422 MB/s Memory
SCSI Disks
PCI 40 MB/s 10 MB/s
133 MB/s each
Multiple disks,
multiple busses
SCSI
40 MB/s
Problem: Disk Bandwidth
Transfer rate:
Rotational speed
Number of sectors per track
Disadvantage: availability
80 MB/s
10 MB/s each
Reliability and Availability
Two terms that are often confused:
Reliability: Is anything broken?
Availability: Is the system still available to the user?
Availability can be improved by adding hardware:
Example: adding ECC on memory
Reliability can only be improved by:
Bettering environmental conditions
Building more reliable components
Building with fewer components
Improve availability may come at the cost of lower reliability
RAID - Redundant Arrays of Inexpensive Disks
Write one unit per drive
Compute the parity and store it on the eight drives
Cheaper than mirroring
reduces overhead to 1/9
parity
Different Levels of RAID
RAID 1 - mirroring
uses twice as many disks to shadow the data (better performance high cost)
RAID 3 - bit interleaved
reduces cost to 1/N, where N is the number of disks in a group
RAID 4 - block interleaved
RAID 5 - block-interleaved, distributed parity
parity is interleaved across disks in the array to balance load
0 1 2 3 P0 0 1 2 3 P0
4 5 6 7 P1 4 5 6 P1 7
8 9 10 11 P2 8 9 P2 10 11
12 13 14 15 P3 12 P3 13 14 15
16 17 18 19 P4 P4 16 17 18 19
20 21 22 23 P5 20 21 22 23 P5
2 4
1 3
D D D P D D D P
D D D P D D D P
Internet: Just another bus?
Theres no clock!!!
Manchester encoding: 0 0 1 0 1
Packet
64 bits 48 48 16 32 8
Destination Source
Preamble Type Body CRC Postamble
Address Address
Ethernet: Sharing the link
No memory mapping
Talking to IO devices:
Memory and IO spaces
Polling (Programmed IO)
Interrupt driven