Input / Output System: Theresa Mae P. Manlunas
Input / Output System: Theresa Mae P. Manlunas
Input / Output System: Theresa Mae P. Manlunas
9-2
I/O Requirements
Means for addressing different peripheral devices
A way for peripheral devices to initiate communication
with the CPU
An efficient means of transferring data directly between
I/O and memory for large data transfers since
programmed I/O is suitable only for slow devices and
individual word transfers
Buses that interconnect high-speed I/O devices with the
computer must support high data transfer rates
Capability of handling devices operating at varying
speeds with varying delays
Means for handling devices with extremely different
control requirements
9-3
I/O Interfaces
Are necessary because of
Different formats required by the devices
Incompatibilities in speed between the
devices and the CPU that make
synchronization difficult
Bursts of data vs. streaming data
Device control requirements that would tie
up too much CPU time
9-4
Examples of I/O Devices
9-5
Simple I/O Configuration
9-6
More Complex I/O Module
9-7
Advanced I/O Techniques
Programmed I/O
CPU controlled I/O
Interrupt Driven I/O
External input controls
Direct Memory Access Controllers
Method for transferring data between main
memory and a device that bypasses the
CPU
9-8
Programmed I/O
I/O data and address registers in CPU
One word transfer per I/O instruction
Address information for each I/O device
LMC I/O capability for 100 devices
Full instruction fetch/execute cycle
Primary use:
Keyboards
Communication with I/O controllers (see DMA)
9-9
Programmed I/O Example
9-10
Programmed I/O Example
9-11
Interrupts
Signal that causes the CPU to alter its
normal flow of instruction execution
Frees CPU from waiting for events
Provides control for external I/O initiation
Examples
unexpected input
abnormal situation
illegal instructions
multitasking, multiprocessing
9-12
Interrupt Terminology
Interrupt lines (hardware)
One or more special control lines to the CPU
Interrupt request
Interrupt handlers
Program that services the interrupt
Also known as an interrupt routine or device driver
Context
Saved registers of a program before control is
transferred to the interrupt handler
Allows program to resume exactly where it left off
when control returns to interrupted program
9-13
Use of Interrupts
Notify that an external event has occurred
Real-time or time-sensitive
Signal completion
Printer ready or buffer full
Allocate CPU time
Time sharing
Indicate abnormal event (CPU originates for
notification and recovery)
Illegal operation, hardware error
Software interrupts
9-14
The CPU – The Interrupt Cycle
Fetch / Execute cycle
Interrupt cycle
START
Fetch Next
Instruction
Execute
HALT Instruction
Interrupts Disabled
9-17
Print Handler Interrupt
9-18
Using an Interrupt for Time Sharing
9-19
Interrupt Processing Methods
Vectored interrupt
Address of interrupting device is included
in the interrupt
Requires additional hardware to implement
Polling
Identifies interrupting device by polling
each device
General interrupt is shared by all devices
9-20
Vectored Interrupts
9-21
Polled Interrupts
9-22
Multiple Interrupts Example
9-23
Direct Memory Access
Transferring large blocks of data
Direct transfer to and from memory
CPU not actively involved in transfer itself
Required conditions for DMA
The I/O interface and memory must be connected
The I/O controller must be capable of reading and
writing to memory
Conflicts between the CPU and the I/O controller
must be avoided
Interrupt required for completion
9-24
DMA Instructions
Application program requests I/O service from
operating system
Privileged programmed I/O instructions
To initiate DMA, programmed I/O is used to
send the following information:
1. Location of data on I/O device
2. Starting location in memory
3. Size of the block
4. Direction of transfer: read or write
Interrupt to CPU upon completion of DMA
9-25
DMA Initiation and Control
9-26
I/O Controller Interfaces
9-27
I/O Controller Functions
Recognizes messages from device(s) addressed to it
and accepts commands from the CPU
Provides a buffer where the data from memory can be
held until it can be transferred to the device
Provides the necessary registers and controls to
perform a direct memory transfer
Physically controls the device
Copies data from its buffer to the device/from the
CPU to its buffer
Communicates with CPU
9-28