COA Notes
Overview of computer peripheral devices, their interfaces, and communication mechanisms.
Introduction
Peripheral devices are everything connected to the computer that is not the CPU or main memory. Your keyboard, mouse, monitor, printer, hard drive, webcam — all peripherals. From a computer architecture perspective, the interesting question is: how does the CPU communicate with devices that have vastly different speeds, data formats, and timing requirements? A keyboard generates a few bytes per second; a graphics card needs gigabytes per second. The I/O system must handle both elegantly. Let's explore how peripherals work and how they connect to the rest of the system.
Classification of Peripheral Devices
By Function
| Input Devices | Output Devices | Storage Devices |
|---|---|---|
| (I/O both) | ||
| Keyboard | Monitor | Hard Disk (HDD) |
| Mouse | Printer | SSD |
| Scanner | Speaker | USB Flash Drive |
| Microphone | Projector | Optical Drives |
| Webcam | Plotter | Tape Drives |
| Touchscreen* | Headphones | Memory Cards |
| Joystick | LED Display | NAS/SAN |
By Data Transfer Speed
| Category | Devices | Typical Speed | I/O Method |
|---|---|---|---|
| Very Slow | Keyboard, Mouse | 10-100 bytes/s | Interrupt-driven |
| Slow | Printer, Scanner | 10 KB/s - 1 MB/s | Interrupt-driven |
| Medium | Network (Ethernet) | 100 MB/s - 1 GB/s | DMA |
| Fast | SSD, NVMe | 500 MB/s - 7 GB/s | DMA |
| Very Fast | GPU (PCIe) | 16-64 GB/s | Bus Mastering DMA |
By Connection Type
- Internal: Connected directly to motherboard (RAM, CPU fan, internal SSD)
- External: Connected via cables/wireless (keyboard, external monitor, USB drives)
- Integrated: Built into the system (laptop screen, trackpad, speakers)
How Peripherals Communicate
Device Controller
Every peripheral has a device controller — a small piece of hardware that bridges the gap between the device's internal operation and the system bus:
| Device | ←→ | Device Controller | ←→ | System |
|---|---|---|---|---|
| (keyboard, | Bus | |||
| disk,etc) | • Data Register | |||
| • Status Register | ||||
| • Control Register | ||||
| • Interface Logic |
The CPU communicates with peripherals through the controller's registers:
- Data Register: Holds data being transferred (read or write)
- Status Register: Indicates device state (busy, ready, error)
- Control Register: CPU writes commands here (start, stop, mode)
I/O Address Space
Two approaches for CPU to access device registers:
Memory-Mapped I/O (ARM, modern systems):
- Device registers appear as memory addresses
- Use regular LOAD/STORE instructions
- Example: Writing to address 0xFF200000 actually sends data to a serial port
- Advantage: No special I/O instructions needed, same addressing modes available
Isolated I/O / Port-Mapped I/O (x86):
- Separate address space for I/O devices
- Special IN/OUT instructions
- Example:
OUT 0x3F8, ALsends byte to COM1 serial port - Advantage: Smaller addresses (16-bit port space), clear distinction in code
Input Devices Deep Dive
Keyboard
Architecture students should understand the keyboard at the hardware level:
- Key Press: Mechanical switch closes, row/column intersection detected
- Scan Code: Keyboard controller generates a scan code (e.g., 0x1E for 'A')
- Interrupt: Keyboard controller raises IRQ1 on the interrupt controller
- ISR: CPU runs keyboard interrupt service routine
- Translation: OS translates scan code to character (considering Shift, Caps Lock, layout)
Mouse
Modern optical/laser mice:
- Camera takes 1000+ pictures/second of the surface below
- Image processing chip detects movement direction and distance
- Delta (dx, dy) values sent to computer via USB (polling at 125-1000 Hz)
- OS updates cursor position: new_x = old_x + dx
Output Devices Deep Dive
Display (Monitor)
A display receives pixel data from the GPU:
- Resolution: 1920×1080 at 32-bit color = 1920 × 1080 × 4 = ~8 MB per frame
- Bandwidth needed: 8 MB × 60 fps = 480 MB/s (why DisplayPort/HDMI need high bandwidth)
- Refresh rate: How many times per second the screen redraws (60 Hz, 144 Hz, 240 Hz)
Printer
A laser printer operates in these steps:
- Processing: CPU/Controller rasterizes page (converts text/images to dot matrix)
- Charging: Photosensitive drum charged uniformly
- Exposing: Laser writes image by discharging specific points
- Developing: Toner attracted to discharged areas
- Transferring: Toner transferred to paper
- Fusing: Heat melts toner permanently onto paper
The printer has its own CPU and memory (often several hundred MB) to rasterize full pages before printing.
Storage Devices
Hard Disk Drive (HDD)
| Average seek | 5-10 ms |
| Average rotation | (1/2) × (60/RPM) seconds = ~4ms at 7200 RPM |
| Transfer | depends on data size and disk transfer rate |
Solid State Drive (SSD)
SSDs use NAND flash memory — no moving parts:
- Read latency: ~50 μs (100× faster than HDD)
- Write latency: ~200 μs
- Sequential read: 500 MB/s (SATA) to 7000 MB/s (NVMe PCIe 4.0)
- No seek time or rotational latency!
The SSD controller handles: wear leveling, garbage collection, error correction (ECC), and the Flash Translation Layer (FTL) that maps logical blocks to physical flash pages.
Data Transfer Rates Comparison
This 6-orders-of-magnitude range in speeds is why different I/O methods (polling, interrupts, DMA) exist — no single method is optimal for all devices.
Real-World Example: What Happens When You Press a Key
Let's trace the full path from keypress to character on screen:
- Physical switch closes under your finger (mechanical event)
- Keyboard controller detects press, generates scan code
- USB controller packages scan code into USB packet
- USB host controller in computer receives packet, raises interrupt
- CPU interrupt handler reads USB data, identifies keyboard event
- OS keyboard driver translates scan code to character ('A')
- Application receives character, updates its data structure
- Application tells window system to redraw
- GPU renders updated text into frame buffer
- Display controller reads frame buffer, sends to monitor
- You see 'A' appear on screen (~10-50 ms total latency)
Key Takeaways
- Every peripheral has a device controller with data, status, and control registers — the CPU accesses these registers to communicate
- Device speeds vary by 6+ orders of magnitude — requiring different I/O techniques (polling for slow, DMA for fast)
- Memory-mapped I/O maps device registers into the memory address space, while port-mapped I/O uses a separate I/O address space
- Storage devices are both input and output — they store data written by the CPU and provide data when read
- The complete path from physical input to visible output involves dozens of hardware and software components working in coordination
- Understanding peripherals at the hardware level explains why I/O is often the bottleneck in system performance
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Peripheral Devices.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Organization & Architecture topic.
Search Terms
computer-organization, computer organization & architecture, computer, organization, input, output, peripheral, devices
Related Computer Organization & Architecture Topics