COMPUTER ORGANIZATION (Unit-3)
COMPUTER ORGANIZATION (Unit-3)
What is Interrupt?
Before interrupts, the CPU had to wait for the signal to process by continuously
checking for related hardware and software components (a method used earlier,
referred to as "polling"). This method expends CPU cycles waiting, reducing our
efficiency. The effective usage time of the CPU is reduced, reducing response time, and
there's also increased power consumption.
The solution proposed to the above problem was the use of interrupts. In this method,
instead of constantly checking for a signal, the CPU receives a signal from the hardware
or software components. The process of sending the signal by hardware or software
components is referred to as sending interrupts or interrupting the system.
The interrupts divert the CPU's attention to the signal request from the running process.
Once the interrupt signal is handled, the control is transferred back to the previous
process to continue from the exact position where it had left off.
Read About - Shift Registers in Digital Electronics
Types of interrupts
The interrupts are of two types:
1. Hardware interrupt
2. Software interrupt
Hardware Interrupt
Interrupts generated by the hardware are referred to as hardware interrupts. The failure
of hardware components and the completion of I/O can trigger hardware interrupts.
The two subtypes under it are:
1. Internal Interrupts
2. External Interrupts
Internal Interrupts
These interrupts occur when there is an error due to some instruction. For example,
overflows (register overflow), incorrect instructions code, etc.
These types of interrupts are commonly referred to as traps.
External Interrupts
These interrupts are the ones issued by hardware components, For example, when the
I/O process is completed data transfer, an infinite loop in the given code, power failure,
etc.
Software interrupt
As the name suggests, these interrupts are caused by software, mostly in user mode.
When a software interrupt occurs, the control is handed over to an interrupt handler (a
part of the Operating System). Termination of programs or requests of certain services
like the output to screen or using the printer can trigger it. These interrupts also have
higher priority than hardware interrupts.
There are two types of software interrupts:
• Normal Interrupts
• Exception Interrupts
• Normal Interrupts
These interrupts are caused by software instructions and are made intentionally.
Exception Interrupts
These interrupts are unplanned that occur during the execution of the program. An
example of this is the divide by zero exception.
The peripheral device sends a request to the DMA controller to initiate a data
transfer.
The DMA controller takes control of the system’s memory bus and accesses
memory directly, either reading data from it or writing data to it.
After the transfer is complete, the DMA controller signals the CPU that the task is
finished, and the CPU can continue with other tasks.
Working of DMA Transfer
Below diagram represents a Direct Memory Access (DMA) controller and its
components in a typical DMA system.
Modes of Transfer
We store the binary information received through an external device in the memory unit.
The information transferred from the CPU to external devices originates from the memory
unit. Although the CPU processes the data, the target and source are always the memory
unit. We can transfer this information using three different modes of transfer.
Programmed I/O
1. Programmed I/O
Programmed I/O uses the I/O instructions written in the computer program. The
instructions in the program initiate every data item transfer. Usually, the data transfer is
from a memory and CPU register. This case requires constant monitoring by the peripheral
device’s CPU.
Advantages:
Disadvantages:
The processor has to wait for a long time for the I/O module to be ready for either
transmission or reception of data.
2. Interrupt-initiated I/O
In the above section, we saw that the CPU is kept busy unnecessarily. We can avoid this
situation by using an interrupt-driven method for data transfer. The interrupt facilities and
special commands inform the interface for issuing an interrupt request signal as soon as
the data is available from any device. In the meantime, the CPU can execute other
programs, and the interface will keep monitoring the i/O device. Whenever it determines
that the device is ready for transferring data interface initiates an interrupt request signal to
the CPU. As soon as the CPU detects an external interrupt signal, it stops the program it
was already executing, branches to the service program to process the I/O transfer, and
returns to the program it was initially running.
On interruptions:-
Advantages:
Disadvantages:
The data transfer between any fast storage media like a memory unit and a magnetic disk
gets limited with the speed of the CPU. Thus it will be best to allow the peripherals to
directly communicate with the storage using the memory buses by removing the
intervention of the CPU. This mode of transfer of data technique is known as Direct Memory
Access (DMA). During Direct Memory Access, the CPU is idle and has no control over the
memory buses. The DMA controller takes over the buses and directly manages data
transfer between the memory unit and I/O devices.
Bus Request – We use bus requests in the DMA controller to ask the CPU to relinquish
the control buses.
Bus Grant – CPU activates bus grant to inform the DMA controller that DMA can take
control of the control buses. Once the control is taken, it can transfer data in many
ways.
A bus is a set of physical connections (cables, circuits, etc.) that can be shared by
multiple hardware components to communicate with one another. Memory and input/
output devices are connected to the Central Processing Unit through a group of lines
called a bus. These lines are designed to transfer data between different
components.
Address Bus
Data Bus
Control Bus
1. Address Bus
The address bus transports memory addresses which the processor wants to
access in order to read or write data..
The size of address bus determines how many unique memory locations can be
addressed.
Example:
2. Data Bus
A collection of wires through which data is transmitted from one part of a computer to
another is called Data Bus.
Data Bus can be thought of as a highway on which data travels within a computer.
The main objective of data bus is transfer of the data between microprocessor to
input/ output devices or memory.
The data bus transfers instructions coming from or going to the processor.
The data bus is bidirectional because the data can flow in either direction from CPU
to memory(or input/output device) or from memory to the CPU.
The size (width) of bus determines how much data can be transmitted at one time.
Example:
Control Bus
The connections that carry control information between the CPU and other devices
within the computer is called Control Bus.
The main objective of control bus is all signals controller carried from processor to
other hardware device.
The control bus transports orders and synchonisation signal coming from the control
unit and travelling to all other hardware components
The Control bus is bidirectional because the data can flow in either direction from
CPU to memory(or input/output device) or from memory to the CPU.
Example:
This bus is used to indicate whether the CPU is reading from memory or writing to
memory.
The bus system is the important part of computer architecture which helps the
computer CPU to communicate efficiently with memory as well input/output
devices. The performance and reliability of a computer system is depending to
the design and implementation of the computer bus system is mentioned into the
points that we elaborate the importance of computing.