Chapter 8 Input-Output Organization - Copy
Chapter 8 Input-Output Organization - Copy
Input-Output Organization
Peripheral Devices
3
… Cont’d
4
I/O Interface
• I/O provides a method for transferring information between internal storage (CPU and
Memory) and extremal storage (peripherals).
Major difference between peripherals and CPU
1. Peripherals are electromechanical and electromagnetic devices and their manner of
operation is different from the operation of CPU and memory, which are electronic
devices.
2. The data transfer rate of peripherals is usually slower than the transfer rate of the CPU,
and consequently, a synchronization mechanism may be needed.
3. Data codes and formats in peripherals differ from the word format in the CPU and
memory.
4. The operating modes of peripherals are different from each other and each must be
controlled so as not to disturb the operation of other peripherals connected to the CPU. 5
… Cont’d
Input/output Problems
• Wide variety of peripherals
• 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.
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 6
… Cont’d
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
• During any period of time, the CPU may communicate with one or more external
devices in unpredictable patterns on the program’s need for I/O.
• The internal resources, main memory and the CPU must be shared among number
of activities including handling data I/O. 7
… Cont’d
• Thus, the I/O device includes a control and timing requirement to coordinate the
flow of traffic between internal resources and external devices to the CPU.
• Thus CPU 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.
8
… Cont’d
• It is used when speed of I/O devices do not match with processor and
Timing characteristics of I/O devices is not predictable.
• Asynchronous data transfer between two independent units require that
control signals be transmitted between the communicating units to indicate
the time at which data is being transmitted.
• Two ways of achieving Sender Receiver
1. Strobe Figure 8.2: Strobe Method
• A strobe pulse is supplied by one of the units to indicate to the other unit
when the transfer has to occur.
10
… Cont’d
2. Handshaking Method
• A control signal is accompanied with each data item being transmitted to
indicate the presence of data.
• The receiving unit responds with another control signal to acknowledge the
receipt of data.
Sender Receiver
• Three techniques are possible for I/O operations or data transfer mode.
• They are:
1. Programmed I/O
2. Interrupt Driven
3. Direct Memory Access (DMA)
1. Programmed I/O
• With 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. 12
… Cont’d
• 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.
• 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 13
… Cont’d
2. A test command: is used to test various status conditions associated with an I/O
module and its peripherals.
• 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.
3. 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.
4. 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.
15
Priority Interrupt
17
… Cont’d
Types of Interrupt
1. Hardware Interrupts
• When the signal for the processor is from an external device or
hardware then this interrupts is known as hardware interrupt.
• Example: when we press any key on our keyboard to do some
action, then this pressing of the key will generate an interrupt
signal for the processor to perform certain action.
• Such an interrupt can be of two types:
i. Maskable Interrupt
• The hardware interrupts which can be delayed when a much
high priority interrupt has occurred at the same time. 18
… Cont’d
20
Direct Memory Access (DMA)
• 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.
• Thus 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.
• When the transfer is complete. 22
… Cont’d
24
… Cont’d
25
… Cont’d
26
Serial Communication
• Communication among the devices is very important for reliable execution of the tasks
assigned to CPU.
• I/O processor designed to communicate with data communication networks.
• Such a communication network consists of devices such as printers, display devices,
digital sensors, etc. serving many users at once.
• The data communication processor communicate with each terminal through bus.
• It also communicates with CPU and memory in the same manner as any I/O processor
does.
• The process of sending data one bit at a time sequentially over a communication bus is
called Serial communication.
27
Figure 8.2: Types of Data Transmission
29
… Cont’d
31