Topics: Central processing unit, Input/output, Direct memory access Pages: 8 (937 words) Published: December 16, 2012
Midterm 2 Report
• Highest: 100
• Lowest: 45
• Average: 83


Chapter 7

Input/Output Problems
• Wide variety of peripherals
– Delivering different amounts of data
– At different speeds
– In different formats

• Slower than CPU and RAM
• Need I/O modules

Input/Output Module

Input/Output Module
• Interface to CPU and Memory
• Interface to one or more

Generic Model of I/O Module

I/O Module Function

Control & Timing
CPU Communication
Device Communication
Data Buffering
Error Detection

I/O Module Diagram

I/O Steps
• CPU checks I/O module device
• I/O module returns status
• If ready, CPU requests data
• I/O module gets data from device
• I/O module transfers data to CPU

Input/Output Techniques

Input Output
• Programmed
• Interrupt driven
• Direct Memory Access (DMA)


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

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
• I/O module does not interrupt CPU
• CPU may wait or come back later

• To increase efficiency for programmed I/O, the
software could be written so that the processor
periodically checks the status of the device. If
the device is not ready, the processor can
jump to other tasks. After some timed interval,
the processor comes back to check status
• Consider the above scheme for outputting data
one character at a time to a printer that
operates at 10 characters per second. What
will happen if its status is scanned every


I/O Commands
• CPU issues address
– Identifies module (if #device >1 per

• 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

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

I/O Mapping
• Memory mapped I/O
– Devices and memory share an address
– 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

Memory Mapped and Isolated I/O

Interrupt Driven

Interrupt Driven I/O
• Overcomes CPU waiting
• No repeated CPU checking of
• I/O module interrupts when ready

Interrupt Driven I/O
Basic Operation
• CPU issues read command
• I/O module gets data from
peripheral whilst CPU does other
• I/O module interrupts CPU
• CPU requests data
• I/O module transfers data

• A particular system is controlled by an
operator through commands entered
from a keyboard. The average number
of commands entered in an 8-hour
interval is 60.
• Suppose the processor scans the
keyboard every 100ms with
programmed I/O. How many times will
the keyboard be checked in an-8-hour

• The processor scans the keyboard 10
times per second. In 8 hours, the
number of times the keyboard is
scanned is 10 × 60 × 60 × 8 =


Example (cont’d)
• For the same example, by what fraction
would the number of processor visits to
the keyboard be reduced if interruptdriven I/O were used?


Example (cont’d)
• For the same example, by what fraction
would the number of processor visits to
the keyboard be reduced if interruptdriven I/O were used?
• Only 60 visits would be...
Continue Reading

Please join StudyMode to read the full document

Become a StudyMode Member

Sign Up - It's Free