Unit-5
1)Input & Output devices
Input Devices
Input devices are used to enter data and instructions into a computer system.
They allow users to communicate and control the computer by providing the
necessary information for processing.
1. Keyboard
A keyboard is the most common input device used to type letters, numbers, and
commands. It consists of various keys such as alphabet keys (A–Z), number keys
(0–9), function keys (F1–F12), and special keys like Ctrl, Alt, and Enter.
When a key is pressed, the keyboard sends a signal to the computer to identify
which key was pressed, and the corresponding character or function is displayed
or executed on the screen.
Different types of keyboards are available, including standard QWERTY
keyboards, mechanical keyboards, wireless keyboards, and multimedia
keyboards. Keyboards can be connected using USB cables or Bluetooth. They
are essential for typing documents, entering data, writing code, and giving
commands to the computer.
2. Mouse
A mouse is a pointing device used to control the movement of the cursor on the
computer screen. It allows users to select items, open files, drag objects, and
scroll through documents.
Modern mice work using optical or laser sensors that detect movement when
the mouse is moved over a surface. The signals are sent to the computer, which
moves the pointer accordingly.
Mice can be wired (connected through USB cables) or wireless (using Bluetooth
or radio signals). Other similar devices include touchpads (commonly used in
laptops) and trackballs.
Common examples include optical mice, laser mice, and wireless mice. The
mouse makes it easy to interact with graphical user interfaces and perform
actions quickly with clicks and drags.
Output Devices
Output devices are used to display or present the processed information from the
computer to the user. They convert the computer’s digital signals into human-
understandable forms such as text, images, sound, or physical copies.
3. Monitor
A monitor is the primary output device that displays text, images, and videos
generated by the computer. It shows all the visual output, allowing users to see
their work and interact with the system.
Modern monitors use LCD (Liquid Crystal Display) or LED (Light Emitting
Diode) technology, which provides clearer images, better color quality, and
lower power consumption compared to older CRT (Cathode Ray Tube)
monitors.
Monitors come in different sizes and resolutions such as Full HD (1920×1080),
QHD (2560×1440), and 4K (3840×2160). Some advanced monitors also
support touchscreen features, allowing direct interaction with the display.
Examples include LED monitors, LCD monitors, and touchscreen monitors.
4. Printer
A printer is an output device that produces a hard copy of digital documents,
such as text files, images, or reports. It converts the soft copy stored on the
computer into physical form on paper.
There are several types of printers:
Inkjet printers use liquid ink sprayed through tiny nozzles to create high-
quality color images and documents.
Laser printers use toner powder and heat to fuse text or images onto
paper, making them faster and more cost-effective for large-volume
printing.
Dot matrix printers use small pins to strike an ink ribbon against paper,
mainly used for printing receipts or multi-copy forms.
Printers can be connected through USB, Wi-Fi, or networks, and many
modern printers are multifunctional, offering scanning and photocopying
features in addition to printing.
External Storage Devices
External storage devices are used to store, back up, and transfer data between
computers. They provide additional storage capacity beyond the computer’s
internal memory and are portable, making it easy to carry data from one place to
another.
Common examples include USB flash drives, external hard disks, memory
cards, and external SSDs (Solid State Drives).
A USB flash drive is a small, lightweight device that uses flash memory to store
data and connects through a USB port. It is commonly used to transfer files
quickly between systems.
An external hard disk offers large storage capacity and is useful for backing up
data, storing movies, photos, or software. However, it has moving parts and is
more prone to damage if dropped.
An external SSD is faster and more reliable than a hard disk because it has no
moving parts and uses flash memory, though it is generally more expensive.
A memory card (like SD or microSD) is used in cameras, mobile phones, and
tablets to store images, videos, and other data.
These devices connect through USB, Thunderbolt, or wireless interfaces, and
they help users expand storage, share data easily, and keep backups safe.
2)Input/Output Control Mechanisms
When a computer performs input and output operations, it must control how data
is transferred between the CPU (Central Processing Unit) and I/O devices
such as keyboards, disks, and printers.
Because I/O devices are usually much slower than the CPU, special control
mechanisms are used to manage data efficiently without wasting processor time.
The three main I/O control mechanisms are:
1. Polling (Programmed I/O)
2. Interrupts (Interrupt-driven I/O)
3. DMA (Direct Memory Access)
1. Polling (Programmed I/O)
Concept:
In polling, the CPU repeatedly checks the status of an I/O device to see
whether it is ready to send or receive data.
How it works:
1. The CPU sends a command to the I/O device (for example, to read or write
data).
2. Then it constantly “polls” (checks) the device’s status register.
3. When the device becomes ready, the CPU transfers the data.
Example:
When a program waits for keyboard input, the CPU continuously checks if a key
has been pressed.
Advantages:
Simple to implement.
Easy to control and suitable for small systems.
Disadvantages:
CPU time is wasted because it keeps checking the device even when it
is not ready.
Not suitable for systems with many I/O devices or frequent operations.
Use case:
Used in simple embedded systems or when I/O operations are infrequent.
2. Interrupt-driven I/O (Interrupts)
Concept:
In interrupt-driven I/O, the CPU does not check devices repeatedly. Instead, the
device alerts the CPU when it is ready by sending an interrupt signal.
How it works:
1. The CPU issues a command to the device and continues executing other
tasks.
2. When the device is ready, it sends an interrupt request (IRQ) to the
CPU.
3. The CPU temporarily stops its current work and executes an Interrupt
Service Routine (ISR) to handle the I/O operation.
4. After the interrupt is handled, the CPU resumes its previous task.
Example:
When a key is pressed on the keyboard, it triggers an interrupt signal. The CPU
pauses the current process, reads the keystroke, and then continues normal
execution.
Advantages:
Efficient CPU usage — the CPU can perform other tasks while waiting for
I/O.
Faster response to I/O events.
Suitable for multitasking systems.
Disadvantages:
Requires more complex hardware and software (interrupt controllers, ISR).
Too many interrupts may slow down performance (interrupt overhead).
Use case:
Commonly used in modern operating systems and devices like keyboards,
mice, and network cards.
3. Direct Memory Access (DMA)
Concept:
Direct Memory Access (DMA) allows data to be transferred directly between
memory and I/O devices without constant CPU involvement.
A special hardware unit called the DMA controller manages this process.
How it works:
1. The CPU instructs the DMA controller to transfer a block of data (for
example, from disk to memory).
2. The DMA controller takes control of the system bus and performs the
transfer directly.
3. Once the transfer is complete, the DMA controller sends an interrupt to
the CPU to signal completion.
Example:
Copying a large file from a hard disk to RAM — the DMA controller moves data
directly while the CPU performs other work.
Advantages:
Very efficient for large data transfers.
Frees up the CPU to perform other tasks.
High-speed data movement between memory and devices.
Disadvantages:
Requires extra hardware (DMA controller).
Complex to manage when multiple devices use DMA simultaneously.
Use case:
Used in high-speed devices like hard drives, graphics cards, and network
interfaces.
Comparison Table
Mechanis Hardware
CPU Role Efficiency Suitable For
m Complexity
Actively checks Simple systems,
Polling Low Simple
device status infrequent I/O
Interrupt Responds only when Moderate Real-time or
Medium
s device signals to High multitasking systems
Large data transfers
Delegates data (e.g., disks, graphics)
DMA transfer to DMA Very High High
controller
3)The Role of Buses in Communication
Definition:
A bus is a set of electrical pathways (wires or traces on a motherboard) that
connect different components of a computer, such as the CPU, memory,
and input/output devices, and allows them to transfer data, addresses, and
control signals.
Buses act like highways inside the computer, carrying information from one part
to another.
Types of Buses
1. Data Bus
o Carries actual data between the CPU, memory, and I/O devices.
o Can be 8-bit, 16-bit, 32-bit, or 64-bit, depending on how many
bits can be transferred at once.
2. Address Bus
o Carries the address of the memory location or I/O device the CPU
wants to read from or write to.
o Unidirectional (CPU → memory/device).
o Its width determines the maximum addressable memory (e.g., 16-
bit address bus → 2¹⁶ = 65,536 memory locations).
3. Control Bus
o Sends control signals to manage operations.
o Examples: Read/Write, Memory/IO select, Clock, Interrupt signals.
o Ensures proper coordination of data transfer.
Roles of Buses in Communication
Connect CPU, memory, and peripherals to enable data transfer.
Transfer addresses, data, and control signals in a synchronized
manner.
Enable coordination between devices, so multiple components can
communicate efficiently.
Reduce hardware complexity by using common pathways instead of
separate lines for each connection.
The Role of I/O Ports in Communication
Definition:
An I/O port is a physical or logical interface through which a computer
communicates with input/output devices.
It acts like a doorway through which the CPU can send or receive data to/from
peripheral devices.
Types of I/O Ports
1. Parallel Ports
o Send multiple bits at a time (usually 8 bits).
o Traditionally used for printers.
o Slower for long distances.
2. Serial Ports
o Send data one bit at a time.
o Examples: RS-232, USB.
o Can transmit over longer distances reliably.
3. Universal Ports (USB, Thunderbolt)
o Can connect many different devices using standard protocols.
o Provide both power and data transfer.
Roles of I/O Ports in Communication
Provide a direct interface between the CPU and peripheral
devices.
Allow data transfer in both directions (input to CPU, output from
CPU).
Translate CPU signals into device-compatible signals, and vice
versa.
Support multiple devices using addressing (e.g., each device has a
unique port number).
Enable expansion and modularity, so devices like keyboards, mice,
printers, and storage drives can be easily connected.
Relationship Between Buses and I/O Ports
The bus carries the data, address, and control signals from the CPU
or memory.
The I/O port connects a specific device to the bus, enabling the
device to receive data from or send data to the CPU.
Example: When the CPU wants to read a keypress from a keyboard, it
places the keyboard’s port address on the address bus, sends a read
command through the control bus, and the keyboard sends the data
through the data bus back to the CPU.
Summary Table
Compone
Function in Communication
nt
Bus Acts as a highway connecting CPU, memory, and I/O devices;
Compone
Function in Communication
nt
transfers data, addresses, and control signals.
Serves as the interface between a peripheral device and the CPU;
I/O Port enables input/output data transfer.
4)Performance Metrics of a Computer System
Performance metrics are used to measure how fast and efficiently a
computer executes tasks. They help compare different systems, optimize
software, and design better hardware.
The most common metrics are:
1. Clock Cycles
Definition:
A clock cycle is the basic unit of time for a computer’s CPU operations. It is
determined by the CPU clock frequency. Each cycle allows the CPU to perform
a small step in instruction execution, such as fetching, decoding, or executing
part of an instruction.
How it works:
The CPU operates according to a clock signal, which oscillates between
high and low voltage.
Each rising or falling edge of the clock can trigger CPU activities.
CPU frequency (in Hz) indicates how many cycles occur per second.
Example:
A 2 GHz CPU has 2 billion clock cycles per second.
Some instructions may take 1 cycle, while others may take multiple
cycles to complete.
Importance:
Faster clock speeds can improve CPU performance, but other factors
(instruction complexity, memory speed) also matter.
2. Execution Time
Definition:
Execution time is the total time taken by a program or instruction to run
on a computer from start to finish.
Formula:
Execution Time=Number of Instructions × Cycles per Instruction (CPI)× Clock Cycle Time
or equivalently,
Number of Instructions × CPI
Execution Time=
Clock Frequency
Explanation:
Number of Instructions: Total instructions executed by the program.
CPI (Cycles per Instruction): Average clock cycles needed for each
instruction.
Clock Cycle Time: Duration of one clock cycle (1 / Clock Frequency).
Example:
If a program takes 1 million instructions, CPI = 2, and CPU clock = 2 GHz:
1,000,000 × 2
Execution Time= =0.001 seconds
2,000,000,000
Importance:
Lower execution time means faster program performance.
3. Throughput
Definition:
Throughput is the amount of work or number of tasks a system can
complete in a given period. It is a measure of productivity rather than the
speed of a single task.
Units:
Instructions per second (IPS)
Tasks per second
Transactions per second
Explanation:
High throughput indicates that the system can handle more work in the
same time.
Example: A web server processing 10,000 requests per second has higher
throughput than one handling 5,000 requests per second.
Difference from execution time:
Execution time measures how long a single task takes, while
throughput measures how many tasks can be completed in a time
interval.
4. Latency
Definition:
Latency is the time delay between the initiation of a task and its
completion. It measures responsiveness rather than overall throughput.
Explanation:
High latency means a system takes longer to respond, even if overall
throughput is high.
Example: A database query with 200 ms latency responds slower than one
with 50 ms latency.
Relation to throughput:
A system can have high throughput but high latency if it handles many
tasks concurrently but each task takes a long time.
Conversely, low latency is desirable for interactive tasks (e.g., gaming,
real-time systems).
5)RISC vs. CISC Architectures
CPU architectures define how a processor executes instructions. Two major
types of instruction set architectures (ISA) are RISC (Reduced Instruction Set
Computer) and CISC (Complex Instruction Set Computer).
1. RISC (Reduced Instruction Set Computer)
Definition:
RISC is a CPU design that uses a small, simple set of instructions. Each
instruction is designed to execute in a single clock cycle.
Characteristics:
Simple instructions: Most instructions perform a small task (e.g., add
two numbers, load from memory).
Fixed instruction length: All instructions are usually the same size,
simplifying instruction decoding.
Load/store architecture: Only load and store instructions access
memory; arithmetic operations use CPU registers.
Large number of registers: Minimizes memory access and speeds up
execution.
Pipelining-friendly: Uniform instruction length and simple operations
make it easier to implement pipelines, improving instruction throughput.
Advantages:
Faster execution for simple instructions.
Easier to design high-performance pipelines.
Lower hardware complexity per instruction.
Disadvantages:
Requires more instructions to perform complex tasks.
Programs may be larger in size due to more instructions.
Example CPUs:
ARM processors (used in smartphones, tablets)
MIPS, SPARC
2. CISC (Complex Instruction Set Computer)
Definition:
CISC is a CPU design that uses a large set of complex instructions, some of
which can perform multiple operations in a single instruction.
Characteristics:
Complex instructions: Some instructions can load from memory,
perform an operation, and store results in one step.
Variable instruction length: Instructions may take different numbers of
bytes, making decoding more complex.
Fewer registers: More operations directly access memory instead of CPU
registers.
Fewer instructions per program: Complex instructions reduce the total
number of instructions needed for a task.
Advantages:
Smaller programs (fewer instructions needed).
Easier for programmers to write complex operations in fewer instructions.
Disadvantages:
Instructions take multiple clock cycles to execute.
Harder to implement efficient pipelining due to variable instruction length
and complexity.
More complex hardware needed for decoding instructions.
Example CPUs:
Intel x86 processors
VAX architecture
3. Impact on Performance
Feature RISC CISC
Instruction set Small, simple Large, complex
Instruction
Usually 1 clock cycle Multiple cycles per instruction
execution
May be larger (more Usually smaller (complex
Program size
instructions) instructions)
Hardware
Simpler More complex
complexity
Harder, lower pipeline
Pipelining Easier, better throughput
efficiency
Mostly via registers Many instructions access
Memory access
(load/store) memory directly
Embedded systems,
Applications Desktop PCs, servers
smartphones, tablets
Performance Insights:
RISC: Faster execution per instruction and higher instruction throughput,
especially with pipelining. Ideal for high-performance, low-power devices.
CISC: Fewer instructions per program but each instruction can take
multiple cycles, which may reduce overall CPU efficiency. Better for
compatibility and complex tasks.
Example Scenario
RISC (ARM): To add two numbers from memory and store the result, you
may need three instructions:
1. Load value1 → register
2. Load value2 → register
3. Add registers and store result
CISC (x86): A single instruction might load, add, and store the result in
one step.
Impact:
o RISC uses more instructions but simpler hardware executes each
instruction faster.
o CISC uses fewer instructions but requires more cycles per
instruction.