Global College
Department of Computer Science
Computer Organization & Architecture
Chapter 3:Input / Output Organization
09/23/2025 Prepared Bayisa G 1
External Devices
The input/output subsystem of a computer, referred to as I/O, provides
an efficient mode of communication between the central system and the
outside environment.
Programs and data must be entered into computer memory for
processing and results obtained from computations must be recorded or
displayed for users.
A computer serves no useful purpose without the ability to receive
information from an outside source and to transmit results in a
meaningful form.
I/O operations are accomplished through a wide assortment of
external devices that provide a means of exchanging data between the
external environment and the computer.
09/23/2025 Prepared Bayisa G 2
External Devices Cont.…
An external device attaches to the computer by a link to an I/O
module.
The link is used to exchange control, status, and data between
the I/O module and the external device.
An external device connected to an I/O module also called
Interface is often referred to as a peripheral device or simply a
peripheral.
09/23/2025 Prepared Bayisa G 3
09/23/2025 Prepared Bayisa G 4
External Devices Cont.…
Input/output interface Problems
Wide variety of peripherals and
Delivering different amounts of data per second
Work at different speeds Send/receive data in different
formats.
All slower than CPU and RAM.
Hence I/O modules are used as a solution
09/23/2025 Prepared Bayisa G 5
Classification of External
devices
• External devices broadly can be classified into three categories:
• Human readable: suitable for communicating with the computer
user. Examples: Screen, keyboard, video display terminals (VDT)
and printers.
• Machine readable: suitable for communicating with equipment’s.
Examples: magnetic disk & tapes systems, Monitoring and control,
sensors and actuators which are used in robotics.
• Communication: These devices allow a computer to exchange data
with remote devices, which may be machine readable or human
readable. Examples: Modem, Network Interface Card (NIC)
09/23/2025 Prepared Bayisa G 6
Input/output Module
It is the entity within a computer that is responsible for the control
of one or more external devices
Interface to CPU and memory
Interface to one or more peripherals
I/O Module Function
The major functions or requirements for an I/O
module fall into the following five categories.
Control & Timing
CPU Communication
Device Communication
Data Buffering
Error Detection
09/23/2025 Prepared Bayisa G 7
I/O Module Function Cont.…
Processor might involve in sequence of operations like:
CPU checks I/O module device status
I/O module returns device status
If ready, CPU requests data transfer
I/O module gets data from device
I/O module transfers data to CPU Variations for output,
DMA, etc.
I/O module must have the capability to engage in communication with
the CPU and external device.
09/23/2025 Prepared Bayisa G 8
Thus CPU communication involves:
• Command decoding: The I/O module accepts commands
from the CPU carried on the control bus.
• Data exchange : data are exchanged between the CPU
and the I/O module over data bus.
09/23/2025 Prepared Bayisa G 9
I/O Module Function Cont.…
Status reporting: Because peripherals are slow it is important to
know the status of I/O device.
• I/O module can report with the status signals common used status
signals are BUSY or READY.
• Various other status signals may be used to report various error
conditions.
Address recognition: just as each memory word has an address,
there is address associated with every I/O device.
• Thus I/O module must be recognized with a unique address for each
peripheral it controls.
09/23/2025 Prepared Bayisa G 10
I/O Module Function Cont.…
The I/O module must also be able to perform device
communication.
This communication involves commands, status information, and
data.
Some of the essentials tasks are listed below:
o Error detection: I/O module is often responsible for error detection
and subsequently reporting errors to the CPU.
o Data buffering: the transfer rate into and out of main memory or
CPU is quite high, and the rate is much lower for most of the
peripherals.
• The data is buffered in the I/O module and then sent to the peripheral
device at its rate.
09/23/2025 Prepared Bayisa G 11
Input/output Techniques (Data Transfer Mode)
Three techniques are possible for I/O operations or data transfer mode.
1. Programmed I/O
2. Interrupt Driven
3. Direct Memory Access (DMA)
1. Programmed I/O
Data are exchanged between the CPU and the I/O module.
The CPU executes a program that gives it direct control of the I/O
operation, including sensing device status, sending a read or write
command and transferring data.
When CPU issues a command to I/O module, it must wait until I/O
operation is complete.
If the CPU is faster than I/O module, there is wastage of CPU time.
09/23/2025 Prepared Bayisa G 12
Input/output Techniques Cont.…
The I/O module does not take any further action to alert CPU.
That is, it doesn’t interrupt CPU.
Hence it is the responsibility of the CPU to periodically check the
status of the I/O module until it finds that the operation is complete.
The sequences of actions that take place with programmed I/O are:
1) CPU requests I/O operation
2) I/O module performs operation
3) I/O module sets status bits
4) CPU checks status bits periodically
5) I/O module does not inform CPU directly
6) I/O module does not interrupt CPU
09/23/2025 7) CPU may wait or come back
Prepared Bayisa later
G 13
Input/output Techniques Cont.…
I/O commands
To execute an I/O related instruction, the CPU issues an address,
specifying the particular I/O module and external device and an I/O
command.
Four types of I/O commands can be received by the I/O module when
it is addressed by the CPU. They are:
A control command: is used to activate a peripheral and tell what to
do.
Example: a magnetic tape may be directed to rewind or move forward
a record.
A test command: is used to test various status conditions associated
with an I/O module and its peripherals.
09/23/2025 Prepared Bayisa G 14
Input/output Techniques Cont.…
The CPU wants to know the interested peripheral for use.
It also wants to know the most recent I/O operation is completed and
if any errors have occurred.
A read command: it causes the I/O module to obtain an item of data
from the peripheral and place it in an internal buffer.
• The CPU then gets the data items by requesting I/O module to
place it on the data bus.
A write command: it causes the I/O module to take an item of data
from the data bus and subsequently transmit the data item to the
peripheral.
09/23/2025 Prepared Bayisa G 15
I/O Mapping
When the CPU, main memory, and I/O module share a common
bus two modes of addressing.
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 and Limited set
09/23/2025 Prepared Bayisa G 16
2. Interrupt Driven I/O
Using Program-controlled I/O requires continuous involvement of
the processor in the I/O activities.
It is desirable to avoid wasting processor execution time.
An alternative is for the CPU to issue an I/O command to a module and
then go on other work.
The I/O module will then interrupt the CPU requesting service when it
is ready to exchange data with the CPU.
The CPU will then execute the data transfer and then resumes its former
processing.
Based on the use of interrupts, this technique improves the utilization
of the processor.
With Interrupt driven I/O, the CPU issues a command to I/O module
and it does not wait until I/O operation is complete but instead
continues to execute other instructions.
When I/O module has completed
09/23/2025
its, work it interrupts the CPU. 17
Prepared Bayisa G
Interrupt Driven I/O Cont.…
An interrupt is more than a simple mechanism for coordinating I/O
transfers.
In a general sense, interrupts enable transfer of control from one
program to another to be initiated by an event that is external to a
computer.
Execution of the interrupted program resumes after completion of
execution of the interrupt service routine.
The concept of interrupts is useful in operating systems and in many
control applications where processing of certain routines has to be
accurately timed relative to the external events.
09/23/2025 Prepared Bayisa G 18
Interrupt Driven I/O Cont.…
Using Interrupt Driven I/O technique CPU issues read command.
I/O module gets data from peripheral while CPU does other work and
I/O module interrupts CPU checks the status if no error that is the
device is ready then CPU requests data and I/O module transfers data.
Thus CPU reads the data and stores it in the main memory.
Basic concepts of an Interrupt
An interrupt is an exception condition in a computer system caused by
an event external to the CPU.
Interrupts are commonly used in I/O operations by a device interface
(or controller) to notify the CPU that it has completed an I/O operation.
An interrupt is indicated by a signal sent by the device interface to
the CPU via an interrupt request line (on an external bus).
09/23/2025 Prepared Bayisa G 19
Interrupt Driven I/O Cont.…
This signal notifies the CPU that the signalling interface needs to be
serviced.
The signal is held until the CPU acknowledges or otherwise services
the interface from which the interrupt originated.
Response of CPU to an Interrupt
The CPU checks periodically to determine if an interrupt signal is
pending.
This check is usually done at the end of each instruction, although some
modern machines allow for interrupts to be checked for several times
during the execution of very long instructions.
When the CPU detects an interrupt, it then saves its current state (at
least the PC and the Processor Status Register containing condition
codes); this state information is usually saved in memory.
09/23/2025 Prepared Bayisa G 20
Interrupt Driven I/O Cont.…
Figure 6.2: CPU Interrupts
3. Direct Memory Access (DMA)
Interrupt driven and programmed I/O require active CPU
intervention.
Transfer rate is limited. CPU is tied up. DMA is the solution for
these problems.
09/23/2025 Prepared Bayisa G 21
Direct Memory Access Cont.…
Direct Memory Access is capabilities provided by some computer bus architectures that
allow data to be sent directly from an attached device (such as a disk drive) to the
memory on the computer’s motherboard.
The microprocessor (CPU) is freed from involvement with the data transfer, thus
speeding up overall computer operation.
Figure… Direct Memory Access (DMA)
09/23/2025 Prepared Bayisa G 22
Direct Memory Access Processes
When the CPU wishes to read or write a block of data, it issues a
command to the DMA module and gives following information:
CPU tells DMA controller:
Whether to read or write
Device address ,
Starting address of memory block for data
Amount of data to be transferred
The CPU carries on with other work.
The DMA controller steals the CPU‟s work of I/O operation.
The DMA module transfers the entire block of data, one word at a time,
directly to or from memory, without going through CPU.
09/23/2025 Prepared Bayisa G 23
Direct Memory Access process
When the transfer is complete.
DMA controller sends interrupt when finished.
Thus CPU is involved only at the beginning and at the end of the
transfer.
09/23/2025 Prepared Bayisa G 24
DMA Configurations
• The DMA mechanism can be configured in variety of ways.
• 1. Single Bus Detached DMA: In this configuration all modules share
the same system bus.
The block diagram of single bus detached DMA is as shown below
09/23/2025 Prepared Bayisa G 25
DMA Configuration Cont.…
The DMA module that is mimicking the CPU uses the programmed I/O
to exchange the data between the memory and the I/O module through the
DMA module.
This scheme may be inexpensive but is clearly inefficient. The features
of this configuration are:
Single Bus, Detached DMA controller
Each transfer uses bus twice
I/O to DMA then DMA to memory
CPU is suspended twice
Figure ..Single Bus, integrated DMA
09/23/2025 Prepared Bayisa G 26
DMA Configuration Cont.…
2. Single Bus, integrated DMA: Here, there is a path between DMA
module and one or more I/O modules that do not include the system bus.
The DMA logic can actually be considered as a part of an I/O module
or there may be a separate module that controls one more I/O modules.
Figure 6.5: Single Bus, integrated DMA
09/23/2025 Prepared Bayisa G 27
DMA Configuration Cont.…
The features of this configuration can be considered as:
Single Bus, Integrated DMA controller
Controller may support >1 device
Each transfer uses the bus once
DMA to memory
CPU is suspended once
3. DMA using an I/O bus: One further step of the concept of integrated
DMA is to connect I/O modules to DMA controller using a separate bus
called I/O bus.
This reduces the number of I/O interfaces in the DMA module to one
and provides for an easily expandable configuration.
09/23/2025 Prepared Bayisa G 28
DMA Configuration Cont.…
The block diagram of DMA using I/O bus is as shown in Figure below.
Here the system bus that the DMA shares with CPU and main memory
is used by DMA module only to exchange data with memory.
And the exchange of data between the DMA module and the I/O
modules takes place off the system bus that is through the I/O bus.
Figure …: DMA using an I/O bus
09/23/2025 Prepared Bayisa G 29
DMA Configuration Cont.…
The features of this configuration are:
Separate I/O Bus
Bus supports all DMA enabled devices
Each transfer uses bus once
DMA to memory
CPU is suspended once
With both Programmed I/O and Interrupt driven I/O the CPU is
responsible for extracting data from main memory for output and
storing data in main memory for input.
09/23/2025 Prepared Bayisa G 30
DMA Configuration Cont.…
Table indicates the relationship among the three techniques.
09/23/2025 Prepared Bayisa G 31
DMA Configuration Cont.…
Advantages of DMA
DMA has several advantages over polling and interrupts.
DMA is fast because a dedicated piece of hardware transfers data from
one computer location to another and only one or two bus read/write
cycles are required per piece of data transferred
In addition, DMA is usually required to achieve maximum data transfer
speed, and thus is useful for high speed data acquisition devices.
DMA also minimizes latency in servicing a data acquisition device
because the dedicated hardware responds more quickly than interrupts
and transfer time is short.
Minimizing latency reduces the amount of temporary storage (memory)
required on an I/O device.
09/23/2025 Prepared Bayisa G 32
Advantages of DMA
• DMA is fast because a dedicated piece of hardware
transfers data from one computer location to another
and only one or two bus read/write cycles are
required per piece of data transferred
• DMA is usually required to achieve maximum data
transfer speed, and thus is useful for high speed data
acquisition devices.
• which means the processor does not have to
execute any instructions to transfer data.
09/23/2025 Prepared Bayisa G 33
End of Chapter 3
Thanks!!!
???
09/23/2025 Prepared Bayisa G 34