Jikjk

Only available on StudyMode
  • Download(s) : 84
  • Published : December 16, 2012
Open Document
Text Preview
Midterm 2 Report
• Highest: 100
• Lowest: 45
• Average: 83

1

Chapter 7
Input/Output

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
peripherals

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
status
• I/O module returns status
• If ready, CPU requests data
transfer
• I/O module gets data from device
• I/O module transfers data to CPU

Input/Output Techniques

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

Programmed
Input/Output

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

Example
• 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
again.
• 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
200ms?

15

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

• 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
(address)

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

Interrupt Driven I/O
• Overcomes CPU waiting
• No repeated CPU checking of
device
• 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
work
• I/O module interrupts CPU
• CPU requests data
• I/O module transfers data

Example
• 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
period?
23

Answer
• 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 =
288,000.

24

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?

25

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...
tracking img