Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

I/O Interfaces, Peripheral Devices and Asynchronous Data Transfer

Lesson 15 of 17 in the free Computer Organization and Architecture notes on Siksha Sarovar, written by Rohit Jangra.

Asynchronous Handshaking Protocol

---

Peripheral Devices Reference

DeviceTypeInterfaceTypical Data RateNotes
KeyboardInputUSB / PS/210 KB/sHuman-speed, interrupt-driven
MouseInputUSB1 MB/sMovement and button events
MonitorOutputHDMI / DisplayPort2–8 GB/s4K@60Hz requires ~12 Gbps
PrinterOutputUSB / Ethernet1–10 MB/sSlow compared to storage
ScannerInputUSB10–100 MB/sResolution-dependent
HDDStorageSATA100–200 MB/sMechanical; sequential fast
SSD (SATA)StorageSATA500 MB/sFlash; random access fast
SSD (NVMe)StoragePCIe 4.0 x45–7 GB/sDirect PCIe lane; very fast

---

Programmed I/O (Polling / Busy-Wait)

The CPU continuously checks (polls) the device status register until the device is ready:

RTL Sequence:

  1. CPU writes command to I/O device control register
  2. Loop: CPU reads device status register
  3. If status bit = BUSY: goto step 2 (busy-wait loop)
  4. If status bit = READY: CPU reads/writes data register

Drawback: CPU is stuck in the polling loop, wasting 100% of CPU time while waiting for slow devices.

---

Interrupt-Driven I/O

Instead of busy-waiting, the CPU:

  1. Issues command to I/O device
  2. Continues executing other processes
  3. When device completes, it sends an interrupt request (IRQ) to CPU
  4. CPU finishes current instruction, saves context (PC, registers to stack)
  5. CPU jumps to Interrupt Service Routine (ISR) via interrupt vector table
  6. ISR transfers data; signals completion
  7. CPU restores context and resumes interrupted program

---

DMA (Direct Memory Access)

For high-speed bulk transfers (disk, network), even interrupt-driven I/O is too slow (CPU must service every byte). DMA Controller transfers data directly between device and memory without CPU involvement:

  1. CPU programs DMA controller (source address, destination address, byte count, direction)
  2. CPU releases memory bus; DMA controller takes over
  3. DMA transfers entire data block to/from memory
  4. DMA sends a single interrupt to CPU when transfer is complete
  5. CPU resumes

---

Comparison: Programmed I/O vs Interrupt I/O vs DMA

FeatureProgrammed I/OInterrupt-Driven I/ODMA
CPU involvement100% (busy-waiting)Only during ISROnly to program DMA + final interrupt
CPU overheadVery HighMediumLow
SpeedLimited by CPU loopBetter (async)Fast (memory-speed)
Transfer unitByte or wordByte or wordBlock (KB–MB)
HardwareSimplestNeeds interrupt controllerNeeds DMA controller chip
Best use caseVery simple/embedded systemsLow-speed devices (keyboard)High-speed devices (disk, NIC)

---

Memory-Mapped I/O vs Isolated (Port) I/O

FeatureMemory-Mapped I/OIsolated (Port) I/O
Address spaceI/O registers share memory address spaceSeparate I/O address space
InstructionsStandard LOAD/STORESpecial IN/OUT instructions
Address bitsSome memory addresses reserved for I/OFull memory space available
ArchitectureARM, MIPS (memory-mapped only)x86 (supports both)
AdvantageSimpler software; can use all addressing modesDoesn't consume memory address space

---

Study Deep: NVMe SSDs and PCIe

Traditional storage used SATA interface (max ~600 MB/s). NVMe SSDs connect directly to the CPU via PCIe lanes:

  • PCIe 4.0 x4: up to 7 GB/s sequential read
  • PCIe 5.0 x4: up to 14 GB/s sequential read
  • Much lower queue depth latency: 2–10 µs vs 0.1 ms for SATA SSD

This bypasses legacy I/O bottlenecks (AHCI, SATA controller) entirely, making storage nearly as fast as DRAM for sequential workloads.

📝 Exam Tips: - Programmed I/O = CPU wastes time polling; simplest hardware - Interrupt I/O = CPU free during transfer; needs interrupt controller (PIC/APIC) - DMA = bulk transfer without CPU; needs DMA controller - Memory-mapped I/O: I/O ports appear as memory addresses — use regular MOV instructions